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);
@@ -701,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);
@@ -723,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("无法购买套餐");
                }
            }
        }
        /**
         * 使用积分折扣现金
         */