| | |
| | | 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"); |
| | | |
| | |
| | | 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 |