KKSU
2024-03-15 b87c5549fe471167882192944db3f2d6b729476c
src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
@@ -99,6 +99,7 @@
        withdraw.setAmount(withdrawalDto.getAmount());
        withdraw.setStatus(1);
        withdraw.setAmountFee(serviceFee);
        withdraw.setRemark("提现");
        withdraw.setWtihdrawTypeId(mallMemberBank.getId());
        this.baseMapper.insert(withdraw);
@@ -113,4 +114,30 @@
                1,
                FlowTypeEnum.BALANCE.getValue());
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void charge(WithdrawalDto withdrawalDto) {
        Long memberId = LoginUserUtil.getLoginUser().getId();
        MallMember mallMember = mallMemberService.getById(memberId);
        MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(withdrawalDto.getBankId());
        if(ObjectUtil.isEmpty(mallMemberBank)){
            throw new FebsException("未找到银行卡信息");
        }
        if(BigDecimal.ZERO.compareTo(withdrawalDto.getAmount()) >= 0) {
            throw new FebsException("金额需要大于0");
        }
        String orderNo = MallUtils.getOrderNum("C");
        MallMemberWithdraw withdraw = new MallMemberWithdraw();
        withdraw.setWithdrawNo(orderNo);
        withdraw.setMemberId(memberId);
        withdraw.setAmount(withdrawalDto.getAmount());
        withdraw.setStatus(1);
        withdraw.setRemark("充值");
        withdraw.setWtihdrawTypeId(mallMemberBank.getId());
        this.baseMapper.insert(withdraw);
    }
}