|
@@ -48,10 +48,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.Collection;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 提现Service业务层处理
|
|
* 提现Service业务层处理
|
|
@@ -178,7 +175,8 @@ public class WithdrawalServiceImpl implements IWithdrawalService {
|
|
|
throw new ServiceException("支付密码错误");
|
|
throw new ServiceException("支付密码错误");
|
|
|
}
|
|
}
|
|
|
//判断手续费是否一致
|
|
//判断手续费是否一致
|
|
|
- if (queryFee(bo.getWithdrawalSource(), bo.getAmount()).compareTo(bo.getFee()) != 0) {
|
|
|
|
|
|
|
+ Map<String, BigDecimal> map = queryFee(bo.getWithdrawalSource(), bo.getAmount());
|
|
|
|
|
+ if (map.getOrDefault("fee", BigDecimal.ZERO).compareTo(bo.getFee()) != 0) {
|
|
|
throw new ServiceException(WithdrawalExceptionEnum.WITHDRAWAL_FEE_NOT_MATCH);
|
|
throw new ServiceException(WithdrawalExceptionEnum.WITHDRAWAL_FEE_NOT_MATCH);
|
|
|
}
|
|
}
|
|
|
Withdrawal add = BeanUtil.toBean(bo, Withdrawal.class);
|
|
Withdrawal add = BeanUtil.toBean(bo, Withdrawal.class);
|
|
@@ -198,7 +196,7 @@ public class WithdrawalServiceImpl implements IWithdrawalService {
|
|
|
* 查询提现手续费
|
|
* 查询提现手续费
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public BigDecimal queryFee(WithdrawalSource withdrawalSource, BigDecimal amount) {
|
|
|
|
|
|
|
+ public Map<String, BigDecimal> queryFee(WithdrawalSource withdrawalSource, BigDecimal amount) {
|
|
|
RevenueSharingConfigVo info = revenueSharingConfigService.getInfo();
|
|
RevenueSharingConfigVo info = revenueSharingConfigService.getInfo();
|
|
|
BigDecimal withdrawRatio = null;
|
|
BigDecimal withdrawRatio = null;
|
|
|
if (WithdrawalSource.USER.equals(withdrawalSource)) {
|
|
if (WithdrawalSource.USER.equals(withdrawalSource)) {
|
|
@@ -210,7 +208,10 @@ public class WithdrawalServiceImpl implements IWithdrawalService {
|
|
|
if (withdrawRatio != null) {
|
|
if (withdrawRatio != null) {
|
|
|
fee = MathUtils.setScale(amount.doubleValue() * withdrawRatio.doubleValue() / 100);
|
|
fee = MathUtils.setScale(amount.doubleValue() * withdrawRatio.doubleValue() / 100);
|
|
|
}
|
|
}
|
|
|
- return fee;
|
|
|
|
|
|
|
+ Map<String, BigDecimal> map = new HashMap<>();
|
|
|
|
|
+ map.put("fee", fee);
|
|
|
|
|
+ map.put("withdrawRatio", withdrawRatio);
|
|
|
|
|
+ return map;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -262,6 +263,9 @@ public class WithdrawalServiceImpl implements IWithdrawalService {
|
|
|
}
|
|
}
|
|
|
//查提现审核中
|
|
//查提现审核中
|
|
|
BigDecimal withdrawing = baseMapper.withdrawing(withdrawalSourceId, withdrawalSource.getCode(), AuditStatus.WAIT_AUDIT.getCode());
|
|
BigDecimal withdrawing = baseMapper.withdrawing(withdrawalSourceId, withdrawalSource.getCode(), AuditStatus.WAIT_AUDIT.getCode());
|
|
|
|
|
+ if (withdrawing == null) {
|
|
|
|
|
+ withdrawing = BigDecimal.ZERO;
|
|
|
|
|
+ }
|
|
|
WithdrawalAmountVo amountVo = new WithdrawalAmountVo();
|
|
WithdrawalAmountVo amountVo = new WithdrawalAmountVo();
|
|
|
amountVo.setAbleAmount(balance.subtract(withdrawing));
|
|
amountVo.setAbleAmount(balance.subtract(withdrawing));
|
|
|
amountVo.setProcessingAmount(withdrawing);
|
|
amountVo.setProcessingAmount(withdrawing);
|