fix
Hentua
2023-04-25 6c98fa6643e00e6a31b87d58184b6470f990e76f
src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
@@ -80,19 +80,13 @@
        }
        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("提现金额不足");
        }
@@ -106,6 +100,7 @@
        withdraw.setStatus(1);
        withdraw.setAmountFee(serviceFee);
        withdraw.setWtihdrawTypeId(mallMemberBank.getId());
        withdraw.setRemark(AppContants.MEMBER_WITHDRAW_NORMAL);
        this.baseMapper.insert(withdraw);
        mallMemberService.addMoneyFlow(memberId, withdrawalDto.getAmount().add(serviceFee).negate(), MoneyFlowTypeEnum.WITHDRAWAL.getValue(), orderNo, null, null, null, 1, FlowTypeEnum.BALANCE.getValue());