|
@@ -40,7 +40,7 @@ public class AppGameBettingTask {
|
|
|
private RedisCache redisCache;
|
|
|
|
|
|
@Async("asyncExecutor")
|
|
|
- public void gameDataTask(String message){
|
|
|
+ public void gameDataTask(String message, String gameCodeFinal){
|
|
|
|
|
|
JSONArray dataArry = JSONArray.parseArray(message);
|
|
|
|
|
@@ -55,7 +55,7 @@ public class AppGameBettingTask {
|
|
|
}
|
|
|
|
|
|
if(type == null){
|
|
|
- System.out.println("游戏socket推送类型为空。");
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -79,29 +79,29 @@ public class AppGameBettingTask {
|
|
|
}
|
|
|
|
|
|
if(classCode == null){
|
|
|
- System.out.println("游戏socket推送倒计时,平台ID为空。");
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if(gameDataArry == null){
|
|
|
- System.out.println("游戏socket推送倒计时,data对象为空。");
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if(time == null || time.trim().isEmpty()){
|
|
|
- System.out.println("游戏socket推送倒计时,time为空。");
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
AppGameClassify appGameClassify = appGameClassifyService.getByCode(classCode);
|
|
|
if(appGameClassify == null){
|
|
|
- System.out.println("开奖游戏平台不存在:" + classCode);
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
List<AppGame> appGameList = appGameService.selectAppGameByClassId(appGameClassify.getId());
|
|
|
if(appGameList == null || appGameList.isEmpty()){
|
|
|
- System.out.println("开奖游戏平台没有游戏:" + classCode);
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
Map<String, List<AppGame>> codeGameMap = appGameList.stream().collect(Collectors.groupingBy(AppGame::getCode));
|
|
@@ -110,11 +110,14 @@ public class AppGameBettingTask {
|
|
|
JSONObject jsonObject = gameDataArry.getJSONObject(i);
|
|
|
String gameCode = jsonObject.getString("id");
|
|
|
if(gameCode == null){
|
|
|
- System.out.println("游戏socket推送倒计时,游戏id为空。");
|
|
|
+
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(!gameCodeFinal.equals(gameCode)){
|
|
|
continue;
|
|
|
}
|
|
|
if(!codeGameMap.containsKey(gameCode)){
|
|
|
- System.out.println("开奖游戏不存在:" + gameCode);
|
|
|
+
|
|
|
continue;
|
|
|
}
|
|
|
AppGame appGame = codeGameMap.get(gameCode).get(0);
|
|
@@ -141,23 +144,23 @@ public class AppGameBettingTask {
|
|
|
}
|
|
|
|
|
|
if(gameArry == null){
|
|
|
- System.out.println("游戏socket推送期号或开奖,gameTypeSortArrayVOS对象为空。");
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if(classCode == null){
|
|
|
- System.out.println("游戏socket推送期号或开奖,平台ID为空。");
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
AppGameClassify appGameClassify = appGameClassifyService.getByCode(classCode);
|
|
|
if(appGameClassify == null){
|
|
|
- System.out.println("开奖游戏平台不存在:" + classCode);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
List<AppGame> appGameList = appGameService.selectAppGameByClassId(appGameClassify.getId());
|
|
|
if(appGameList == null || appGameList.isEmpty()){
|
|
|
- System.out.println("开奖游戏平台没有游戏:" + classCode);
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
Map<String, List<AppGame>> codeGameMap = appGameList.stream().collect(Collectors.groupingBy(AppGame::getCode));
|
|
@@ -167,20 +170,23 @@ public class AppGameBettingTask {
|
|
|
String gameCode = gameLotteryObject.getString("id");
|
|
|
|
|
|
if(gameCode == null){
|
|
|
- System.out.println("游戏socket推送期号或开奖,游戏ID为空。");
|
|
|
- return;
|
|
|
+
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(!gameCodeFinal.equals(gameCode)){
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
if(!codeGameMap.containsKey(gameCode)){
|
|
|
- System.out.println("开奖游戏不存在:" + gameCode);
|
|
|
+
|
|
|
continue;
|
|
|
}
|
|
|
AppGame appGame = codeGameMap.get(gameCode).get(0);
|
|
|
|
|
|
String gameDate = gameLotteryObject.getString("gameDate");
|
|
|
if(gameDate == null){
|
|
|
- System.out.println("游戏socket推送期号或开奖,期号为空。");
|
|
|
- return;
|
|
|
+
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
if(type == 3){
|
|
@@ -192,7 +198,7 @@ public class AppGameBettingTask {
|
|
|
long count = appGameLotteryService.selectCount(appGame.getClassifyId(), appGame.getId(), gameDate);
|
|
|
|
|
|
if(count > 0){
|
|
|
- System.out.println("游戏socket推送开奖,当前期已开过将,游戏编码:" + gameCode + ",期号:" + gameDate);
|
|
|
+
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -229,79 +235,86 @@ public class AppGameBettingTask {
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
AppGameBetting appGameBetting = list.get(i);
|
|
|
appGameBetting.setUpdateTime(new Date());
|
|
|
- if(!appGameBetting.getBettingItem().equals(bettingItem)){
|
|
|
- appGameBetting.setIsWinning(2);
|
|
|
- appGameBettingService.updateById(appGameBetting);
|
|
|
- continue;
|
|
|
- }
|
|
|
|
|
|
- AppUser appUser = appUserService.selectAppUserByUserid(appGameBetting.getUserId());
|
|
|
- if(appUser == null){
|
|
|
- appGameBetting.setIsWinning(1);
|
|
|
- appGameBettingService.updateById(appGameBetting);
|
|
|
- continue;
|
|
|
- }
|
|
|
+ String [] bettingItems = bettingItem.split(",");
|
|
|
+ for(int j = 0; j < bettingItems.length; j++){
|
|
|
+ String bettingItemStr = bettingItems[j];
|
|
|
+
|
|
|
+ if(!appGameBetting.getBettingItem().equals(bettingItemStr)){
|
|
|
+ appGameBetting.setIsWinning(2);
|
|
|
+ appGameBettingService.updateById(appGameBetting);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ AppUser appUser = appUserService.selectAppUserByUserid(appGameBetting.getUserId());
|
|
|
+ if(appUser == null){
|
|
|
+ appGameBetting.setIsWinning(1);
|
|
|
+ appGameBettingService.updateById(appGameBetting);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ appUser.setDiamondCoin(appUser.getDiamondCoin() + (appGameBetting.getBettingAmount() * appGameBetting.getBettingMultiple()) );
|
|
|
+ appUser.setDiamondCoinTotal(appUser.getDiamondCoinCashTotal() + (appGameBetting.getBettingAmount() * appGameBetting.getBettingMultiple()));
|
|
|
+ appUserService.updateAppUser(appUser);
|
|
|
|
|
|
-
|
|
|
- appUser.setDiamondCoin(appUser.getDiamondCoin() + (appGameBetting.getBettingAmount() * appGameBetting.getBettingMultiple()) );
|
|
|
- appUser.setDiamondCoinTotal(appUser.getDiamondCoinCashTotal() + (appGameBetting.getBettingAmount() * appGameBetting.getBettingMultiple()));
|
|
|
- appUserService.updateAppUser(appUser);
|
|
|
+ redisCache.deleteObject("U:UserInfo:" + appUser.getUserid());
|
|
|
|
|
|
- redisCache.deleteObject("U:UserInfo:" + appUser.getUserid());
|
|
|
+ appGameBetting.setIsWinning(1);
|
|
|
+ appGameBettingService.updateById(appGameBetting);
|
|
|
|
|
|
- appGameBetting.setIsWinning(1);
|
|
|
- appGameBettingService.updateById(appGameBetting);
|
|
|
+ FinTranRecord finTranRecord = new FinTranRecord();
|
|
|
|
|
|
- FinTranRecord finTranRecord = new FinTranRecord();
|
|
|
+ finTranRecord.setAfterCoin(appUser.getCoin());
|
|
|
+ finTranRecord.setCoinChange(0.00);
|
|
|
|
|
|
- finTranRecord.setAfterCoin(appUser.getCoin());
|
|
|
- finTranRecord.setCoinChange(0.00);
|
|
|
+ finTranRecord.setAfterMoney(0.00);
|
|
|
+ finTranRecord.setMoneyChange(0.00);
|
|
|
|
|
|
- finTranRecord.setAfterMoney(0.00);
|
|
|
- finTranRecord.setMoneyChange(0.00);
|
|
|
+ finTranRecord.setAfterDiamondCoin(appUser.getDiamondCoin());
|
|
|
+ finTranRecord.setDiamondCoinChange(appGameBetting.getBettingAmount());
|
|
|
|
|
|
- finTranRecord.setAfterDiamondCoin(appUser.getDiamondCoin());
|
|
|
- finTranRecord.setDiamondCoinChange(appGameBetting.getBettingAmount());
|
|
|
+ finTranRecord.setAfterTicket(0.00);
|
|
|
+ finTranRecord.setTicketChange(0.00);
|
|
|
|
|
|
- finTranRecord.setAfterTicket(0.00);
|
|
|
- finTranRecord.setTicketChange(0.00);
|
|
|
+ finTranRecord.setToUid(appUser.getUserid());
|
|
|
+ finTranRecord.setUid(appUser.getUserid());
|
|
|
|
|
|
- finTranRecord.setToUid(appUser.getUserid());
|
|
|
- finTranRecord.setUid(appUser.getUserid());
|
|
|
+ finTranRecord.setSceneId1(0L);
|
|
|
+ finTranRecord.setSceneId2(null);
|
|
|
+ finTranRecord.setSceneType(0L);
|
|
|
|
|
|
- finTranRecord.setSceneId1(0L);
|
|
|
- finTranRecord.setSceneId2(null);
|
|
|
- finTranRecord.setSceneType(0L);
|
|
|
+ finTranRecord.setTranGroupId(appGameBetting.getId());
|
|
|
+ finTranRecord.setTranType1(17L);
|
|
|
+ finTranRecord.setTranType2(200L);
|
|
|
+ finTranRecord.setTranType3(20001L);
|
|
|
|
|
|
- finTranRecord.setTranGroupId(appGameBetting.getId());
|
|
|
- finTranRecord.setTranType1(17L);
|
|
|
- finTranRecord.setTranType2(200L);
|
|
|
- finTranRecord.setTranType3(20001L);
|
|
|
+ finTranRecord.setRemarks("游戏中奖");
|
|
|
|
|
|
- finTranRecord.setRemarks("游戏中奖");
|
|
|
+ finTranRecord.setConsumptionCoin(appGameBetting.getBettingAmount());
|
|
|
+ finTranRecord.setConsumptionMoney(0.00);
|
|
|
+ finTranRecord.setCommissionRelatedUid(0L);
|
|
|
+ finTranRecord.setAgentId(appUser.getAgentId());
|
|
|
|
|
|
- finTranRecord.setConsumptionCoin(appGameBetting.getBettingAmount());
|
|
|
- finTranRecord.setConsumptionMoney(0.00);
|
|
|
- finTranRecord.setCommissionRelatedUid(0L);
|
|
|
- finTranRecord.setAgentId(appUser.getAgentId());
|
|
|
+ finTranRecord.setCreateTime(new Date());
|
|
|
|
|
|
- finTranRecord.setCreateTime(new Date());
|
|
|
+ finTranRecord.setCurrencyType(4L);
|
|
|
|
|
|
- finTranRecord.setCurrencyType(4L);
|
|
|
+ finTranRecord.setFromUid(0L);
|
|
|
+ finTranRecord.setGoodsId(0L);
|
|
|
+ finTranRecord.setGuildId(0L);
|
|
|
+ finTranRecord.setManagerCoId(0L);
|
|
|
+ finTranRecord.setManagerId(0L);
|
|
|
|
|
|
- finTranRecord.setFromUid(0L);
|
|
|
- finTranRecord.setGoodsId(0L);
|
|
|
- finTranRecord.setGuildId(0L);
|
|
|
- finTranRecord.setManagerCoId(0L);
|
|
|
- finTranRecord.setManagerId(0L);
|
|
|
+ finTranRecord.setPerc(0.00);
|
|
|
+ finTranRecord.setProId(0L);
|
|
|
+ finTranRecord.setProCount(0L);
|
|
|
|
|
|
- finTranRecord.setPerc(0.00);
|
|
|
- finTranRecord.setProId(0L);
|
|
|
- finTranRecord.setProCount(0L);
|
|
|
+ finTranRecord.setOrderId(appGameBetting.getId());
|
|
|
+ finTranRecord.setId(IdUtil.getSnowflakeNextId());
|
|
|
+ finTranRecordService.insertFinTranRecord(finTranRecord);
|
|
|
|
|
|
- finTranRecord.setOrderId(appGameBetting.getId());
|
|
|
- finTranRecord.setId(IdUtil.getSnowflakeNextId());
|
|
|
- finTranRecordService.insertFinTranRecord(finTranRecord);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|