xiaoyong931011
2023-04-24 d7f57903262d8a0db7239fde71a8b7abc48df852
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -2,9 +2,7 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.common.enumerates.AgentLevelEnum;
import cc.mrbird.febs.common.enumerates.FlowTypeEnum;
import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum;
import cc.mrbird.febs.common.enumerates.*;
import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.common.utils.LoginUserUtil;
import cc.mrbird.febs.common.utils.MallUtils;
@@ -111,6 +109,8 @@
            mallMember.setDirector(value);
        } else if (type == 2){
            mallMember.setStoreMaster(value);
        }else if (type == 3){
            mallMember.setPartner(value);
        } else {
            throw new FebsException("参数错误");
        }
@@ -159,24 +159,39 @@
        Long wtihdrawTypeId = mallMemberWithdraw.getWtihdrawTypeId();
        MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(wtihdrawTypeId);
        if(ObjectUtil.isEmpty(mallMemberBank)){
            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);
        }
        /**
         * 调用汇聚代付
         */
        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("提现失败,请稍后查看错误信息一览");
//        }
        return new FebsResponse().success();
    }
@@ -202,8 +217,8 @@
        mallMoneyFlow.setStatus(3);
        mallMoneyFlowMapper.updateById(mallMoneyFlow);
        //用户佣金增加对应的余额
        iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"commission");
        //用户增加对应的余额
        iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"balance");
        return new FebsResponse().success();
    }
@@ -267,6 +282,15 @@
    @Override
    public List<AdminAgentLevelOptionTreeVo> getAgentLevelOption() {
        List<AdminAgentLevelOptionTreeVo> agentLevelOption = dataDictionaryCustomMapper.getAgentLevelOption();
        AdminAgentLevelOptionTreeVo adminAgentLevelOptionTreeVo = new AdminAgentLevelOptionTreeVo();
        adminAgentLevelOptionTreeVo.setId(MemberLevelEnum.NORMAL.getType());
        adminAgentLevelOptionTreeVo.setName("普通会员");
        agentLevelOption.add(adminAgentLevelOptionTreeVo);
        AdminAgentLevelOptionTreeVo adminAgentLevelOptionTreeVos = new AdminAgentLevelOptionTreeVo();
        adminAgentLevelOptionTreeVos.setId(MemberLevelEnum.V_DIRECTOR.getType());
        adminAgentLevelOptionTreeVos.setName("董事");
        agentLevelOption.add(adminAgentLevelOptionTreeVos);
        return dataDictionaryCustomMapper.getAgentLevelOption();
    }
@@ -450,7 +474,7 @@
            // 重置交易密码
            if (type == 1) {
                String payPwd = SecureUtil.md5("654321");
                String payPwd = SecureUtil.md5("123456");
                member.setTradePassword(payPwd);
                // 重置登录密码
            } else {
@@ -605,6 +629,22 @@
        mallShopApplyMapper.updateById(mallShopApply);
    }
    @Override
    public AdminMallMemberPaymentVo getMallBankInfoById(long id) {
        MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(id);
        Long wtihdrawTypeId = mallMemberWithdraw.getWtihdrawTypeId();
        MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(wtihdrawTypeId);
        AdminMallMemberPaymentVo adminMallMemberPaymentVo = new AdminMallMemberPaymentVo();
        if(ObjectUtil.isNotEmpty(mallMemberBank)){
            adminMallMemberPaymentVo.setBankNo(mallMemberBank.getBankNo());
            adminMallMemberPaymentVo.setName(mallMemberBank.getName());
            adminMallMemberPaymentVo.setBankName(mallMemberBank.getBankName());
            adminMallMemberPaymentVo.setBankNameS(mallMemberBank.getBankNameS());
        }
        return adminMallMemberPaymentVo;
    }
    private String refererIds(String parentId) {
        boolean flag = false;
        if (StrUtil.isBlank(parentId)) {