xiaoyong931011
2022-08-17 c7ad20b2170aa3e30e271c2f3031c28a8deb3bf6
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -58,6 +58,7 @@
    private final IApiMallMemberWalletService iApiMallMemberWalletService;
    private final AppVersionMapper appVersionMapper;
    private final MallMemberWithdrawMapper mallMemberWithdrawMapper;
    private final MallNewsInfoMapper mallNewsInfoMapper;
    private final MallShopApplyMapper mallShopApplyMapper;
@@ -96,6 +97,24 @@
    }
    @Override
    public void changeIdentity(Integer type, Long id, Integer value) {
        MallMember mallMember = mallMemberMapper.selectById(id);
        if(mallMember == null) {
            throw new FebsException("参数错误");
        }
        if (type == 1) {
            mallMember.setDirector(value);
        } else if (type == 2){
            mallMember.setStoreMaster(value);
        } else {
            throw new FebsException("参数错误");
        }
        this.baseMapper.updateById(mallMember);
    }
    @Override
    public MallMemberVo getMallMemberInfoById(long id) {
        MallMemberVo mallMemberVo = mallMemberMapper.getMallMemberInfoById(id);
        return mallMemberVo;
@@ -125,28 +144,44 @@
    @Override
    @Transactional
    public FebsResponse chargeAgree(Long id) {
        MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectById(id);
        if(ObjectUtil.isEmpty(mallMoneyFlow)){
        MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(id);
        if(ObjectUtil.isEmpty(mallMemberWithdraw)){
            return new FebsResponse().fail().message("系统繁忙,请刷新后重试");
        }
        if(1 != mallMoneyFlow.getStatus()){
        if(1 != mallMemberWithdraw.getStatus()){
            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);
        return new FebsResponse().success();
    }
    @Override
    @Transactional
    public FebsResponse chargeDisagree(Long id) {
        MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectById(id);
        if(ObjectUtil.isEmpty(mallMoneyFlow)){
        MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(id);
        if(ObjectUtil.isEmpty(mallMemberWithdraw)){
            return new FebsResponse().fail().message("系统繁忙,请刷新后重试");
        }
        if(1 != mallMoneyFlow.getStatus()){
        if(1 != mallMemberWithdraw.getStatus()){
            return new FebsResponse().fail().message("当前状态不是提现中");
        }
        mallMemberWithdraw.setStatus(3);
        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(3);
        mallMoneyFlowMapper.updateById(mallMoneyFlow);
@@ -158,8 +193,8 @@
    @Override
    public AdminMallMemberPaymentVo getMallMemberPaymentInfoByFlowId(long id) {
        AdminMallMemberPaymentVo adminMallMemberPaymentVo = new AdminMallMemberPaymentVo();
        MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectById(id);
        AdminMallMemberPaymentVo adminMallMemberPaymentVoa = mallMemberPaymentMapper.getMallMemberPaymentInfoByMemberId(mallMoneyFlow.getMemberId());
        MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(id);
        AdminMallMemberPaymentVo adminMallMemberPaymentVoa = mallMemberPaymentMapper.getMallMemberPaymentInfoByMemberId(mallMemberWithdraw.getMemberId());
        if(ObjectUtil.isNotEmpty(adminMallMemberPaymentVoa)){
            adminMallMemberPaymentVo = adminMallMemberPaymentVoa;
        }
@@ -322,8 +357,9 @@
        }
        BigDecimal bigDecimal = mallSystemPayDto.getAddBalance();
        boolean isReduce = false;
        if(bigDecimal.compareTo(BigDecimal.ZERO) <= 0){
            return new FebsResponse().fail().message("拨付数目需要大于0");
            isReduce = true;
        }
        Integer type = mallSystemPayDto.getType();
@@ -338,7 +374,15 @@
            throw new FebsException("参数错误");
        }
        iApiMallMemberWalletService.add(mallSystemPayDto.getAddBalance(), mallSystemPayDto.getId(), filedType);
        if (isReduce) {
            int i = iApiMallMemberWalletService.reduce(mallSystemPayDto.getAddBalance().negate(), mallSystemPayDto.getId(), filedType);
            if (i == 2) {
                throw new FebsException("剩余数量不足");
            }
        } else {
            iApiMallMemberWalletService.add(mallSystemPayDto.getAddBalance(), mallSystemPayDto.getId(), filedType);
        }
        mallMoneyFlowService.addMoneyFlow(memberId, bigDecimal, MoneyFlowTypeEnum.SYSTEM.getValue(), null, type);
        return new FebsResponse().success();
    }
@@ -426,6 +470,10 @@
            throw new FebsException("申请已审核, 请勿重复操作");
        }
        MallMember member = mallMemberMapper.selectById(apply.getMemberId());
        member.setStoreMaster(1);
        mallMemberMapper.updateById(member);
        apply.setStatus(MallShopApply.APPLY_AGREE);
        mallShopApplyMapper.updateById(apply);
    }