Prechádzať zdrojové kódy

增加礼物收益统计字段

dos 1 mesiac pred
rodič
commit
5b30d6531d

+ 29 - 2
game-business/src/main/java/com/game/business/controller/AppAgentController.java

@@ -11,6 +11,9 @@ import com.game.business.vo.AppUserDetailVo;
 import com.game.business.vo.AppUserTeamTranserRecordVo;
 import com.game.common.annotation.RepeatSubmit;
 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;
 import com.game.common.core.controller.BaseController;
 import com.game.common.core.domain.HttpRet;
 import com.game.common.core.domain.HttpRetPageArr;
@@ -387,9 +390,9 @@ public class AppAgentController extends BaseController {
                 DateUtil.format(endDate,"yyyy-MM-dd").concat(" 23:59:59"),
                 null,null,null,null);
         //用户总投注流水
-        appUserDetailVo.setTotalBetting(appGameBettingService.sumBettingAmount(userId,0,null,null));
+        appUserDetailVo.setTotalBetting(appGameBettingService.sumBettingAmount(userId,0,null,null,null));
         //用户金币总投注流水
-        appUserDetailVo.setTotalCoinBetting(appGameBettingService.sumBettingAmount(userId,1,null,null));
+        appUserDetailVo.setTotalCoinBetting(appGameBettingService.sumBettingAmount(userId,1,null,null,null));
 
         //当日游戏投注
         appUserDetailVo.setTodayBetting(gameBettingList.stream().filter(e->{
@@ -471,6 +474,30 @@ public class AppAgentController extends BaseController {
         //本周提现
         appUserDetailVo.setWeekWithdraw(appUsersCashrecords.stream().mapToDouble(e->{return e.getVotes().doubleValue();}).sum());
 
+
+        //礼物
+        Date giftBeginTime = DateUtil.offsetDay(DateUtil.date(),-30);
+        Date giftEndTime = DateUtil.date();
+        LambdaQueryWrapper<FinTranRecord> finTranWrapper = new LambdaQueryWrapper<>();
+        finTranWrapper.eq(FinTranRecord::getTranType1, FinTranType1.U_Income_Coin.getType());
+        finTranWrapper.eq(FinTranRecord::getTranType2, FinTranType2.REWARD_Income.getType());
+        finTranWrapper.eq(FinTranRecord::getTranType3, FinTranType3.RECOMMEND_ADD_AMOUNT.getType());
+        finTranWrapper.eq(FinTranRecord::getUid,userId);
+        finTranWrapper.between(FinTranRecord::getCreateTime,DateUtil.format(giftBeginTime,"yyyy-MM-dd").concat(" 00:00:00"),
+                DateUtil.format(giftEndTime,"yyyy-MM-dd").concat(" 23:59:59"));
+        List<FinTranRecord> giftList = finTranRecordService.selecListByWrapper(finTranWrapper);
+        if(null == giftList){
+            giftList = new ArrayList<>();
+        }
+        appUserDetailVo.setTotalGift(giftList.stream().mapToDouble(FinTranRecord::getCoinChange).sum());
+        appUserDetailVo.setTodayGift(giftList.stream().filter(e->DateUtil.format(DateUtil.date(),
+                "yyyy-MM-dd").equals(DateUtil.format(e.getCreateTime(),"yyyy-MM-dd"))).mapToDouble(FinTranRecord::getCoinChange).sum());
+        Date finalEndDate = endDate;
+        Date finalBeginDate = beginDate;
+        appUserDetailVo.setWeekGift(giftList.stream().filter(e->e.getCreateTime().getTime() >= finalBeginDate.getTime() &&
+                e.getCreateTime().getTime() <= finalEndDate.getTime()).mapToDouble(FinTranRecord::getCoinChange).sum());
+
+
        /* AppUser queryIpUser = new AppUser();
         queryIpUser.setIpaddr(appUser.getIpaddr());
         List<AppUser> ipUserList = appUserService.selectAppUserList(queryIpUser);

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

@@ -655,10 +655,10 @@ public class AppGameBettingController extends BaseController{
     {
         AppUserGameBettingStaticsVo appUserGameBettingStaticsVo = new AppUserGameBettingStaticsVo();
         String date = DateUtil.format(DateUtil.date(),"yyyy-MM-dd");
-        appUserGameBettingStaticsVo.setTotalAmount(appGameBettingService.sumBettingAmount(userId,0,null,null));
-        appUserGameBettingStaticsVo.setTotalCoinAmount(appGameBettingService.sumBettingAmount(userId,1,null,null));
-        appUserGameBettingStaticsVo.setToDayAmount(appGameBettingService.sumBettingAmount(userId,0,date.concat(" 00:00:00"),date.concat(" 23:59:59")));
-        appUserGameBettingStaticsVo.setToDayCoinAmount(appGameBettingService.sumBettingAmount(userId,1,date.concat(" 00:00:00"),date.concat(" 23:59:59")));
+        appUserGameBettingStaticsVo.setTotalAmount(appGameBettingService.sumBettingAmount(userId,0,beginTime,endTime,gameId));
+        appUserGameBettingStaticsVo.setTotalCoinAmount(appGameBettingService.sumBettingAmount(userId,1,beginTime,endTime,gameId));
+        appUserGameBettingStaticsVo.setToDayAmount(appGameBettingService.sumBettingAmount(userId,0,date.concat(" 00:00:00"),date.concat(" 23:59:59"),gameId));
+        appUserGameBettingStaticsVo.setToDayCoinAmount(appGameBettingService.sumBettingAmount(userId,1,date.concat(" 00:00:00"),date.concat(" 23:59:59"),gameId));
         return R.ok(appUserGameBettingStaticsVo);
     }
 

+ 1 - 1
game-business/src/main/java/com/game/business/mapper/AppGameBettingMapper.java

@@ -93,6 +93,6 @@ public interface AppGameBettingMapper extends BaseMapper<AppGameBetting> {
             "   </if>" +
             "  </where>" +
             " </script>")*/
-    public Double sumBettingAmount(@Param("userId") Long userId, @Param("bettingType") Integer bettingType, @Param("beginTime") String beginTime, @Param("endTime") String endTime);
+    public Double sumBettingAmount(@Param("userId") Long userId, @Param("bettingType") Integer bettingType, @Param("beginTime") String beginTime, @Param("endTime") String endTime,@Param("gameId") Long gameId);
 
 }

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

@@ -104,5 +104,5 @@ public interface IAppGameBettingService extends IService<AppGameBetting> {
      */
     public int deleteAppGameBettingById(Long id);
 
-    public Double sumBettingAmount(Long userId,Integer bettingType,String beginTime,String endTime);
+    public Double sumBettingAmount(Long userId,Integer bettingType,String beginTime,String endTime,Long gameId);
 }

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

@@ -255,8 +255,8 @@ public class AppGameBettingServiceImpl extends ServiceImpl<AppGameBettingMapper,
     }
 
     @Override
-    public Double sumBettingAmount(Long userId,Integer bettingType,String beginTime,String endTime) {
-        return appGameBettingMapper.sumBettingAmount(userId,bettingType,beginTime,endTime);
+    public Double sumBettingAmount(Long userId,Integer bettingType,String beginTime,String endTime,Long gameId) {
+        return appGameBettingMapper.sumBettingAmount(userId,bettingType,beginTime,endTime,gameId);
     }
 
 

+ 5 - 0
game-business/src/main/java/com/game/business/vo/AppUserDetailVo.java

@@ -64,4 +64,9 @@ public class AppUserDetailVo implements Serializable {
     private Double weekWithdraw;
     private Double totalWithdraw;
 
+    //礼物收益
+    private Double totalGift; //近30天收益
+    private Double todayGift; //今日礼物收益
+    private Double weekGift; //当前周期礼物收益
+
 }

+ 3 - 0
game-business/src/main/resources/mapper/business/AppGameBettingMapper.xml

@@ -283,6 +283,9 @@
             <if test="userId != null ">
                 and user_id = #{userId}
             </if>
+            <if test="gameId != null ">
+                and game_id = #{gameId}
+            </if>
             <if test="bettingType != null ">
                 and betting_type = #{bettingType}
             </if>

+ 1 - 1
game-ui/src/views/business/betting/index.vue

@@ -477,7 +477,7 @@ export default {
       let amount = 0;
       for(var i in detailsCountVOList){
         let item = detailsCountVOList[i];
-        amount += parseInt(item.winAmount) - parseInt(item.loseAmount);
+        amount += (parseInt(item.winAmount) - (parseInt(item.orderAmount) - parseInt(item.loseAmount))) - parseInt(item.loseAmount);
       }
       return amount;
     },

+ 101 - 20
game-ui/src/views/business/user/index.vue

@@ -553,6 +553,9 @@
           <span style="margin-left: 1rem;">
             总投注(金币):{{userInfo.infoDetail.totalCoinBetting}}
           </span>
+          <span style="margin-left: 1rem;">
+            近30天礼物收益:{{userInfo.infoDetail.totalGift}}
+          </span>
         </el-form-item>
         <el-tabs v-model="activeName2" @tab-click="handleClick" style="width: 100%">
           <el-tab-pane label="今日" name="first">
@@ -562,6 +565,9 @@
             </span>
                 <span style="margin-left: 1rem;">
               提现:{{userInfo.infoDetail.todayWithdraw}}
+            </span>
+                <span style="margin-left: 1rem;">
+              礼物收益:{{userInfo.infoDetail.todayGift}}
             </span>
               </el-form-item>
               <el-form-item >
@@ -600,6 +606,9 @@
           </span>
               <span style="margin-left: 1rem;">
             提现:{{userInfo.infoDetail.weekWithdraw}}
+          </span>
+              <span style="margin-left: 1rem;">
+            礼物收益:{{userInfo.infoDetail.weekGift}}
           </span>
             </el-form-item>
             <el-form-item>
@@ -869,38 +878,50 @@
                 v-loading="bettingLoading"
                 stripe
                 style="width: 100%">
-                <el-table-column label="游戏" align="center" prop="gameId">
+                <el-table-column label="用户ID" align="center" prop="userId" width="100"/>
+                <el-table-column label="游戏" align="center" prop="gameId" width="100">
                   <template slot-scope="scope">
                     <span>{{ getTypeName(scope.row.gameId) }}</span>
                   </template>
                 </el-table-column>
-                <el-table-column label="用户ID" align="center" prop="userId" />
-                <el-table-column label="游戏期号" align="center" prop="gameDate" />
-                <el-table-column label="主播ID" align="center" prop="liveUserId" />
-                <el-table-column label="直播房间号" align="center" prop="liveRoomId" />
-                <el-table-column label="是否直播间投注 " align="center" prop="isLive">
+                <el-table-column label="投注详情(选项:金额)" align="center"  width="200">
                   <template slot-scope="scope">
-                    <dict-tag :options="dict.type.app_betting_is_live" :value="scope.row.isLive"/>
+                    {{getBettingInfo(scope.row)}}
                   </template>
                 </el-table-column>
-                <el-table-column label="投注类型" align="center" prop="bettingType">
+                <el-table-column label="本期总投注金额" align="center"  width="120">
                   <template slot-scope="scope">
-                    <dict-tag :options="dict.type.app_game_betting_type" :value="scope.row.bettingType"/>
+                    {{getBettingAmount(scope.row)}}
+                  </template>
+                </el-table-column>
+                <el-table-column label="开奖获得" align="center"  width="120">
+                  <template slot-scope="scope">
+                    {{getBettingWinAmount(scope.row)}}
+                  </template>
+                </el-table-column>
+                <el-table-column label="本局盈亏" align="center"  width="120">
+                  <template slot-scope="scope">
+                    {{getBettingWinLoseAmount(scope.row)}}
+                  </template>
+                </el-table-column>
+                <el-table-column label="是否开奖" align="center"  width="120">
+                  <template slot-scope="scope">
+                    {{scope.row.isLottery==0?'否':'是'}}
                   </template>
                 </el-table-column>
-                <el-table-column label="投注选项" align="center" prop="bettingItem">
+                <el-table-column label="游戏期号" align="center" prop="gameDate" width="130"/>
+                <el-table-column label="开奖项" align="center" prop="gameLotterySucc" width="130">
                   <template slot-scope="scope">
                     {{getItemName(scope.row)}}
                   </template>
                 </el-table-column>
-                <el-table-column label="投注选项倍数" align="center" prop="bettingMultiple" />
-                <el-table-column label="投注金额" align="center" prop="bettingAmount" />
-                <el-table-column label="投注佣金" align="center" prop="bettingCommission" />
-                <el-table-column label="是否中奖" align="center" prop="isWinning">
+                <el-table-column label="投注类型" align="center" prop="bettingType">
                   <template slot-scope="scope">
-                    <dict-tag :options="dict.type.app_game_betting_winning" :value="scope.row.isWinning"/>
+                    <dict-tag :options="dict.type.app_game_betting_type" :value="scope.row.bettingType"/>
                   </template>
                 </el-table-column>
+                <el-table-column label="开奖时间" align="center" prop="gameRecordDate" width="130"/>
+                <el-table-column label="投注时间" align="center" prop="bettingDate" width="100"/>
               </el-table>
               <pagination
                 v-show="bettingTotal>0"
@@ -926,7 +947,7 @@
 import { listUser, getUser, delUser, addUser, updateUser,resetUser,userCharge,channelList,withdraw,openLive,userDetail,liveCommission,getGift,updateUserAgent,updateGameCommissionAgent,restPayPwd  } from "@/api/business/user";
 import { listAccount} from "@/api/business/account";
 import { listOrder } from "@/api/business/order";
-import { listBetting} from "@/api/business/betting";
+import { listHistoryWeb} from "@/api/business/betting";
 import {allGameList } from "@/api/business/game_item";
 import {allList} from "@/api/business/lottery";
 
@@ -1162,22 +1183,82 @@ export default {
     },
   },
   methods: {
+    getBettingInfo(row){
+      let detailsCountVOList = row.detailsCountVOList;
+      if(!detailsCountVOList){
+        return "-";
+      }
+      let res = "";
+      let map = {};
+      for(var i in detailsCountVOList){
+        let item = detailsCountVOList[i];
+        let amount = map[item.bettingTtem];
+        if(!amount){
+          amount = 0;
+        }
+        amount += item.orderAmount;
+        map[item.bettingTtem] = amount;
+      }
+      for(var i in map){
+        if(res.length > 0){
+          res += " | "
+        }
+        res += this.gameItemMap[i+"_"+row.gameId] + ":" + map[i];
+      }
+      return res;
+    },
+    getBettingAmount(row){
+      let detailsCountVOList = row.detailsCountVOList;
+      if(!detailsCountVOList){
+        return "-";
+      }
+      let amount = 0;
+      for(var i in detailsCountVOList){
+        let item = detailsCountVOList[i];
+        amount += parseInt(item.orderAmount);
+      }
+      return amount;
+    },
+    getBettingWinAmount(row){
+      let detailsCountVOList = row.detailsCountVOList;
+      if(!detailsCountVOList){
+        return "-";
+      }
+      let amount = 0;
+      for(var i in detailsCountVOList){
+        let item = detailsCountVOList[i];
+        amount += parseInt(item.winAmount);
+      }
+      return amount;
+    },
+    getBettingWinLoseAmount(row){
+      let detailsCountVOList = row.detailsCountVOList;
+      if(!detailsCountVOList){
+        return "-";
+      }
+      let amount = 0;
+      for(var i in detailsCountVOList){
+        let item = detailsCountVOList[i];
+        amount += (parseInt(item.winAmount) - (parseInt(item.orderAmount) - parseInt(item.loseAmount))) - parseInt(item.loseAmount);
+      }
+      return amount;
+    },
     getItemName(row){
       let that = this;
       let bettingGameType = row.bettingGameType;
-      let bettingItem = row.bettingItem;
+      let bettingItem = row.gameLotterySucc;
       let gameId = row.gameId;
       if("0" == bettingGameType){
         return that.gameItemMap[bettingItem+"_"+gameId];
       }else{
         let name = "";
-        let arr = JSON.parse(bettingItem);
+        let arr = bettingItem.split(",")
         for(var i in arr){
           let item = arr[i];
           if("" != name){
             name = name + ",";
           }
-          name = name + that.gameItemMap[item["bettingItem"]+"_"+gameId];
+          name = name + that.gameItemMap[item+"_"+gameId];
         }
         return name;
       }
@@ -1248,7 +1329,7 @@ export default {
     getBettingList() {
       this.bettingLoading = true;
       this.queryBettingParams.userId = this.userInfo.userid;
-      listBetting(this.queryBettingParams).then(response => {
+      listHistoryWeb(this.queryBettingParams).then(response => {
         this.bettingList = response.rows;
         this.bettingTotal = response.total;
         this.bettingLoading = false;