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;
@@ -16,6 +14,8 @@
import cc.mrbird.febs.mall.service.IApiMallMemberWalletService;
import cc.mrbird.febs.mall.service.IMallMoneyFlowService;
import cc.mrbird.febs.mall.vo.*;
import cc.mrbird.febs.pay.model.SinglePayDto;
import cc.mrbird.febs.pay.service.UnipayService;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -64,6 +64,8 @@
    private final MallShopApplyMapper mallShopApplyMapper;
    private final IMallMoneyFlowService mallMoneyFlowService;
    private final UnipayService unipayService;
    private final MallMemberBankMapper mallMemberBankMapper;
    @Override
    public IPage<MallMember> getMallMemberList(MallMember mallMember, QueryRequest request) {
@@ -107,6 +109,8 @@
            mallMember.setDirector(value);
        } else if (type == 2){
            mallMember.setStoreMaster(value);
        }else if (type == 3){
            mallMember.setPartner(value);
        } else {
            throw new FebsException("参数错误");
        }
@@ -152,15 +156,42 @@
        if(1 != mallMemberWithdraw.getStatus()){
            return new FebsResponse().fail().message("当前状态不是提现中");
        }
        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> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("order_no",mallMemberWithdraw.getWithdrawNo());
        objectQueryWrapper.eq("type",MoneyFlowTypeEnum.WITHDRAWAL.getValue());
        MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOne(objectQueryWrapper);
        mallMoneyFlow.setStatus(2);
        mallMoneyFlowMapper.updateById(mallMoneyFlow);
        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("提现失败,请稍后查看错误信息一览");
//        }
        return new FebsResponse().success();
    }
@@ -175,6 +206,7 @@
        if(1 != mallMemberWithdraw.getStatus()){
            return new FebsResponse().fail().message("当前状态不是提现中");
        }
        mallMemberWithdraw.setStatus(3);
        mallMemberWithdrawMapper.updateById(mallMemberWithdraw);
@@ -185,8 +217,8 @@
        mallMoneyFlow.setStatus(3);
        mallMoneyFlowMapper.updateById(mallMoneyFlow);
        //用户钱包增加对应的余额
        iApiMallMemberWalletService.addBalance(mallMoneyFlow.getAmount().negate(),mallMoneyFlow.getMemberId());
        //用户增加对应的余额
        iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"balance");
        return new FebsResponse().success();
    }
@@ -250,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();
    }
@@ -433,7 +474,7 @@
            // 重置交易密码
            if (type == 1) {
                String payPwd = SecureUtil.md5("654321");
                String payPwd = SecureUtil.md5("123456");
                member.setTradePassword(payPwd);
                // 重置登录密码
            } else {
@@ -588,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)) {