xiaoyong931011
2023-03-21 fc6131cec1b0c898c970b10596c0eb15eaba885e
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -861,7 +861,13 @@
        BigDecimal total = BigDecimal.ZERO;
        for (AddOrderItemDto item : addOrderDto.getItems()) {
            MallGoodsSku sku = mallGoodsSkuMapper.selectSkuInfoById(item.getSkuId());
            if(ObjectUtil.isEmpty(sku)){
                throw new FebsException("商品已更新,请重新下单");
            }
            MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId());
            if(ObjectUtil.isEmpty(mallGoods)){
                throw new FebsException("商品已更新,请重新下单");
            }
            /**
             * 贡献点判断
             */
@@ -878,6 +884,12 @@
        }
        BigDecimal score = ObjectUtil.isEmpty(addOrderDto.getScore()) ? BigDecimal.ZERO : addOrderDto.getScore();
        MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId);
        BigDecimal prizeScore = mallMemberWallet.getPrizeScore();
        if(prizeScore.compareTo(score) < 0){
            throw new FebsException("积分不足");
        }
        if(hasTc){
            //系统设置的个人贡献点最大值
            DataDictionaryCustom starGetDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
@@ -886,15 +898,9 @@
            if(ObjectUtil.isNotEmpty(starGetDic)){
                String starGetStr = StrUtil.isEmpty(starGetDic.getValue()) ? "0" : starGetDic.getValue();
                BigDecimal starGet = new BigDecimal(starGetStr);
                MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId);
                BigDecimal star = new BigDecimal(mallMemberWallet.getStar());
                if(starGet.compareTo(BigDecimal.ZERO) != 0 && starGet.compareTo(star) <= 0){
                    throw new FebsException("无法购买套餐");
                }
                BigDecimal prizeScore = mallMemberWallet.getPrizeScore();
                if(prizeScore.compareTo(score) < 0){
                    throw new FebsException("积分不足");
                }
            }
        }