|
@@ -3,18 +3,23 @@ package com.game.business.controller;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.game.business.domain.*;
|
|
import com.game.business.domain.*;
|
|
|
|
+import com.game.business.dto.AppGameBettingCountDTO;
|
|
|
|
+import com.game.business.dto.AppGameBettingDetailsCountDTO;
|
|
import com.game.business.service.*;
|
|
import com.game.business.service.*;
|
|
import com.game.common.core.controller.BaseController;
|
|
import com.game.common.core.controller.BaseController;
|
|
import com.game.common.core.domain.AjaxResult;
|
|
import com.game.common.core.domain.AjaxResult;
|
|
|
|
+import com.game.common.core.page.TableDataInfo;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/game/betting")
|
|
@RequestMapping("/game/betting")
|
|
@@ -43,6 +48,7 @@ public class AppGameBettingController extends BaseController{
|
|
* 下注
|
|
* 下注
|
|
*/
|
|
*/
|
|
@PostMapping(value = "/create")
|
|
@PostMapping(value = "/create")
|
|
|
|
+ @ApiOperation(value = "游戏下注", notes = "游戏下注")
|
|
public AjaxResult betting(@RequestBody AppGameBetting gameBetting)
|
|
public AjaxResult betting(@RequestBody AppGameBetting gameBetting)
|
|
{
|
|
{
|
|
|
|
|
|
@@ -169,4 +175,67 @@ public class AppGameBettingController extends BaseController{
|
|
|
|
|
|
return success();
|
|
return success();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 游戏输赢统计
|
|
|
|
+ */
|
|
|
|
+ @GetMapping(value = "/count")
|
|
|
|
+ public AjaxResult getCount(@RequestParam(name = "strDate") String strDate)
|
|
|
|
+ {
|
|
|
|
+ AppGameBettingCountDTO appGameBettingCountDTO = new AppGameBettingCountDTO();
|
|
|
|
+ List<AppGame> gameList = appGameService.selectAppGameList(new AppGame());
|
|
|
|
+
|
|
|
|
+ if(gameList == null || gameList.isEmpty()){
|
|
|
|
+ return success(appGameBettingCountDTO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<AppGameBettingDetailsCountDTO> countList = appGameBettingService.getCount(strDate);
|
|
|
|
+ if(countList == null){
|
|
|
|
+ countList = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ Map<Long, List<AppGameBettingDetailsCountDTO>> idGameMap = countList.stream().collect(Collectors.groupingBy(AppGameBettingDetailsCountDTO::getGameId));
|
|
|
|
+
|
|
|
|
+ List<AppGameBettingDetailsCountDTO> newList = new ArrayList<>();
|
|
|
|
+ double orderAmount = 0.00;
|
|
|
|
+ double winAmount = 0.00;
|
|
|
|
+ double loseAmount = 0.00;
|
|
|
|
+ for (int i = 0; i < gameList.size(); i++) {
|
|
|
|
+ AppGame appGame = gameList.get(i);
|
|
|
|
+ AppGameBettingDetailsCountDTO appGameBettingDetailsCountDTO = new AppGameBettingDetailsCountDTO();
|
|
|
|
+ appGameBettingDetailsCountDTO.setGameId(appGame.getId());
|
|
|
|
+ appGameBettingDetailsCountDTO.setGameName(appGame.getName());
|
|
|
|
+ if(idGameMap.containsKey(appGame.getId())){
|
|
|
|
+ AppGameBettingDetailsCountDTO dbAppGameBettingDetailsCount = idGameMap.get(appGame.getId()).get(0);
|
|
|
|
+ appGameBettingDetailsCountDTO.setBettingCount(dbAppGameBettingDetailsCount.getBettingCount());
|
|
|
|
+ appGameBettingDetailsCountDTO.setOrderAmount(dbAppGameBettingDetailsCount.getOrderAmount());
|
|
|
|
+ appGameBettingDetailsCountDTO.setWinAmount(dbAppGameBettingDetailsCount.getWinAmount());
|
|
|
|
+ appGameBettingDetailsCountDTO.setLoseAmount(dbAppGameBettingDetailsCount.getLoseAmount());
|
|
|
|
+ orderAmount += dbAppGameBettingDetailsCount.getOrderAmount();
|
|
|
|
+ winAmount += dbAppGameBettingDetailsCount.getWinAmount();
|
|
|
|
+ loseAmount += dbAppGameBettingDetailsCount.getLoseAmount();
|
|
|
|
+ }else{
|
|
|
|
+ appGameBettingDetailsCountDTO.setBettingCount(0);
|
|
|
|
+ appGameBettingDetailsCountDTO.setOrderAmount(0.00);
|
|
|
|
+ appGameBettingDetailsCountDTO.setWinAmount(0.00);
|
|
|
|
+ appGameBettingDetailsCountDTO.setLoseAmount(0.00);
|
|
|
|
+ }
|
|
|
|
+ newList.add(appGameBettingDetailsCountDTO);
|
|
|
|
+ }
|
|
|
|
+ appGameBettingCountDTO.setOrderAmount(orderAmount);
|
|
|
|
+ appGameBettingCountDTO.setWinAmount(winAmount);
|
|
|
|
+ appGameBettingCountDTO.setLoseAmount(loseAmount);
|
|
|
|
+ appGameBettingCountDTO.setList(newList);
|
|
|
|
+ return success(appGameBettingCountDTO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 游戏输赢详情列表
|
|
|
|
+ */
|
|
|
|
+ @GetMapping(value = "/listByGameId")
|
|
|
|
+ public TableDataInfo getListByGameId(@RequestParam(name = "gameId") Long gameId)
|
|
|
|
+ {
|
|
|
|
+ startPage();
|
|
|
|
+ List<AppGameBetting> list = appGameBettingService.selectListByGameId(gameId);
|
|
|
|
+ return getDataTable(list);
|
|
|
|
+ }
|
|
}
|
|
}
|