Переглянути джерело

Merge remote-tracking branch 'origin/master'

dos 3 місяців тому
батько
коміт
2f1b93826d

+ 1 - 1
game-business/src/main/java/com/game/business/controller/AppGameBettingController.java

@@ -302,7 +302,7 @@ public class AppGameBettingController extends BaseController{
                 AppGameBettingVO appGameBettingVO = new AppGameBettingVO();
                 BeanUtils.copyProperties(appGameBetting, appGameBettingVO);
 
-                if(StringUtils.isNoneBlank(appGameBettingVO.getBettingItem())){
+                if(StringUtils.isNotBlank(appGameBettingVO.getBettingItem())){
                     if(codeItmeMap.containsKey(appGameBettingVO.getBettingItem())){
                         appGameBettingVO.setItemName(codeItmeMap.get(appGameBettingVO.getBettingItem()).get(0).getItemName());
                     }

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

@@ -50,10 +50,10 @@ public class AppGameLotteryController extends BaseController{
 
         LambdaQueryWrapper<AppGameLottery> queryLotteryWrapper = Wrappers.lambdaQuery();;
         queryLotteryWrapper.eq(AppGameLottery::getGameId, gameId);
-        if(StringUtils.isNoneBlank(gameDate)) {
+        if(StringUtils.isNotBlank(gameDate)) {
             queryLotteryWrapper.like(AppGameLottery::getGameDate, gameDate);
         }
-        if(StringUtils.isNoneBlank(strDate)){
+        if(StringUtils.isNotBlank(strDate)){
             queryLotteryWrapper.between(AppGameLottery::getGameRecordDate, strDate + " 00:00:00", strDate + " 23:59:59");
         }
         queryLotteryWrapper.orderByDesc(AppGameLottery::getGameRecordDate);
@@ -70,14 +70,14 @@ public class AppGameLotteryController extends BaseController{
                 AppGameLotteryVO appGameLotteryVO = new AppGameLotteryVO();
                 BeanUtils.copyProperties(appGameLottery, appGameLotteryVO);
 
-                if(StringUtils.isNoneBlank(appGameLotteryVO.getGameLotterySucc())){
+                if(StringUtils.isNotBlank(appGameLotteryVO.getGameLotterySucc())){
 
                     String [] itmeArr = appGameLotteryVO.getGameLotterySucc().split(",");
                     String itemName = "";
                     for (int j = 0; j < itmeArr.length; j++) {
                         String item = itmeArr[j];
                         if(codeItmeMap.containsKey(item)){
-                            if(StringUtils.isNoneBlank(itemName)){
+                            if(StringUtils.isNotBlank(itemName)){
                                 itemName += "," + codeItmeMap.get(item).get(0).getItemName();
                             }else{
                                 itemName += codeItmeMap.get(item).get(0).getItemName();

+ 15 - 0
game-business/src/main/java/com/game/business/domain/AppGameBetting.java

@@ -36,6 +36,21 @@ public class AppGameBetting {
     @ApiModelProperty(value = "用户ID")
     private Long userId;
 
+    @Excel(name = "主播ID")
+    @TableField(value = "live_user_id")
+    @ApiModelProperty(value = "主播ID")
+    private Long liveUserId;
+
+    @Excel(name = "直播房间号")
+    @TableField(value = "live_room_id")
+    @ApiModelProperty(value = "直播房间号")
+    private Long liveRoomId;
+
+    @Excel(name = "是否直播间投注 0:否 1:是")
+    @TableField(value = "is_live")
+    @ApiModelProperty(value = "直播房间号")
+    private Integer isLive;
+
     @Excel(name = "游戏期号")
     @TableField(value = "game_date")
     @ApiModelProperty(value = "游戏期号")

+ 1 - 1
game-business/src/main/java/com/game/business/service/impl/AppGameBettingServiceImpl.java

@@ -54,7 +54,7 @@ public class AppGameBettingServiceImpl extends ServiceImpl<AppGameBettingMapper,
         if(isWinning != null && isWinning != -1){
             queryWrapper.eq(AppGameBetting::getIsWinning, isWinning);
         }
-        if(StringUtils.isNoneBlank(strDate)){
+        if(StringUtils.isNotBlank(strDate)){
             queryWrapper.between(AppGameBetting::getCreateTime, strDate + " 00:00:00", strDate + " 23:59:59");
         }
         queryWrapper.orderByDesc(AppGameBetting::getCreateTime);

+ 94 - 1
game-business/src/main/java/com/game/business/task/AppAgentGameBettingTask.java

@@ -41,6 +41,9 @@ public class AppAgentGameBettingTask {
     @Async("asyncExecutor")
     public void agentGameBettingTask(AppGameBetting appGameBetting) {
 
+        // 主播分佣
+        liveCommissionHandler(appGameBetting);
+
         AppUserAgent userIdObject = new AppUserAgent();
         userIdObject.setUserId(appGameBetting.getUserId());
         List<AppUserAgent> userAgents = appUserAgentService.selectAppUserAgentList(userIdObject);
@@ -181,7 +184,7 @@ public class AppAgentGameBettingTask {
             finTranRecord.setSceneId2(null);
             finTranRecord.setSceneType(0L);
 
-            finTranRecord.setTranGroupId(appGameCommission.getId());
+            finTranRecord.setTranGroupId(appGameBetting.getId());
             finTranRecord.setTranType1(FinTranType1.U_Income_Coin.getType());
             finTranRecord.setTranType2(FinTranType2.REWARD_Income.getType());
             finTranRecord.setTranType3(FinTranType3.RECOMMEND_ADD_AMOUNT.getType());
@@ -210,4 +213,94 @@ public class AppAgentGameBettingTask {
             finTranRecordService.insertFinTranRecord(finTranRecord);
         }
     }
+
+    private void liveCommissionHandler(AppGameBetting appGameBetting){
+
+        if(appGameBetting.getIsLive() == 0){
+            return;
+        }
+
+        AppUser appUser = appUserService.selectAppUserByUserid(appGameBetting.getLiveUserId());
+        if(appUser == null){
+            return;
+        }
+
+        // 主播分佣
+        double gameRateAmount = appGameBetting.getBettingAmount() * 0.0003;
+
+
+        // 更新用户余额
+        if(appGameBetting.getBettingType() == 0){
+            appUser.setDiamondCoin(appUser.getDiamondCoin() + gameRateAmount);
+            appUser.setDiamondCoinTotal(appUser.getDiamondCoinTotal() + gameRateAmount);
+            appUserService.updateAppUser(appUser);
+            // 更新用户金币
+        }else{
+            appUser.setCoin(appUser.getCoin() + gameRateAmount);
+            appUserService.updateAppUser(appUser);
+        }
+
+        redisCache.deleteObject("U:UserInfo:" + appUser.getUserid());
+
+        FinTranRecord finTranRecord = new FinTranRecord();
+
+        if(appGameBetting.getBettingType() == 0){
+            finTranRecord.setCurrencyType(4L);
+            finTranRecord.setAfterDiamondCoin(appUser.getDiamondCoin());
+            finTranRecord.setDiamondCoinChange(gameRateAmount);
+
+            finTranRecord.setAfterCoin(appUser.getCoin());
+            finTranRecord.setCoinChange(0.00);
+        }else{
+            finTranRecord.setCurrencyType(2L);
+            finTranRecord.setAfterCoin(appUser.getCoin());
+            finTranRecord.setCoinChange(gameRateAmount);
+
+            finTranRecord.setAfterDiamondCoin(appUser.getDiamondCoin());
+            finTranRecord.setDiamondCoinChange(0.00);
+        }
+
+        finTranRecord.setAfterMoney(0.00);
+        finTranRecord.setMoneyChange(0.00);
+
+        finTranRecord.setAfterTicket(0.00);
+        finTranRecord.setTicketChange(0.00);
+
+        finTranRecord.setToUid(appUser.getUserid());
+        finTranRecord.setUid(appUser.getUserid());
+        finTranRecord.setFromUid(appGameBetting.getUserId());
+
+        finTranRecord.setSceneId1(0L);
+        finTranRecord.setSceneId2(null);
+        finTranRecord.setSceneType(0L);
+
+        finTranRecord.setTranGroupId(appGameBetting.getId());
+        finTranRecord.setTranType1(FinTranType1.U_Income_Coin.getType());
+        finTranRecord.setTranType2(FinTranType2.REWARD_Income.getType());
+        finTranRecord.setTranType3(FinTranType3.RECOMMEND_ADD_AMOUNT.getType());
+
+        finTranRecord.setRemarks("游戏分佣");
+
+        finTranRecord.setConsumptionCoin(0.00);
+        finTranRecord.setConsumptionMoney(0.00);
+        finTranRecord.setCommissionRelatedUid(0L);
+        finTranRecord.setAgentId(appUser.getAgentId());
+
+        finTranRecord.setCreateTime(new Date());
+
+        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.setOrderId(appGameBetting.getId());
+        finTranRecord.setId(IdUtil.getSnowflakeNextId());
+        finTranRecordService.insertFinTranRecord(finTranRecord);
+
+    }
 }