|
@@ -10,6 +10,7 @@ import com.game.business.service.*;
|
|
|
import com.game.business.util.Common;
|
|
|
import com.game.business.util.im.TencentCloudImUtil;
|
|
|
import com.game.business.vo.AppGameItemBettingVO;
|
|
|
+import com.game.common.constant.CacheConstants;
|
|
|
import com.game.common.constant.finance.FinTranType1;
|
|
|
import com.game.common.constant.finance.FinTranType2;
|
|
|
import com.game.common.constant.finance.FinTranType3;
|
|
@@ -60,6 +61,7 @@ public class AppGameBettingTask {
|
|
|
@Autowired
|
|
|
private IAppGameItemMultipleService appGameItemMultipleService;
|
|
|
|
|
|
+ @Async("asyncExecutor")
|
|
|
public void gameDataTask(String message, String gameCodeFinal) throws Exception {
|
|
|
|
|
|
JSONArray dataArry = JSONArray.parseArray(message);
|
|
@@ -281,29 +283,41 @@ public class AppGameBettingTask {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- long count = appGameLotteryService.selectCount(appGame.getClassifyId(), appGame.getId(), gameDate);
|
|
|
-
|
|
|
- if(count > 0){
|
|
|
-// System.out.println("游戏socket推送开奖,当前期已开过将,游戏编码:" + gameCode + ",期号:" + gameDate);
|
|
|
+ String redisKey = CacheConstants.GAME_LOTTERY_TASK.concat(appGame.getId() + ":" + gameCode);
|
|
|
+ if(!redisCache.redisTemplate.opsForValue().setIfAbsent(redisKey, 1)){
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- // 保存开奖记录
|
|
|
- AppGameLottery appGameLottery = new AppGameLottery();
|
|
|
- appGameLottery.setGameId(appGame.getId());
|
|
|
- appGameLottery.setClassId(appGame.getClassifyId());
|
|
|
- appGameLottery.setGameDate(gameDate);
|
|
|
- appGameLottery.setIsLottery(isLottery);
|
|
|
- appGameLottery.setGameRecordDate(new Date());
|
|
|
- appGameLottery.setGameLotterySucc(gameLotterySucc);
|
|
|
- appGameLotteryService.save(appGameLottery);
|
|
|
-
|
|
|
- lotteryTask(appGame, appGameClassify, gameLotterySucc, gameDate);
|
|
|
- }
|
|
|
+ try {
|
|
|
+
|
|
|
+ long count = appGameLotteryService.selectCount(appGame.getClassifyId(), appGame.getId(), gameDate);
|
|
|
+
|
|
|
+ if(count > 0){
|
|
|
+ redisCache.redisTemplate.delete(redisKey);
|
|
|
+// System.out.println("游戏socket推送开奖,当前期已开过将,游戏编码:" + gameCode + ",期号:" + gameDate);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
+ // 保存开奖记录
|
|
|
+ AppGameLottery appGameLottery = new AppGameLottery();
|
|
|
+ appGameLottery.setGameId(appGame.getId());
|
|
|
+ appGameLottery.setClassId(appGame.getClassifyId());
|
|
|
+ appGameLottery.setGameDate(gameDate);
|
|
|
+ appGameLottery.setIsLottery(isLottery);
|
|
|
+ appGameLottery.setGameRecordDate(new Date());
|
|
|
+ appGameLottery.setGameLotterySucc(gameLotterySucc);
|
|
|
+ appGameLotteryService.save(appGameLottery);
|
|
|
+
|
|
|
+ lotteryTask(appGame, appGameClassify, gameLotterySucc, gameDate);
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ redisCache.redisTemplate.delete(redisKey);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- @Async("asyncExecutor")
|
|
|
public void lotteryTask(AppGame appGame, AppGameClassify appGameClassify, String gameLotterySucc, String gameDate) throws Exception {
|
|
|
|
|
|
this.updateItme(appGame.getId(), gameLotterySucc);
|