fix
Hentua
2023-04-23 4f65db3a1766fea81630d31a648c1c14b2d21c24
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -81,6 +81,8 @@
    private final MallMemberWalletMapper mallMemberWalletMapper;
    private final MallMqRecordMapper mallMqRecordMapper;
    private final MallShopMapper mallShopMapper;
    private final ICommonService commonService;
    @Override
@@ -117,11 +119,8 @@
                throw new FebsException("请选择门店");
            }
            Long shopId = addOrderDto.getShopId();
            MallShopApply mallShopApply = mallShopApplyMapper.selectById(shopId);
            MallShop mallShopApply = mallShopMapper.selectById(shopId);
            if(ObjectUtil.isEmpty(mallShopApply)){
                throw new FebsException("请选择门店");
            }
            if(MallShopApply.APPLY_AGREE != mallShopApply.getStatus()){
                throw new FebsException("请选择门店");
            }
            orderInfo.setShopId(shopId);
@@ -334,18 +333,9 @@
                this.baseMapper.updateById(orderInfo);
                commonService.changeWallet(orderInfo.getId(), FlowTypeEnum.BALANCE.getValue());
                /**
                 * 插入一条待处理记录
                 * mq处理之后,更新状态
                 */
                MallMqRecord mallMqRecord = new MallMqRecord();
                mallMqRecord.setOrderId(orderInfo.getId());
                mallMqRecord.setState(2);
                mallMqRecord.setRetryTimes(2);
                mallMqRecord.setCreateTime(orderInfo.getPayTime());
                mallMqRecordMapper.insert(mallMqRecord);
                //发送补贴消息
                agentProducer.sendPerkMoneyMsg(orderInfo.getId());
                //发送直推返利消息
                agentProducer.sendOrderReturn(orderInfo.getId());
                //发送代理自动升级消息
                agentProducer.sendAutoLevelUpMsg(member.getId());
                break;
@@ -710,16 +700,11 @@
            if(ObjectUtil.isEmpty(mallGoods)){
                throw new FebsException("商品已更新,请重新下单");
            }
            /**
             * 贡献点判断
            /*
            获取单个商品的折扣积分数量
                = 现价 * 数量 * 折扣现金比例
             */
            if (mallGoods.getIsNormal() == 2) {
                hasTc = true;
            }
                /*
                获取单个商品的折扣积分数量
                    = 现价 * 数量 * 折扣现金比例
                 */
            BigDecimal scorePercent = new BigDecimal(mallGoods.getScorePercent()).multiply(new BigDecimal(0.01));
            BigDecimal amount = sku.getPresentPrice().multiply(BigDecimal.valueOf(item.getCnt())).multiply(scorePercent);
            total = total.add(amount);
@@ -732,20 +717,7 @@
        if(prizeScore.compareTo(score) < 0){
            throw new FebsException("积分不足");
        }
        if(hasTc){
            //系统设置的个人贡献点最大值
            DataDictionaryCustom starGetDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                    DataDictionaryEnum.STAR_GET.getType(),
                    DataDictionaryEnum.STAR_GET.getCode());
            if(ObjectUtil.isNotEmpty(starGetDic)){
                String starGetStr = StrUtil.isEmpty(starGetDic.getValue()) ? "0" : starGetDic.getValue();
                BigDecimal starGet = new BigDecimal(starGetStr);
                BigDecimal star = new BigDecimal(mallMemberWallet.getStar());
                if(starGet.compareTo(BigDecimal.ZERO) != 0 && starGet.compareTo(star) <= 0){
                    throw new FebsException("无法购买套餐");
                }
            }
        }
        /**
         * 使用积分折扣现金
         */