|
@@ -27,10 +27,14 @@ import com.qs.mp.channel.service.IChannelWithdrawService;
|
|
import com.qs.mp.common.core.domain.AjaxResult;
|
|
import com.qs.mp.common.core.domain.AjaxResult;
|
|
import com.qs.mp.common.core.redis.RedisCache;
|
|
import com.qs.mp.common.core.redis.RedisCache;
|
|
import com.qs.mp.common.domain.param.BatchLongIdsParam;
|
|
import com.qs.mp.common.domain.param.BatchLongIdsParam;
|
|
|
|
+import com.qs.mp.common.utils.StringUtils;
|
|
|
|
+import com.qs.mp.system.service.ISysConfigService;
|
|
import com.qs.mp.utils.SecurityUtils;
|
|
import com.qs.mp.utils.SecurityUtils;
|
|
import com.qs.mp.web.controller.common.BaseApiController;
|
|
import com.qs.mp.web.controller.common.BaseApiController;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.math.RoundingMode;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
@@ -65,16 +69,31 @@ public class ChannelWithdrawController extends BaseApiController {
|
|
|
|
|
|
private final String CHANNEL_WITHDRAW_CACHE_KEY = "channel_settle_withdraw_";
|
|
private final String CHANNEL_WITHDRAW_CACHE_KEY = "channel_settle_withdraw_";
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysConfigService configService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 提现费率配置key
|
|
|
|
+ */
|
|
|
|
+ private final String FEE_RATE_CONFIG_KEY = "channel.withdraw.feeRate";
|
|
|
|
+ /**
|
|
|
|
+ * 提现费率默认值
|
|
|
|
+ */
|
|
|
|
+ private final String FEE_RATE_DEFAULT_VALUE = "8";
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 渠道提现计算手续费
|
|
* 渠道提现计算手续费
|
|
*/
|
|
*/
|
|
@PostMapping("/withdraw/settle")
|
|
@PostMapping("/withdraw/settle")
|
|
@ApiOperation(value = "提现" , notes = "提现计费")
|
|
@ApiOperation(value = "提现" , notes = "提现计费")
|
|
public AjaxResult settle(@Valid @RequestBody ChannelWithdrawParam param) {
|
|
public AjaxResult settle(@Valid @RequestBody ChannelWithdrawParam param) {
|
|
|
|
+ String feeRateValue = configService.selectConfigByKey(FEE_RATE_CONFIG_KEY);
|
|
|
|
+ BigDecimal feeRate = new BigDecimal(StringUtils.isNotBlank(feeRateValue) ? feeRateValue : FEE_RATE_DEFAULT_VALUE);
|
|
Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
ChannelWithdraw channelWithdraw = new ChannelWithdraw();
|
|
ChannelWithdraw channelWithdraw = new ChannelWithdraw();
|
|
channelWithdraw.setMoney(param.getMoney());
|
|
channelWithdraw.setMoney(param.getMoney());
|
|
- channelWithdraw.setChargeAmt(0);
|
|
|
|
|
|
+ BigDecimal feeAmt = new BigDecimal(param.getMoney()).multiply(feeRate).divide(new BigDecimal(1000), 2, RoundingMode.DOWN);
|
|
|
|
+ channelWithdraw.setChargeAmt(feeAmt.intValue());
|
|
channelWithdraw.setUserName(param.getUserName());
|
|
channelWithdraw.setUserName(param.getUserName());
|
|
channelWithdraw.setCardNo(param.getCardNo());
|
|
channelWithdraw.setCardNo(param.getCardNo());
|
|
channelWithdraw.setBranchName(param.getBranchName());
|
|
channelWithdraw.setBranchName(param.getBranchName());
|