KKSU
2024-07-30 c1af5cf94920702b6aa962881365116542e88ab0
src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
@@ -95,16 +95,25 @@
        if(wallet.getBalance().compareTo(BigDecimal.ZERO) <= 0){
            throw new FebsException("金额不足");
        }
        if(wallet.getEquityLimit().compareTo(BigDecimal.ZERO) <= 0){
            throw new FebsException("权益积分不足");
        }
        if(withdrawalDto.getAmount().compareTo(wallet.getBalance()) > 0) {
            throw new FebsException("金额不足");
        }
        if(withdrawalDto.getAmount().compareTo(wallet.getEquityLimit()) > 0) {
            throw new FebsException("权益积分不足");
        }
//        BigDecimal commission = wallet.getCommission();
//        if(withdrawalDto.getAmount().compareTo(commission) > 0){
//            throw new FebsException("金额不足");
//        }
        BigDecimal serviceFee = cashOutSettingVo.getServiceFee().multiply(BigDecimal.valueOf(0.01));
        walletService.reduce(withdrawalDto.getAmount(), memberId, "balance");
        walletService.reduce(withdrawalDto.getAmount(), memberId, "balance");//减少余额
        walletService.reduce(withdrawalDto.getAmount(), memberId, "equityLimit");//减少权益积分
//        walletService.reduce(withdrawalDto.getAmount(), memberId, "commission");
        String orderNo = MallUtils.getOrderNum("W");
@@ -127,6 +136,16 @@
                null,
                1,
                FlowTypeEnum.BALANCE.getValue());
        mallMemberService.addMoneyFlow(memberId,
                withdrawalDto.getAmount().negate(),
                MoneyFlowTypeEnum.REDUCE_EQUITY_LIMIT.getValue(),
                orderNo,
                null,
                null,
                null,
                1,
                FlowTypeEnum.BALANCE.getValue());
    }
    @Override