|
@@ -1,23 +1,20 @@
|
|
package com.game.business.task;
|
|
package com.game.business.task;
|
|
|
|
|
|
-import cn.hutool.core.util.IdUtil;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.game.business.domain.*;
|
|
import com.game.business.domain.*;
|
|
|
|
+import com.game.business.dto.AppItemCountDTO;
|
|
import com.game.business.service.*;
|
|
import com.game.business.service.*;
|
|
import com.game.common.constant.finance.FinTranType1;
|
|
import com.game.common.constant.finance.FinTranType1;
|
|
import com.game.common.constant.finance.FinTranType2;
|
|
import com.game.common.constant.finance.FinTranType2;
|
|
import com.game.common.constant.finance.FinTranType3;
|
|
import com.game.common.constant.finance.FinTranType3;
|
|
-import com.game.common.core.domain.HttpRet;
|
|
|
|
import com.game.common.core.redis.RedisCache;
|
|
import com.game.common.core.redis.RedisCache;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Component
|
|
@Component
|
|
@@ -41,6 +38,9 @@ public class AppGameBettingTask {
|
|
@Autowired
|
|
@Autowired
|
|
private IAppGameClassifyService appGameClassifyService;
|
|
private IAppGameClassifyService appGameClassifyService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IAppGameItemService appGameItemService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private RedisCache redisCache;
|
|
private RedisCache redisCache;
|
|
|
|
|
|
@@ -197,6 +197,18 @@ public class AppGameBettingTask {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Integer isLottery = gameLotteryObject.getInteger("isLottery");
|
|
|
|
+ String gameLotterySucc = gameLotteryObject.getString("gameLotterySucc");
|
|
|
|
+
|
|
|
|
+ if(isLottery != 1){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(gameLotterySucc == null || gameLotterySucc.trim().isEmpty()){
|
|
|
|
+// System.out.println("游戏socket推送倒计时,time为空。");
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
long count = appGameLotteryService.selectCount(appGame.getClassifyId(), appGame.getId(), gameDate);
|
|
long count = appGameLotteryService.selectCount(appGame.getClassifyId(), appGame.getId(), gameDate);
|
|
|
|
|
|
if(count > 0){
|
|
if(count > 0){
|
|
@@ -204,9 +216,6 @@ public class AppGameBettingTask {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
- Integer isLottery = gameLotteryObject.getInteger("isLottery");
|
|
|
|
- String gameLotterySucc = gameLotteryObject.getString("gameLotterySucc");
|
|
|
|
-
|
|
|
|
// 保存开奖记录
|
|
// 保存开奖记录
|
|
AppGameLottery appGameLottery = new AppGameLottery();
|
|
AppGameLottery appGameLottery = new AppGameLottery();
|
|
appGameLottery.setGameId(appGame.getId());
|
|
appGameLottery.setGameId(appGame.getId());
|
|
@@ -217,9 +226,7 @@ public class AppGameBettingTask {
|
|
appGameLottery.setGameLotterySucc(gameLotterySucc);
|
|
appGameLottery.setGameLotterySucc(gameLotterySucc);
|
|
appGameLotteryService.save(appGameLottery);
|
|
appGameLotteryService.save(appGameLottery);
|
|
|
|
|
|
- if(isLottery != 1){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ this.updateItme(appGame.getId(), gameLotterySucc);
|
|
|
|
|
|
this.gameBettingTask(appGameClassify.getId(), appGame.getId(), gameDate, gameLotterySucc);
|
|
this.gameBettingTask(appGameClassify.getId(), appGame.getId(), gameDate, gameLotterySucc);
|
|
|
|
|
|
@@ -228,7 +235,48 @@ public class AppGameBettingTask {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- @Transactional
|
|
|
|
|
|
+ public void updateItme(Long gameId, String gameLotterySucc){
|
|
|
|
+
|
|
|
|
+ // 获取上次开奖结果
|
|
|
|
+ List<AppItemCountDTO> itemCountList = new ArrayList<>();
|
|
|
|
+ String gameLotterySuccCache = redisCache.getCacheObject("G:GameCount:" + gameId);
|
|
|
|
+ if(gameLotterySuccCache != null && !gameLotterySuccCache.trim().isEmpty()){
|
|
|
|
+ itemCountList = JSONArray.parseArray(gameLotterySuccCache, AppItemCountDTO.class);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 修改游戏选项
|
|
|
|
+ String [] bettingItems = gameLotterySucc.split(",");
|
|
|
|
+ List<AppItemCountDTO> nowItemCountList = new ArrayList<>();
|
|
|
|
+ for(int j = 0; j < bettingItems.length; j++) {
|
|
|
|
+ String bettingItemStr = bettingItems[j];
|
|
|
|
+
|
|
|
|
+ AppItemCountDTO appItemCountDTO = new AppItemCountDTO();
|
|
|
|
+ appItemCountDTO.setGameId(gameId);
|
|
|
|
+ appItemCountDTO.setItemLocation(bettingItemStr);
|
|
|
|
+ appItemCountDTO.setConsecutive(1);
|
|
|
|
+
|
|
|
|
+ AppGameItem appGameItem = new AppGameItem();
|
|
|
|
+ appGameItem.setGameId(gameId);
|
|
|
|
+ appGameItem.setItemLocation(bettingItemStr);
|
|
|
|
+ // 开奖次数
|
|
|
|
+ appGameItemService.updateLotteryCount(appGameItem);
|
|
|
|
+
|
|
|
|
+ if(!itemCountList.isEmpty()){
|
|
|
|
+ for (AppItemCountDTO appItemCount : itemCountList){
|
|
|
|
+ if(appItemCount.getItemLocation().equals(bettingItemStr)){
|
|
|
|
+ appItemCountDTO.setConsecutive(appItemCount.getConsecutive() + 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 更新连中
|
|
|
|
+ appGameItemService.updateConsecutive(appItemCountDTO);
|
|
|
|
+ nowItemCountList.add(appItemCountDTO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ redisCache.setCacheObject("G:GameCount:" + gameId, JSON.toJSONString(nowItemCountList));
|
|
|
|
+ }
|
|
|
|
+
|
|
public void gameBettingTask(Long classId, Long gameId, String gameDate, String bettingItem){
|
|
public void gameBettingTask(Long classId, Long gameId, String gameDate, String bettingItem){
|
|
|
|
|
|
List<AppGameBetting> list = appGameBettingService.getIsWinning(classId, gameId, gameDate, 0);
|
|
List<AppGameBetting> list = appGameBettingService.getIsWinning(classId, gameId, gameDate, 0);
|