|
@@ -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);
|
|
|
}
|