2 次代码提交 54b2c2c5c9 ... ffe3c68db2

作者 SHA1 备注 提交日期
  dos ffe3c68db2 Merge remote-tracking branch 'origin/master' 1 天之前
  dos 80ec54bc07 优化 1 天之前

+ 34 - 8
game-business/src/main/java/com/game/business/controller/AppUserAgentController.java

@@ -25,6 +25,7 @@ import com.game.common.utils.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import com.game.common.annotation.Log;
@@ -553,6 +554,7 @@ public class AppUserAgentController extends BaseController
     @ApiOperation(value = "更新代理成员设置", notes = "更新代理成员设置")
     @PreAuthorize("@ss.hasPermi('business:user:updateSetting')")
     @Log(title = "用户代理设置-更新直播、分红待遇", businessType = BusinessType.UPDATE)
+    @Transactional(rollbackFor = Exception.class)
     public R<String> updateSetting(@RequestBody AppUserAgent appUserAgent){
         AppUserAgent userAgent = appUserAgentService.selectInfo(appUserAgent.getUserId());
         if(null == userAgent){
@@ -563,14 +565,14 @@ public class AppUserAgentController extends BaseController
         }
         //查询上级
         AppUserAgent superAgent = appUserAgentService.selectInfo(userAgent.getPid());
-        if(superAgent.getDividendGuaranteeRate().doubleValue() < appUserAgent.getDividendGuaranteeRate().doubleValue()){
-            return R.fail("修改失败,保底分红超过最大可修改值:" + superAgent.getDividendGuaranteeRate());
+        if(1 == appUserAgent.getUpType().intValue() && superAgent.getDividendGuaranteeRate().doubleValue() < appUserAgent.getDividendGuaranteeRate().doubleValue()){
+            return R.fail("修改失败,保底分红超过上级分红比例请先修改上级");
         }
-        if(superAgent.getLiveRate().doubleValue() < appUserAgent.getLiveRate().doubleValue()){
-            return R.fail("修改失败,直播分成超过最大可修改值:" + superAgent.getLiveRate());
+        if(0 == appUserAgent.getUpType().intValue() && superAgent.getLiveRate().doubleValue() < appUserAgent.getLiveRate().doubleValue()){
+            return R.fail("修改失败,直播分成超过上级分红比例请先修改上级");
         }
         //查询下级
-        AppUserAgent queryAgent = new AppUserAgent();
+        /*AppUserAgent queryAgent = new AppUserAgent();
         queryAgent.setPid(userAgent.getUserId());
         List<AppUserAgent> downAgents = appUserAgentService.selectAppUserAgentList(queryAgent);
         if(null != downAgents && downAgents.size() > 0){
@@ -582,12 +584,36 @@ public class AppUserAgentController extends BaseController
             if(appUserAgent.getLiveRate() < liveRate){
                 return R.fail("修改失败,直播分成超过最小可修改值:" + liveRate);
             }
-        }
+        }*/
         AppUserAgent updateAgent = new AppUserAgent();
         updateAgent.setId(userAgent.getId());
-        updateAgent.setDividendGuaranteeRate(appUserAgent.getDividendGuaranteeRate());
-        updateAgent.setLiveRate(appUserAgent.getLiveRate());
+        if(appUserAgent.getUpType().intValue() == 0){
+            updateAgent.setLiveRate(appUserAgent.getLiveRate());
+        }else if(appUserAgent.getUpType().intValue() == 1){
+            updateAgent.setDividendGuaranteeRate(appUserAgent.getDividendGuaranteeRate());
+        }
         appUserAgentService.updateAppUserAgent(updateAgent);
+        upRate(userAgent.getUserId(),appUserAgent.getUpType().intValue()==0?appUserAgent.getLiveRate():appUserAgent.getDividendGuaranteeRate(),appUserAgent.getUpType());
         return R.ok("修改成功");
     }
+
+    private void upRate(Long userId,Double rate,Integer upType){
+        double newRate = rate - 0.1;
+        //查询下级大于等于当前分红比例的用户
+        List<AppUserAgent> downAgents = appUserAgentService.selectDownByRate(userId,rate,upType);
+        if(null != downAgents && downAgents.size() > 0){
+            for(AppUserAgent downAgent : downAgents){
+                AppUserAgent updateAgent = new AppUserAgent();
+                updateAgent.setId(downAgent.getId());
+                if(0 == upType.intValue()){
+                    updateAgent.setLiveRate(newRate);
+                }else if(1 == upType.intValue()){
+                    updateAgent.setDividendGuaranteeRate(newRate);
+                }
+                appUserAgentService.updateAppUserAgent(updateAgent);
+
+                upRate(downAgent.getUserId(),newRate,upType);
+            }
+        }
+    }
 }

+ 30 - 19
game-business/src/main/java/com/game/business/controller/AppUsersCashrecordController.java

@@ -1,6 +1,7 @@
 package com.game.business.controller;
 
 import java.beans.Encoder;
+import java.math.BigDecimal;
 import java.net.URLEncoder;
 import java.util.Arrays;
 import java.util.List;
@@ -9,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.NumberUtil;
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -147,10 +149,22 @@ public class AppUsersCashrecordController extends BaseController
         if(null == appUser){
             return R.fail("审核失败,用户不存在");
         }
+        if(null == appUsersCashrecord.getCashChannelId()){
+            return R.fail("请选择提现渠道");
+        }
+        AppChargeChannel appChargeChannel = appChargeChannelService.selectAppChargeChannelById(appUsersCashrecord.getCashChannelId());
+        if(null == appChargeChannel){
+            return R.fail("审核失败,提现渠道不存在");
+        }
         AppUsersCashrecord update = new AppUsersCashrecord();
         update.setId(cashrecord.getId());
         update.setStatus(appUsersCashrecord.getStatus());
         update.setReason(appUsersCashrecord.getReason());
+        //计算手续费
+        double servicePerc = null==appChargeChannel?0:appChargeChannel.getWithdrawRate();
+        BigDecimal service = NumberUtil.div(NumberUtil.mul(cashrecord.getMoney(), servicePerc), 1, 2);
+        update.setService(service);
+        update.setPlatformService(service);
         /*if(appUsersCashrecord.getCallOther() == 0 && 1== appUsersCashrecord.getStatus().intValue() &&
                 (null == appUsersCashrecord.getCashChannelId() || appUsersCashrecord.getCashChannelId() < 1)){
             return R.fail("审核失败,未找到对应渠道,请驳回或者人工审核");
@@ -158,9 +172,6 @@ public class AppUsersCashrecordController extends BaseController
         if(1 == appUsersCashrecord.getStatus().intValue()
          && appUsersCashrecord.getCallOther() == 0){
             //审核通过
-            if(null == appUsersCashrecord.getCashChannelId()){
-                return R.fail("请选择提现渠道");
-            }
             /*String key = "";
             switch (cashrecord.getType().intValue()){
                 case 1: //支付宝
@@ -182,10 +193,6 @@ public class AppUsersCashrecordController extends BaseController
             if(StringUtils.isBlank(key)){
                 return R.fail("审核失败,用户提现账号渠道异常");
             }*/
-            AppChargeChannel appChargeChannel = appChargeChannelService.selectAppChargeChannelById(appUsersCashrecord.getCashChannelId());
-            if(null == appChargeChannel){
-                return R.fail("审核失败,提现渠道不存在");
-            }
             if(StringUtils.isBlank(appChargeChannel.getChannelKey())){
                 return R.fail("审核失败,提现渠道未配置四方产品id");
             }
@@ -295,18 +302,22 @@ public class AppUsersCashrecordController extends BaseController
                 if(null == appUser){
                     return "failed";
                 }
-                if(null != appUsersCashrecord.getCashOutStatus() && appUsersCashrecord.getCashOutStatus().intValue() == 3) {
-                    FinTranAddedInfo addedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
-                    FinTranRecord tran = FinTranRecord.initFinTranRecordSomeParams(addedInfo, FinTranType3.CASH_DIAMOND_INCOME_BACK, FinTranType1.U_Income_Coin_Balance, appUser);
-                    tran.setDiamondCoinChange(appUsersCashrecord.getVotes().doubleValue());
-                    tran.setAfterDiamondCoin(appUser.getDiamondCoin());
-                    tran.setCurrencyType(TranCurrencyType.Balance.getType());
-                    tran.setTranGroupId(IdUtil.getSnowflakeNextId());
-                    tran.setRemarks("转出失败:回退金额");
-                    appUserService.updateUserAmount(tran,true,false);
-                }else{
-                    logger.info("订单{},当前状态非转出中,停止更新失败逻辑",orderNo);
-                }
+                /*try {
+                    if(null != appUsersCashrecord.getCashOutStatus() && appUsersCashrecord.getCashOutStatus().intValue() == 3) {
+                        FinTranAddedInfo addedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
+                        FinTranRecord tran = FinTranRecord.initFinTranRecordSomeParams(addedInfo, FinTranType3.CASH_DIAMOND_INCOME_BACK, FinTranType1.U_Income_Coin_Balance, appUser);
+                        tran.setDiamondCoinChange(appUsersCashrecord.getVotes().doubleValue());
+                        tran.setAfterDiamondCoin(appUser.getDiamondCoin());
+                        tran.setCurrencyType(TranCurrencyType.Balance.getType());
+                        tran.setTranGroupId(IdUtil.getSnowflakeNextId());
+                        tran.setRemarks("转出失败:回退金额");
+                        appUserService.updateUserAmount(tran,true,false);
+                    }else{
+                        logger.info("订单{},当前状态非转出中,停止更新失败逻辑",orderNo);
+                    }
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }*/
                 //更新状态
                 update.setCashOutStatus(2L);
             }

+ 4 - 0
game-business/src/main/java/com/game/business/domain/AppUserAgent.java

@@ -92,6 +92,10 @@ private static final long serialVersionUID=1L;
     @TableField(exist = false)
     private List<AppUserAgent> childrenList = new ArrayList<>();
 
+    @ApiModelProperty(value = "修改类型 0:直播分红比例  1:保底分红比例")
+    @TableField(exist = false)
+    private Integer upType;
+
     public static AppUserAgent buildTree(List<AppUserAgent> appUserAgentList,Long parentId,List<AppUserCount> appUserCountList){
         AppUserAgent appUserAgent = new AppUserAgent();
         if(null != appUserAgentList && appUserAgentList.size() > 0){

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

@@ -102,4 +102,7 @@ public interface IAppUserAgentService extends IService<AppUserAgent> {
     public List<AppUserAgent> selectSuperList(Long userId);
 
     public AppUserAgent selectInfo(Long userId);
+
+
+    public List<AppUserAgent> selectDownByRate(Long userId,Double rate,Integer upType);
 }

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

@@ -356,4 +356,18 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
         return appUserAgentMapper.selectOne(queryWrapper);
     }
 
+    @Override
+    public List<AppUserAgent> selectDownByRate(Long userId, Double rate, Integer upType) {
+        LambdaQueryWrapper<AppUserAgent> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AppUserAgent::getPid,userId);
+        if(0 == upType.intValue()){
+            queryWrapper.ge(AppUserAgent::getLiveRate,rate);
+        }else if(1 == upType.intValue()){
+            queryWrapper.ge(AppUserAgent::getDividendGuaranteeRate,rate);
+        }else{
+            return null;
+        }
+        return appUserAgentMapper.selectList(queryWrapper);
+    }
+
 }

+ 6 - 5
game-ui/src/views/business/cashrecord/index.vue

@@ -141,7 +141,7 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row,1)"
             v-hasPermi="['business:cashrecord:edit']"
-            v-if="scope.row.status == 0"
+            v-if="scope.row.status == 0 || scope.row.cashOutStatus == 2"
           >人工审核</el-button>
           <el-button
             size="mini"
@@ -202,7 +202,7 @@
         <el-form-item label="姓名" prop="name">
           <el-input disabled v-model="form.name" placeholder="请输入姓名" />
         </el-form-item>
-        <el-form-item label="提现渠道" prop="accountType" v-if="form.callOther == 0">
+        <el-form-item label="提现渠道" prop="accountType">
           <el-select v-model="form.cashChannelId" placeholder="请选择提现渠道">
             <el-option
               v-for="item in typeList"
@@ -399,10 +399,11 @@ export default {
         this.form = response.data;
         this.form["cashChannelId"] = null;
         this.form["callOther"] = calOther;
-        if(calOther == 0){
+        // if(calOther == 0){
           if(!this.form.accountType){
             this.open = true;
           }else{
+            that.typeList = [];
             channelList({type:this.form.accountType}).then(response => {
               if(response.data){
                 for(var i in response.data){
@@ -418,9 +419,9 @@ export default {
             })
           }
 
-        }else{
+        /*}else{
           this.open = true;
-        }
+        }*/
 
         this.title = calOther==0?"审核":"人工审核";
       });

+ 46 - 22
game-ui/src/views/business/user/index.vue

@@ -677,6 +677,14 @@
                   prop="pid"
                   label="上级UID">
                 </el-table-column>
+                <el-table-column
+                  prop="liveRate"
+                  label="直播分成(%)">
+                </el-table-column>
+                <el-table-column
+                  prop="dividendGuaranteeRate"
+                  label="保底分红(%)">
+                </el-table-column>
               </el-table>
             </el-tab-pane>
             <el-tab-pane label="用户待遇" name="second">
@@ -688,6 +696,9 @@
                   style="width: 150px"
                 />
                 </span><span style="padding-left: 10px">%</span>
+                <span style="margin-left: 1rem;">
+                  <el-button type="primary" @click="submitAgentForm(0)">修改直播分红</el-button>
+                </span>
                 <span style="margin-left: 1rem;">
                   保底分红:<el-input
                   v-model="appAgentForm.dividendGuaranteeRate"
@@ -697,7 +708,7 @@
                 </span>
                 <span style="padding-left: 10px">%</span>
                 <span style="margin-left: 1rem;">
-                  <el-button type="primary" @click="submitAgentForm">修 改</el-button>
+                  <el-button type="primary" @click="submitAgentForm(1)">修改分红比例</el-button>
                 </span>
                 <el-table
                   :data="undefined!=userInfo.infoDetail?userInfo.infoDetail.gameCommissionList:[]"
@@ -1024,7 +1035,8 @@ export default {
       appAgentForm:{
         liveRate:null,
         dividendGuaranteeRate:null,
-        userId:null
+        userId:null,
+        upType:null
       },
       appGameCommissionForm:{
         id:null,
@@ -1809,28 +1821,40 @@ export default {
       });
     },
     /** 代理待遇提交按钮 */
-    submitAgentForm() {
+    submitAgentForm(upType) {
       var that =this;
-      if(!that.appAgentForm.liveRate){
-        that.$modal.msgError("直播分红不能为空!");
-        return;
-      }
-      if(!that.appAgentForm.dividendGuaranteeRate){
-        that.$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);
-      updateUserAgent(this.appAgentForm).then(response => {
-        that.$modal.msgSuccess("修改成功");
-        that.getList();
-        loading.close();
+      this.appAgentForm["upType"] = upType;
+      let info = upType==0?"直播分红":"保底分红";
+      this.$confirm('此操作将修改当前用户以及下级用户大于修改数值的'+info+', 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        if(!that.appAgentForm.liveRate){
+          that.$modal.msgError("直播分红不能为空!");
+          return;
+        }
+        if(!that.appAgentForm.dividendGuaranteeRate){
+          that.$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);
+        updateUserAgent(this.appAgentForm).then(response => {
+          that.$modal.msgSuccess("修改成功");
+          that.getList();
+          that.getUserDetail(that.userInfo)
+          loading.close();
+        });
+      }).catch(() => {
+
       });
+
     },
     /** 代理游戏待遇提交按钮 */
     submitGameCommissionForm(row) {