Ver código fonte

Merge remote-tracking branch 'origin/master'

kk 1 semana atrás
pai
commit
177fcec73c
31 arquivos alterados com 279 adições e 67 exclusões
  1. 1 1
      game-business/src/main/java/com/game/business/controller/AppAgentController.java
  2. 1 1
      game-business/src/main/java/com/game/business/controller/AppGameBettingController.java
  3. 2 2
      game-business/src/main/java/com/game/business/controller/AppUserController.java
  4. 17 3
      game-business/src/main/java/com/game/business/controller/AppUserCountDividendController.java
  5. 32 11
      game-business/src/main/java/com/game/business/controller/AppUsersCashrecordController.java
  6. 6 0
      game-business/src/main/java/com/game/business/domain/AppChargeChannel.java
  7. 1 1
      game-business/src/main/java/com/game/business/mapper/AppUserCountDividendMapper.java
  8. 1 1
      game-business/src/main/java/com/game/business/mapper/AppUsersCashrecordMapper.java
  9. 4 0
      game-business/src/main/java/com/game/business/mapper/FinTranRecordMapper.java
  10. 8 0
      game-business/src/main/java/com/game/business/service/IAppChargeChannelService.java
  11. 1 1
      game-business/src/main/java/com/game/business/service/IAppUserCountDividendService.java
  12. 4 2
      game-business/src/main/java/com/game/business/service/IAppUserService.java
  13. 6 0
      game-business/src/main/java/com/game/business/service/IAppUsersCashrecordService.java
  14. 2 0
      game-business/src/main/java/com/game/business/service/IFinTranRecordService.java
  15. 13 0
      game-business/src/main/java/com/game/business/service/impl/AppChargeChannelServiceImpl.java
  16. 30 9
      game-business/src/main/java/com/game/business/service/impl/AppUserCountDividendServiceImpl.java
  17. 6 4
      game-business/src/main/java/com/game/business/service/impl/AppUserServiceImpl.java
  18. 19 2
      game-business/src/main/java/com/game/business/service/impl/AppUsersCashrecordServiceImpl.java
  19. 10 4
      game-business/src/main/java/com/game/business/service/impl/FinTranRecordServiceImpl.java
  20. 2 2
      game-business/src/main/java/com/game/business/task/AppAgentGameBettingTask.java
  21. 1 1
      game-business/src/main/java/com/game/business/task/AppGameBettingTask.java
  22. 1 1
      game-business/src/main/java/com/game/business/task/AppGameLotteryTask.java
  23. 41 11
      game-business/src/main/java/com/game/business/task/AppUserCountTask.java
  24. 1 1
      game-business/src/main/java/com/game/business/task/AppUserLiveDividedTask.java
  25. 13 2
      game-business/src/main/java/com/game/business/util/other/PayOrderUtils.java
  26. 6 1
      game-business/src/main/resources/mapper/business/AppChargeChannelMapper.xml
  27. 4 0
      game-business/src/main/resources/mapper/business/AppUserCountDividendMapper.xml
  28. 1 1
      game-business/src/main/resources/mapper/business/AppUserMapper.xml
  29. 32 2
      game-business/src/main/resources/mapper/business/FinTranRecordMapper.xml
  30. 3 0
      game-ui/src/views/business/betting/index.vue
  31. 10 3
      game-ui/src/views/business/lottery/index.vue

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

@@ -113,7 +113,7 @@ public class AppAgentController extends BaseController {
             weekBegin = DateUtil.beginOfMonth(curDate);
             weekend = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 23:59:59")),"yyyy-MM-dd HH:mm:ss");
         }else{
-            weekBegin = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
+            weekBegin = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("16").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
             weekend = DateUtil.endOfMonth(curDate);
         }
 

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

@@ -445,7 +445,7 @@ public class AppGameBettingController extends BaseController{
 
             finTranRecord.setOrderId(gameBetting.getId());
             //finTranRecordService.insertFinTranRecord(finTranRecord);
-            appUserService.updateUserAmount(finTranRecord);
+            appUserService.updateUserAmount(finTranRecord,false);
 
             // 分佣
             if(gameBetting.getBettingType() == 0){

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

@@ -266,7 +266,7 @@ public class AppUserController extends BaseController
                 AppChargeChannel channel = appChargeChannelService.selectAppChargeChannelById(userChargeDto.getChannelId());
                 userChargeDto.setRate(channel.getRate());
             }*/
-            appUserService.updateUserAmount(tran);
+            appUserService.updateUserAmount(tran,false);
             BigDecimal rate = BigDecimal.ZERO;
             if(null != userChargeDto.getRate() && userChargeDto.getRate() > 0 && userChargeDto.getAmount() > 0){
                 if(userChargeDto.getRate() > 1){
@@ -315,7 +315,7 @@ public class AppUserController extends BaseController
                     giveTran.setTranType1(userChargeDto.getType() == 1 ? FinTranType1.U_Income_Coin_Balance.getType() : FinTranType1.U_Income_Coin.getType());
                     giveTran.setRemarks("充值赠送");
                     giveTran.setId(null);
-                    appUserService.updateUserAmount(giveTran);
+                    appUserService.updateUserAmount(giveTran,false);
                 }
             }
             AppUser afterUser = appUserService.selectAppUserByUserid(userChargeDto.getUserId());

+ 17 - 3
game-business/src/main/java/com/game/business/controller/AppUserCountDividendController.java

@@ -5,8 +5,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
 import java.util.stream.Collectors;
+import javax.annotation.PostConstruct;
 import javax.servlet.http.HttpServletResponse;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.game.business.domain.AppUser;
 import com.game.business.domain.FinTranRecord;
@@ -14,6 +16,7 @@ import com.game.business.dto.AppUserDividendListDto;
 import com.game.business.dto.AppUserDividendSendDto;
 import com.game.business.service.IAppUserService;
 import com.game.business.service.IFinTranRecordService;
+import com.game.common.annotation.RepeatSubmit;
 import com.game.common.constant.AppSceneType;
 import com.game.common.constant.finance.FinTranAddedInfo;
 import com.game.common.constant.finance.FinTranType1;
@@ -80,7 +83,7 @@ public class AppUserCountDividendController extends BaseController
     public HttpRetPageArr<AppUserCountDividend> list(AppUserDividendListDto dto)
     {
         startPage();
-        List<AppUserCountDividend> list = appUserCountDividendService.selectUserDividendList(SecurityUtils.getUserId(),null,null);
+        List<AppUserCountDividend> list = appUserCountDividendService.selectUserDividendList(SecurityUtils.getUserId(),null,null,null);
         return HttpRetPageArr.success("查询成功", getDataTable(list));
     }
 
@@ -90,9 +93,15 @@ public class AppUserCountDividendController extends BaseController
     @PostMapping("/send")
     @ApiOperation(value = "发放分红", notes = "发放分红")
 //    @Transactional
-
-    public HttpRet<Boolean> send(AppUserDividendSendDto dto) throws Exception
+    @RepeatSubmit(message = "频繁操作")
+    public HttpRet<Boolean> send(@RequestBody AppUserDividendSendDto dto) throws Exception
     {
+        try {
+            logger.info("分红发放{}", JSONObject.toJSONString(dto));
+        }catch (Exception e){
+
+        }
+
         String userId = dto.getUserId();
         String dateNo = dto.getDateNum();
         Long curUserId = SecurityUtils.getUserId();
@@ -103,4 +112,9 @@ public class AppUserCountDividendController extends BaseController
         return appUserCountDividendService.send(userId,dateNo,curUserId);
     }
 
+    /*@PostConstruct
+    private void test(){
+        appUserCountDividendService.send("10302","2024-09-30",10013L);
+    }*/
+
 }

+ 32 - 11
game-business/src/main/java/com/game/business/controller/AppUsersCashrecordController.java

@@ -151,25 +151,46 @@ public class AppUsersCashrecordController extends BaseController
         update.setId(cashrecord.getId());
         update.setStatus(appUsersCashrecord.getStatus());
         update.setReason(appUsersCashrecord.getReason());
-        if(appUsersCashrecord.getCallOther() == 0 && 1== appUsersCashrecord.getStatus().intValue() &&
+        /*if(appUsersCashrecord.getCallOther() == 0 && 1== appUsersCashrecord.getStatus().intValue() &&
                 (null == appUsersCashrecord.getCashChannelId() || appUsersCashrecord.getCashChannelId() < 1)){
             return R.fail("审核失败,未找到对应渠道,请驳回或者人工审核");
-        }
-        if(1 == appUsersCashrecord.getStatus().intValue() && null != appUsersCashrecord.getCashChannelId() && appUsersCashrecord.getCashChannelId() > 0
+        }*/
+        if(1 == appUsersCashrecord.getStatus().intValue()
          && appUsersCashrecord.getCallOther() == 0){
             //审核通过
-            AppChargeChannel appChargeChannel = appChargeChannelService.selectAppChargeChannelById(appUsersCashrecord.getCashChannelId());
+            String key = "";
+            switch (cashrecord.getType().intValue()){
+                case 1: //支付宝
+                    key = "alipay";
+                    break;
+                case 2: //微信
+                    key = "weixin";
+                    break;
+                case 3: //银行卡
+                    key = "bank";
+                    break;
+                case 4:
+                    key = "okpay";
+                    break;
+                case 5:
+                    key = "cbpay";
+                    break;
+            }
+            if(StringUtils.isBlank(key)){
+                return R.fail("审核失败,用户提现账号渠道异常");
+            }
+            AppChargeChannel appChargeChannel = appChargeChannelService.selectByKey(key);
             if(null != appChargeChannel && StringUtils.isNotBlank(appChargeChannel.getChannelKey())){
                 String extra = "";
                 if(Arrays.asList("8092","8095").contains(appChargeChannel.getChannelKey())){
                     //钱包提现
-                    extra = appUsersCashrecord.getAccount();
+                    extra = cashrecord.getAccount();
                 }else{
-                    AppUsersCashAccount appUsersCashAccount = appUsersCashAccountService.selectAppUsersCashAccountById(appUsersCashrecord.getCashAccountId());
+                    AppUsersCashAccount appUsersCashAccount = appUsersCashAccountService.selectAppUsersCashAccountById(cashrecord.getCashAccountId());
                     if(null != appUsersCashAccount) {
                         JSONObject jsonObject = new JSONObject();
-                        jsonObject.put("cardNumber", appUsersCashrecord.getAccount());
-                        jsonObject.put("bankName", URLEncoder.encode(appUsersCashrecord.getAccountBank(),"UTF-8"));
+                        jsonObject.put("cardNumber", cashrecord.getAccount());
+                        jsonObject.put("bankName", URLEncoder.encode(cashrecord.getAccountBank(),"UTF-8"));
                         jsonObject.put("branchName", URLEncoder.encode(appUsersCashAccount.getBranch(),"UTF-8"));
                         jsonObject.put("ownerName", URLEncoder.encode(appUsersCashAccount.getName(),"UTF-8"));
                         extra = jsonObject.toString();
@@ -211,7 +232,7 @@ public class AppUsersCashrecordController extends BaseController
             tran.setCurrencyType(TranCurrencyType.Balance.getType());
             tran.setTranGroupId(IdUtil.getSnowflakeNextId());
             tran.setRemarks("提现审核失败:回退金额");
-            appUserService.updateUserAmount(tran,true);
+            appUserService.updateUserAmount(tran,true,false);
         }
         int rest = appUsersCashrecordService.updateAppUsersCashrecord(update);
         logger.info("{},提现审核:{}",appUser.getUserid(),appUsersCashrecord.getStatus());
@@ -242,7 +263,7 @@ public class AppUsersCashrecordController extends BaseController
     public String otherPayCallBack(@ApiIgnore HttpServletRequest request) {
         Map<String, Object> map =  PayOrderUtils.getOrderStatus(request);
         logger.info("订单回调:{}",JSONObject.toJSONString(map));
-        if("1".equals(String.valueOf(map.get("code")))){
+        if(null != map && null != map.get("data") && null != map.get("tradeNo")){
             //支付回调成功
             String orderNo = map.get("data").toString();
             String tradeNo = map.get("tradeNo").toString();
@@ -272,7 +293,7 @@ public class AppUsersCashrecordController extends BaseController
                     tran.setCurrencyType(TranCurrencyType.Balance.getType());
                     tran.setTranGroupId(IdUtil.getSnowflakeNextId());
                     tran.setRemarks("转出失败:回退金额");
-                    appUserService.updateUserAmount(tran,true);
+                    appUserService.updateUserAmount(tran,true,false);
                 }else{
                     logger.info("订单{},当前状态非转出中,停止更新失败逻辑",orderNo);
                 }

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

@@ -37,6 +37,12 @@ private static final long serialVersionUID=1L;
     @TableField(value = "name")
     private String name;
 
+    /** key */
+    @ApiModelProperty(value = "用于判断类型")
+    @Excel(name = "用于判断类型")
+    @TableField(value = "c_key")
+    private String cKey;
+
     /** 渠道key */
     @ApiModelProperty(value = "渠道key")
     @Excel(name = "渠道key")

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

@@ -64,5 +64,5 @@ public interface AppUserCountDividendMapper extends BaseMapper<AppUserCountDivid
      * 查询用户团队分红列表
      *
      * */
-    public List<AppUserCountDividend> selectUserDividendList(@Param("pid") Long pid,@Param("userId") Long userId,@Param("dateNum")String dateNum);
+    public List<AppUserCountDividend> selectUserDividendList(@Param("pid") Long pid,@Param("userId") Long userId,@Param("dateNum")String dateNum,@Param("status")Integer status);
 }

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

@@ -61,6 +61,6 @@ public interface AppUsersCashrecordMapper extends BaseMapper<AppUsersCashrecord>
      */
     public int deleteAppUsersCashrecordByIds(Long[] ids);
 
-    @Select("select IFNULL(sum(money),0) from app_users_cashrecord where status = 1 and uid = #{userId}")
+    @Select("select IFNULL(sum(money),0) from app_users_cashrecord where status = 1 and cash_out_status in(1,0) and uid = #{userId}")
     public Double sumWithdraw(@Param("userId") Long userId);
 }

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

@@ -1,6 +1,7 @@
 package com.game.business.mapper;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -9,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 org.apache.ibatis.annotations.Param;
 
 /**
  * 消费记录Mapper接口
@@ -78,4 +80,6 @@ public interface FinTranRecordMapper extends BaseMapper<FinTranRecord> {
     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);
 }

+ 8 - 0
game-business/src/main/java/com/game/business/service/IAppChargeChannelService.java

@@ -58,4 +58,12 @@ public interface IAppChargeChannelService extends IService<AppChargeChannel> {
      * @return 结果
      */
     public int deleteAppChargeChannelById(Long id);
+
+    /**
+     * 删除充值渠道信息
+     *
+     * @param key key
+     * @return 结果
+     */
+    public AppChargeChannel selectByKey(String key);
 }

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

@@ -63,7 +63,7 @@ public interface IAppUserCountDividendService extends IService<AppUserCountDivid
     /**
      * 查询团队分红
      * */
-    public List<AppUserCountDividend> selectUserDividendList(Long pid,Long userId,String dateNum);
+    public List<AppUserCountDividend> selectUserDividendList(Long pid,Long userId,String dateNum,Integer status);
 
     /**
      * 发放分红

+ 4 - 2
game-business/src/main/java/com/game/business/service/IAppUserService.java

@@ -87,12 +87,14 @@ public interface IAppUserService extends IService<AppUser> {
     /**
      * 更新用户余额、插入流水
      * */
-    int updateUserAmount(FinTranRecord finTranRecord);
+    int updateUserAmount(FinTranRecord finTranRecord,boolean coinCashFlag);
 
     /**
      * 更新用户余额、插入流水(更新可提现)
+     * @param withdrawAble 是否更新可提现金额
+     * @param coinCashFlag 是否更新可提现金币
      * */
-    int updateUserAmount(FinTranRecord finTranRecord,boolean withdrawAble);
+    int updateUserAmount(FinTranRecord finTranRecord,boolean withdrawAble,boolean coinCashFlag);
 
     ApiUserInfoVo getUserInfo(Long userId);
 

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

@@ -65,6 +65,12 @@ public interface IAppUsersCashrecordService extends IService<AppUsersCashrecord>
      * */
     public List<AppUsersCashrecord> getUserCashList(Long userId,String beginTime,String endTime);
 
+    /**
+     *  根据日期查询用户提现记录
+     *
+     * */
+    public List<AppUsersCashrecord> getUserCashListByIds(List<Long> userIds,String beginTime,String endTime);
+
     public Double sumWithdraw(Long userId);
 
     public AppUsersCashrecord getByOrderNo(String orderNo);

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

@@ -106,4 +106,6 @@ public interface IFinTranRecordService extends IService<FinTranRecord> {
      * 根据type查询流水
      * */
     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);
 }

+ 13 - 0
game-business/src/main/java/com/game/business/service/impl/AppChargeChannelServiceImpl.java

@@ -1,5 +1,6 @@
 package com.game.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -92,4 +93,16 @@ public class AppChargeChannelServiceImpl extends ServiceImpl<AppChargeChannelMap
     public int deleteAppChargeChannelById(Long id) {
         return appChargeChannelMapper.deleteAppChargeChannelById(id);
     }
+
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public AppChargeChannel selectByKey(String key) {
+        LambdaQueryWrapper<AppChargeChannel> queryWrapper = new LambdaQueryWrapper<AppChargeChannel>();
+        queryWrapper.eq(AppChargeChannel::getCKey,key);
+        List<AppChargeChannel> list = appChargeChannelMapper.selectList(queryWrapper);
+        if(null != list && list.size()>0){
+            return list.get(0);
+        }
+        return null;
+    }
 }

+ 30 - 9
game-business/src/main/java/com/game/business/service/impl/AppUserCountDividendServiceImpl.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.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -144,8 +145,17 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
     }
 
     @Override
-    public List<AppUserCountDividend> selectUserDividendList(Long pid,Long userId,String dateNum) {
-        List<AppUserCountDividend> dividendList = appUserCountDividendMapper.selectUserDividendList(pid,userId,dateNum);
+    public List<AppUserCountDividend> selectUserDividendList(Long pid,Long userId,String dateNum,Integer status) {
+        //需求变动  只展示和发放上一周期数据
+        String day = DateUtil.format(DateUtil.date(),"dd");
+        if(Integer.parseInt(day) > 15){
+            //下半月上一周期是15号
+            dateNum = DateUtil.format(DateUtil.date(),"yyyy-MM").concat("-15");
+        }else{
+            //上半月上一周期为上个月月底
+            dateNum = DateUtil.format(DateUtil.endOfMonth(DateUtil.offsetMonth(DateUtil.date(),-1)),"yyyy-MM-dd");
+        }
+        List<AppUserCountDividend> dividendList = appUserCountDividendMapper.selectUserDividendList(pid,userId,dateNum,status);
         if(null != dividendList && dividendList.size()>0){
             List<Long> ids = dividendList.stream().map(AppUserCountDividend::getUserId).collect(Collectors.toList());
             List<AppUser> userList = appUserService.selectListByIds(ids);
@@ -164,10 +174,17 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
 
     @Override
     public HttpRet<Boolean> send(String userId, String dateNo,Long sendUserId) {
-        List<AppUserCountDividend> dividendList = this.selectUserDividendList(sendUserId, StringUtils.isBlank(userId)?null:Long.parseLong(userId),dateNo);
+        List<AppUserCountDividend> dividendList = this.selectUserDividendList(sendUserId, StringUtils.isBlank(userId)?null:Long.parseLong(userId),dateNo,0);
         if(null == dividendList || dividendList.size() < 1){
             return HttpRet.fail("发放失败,不存在或已发放");
         }
+        if(StringUtils.isNotBlank(userId) && dividendList.size() == 1 && dividendList.get(0).getDiamondCoin() < 1 && dividendList.get(0).getCoin() < 1){
+            return HttpRet.fail("发放失败,金额为0");
+        }
+        /*dividendList = dividendList.stream().filter(e->e.getStatus().intValue() == 0).collect(Collectors.toList());
+        if(dividendList.size() < 1){
+            return HttpRet.fail("发放失败,不存在或已发放");
+        }*/
         /*AppUser curUser = appUserService.selectAppUserByUserid(curUserId);
         if(curUser.getDiamondCoin() < dividendList.stream().mapToDouble(e->e.getDiamondCoin()).sum()){
             return HttpRet.fail("发放失败,余额不足");
@@ -186,8 +203,10 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
             String errMsg = "";
             for(AppUserCountDividend countDividend : dividendList){
                 Long errUserId = countDividend.getUserId();
+                if(countDividend.getStatus().intValue() != 0){
+                    continue;
+                }
                 try {
-                    List<FinTranRecord> tranRecordList = new ArrayList<>();
                     AppUser appUser = userMap.get(String.valueOf(countDividend.getUserId()));
                     AppUser curUser = appUserService.selectAppUserByUserid(sendUserId);
                     if(!sendUserId.equals(appUser.getPid())){
@@ -217,7 +236,7 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
                         curTran.setRemarks(countDividend.getDateNo() + " 发放团队分红奖励");
                         curTran.setFromUid(sendUserId);
 //                        tranRecordList.add(curTran);
-                        appUserService.updateUserAmount(curTran);
+                        appUserService.updateUserAmount(curTran,true);
 
                         //受益用户
                         /*updateAppUser.setDiamondCoin(appUser.getDiamondCoin() + e.getDiamondCoin());
@@ -232,7 +251,7 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
                         tran.setRemarks(countDividend.getDateNo() + " 团队周分红奖励");
                         tran.setFromUid(sendUserId);
                         //                    tranRecordList.add(tran);
-                        appUserService.updateUserAmount(tran);
+                        appUserService.updateUserAmount(tran,true,true);
                     }
                     if (null != countDividend.getCoin() && countDividend.getCoin() > 0) {
                         if(null != countDividend.getCoin() && curUser.getCoin() < countDividend.getCoin()){
@@ -253,7 +272,7 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
                         curTran.setRemarks(countDividend.getDateNo() + " 发放团队分红奖励");
                         curTran.setFromUid(sendUserId);
 //                        tranRecordList.add(curTran);
-                        appUserService.updateUserAmount(curTran);
+                        appUserService.updateUserAmount(curTran,true);
 
                         //                    updateAppUser.setCoin(appUser.getDiamondCoin() + e.getDiamondCoin());
                         //流水 余额
@@ -264,7 +283,7 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
                         tran.setCurrencyType(TranCurrencyType.Coin.getType());
                         tran.setRemarks(countDividend.getDateNo() + " 团队周分红奖励");
                         tran.setFromUid(sendUserId);
-                        appUserService.updateUserAmount(tran);
+                        appUserService.updateUserAmount(tran,true);
                         //                    tranRecordList.add(tran);
                     }
                     /*appUserService.updateAppUser(updateAppUser);
@@ -301,7 +320,9 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
             userIds = userIds.stream().distinct().collect(Collectors.toList());
             for(Long uid : userIds) {
                 //更新用户可提现余额
-                appUserCountTask.updateWithdrawAble(uid);
+                ThreadUtil.execute(()->{
+                    appUserCountTask.updateWithdrawAble(uid);
+                });
             }
         }
         return HttpRet.success("发放成功",true);

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

@@ -178,7 +178,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
 
     @Override
     @DataSource(DataSourceType.SLAVE)
-    public int updateUserAmount(FinTranRecord finTranRecord,boolean withdrawAble){
+    public int updateUserAmount(FinTranRecord finTranRecord,boolean withdrawAble,boolean coinCashFlag){
         int res = 0;
         int finRes = 0;
         RLock rLock = redisson.getLock("app_user_amount_".concat(String.valueOf(finTranRecord.getUid())));
@@ -193,7 +193,9 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
                     if(2 == finTranRecord.getCurrencyType().intValue()){
                         //金币
                         updateAppUser.setCoin(finTranRecord.getCoinChange());
-                        updateAppUser.setCoinCash(MoneyUtils.consumeCash(appUser.getCoin(),appUser.getCoinCash(),finTranRecord.getCoinChange()));
+                        if(coinCashFlag || finTranRecord.getCoinChange() < 0) {
+                            updateAppUser.setCoinCash(MoneyUtils.consumeCash(appUser.getCoin(), appUser.getCoinCash(), finTranRecord.getCoinChange()));
+                        }
                     }else if(4 == finTranRecord.getCurrencyType().intValue()){
                         //余额
                         updateAppUser.setDiamondCoin(finTranRecord.getDiamondCoinChange());
@@ -241,8 +243,8 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
 
     @Override
     @DataSource(DataSourceType.SLAVE)
-    public int updateUserAmount(FinTranRecord finTranRecord){
-        return updateUserAmount(finTranRecord,false);
+    public int updateUserAmount(FinTranRecord finTranRecord,boolean coinCashFlag){
+        return updateUserAmount(finTranRecord,false,coinCashFlag);
     }
 
     @Override

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 
 import com.game.common.annotation.DataSource;
@@ -70,6 +71,7 @@ public class AppUsersCashrecordServiceImpl extends ServiceImpl<AppUsersCashrecor
     @Override
     @DataSource(DataSourceType.SLAVE)
     public int updateAppUsersCashrecord(AppUsersCashrecord appUsersCashrecord) {
+        appUsersCashrecord.setUptime(new Date());
         return appUsersCashrecordMapper.updateAppUsersCashrecord(appUsersCashrecord);
     }
 
@@ -102,9 +104,24 @@ public class AppUsersCashrecordServiceImpl extends ServiceImpl<AppUsersCashrecor
     public List<AppUsersCashrecord> getUserCashList(Long userId, String beginTime, String endTime) {
         LambdaQueryWrapper<AppUsersCashrecord> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(AppUsersCashrecord::getStatus,"1");
+        queryWrapper.in(AppUsersCashrecord::getCashOutStatus,0,1);
         queryWrapper.eq(AppUsersCashrecord::getCashType,"7");//余额提现
-        queryWrapper.eq(AppUsersCashrecord::getUid,userId);
-        queryWrapper.between(AppUsersCashrecord::getAddtime,beginTime,endTime);
+        if(null != userId){
+            queryWrapper.eq(AppUsersCashrecord::getUid,userId);
+        }
+        queryWrapper.between(AppUsersCashrecord::getUptime,beginTime,endTime);
+        return appUsersCashrecordMapper.selectList(queryWrapper);
+    }
+
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public List<AppUsersCashrecord> getUserCashListByIds(List<Long> userIds, String beginTime, String endTime) {
+        LambdaQueryWrapper<AppUsersCashrecord> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AppUsersCashrecord::getStatus,"1");
+        queryWrapper.in(AppUsersCashrecord::getCashOutStatus,0,1);
+        queryWrapper.eq(AppUsersCashrecord::getCashType,"7");//余额提现
+        queryWrapper.in(AppUsersCashrecord::getUid,userIds);
+        queryWrapper.between(AppUsersCashrecord::getUptime,beginTime,endTime);
         return appUsersCashrecordMapper.selectList(queryWrapper);
     }
 

+ 10 - 4
game-business/src/main/java/com/game/business/service/impl/FinTranRecordServiceImpl.java

@@ -217,7 +217,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
         tran.setCurrencyType(TranCurrencyType.Balance.getType());
         tran.setRemarks("团队转账");
 //        finTranRecordService.insertFinTranRecord(tran);
-        appUserService.updateUserAmount(tran);
+        appUserService.updateUserAmount(tran,true);
 
         //受益用户增加余额
         /*AppUser toUpdateAppUser = new AppUser();
@@ -236,7 +236,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
         toTran.setFromUid(appUser.getUserid());
         toTran.setRemarks("团队转账");
 //        finTranRecordService.insertFinTranRecord(toTran);
-        appUserService.updateUserAmount(toTran);
+        appUserService.updateUserAmount(toTran,false);
         //清除用户缓存
         redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(appUser.getUserid())));
         redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(toAppUser.getUserid())));
@@ -277,7 +277,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
         tran.setCoinChange(transfer.getMoney() * -1);
         tran.setCurrencyType(TranCurrencyType.Coin.getType());
         tran.setRemarks("金币转账:转给" + toAppUser.getUserid());
-        appUserService.updateUserAmount(tran);
+        appUserService.updateUserAmount(tran,true);
 
 
         FinTranAddedInfo toAddedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
@@ -286,7 +286,7 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
         toTran.setCurrencyType(TranCurrencyType.Coin.getType());
         toTran.setFromUid(appUser.getUserid());
         toTran.setRemarks("金币转账: 收到来自" + appUser.getUserid() + "的转账");
-        appUserService.updateUserAmount(toTran);
+        appUserService.updateUserAmount(toTran,false);
         //清除用户缓存
         redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(appUser.getUserid())));
         redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(toAppUser.getUserid())));
@@ -429,4 +429,10 @@ public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, F
         queryWrapper.eq(FinTranRecord::getCurrencyType,4);//余额流水
         return finTranRecordMapper.selectList(queryWrapper);
     }
+
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public Double sumUserTran(Integer type1, String type3s, Long userId, Date beginDate, Date endDate, Integer withDrawFlag) {
+        return finTranRecordMapper.sumUserTran(type1,type3s,userId,beginDate,endDate,withDrawFlag);
+    }
 }

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

@@ -256,7 +256,7 @@ public class AppAgentGameBettingTask {
 
             finTranRecord.setOrderId(appGameBetting.getId());
             //finTranRecordService.insertFinTranRecord(finTranRecord);
-            appUserService.updateUserAmount(finTranRecord,true);
+            appUserService.updateUserAmount(finTranRecord,true,false);
         }
     }
 
@@ -363,7 +363,7 @@ public class AppAgentGameBettingTask {
 
         finTranRecord.setOrderId(appGameBetting.getId());
         //finTranRecordService.insertFinTranRecord(finTranRecord);
-        appUserService.updateUserAmount(finTranRecord);
+        appUserService.updateUserAmount(finTranRecord,false);
 
     }
 

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

@@ -604,7 +604,7 @@ public class AppGameBettingTask {
 
             finTranRecord.setOrderId(appGameBetting.getId());
             //finTranRecordService.insertFinTranRecord(finTranRecord);
-            appUserService.updateUserAmount(finTranRecord);
+            appUserService.updateUserAmount(finTranRecord,false);
         }
         return userIds;
     }

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

@@ -235,7 +235,7 @@ public class AppGameLotteryTask {
 
             finTranRecord.setOrderId(appGameBetting.getId());
             //finTranRecordService.insertFinTranRecord(finTranRecord);
-            appUserService.updateUserAmount(finTranRecord);
+            appUserService.updateUserAmount(finTranRecord,false);
         }
         return userIds;
     }

+ 41 - 11
game-business/src/main/java/com/game/business/task/AppUserCountTask.java

@@ -81,7 +81,7 @@ public class AppUserCountTask {
      * 统计用户前一天
      * */
     public void statistics(String dateTime){
-        if(!taskSwitch){
+        if(!taskSwitch && org.apache.commons.lang3.StringUtils.isBlank(dateTime)){
             return;
         }
         String redisKey = CacheConstants.USER_STATICS_COUNT.concat("statistics");
@@ -325,7 +325,7 @@ public class AppUserCountTask {
      * */
     @DSTransactional
     public void calculateDividends(String dateTime){
-        if(!taskSwitch){
+        if(!taskSwitch && org.apache.commons.lang3.StringUtils.isBlank(dateTime)){
             return;
         }
         String redisKey = CacheConstants.USER_STATICS_COUNT.concat("calculateDividends");
@@ -461,7 +461,7 @@ public class AppUserCountTask {
             beginTime = DateUtil.beginOfMonth(curDate);
             endTime = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 23:59:59")),"yyyy-MM-dd HH:mm:ss");
         }else{
-            beginTime = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("15").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
+            beginTime = DateUtil.parse(DateUtil.format(curDate,"yyyy-MM-".concat("16").concat(" 00:00:00")),"yyyy-MM-dd HH:mm:ss");
             endTime = DateUtil.endOfMonth(curDate);
         }
 
@@ -476,10 +476,10 @@ public class AppUserCountTask {
             Date finalEndTime = endTime;
             list.forEach(appUser -> {
                 AppUserAgent userAgent = appUserAgentService.selectInfo(appUser.getUserid());
-                if (userAgent.getDividendGuaranteeRate() <= 0.00) {
+                /*if (userAgent.getDividendGuaranteeRate() <= 0.00) {
                     log.info("用户{},未设置分红比例,停止分红", userAgent.getUserId());
                     return;
-                }
+                }*/
                 String beginTimeStr = DateUtil.format(finalBeginTime,"yyyy-MM-dd");
                 String endTimeStr = DateUtil.format(finalEndTime,"yyyy-MM-dd");
                 //查询用户所有下级本周盈亏
@@ -497,7 +497,9 @@ public class AppUserCountTask {
                         return e.getGameWinAmount() - (e.getGameBetting() - e.getGameLoseAmount()); //实际赢钱 = 赢 - 中奖本金
                     }).sum();
                     //提现手续费
-                    double withdrawalCommission = appUserCountList.stream().mapToDouble(e -> e.getWithdrawalCommission()).sum();
+                    List<AppUsersCashrecord> usersCashrecords = appUsersCashrecordService.getUserCashListByIds(appUserCountList.stream().map(AppUserCount::getUserId).collect(Collectors.toList()), beginTimeStr.concat(" 00:00:00"),endTimeStr.concat(" 23:59:59"));
+//                    double withdrawalCommission = appUserCountList.stream().mapToDouble(e -> e.getWithdrawalCommission()).sum();
+                    double withdrawalCommission = null==usersCashrecords?0.00:usersCashrecords.stream().mapToDouble(e->{return null==e.getPlatformService()?0.00:e.getPlatformService().doubleValue();}).sum();
                     //充值手续费
                     double rechargeCommission = appUserCountList.stream().mapToDouble(e -> e.getRechargeCommission()).sum();
                     //游戏佣金
@@ -582,6 +584,9 @@ public class AppUserCountTask {
     public void calculationWithdraw(Long userId){
         if(null != userId && userId.longValue() == -1){
             userId = null;
+            if(!taskSwitch){
+                return;
+            }
         }
         //查询所有未满足提现的充值、转账
         String chargeType3 = FinTranType3.ON_LINE_CHARGE.getType() + "," + FinTranType3.CHARGE_IN.getType()+ "," + FinTranType3.CHARGE_IN_Back.getType()
@@ -632,7 +637,7 @@ public class AppUserCountTask {
             double bettingAmount = curTranList.stream().filter(e->
                             e.getCurrencyType().intValue() == 4
             ).mapToDouble(FinTranRecord::getDiamondCoinChange).sum() * -1;
-            log.info("用户{},充值:{} 满足流水:{}",userId,money,bettingAmount);
+            log.info("用户{},充值:{} 满足流水:{}",userId,money,bettingAmount);
             if(bettingAmount >= money * 2){
                 //更新为已满足提现
                 userChargeList.forEach(e->{
@@ -654,6 +659,9 @@ public class AppUserCountTask {
     public void updateWithdrawAble(Long userId){
         if(null != userId && userId.longValue() == -1){
             userId = null;
+            if(!taskSwitch){
+                return;
+            }
         }
         //查询所有已满足提现的充值、转账
         String chargeType3 = FinTranType3.ON_LINE_CHARGE.getType() + "," + FinTranType3.CHARGE_IN.getType()+ "," + FinTranType3.CHARGE_IN_Back.getType()
@@ -689,8 +697,9 @@ public class AppUserCountTask {
 
                 }
                 //查询用户这段时间流水记录
-                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();
+                /*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);
@@ -699,10 +708,31 @@ public class AppUserCountTask {
                 //清除用户缓存
                 redisCache.deleteObject("U:UserInfo:".concat(String.valueOf(uid)));
             }
+        }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)));
+            }
         }
     }
 
     public void dealOffLive(){
+        if(!taskSwitch){
+            return;
+        }
         List<OffLineUserVo> list = appUserService.selectOffLineUser();
         if(null != list && list.size() > 0){
             Date now = DateUtil.date();
@@ -710,12 +740,12 @@ public class AppUserCountTask {
                 if(now.getTime() - e.getOffTime().getTime() >= 1*60*1000){
                     log.info("{}离线已超过1分钟,自动关播",e.getUserId());
                     //离线超过一分钟 自动关播
-                    String url = sysConfigService.selectConfigByKey("sys_live_apiurl").concat("/api/live/httpOpenCloseLive");
+                    String url = sysConfigService.selectConfigByKey("sys_live_apiurl").concat("/api/live/httpClose");
                     Map<String, String> map = new HashMap<>();
                     map.put("roomId", String.valueOf(e.getRoomId()));
                     map.put("liveType", "1");
                     map.put("isLive", String.valueOf(e.getIsLive()));
-                    map.put("description", "关播");
+                    map.put("description", "主播已离线,自动关播");
 
                     String res = HttpClientUtils.ajaxPost(url,map);
                     if(org.apache.commons.lang3.StringUtils.isBlank(res) || !JSONObject.parseObject(res).getString("code").equals("1")){

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

@@ -226,7 +226,7 @@ public class AppUserLiveDividedTask {
             //finTranRecordService.insertFinTranRecord(finTranRecord);
             //本人已在直播系统分成过 停止流水生成以及金额更新
             if(!item.getUserId().equals(appUser.getUserid())){
-                appUserService.updateUserAmount(finTranRecord);
+                appUserService.updateUserAmount(finTranRecord,true);
                 // 插入分佣记录
                 AppUserLiveDividedRecord appUserLiveDividedRecord = new AppUserLiveDividedRecord();
                 appUserLiveDividedRecord.setRate(userLiveRate);

+ 13 - 2
game-business/src/main/java/com/game/business/util/other/PayOrderUtils.java

@@ -1,7 +1,10 @@
 package com.game.business.util.other;
 
+import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.game.common.exception.ServiceException;
+import com.game.system.service.ISysConfigService;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpEntity;
@@ -37,8 +40,14 @@ public class PayOrderUtils {
     private static final String notifyUrl = "/business/cashrecord/otherCallback";
 
     public static Map<String, Object> getPayUrl(String orderNo, String payType, Integer amount,String extra){
-
-        String url = "http://apifoxgame.qhnd.cn";
+        ISysConfigService sysConfigService = SpringUtil.getBean(ISysConfigService.class);
+        if(null == sysConfigService){
+            throw new ServiceException("系统异常");
+        }
+        String url = sysConfigService.selectConfigByKey("sys_api_url");
+        if(StringUtils.isBlank(url)){
+            throw new ServiceException("配置缺失");
+        }
         Map<String, Object> resultMap = new HashMap<>();
         resultMap.put("code", 0);
         resultMap.put("mgs", "获取支付地址失败!");
@@ -149,6 +158,8 @@ public class PayOrderUtils {
         String returncode = params.get("status").toString();
         String orderid = params.get("mchOrderNo").toString();
         String tradeNo = params.get("payOrderId").toString();
+        resultMap.put("data", orderid);
+        resultMap.put("tradeNo", tradeNo);
 
         if (returncode == null || (!returncode.equals("2") && !returncode.equals("3"))) {
             logger.error("状态错误 ,payOrderId={}, status={}", new Object[]{orderid, returncode});

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

@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="com.game.business.domain.AppChargeChannel" id="AppChargeChannelResult">
         <result property="id"    column="id"    />
         <result property="name"    column="name"    />
+        <result property="cKey"    column="c_key"    />
         <result property="channelKey"    column="channel_key"    />
         <result property="rate"    column="rate"    />
         <result property="withdrawRate"    column="withdraw_rate"    />
@@ -27,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectAppChargeChannelVo">
-        select id, name, channel_key,channel_no, rate,withdraw_rate,is_show, logo_url, company, app_id, app_secret, third_url, status, cert_path, ali_public_cert, ali_apply_cert, ali_ca_cert, merchant_no, api_secret, orderno from app_charge_channel
+        select id, name,c_key, channel_key,channel_no, rate,withdraw_rate,is_show, logo_url, company, app_id, app_secret, third_url, status, cert_path, ali_public_cert, ali_apply_cert, ali_ca_cert, merchant_no, api_secret, orderno from app_charge_channel
     </sql>
 
     <select id="selectAppChargeChannelList" parameterType="com.game.business.domain.AppChargeChannel" resultMap="AppChargeChannelResult">
@@ -35,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>  
             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
             <if test="channelKey != null  and channelKey != ''"> and channel_key = #{channelKey}</if>
+            <if test="cKey != null  and cKey != ''"> and c_key = #{cKey}</if>
             <if test="channelNo != null  and channelNo != ''"> and channel_no = #{channelNo}</if>
             <if test="rate != null "> and rate = #{rate}</if>
             <if test="withdrawRate != null "> and withdraw_rate = #{withdrawRate}</if>
@@ -67,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="id != null">id,</if>
             <if test="name != null">name,</if>
             <if test="channelKey != null">channel_key,</if>
+            <if test="cKey != null and cKey != ''">c_key,</if>
             <if test="channelNo != null">channel_no,</if>
             <if test="rate != null">rate,</if>
             <if test="withdrawRate != null">withdraw_rate,</if>
@@ -88,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
             <if test="name != null">#{name},</if>
+            <if test="cKey != null">#{cKey},</if>
             <if test="channelKey != null">#{channelKey},</if>
             <if test="channelNo != null">#{channelNo},</if>
             <if test="rate != null">#{rate},</if>
@@ -113,6 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update app_charge_channel
         <trim prefix="SET" suffixOverrides=",">
             <if test="name != null">name = #{name},</if>
+            <if test="cKey != null">c_key = #{cKey},</if>
             <if test="channelKey != null">channel_key = #{channelKey},</if>
             <if test="channelNo != null">channel_no = #{channelNo},</if>
             <if test="rate != null">rate = #{rate},</if>

+ 4 - 0
game-business/src/main/resources/mapper/business/AppUserCountDividendMapper.xml

@@ -107,5 +107,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="dateNum != null and dateNum != ''">
             and a.date_no = #{dateNum}
         </if>
+        <if test="status != null">
+            and a.status = #{status}
+        </if>
+        order by a.date_no desc
     </select>
 </mapper>

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

@@ -878,6 +878,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectOffLineUser" resultType="com.game.business.vo.OffLineUserVo">
         select a.userid as userId,b.islive as isLive,b.id as roomId,a.last_off_line_time as offTime from app_user as a inner join live_live as b on a.userid = b.user_id
-        where b.islive = 1 and online_status = 0
+        where b.islive = 1 and a.online_status = 0
     </select>
 </mapper>

+ 32 - 2
game-business/src/main/resources/mapper/business/FinTranRecordMapper.xml

@@ -256,7 +256,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
         ifnull(sum(votes), 0.00) as diamondCoinSum
 
-        from app_users_cashrecord where status = 1
+        from app_users_cashrecord where status = 1 and cash_out_status in (0,1)
 
         <if test="userId != null">
             and uid = #{userId}
@@ -271,7 +271,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ifnull(sum(actual_money), 0.00) as actualMoneySum,
         ifnull(sum(platform_service), 0.00) as platformServiceSum
 
-        from app_users_cashrecord where status = 1
+        from app_users_cashrecord where status = 1 and cash_out_status in (0,1)
 
         <if test="userId != null">
             and uid = #{userId}
@@ -347,4 +347,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
     </select>
 
+    <select id="sumUserTran" resultType="java.lang.Double">
+        select sum(diamond_coin_change) from fin_tran_record
+        <where>
+            <if test="type1 != null">
+                and tran_type1 = #{type1}
+            </if>
+            <if test="userId != null">
+                and uid = #{userId}
+            </if>
+            <if test="type3s != null">
+                and tran_type3 in
+                <foreach item="item" collection="type3s" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="type3s == null">
+                and tran_type3 != 20002
+            </if>
+            <if test="beginDate != null">
+                and create_time &gt;= #{beginDate}
+            </if>
+            <if test="endDate != null">
+                and create_time &lt;= #{endDate}
+            </if>
+            <if test="withdrawFlag != null">
+                and withdraw_flag = #{withdrawFlag}
+            </if>
+        </where>
+    </select>
+
 </mapper>

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

@@ -495,6 +495,9 @@ export default {
       let that = this;
       let bettingGameType = row.bettingGameType;
       let bettingItem = row.gameLotterySucc;
+      if(!bettingItem){
+        return "";
+      }
       let gameId = row.gameId;
       /*if("0" == bettingGameType){
         // return that.gameItemMap[bettingItem+"_"+gameId];

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

@@ -245,8 +245,8 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="开奖选项" prop="gameLotterySucc">
-          <el-select v-model="kjForm.gameLotterySucc" placeholder="请选择">
+        <el-form-item label="开奖选项" prop="gameLotterySuccItem">
+          <el-select v-model="kjForm.gameLotterySuccItem" multiple placeholder="请选择">
             <el-option
               v-for="dict in kjGameItemList"
               :key="dict.value"
@@ -348,7 +348,7 @@ export default {
         gameId: [
           { required: true, message: "游戏不能为空", trigger: "blur" }
         ],
-        gameLotterySucc: [
+        gameLotterySuccItem: [
           { required: true, message: "游戏选项不能为空", trigger: "blur" }
         ],
         gameDate: [
@@ -564,8 +564,15 @@ export default {
     },
     /** 提交按钮 */
     submitKjForm() {
+      let that = this;
       this.$refs["kjForm"].validate(valid => {
         if (valid) {
+          if(that.kjForm["gameDate"] != undefined && that.kjForm["gameDate"] != null){
+            that.kjForm["gameDate"] = that.kjForm["gameDate"].trimStart().trimEnd();
+          }
+          if(that.kjForm.gameLotterySuccItem != undefined){
+            that.kjForm.gameLotterySucc = that.kjForm.gameLotterySuccItem.join(',');
+          }
           kjLottery(this.kjForm).then(response => {
                 this.$modal.msgSuccess(response.msg);
                 this.open = false;