1
0

3 Komitmen ae666cf5b6 ... a59371fcd0

Pembuat SHA1 Pesan Tanggal
  kk a59371fcd0 Merge remote-tracking branch 'origin/master' 2 bulan lalu
  kk 28b0e10aa1 开奖记录修改 2 bulan lalu
  kk 45edf18350 修改查询选项list 2 bulan lalu

+ 26 - 7
game-business/src/main/java/com/game/business/controller/AppGameLotteryController.java

@@ -3,8 +3,10 @@ package com.game.business.controller;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.game.business.domain.AppGameItem;
+import com.game.business.domain.AppGameItemMultiple;
 import com.game.business.domain.AppGameLottery;
 import com.game.business.dto.AppUserDTO;
+import com.game.business.service.IAppGameItemMultipleService;
 import com.game.business.service.IAppGameItemService;
 import com.game.business.service.IAppGameLotteryService;
 import com.game.business.service.IAppGameService;
@@ -31,10 +33,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 @RestController
@@ -54,6 +53,9 @@ public class AppGameLotteryController extends BaseController{
     @Autowired
     private AppGameLotteryTask appGameLotteryTask;
 
+    @Autowired
+    private IAppGameItemMultipleService appGameItemMultipleService;
+
     @PostMapping(value = "/list")
     @ApiOperation(value = "游戏开奖记录", notes = "游戏开奖记录")
     public HttpRetPageArr<AppGameLotteryVO> getListByGameId(@RequestParam(name = "gameId") Long gameId, @RequestParam(name= "gameDate", required = false) String gameDate
@@ -86,18 +88,35 @@ public class AppGameLotteryController extends BaseController{
 
                 if(StringUtils.isNotBlank(appGameLotteryVO.getGameLotterySucc())){
 
-                    String [] itmeArr = appGameLotteryVO.getGameLotterySucc().split(",");
                     String itemName = "";
                     String itemMultiple = "";
+                    List<String> multipleList = new ArrayList<>();
+
+                    AppGameItemMultiple appGameItemMultiple = appGameItemMultipleService.getAppGameItemMultiple(appGameLottery.getGameId(), appGameLottery.getGameDate());
+                    if(appGameItemMultiple != null){
+                        multipleList = Arrays.asList(appGameItemMultiple.getItemMultiple().split(","));
+                    }
+
+                    String [] itmeArr = appGameLotteryVO.getGameLotterySucc().split(",");
+
                     for (int j = 0; j < itmeArr.length; j++) {
                         String item = itmeArr[j];
                         if(codeItmeMap.containsKey(item)){
                             if(StringUtils.isNotBlank(itemName)){
                                 itemName += "," + codeItmeMap.get(item).get(0).getItemName();
-                                itemMultiple += "," + codeItmeMap.get(item).get(0).getItemMultiple();
+                                if(!multipleList.isEmpty()){
+                                    itemMultiple += "," + multipleList.get(Integer.parseInt(item));
+                                }else{
+                                    itemMultiple += "," + codeItmeMap.get(item).get(0).getItemMultiple();
+                                }
                             }else{
                                 itemName += codeItmeMap.get(item).get(0).getItemName();
-                                itemMultiple += codeItmeMap.get(item).get(0).getItemMultiple();
+
+                                if(!multipleList.isEmpty()){
+                                    itemMultiple +=  multipleList.get(Integer.parseInt(item));
+                                }else{
+                                    itemMultiple += codeItmeMap.get(item).get(0).getItemMultiple();
+                                }
                             }
                         }
                     }

+ 5 - 0
game-business/src/main/java/com/game/business/service/IAppGameItemMultipleService.java

@@ -4,4 +4,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.game.business.domain.AppGameItemMultiple;
 
 public interface IAppGameItemMultipleService extends IService<AppGameItemMultiple> {
+
+    Boolean checkAooGameItemMultiple(Long gameId, String gameDate);
+
+    AppGameItemMultiple getAppGameItemMultiple(Long gameId, String gameDate);
+
 }

+ 21 - 0
game-business/src/main/java/com/game/business/service/impl/AppGameItemMultipleServiceImpl.java

@@ -1,11 +1,32 @@
 package com.game.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.game.business.domain.AppGameItemMultiple;
 import com.game.business.mapper.AppGameItemMultipleMapper;
 import com.game.business.service.IAppGameItemMultipleService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 @Service
 public class AppGameItemMultipleServiceImpl extends ServiceImpl<AppGameItemMultipleMapper, AppGameItemMultiple> implements IAppGameItemMultipleService {
+
+    @Autowired
+    private AppGameItemMultipleMapper appGameItemMultipleMapper;
+
+    @Override
+    public Boolean checkAooGameItemMultiple(Long gameId, String gameDate) {
+        LambdaQueryWrapper<AppGameItemMultiple> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AppGameItemMultiple::getGameId, gameId);
+        queryWrapper.eq(AppGameItemMultiple::getGameDate, gameDate);
+        return appGameItemMultipleMapper.selectCount(queryWrapper) > 0;
+    }
+
+    @Override
+    public AppGameItemMultiple getAppGameItemMultiple(Long gameId, String gameDate) {
+        LambdaQueryWrapper<AppGameItemMultiple> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AppGameItemMultiple::getGameId, gameId);
+        queryWrapper.eq(AppGameItemMultiple::getGameDate, gameDate);
+        return appGameItemMultipleMapper.selectOne(queryWrapper);
+    }
 }

+ 12 - 5
game-business/src/main/java/com/game/business/task/AppGameBettingTask.java

@@ -142,11 +142,18 @@ public class AppGameBettingTask {
                     return;
                 }
 
-                AppGameItemMultiple appGameItemMultiple = new AppGameItemMultiple();
-                appGameItemMultiple.setGameId(appGame.getId());
-                appGameItemMultiple.setGameDate(gameDate);
-                appGameItemMultiple.setItemMultiple(gameLotteryBet.substring(1, gameLotteryBet.length() - 1));
-                appGameItemMultipleService.save(appGameItemMultiple);
+                AppGameItemMultiple appGameItemMultiple = appGameItemMultipleService.getAppGameItemMultiple(appGame.getId(), gameDate);
+
+                if(appGameItemMultiple != null){
+                    appGameItemMultiple.setItemMultiple(gameLotteryBet.substring(1, gameLotteryBet.length() - 1));
+                    appGameItemMultipleService.updateById(appGameItemMultiple);
+                }else{
+                    appGameItemMultiple = new AppGameItemMultiple();
+                    appGameItemMultiple.setGameId(appGame.getId());
+                    appGameItemMultiple.setGameDate(gameDate);
+                    appGameItemMultiple.setItemMultiple(gameLotteryBet.substring(1, gameLotteryBet.length() - 1));
+                    appGameItemMultipleService.save(appGameItemMultiple);
+                }
 
                 // 升序排序
                 itemList.stream().sorted(Comparator.comparing(AppGameItem::getItemLocation));

+ 1 - 0
game-business/src/main/resources/mapper/business/AppGameItemMapper.xml

@@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="lotteryCount != null "> and lottery_count = #{lotteryCount}</if>
             <if test="consecutive != null "> and consecutive = #{consecutive}</if>
         </where>
+        order by item_location asc
     </select>
     
     <select id="selectAppGameItemById" parameterType="Long" resultMap="AppGameItemResult">