xiaoyong931011
2023-04-06 e6667c792be898c41cda7d850dda02a403ef79c2
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -7,6 +7,7 @@
import cc.mrbird.febs.common.enumerates.GreenScoreEnum;
import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum;
import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.common.utils.AppContants;
import cc.mrbird.febs.common.utils.LoginUserUtil;
import cc.mrbird.febs.common.utils.MallUtils;
import cc.mrbird.febs.mall.dto.*;
@@ -175,24 +176,36 @@
        }
        Long wtihdrawTypeId = mallMemberWithdraw.getWtihdrawTypeId();
        MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(wtihdrawTypeId);
//        MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(wtihdrawTypeId);
        /**
         * 调用汇聚代付
         */
        SinglePayDto singlePayDto = new SinglePayDto();
        singlePayDto.setMerchantOrderNo(mallMemberWithdraw.getWithdrawNo());
        singlePayDto.setReceiverAccountNoEncBankNo(mallMemberBank.getBankNo());
        singlePayDto.setReceiverAccountNoEncName(mallMemberBank.getName());
        singlePayDto.setReceiverAccountType("201");
        BigDecimal paidAmount = mallMemberWithdraw.getAmount().subtract(mallMemberWithdraw.getAmountFee()).setScale(2, BigDecimal.ROUND_DOWN);
        singlePayDto.setPaidAmount(paidAmount);
        singlePayDto.setCurrency("201");
        singlePayDto.setIsChecked("202");
        singlePayDto.setPaidDesc("用户提现");
        singlePayDto.setPaidUse("202");
        String singlePayRep = unipayService.singlePay(singlePayDto);
        if(!mallMemberWithdraw.getWithdrawNo().equals(singlePayRep)){
            return new FebsResponse().fail().message("提现失败,请稍后查看错误信息一览");
//        SinglePayDto singlePayDto = new SinglePayDto();
//        singlePayDto.setMerchantOrderNo(mallMemberWithdraw.getWithdrawNo());
//        singlePayDto.setReceiverAccountNoEncBankNo(mallMemberBank.getBankNo());
//        singlePayDto.setReceiverAccountNoEncName(mallMemberBank.getName());
//        singlePayDto.setReceiverAccountType("201");
//        BigDecimal paidAmount = mallMemberWithdraw.getAmount().subtract(mallMemberWithdraw.getAmountFee()).setScale(2, BigDecimal.ROUND_DOWN);
//        singlePayDto.setPaidAmount(paidAmount);
//        singlePayDto.setCurrency("201");
//        singlePayDto.setIsChecked("202");
//        singlePayDto.setPaidDesc("用户提现");
//        singlePayDto.setPaidUse("202");
//        String singlePayRep = unipayService.singlePay(singlePayDto);
//        if(!mallMemberWithdraw.getWithdrawNo().equals(singlePayRep)){
//            return new FebsResponse().fail().message("提现失败,请稍后查看错误信息一览");
//        }
        mallMemberWithdraw.setStatus(2);
        mallMemberWithdrawMapper.updateById(mallMemberWithdraw);
        QueryWrapper<MallMoneyFlow> flowQueryWrapper = new QueryWrapper<>();
        flowQueryWrapper.eq("order_no",mallMemberWithdraw.getWithdrawNo());
        flowQueryWrapper.eq("type",MoneyFlowTypeEnum.WITHDRAWAL.getValue());
        MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOne(flowQueryWrapper);
        if(ObjectUtil.isNotEmpty(mallMoneyFlow)){
            mallMoneyFlow.setStatus(2);
            mallMoneyFlowMapper.updateById(mallMoneyFlow);
        }
        return new FebsResponse().success();
@@ -218,9 +231,17 @@
        MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOne(objectQueryWrapper);
        mallMoneyFlow.setStatus(3);
        mallMoneyFlowMapper.updateById(mallMoneyFlow);
        //用户佣金增加对应的余额
        iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"balance");
        if(AppContants.MEMBER_WITHDRAW_NORMAL.equals(mallMemberWithdraw.getRemark())){
            //用户佣金增加对应的余额
            iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"balance");
        }
        if(AppContants.MEMBER_WITHDRAW_VOUCHER.equals(mallMemberWithdraw.getRemark())){
            iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"balance");
            iApiMallMemberWalletService.add(mallMemberWithdraw.getAmountFee(),mallMemberWithdraw.getMemberId(),"voucherCnt");
        }
        if(AppContants.MEMBER_WITHDRAW_VOUCHER_AMOUNT.equals(mallMemberWithdraw.getRemark())){
            iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"voucherAmount");
        }
        return new FebsResponse().success();
    }
@@ -632,6 +653,8 @@
        if(ObjectUtil.isNotEmpty(mallMemberBank)){
            adminMallMemberPaymentVo.setBankNo(mallMemberBank.getBankNo());
            adminMallMemberPaymentVo.setBankName(mallMemberBank.getName());
            adminMallMemberPaymentVo.setDigitalNo(mallMemberBank.getDigitalNo());
            adminMallMemberPaymentVo.setBank(mallMemberBank.getBankName());
        }
        return adminMallMemberPaymentVo;
    }