| | |
| | | } |
| | | |
| | | MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); |
| | | BigDecimal profit = mallMoneyFlowMapper.selectProfitByDateAndMemberId(memberId); |
| | | |
| | | BigDecimal serviceFeePercent = cashOutSettingVo.getServiceFee().multiply(BigDecimal.valueOf(0.01)); |
| | | BigDecimal serviceFee = serviceFeePercent.multiply(withdrawalDto.getAmount()); |
| | | // 可提现 |
| | | BigDecimal canMoney = wallet.getCommission(); |
| | | if (profit != null) { |
| | | if(canMoney.subtract(serviceFee).compareTo(BigDecimal.ZERO) > 0) { |
| | | canMoney = canMoney.subtract(profit); |
| | | } |
| | | } |
| | | BigDecimal canMoney = wallet.getBalance(); |
| | | |
| | | if(withdrawalDto.getAmount().compareTo(canMoney) > 0) { |
| | | if(withdrawalDto.getAmount().add(serviceFee).compareTo(canMoney) > 0) { |
| | | throw new FebsException("提现金额不足"); |
| | | } |
| | | |