KKSU
2023-12-13 18aa07a530c6222708ef59a87c32248c15c6f6b7
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -83,6 +83,8 @@
    private final MallAchieveRecordMapper mallAchieveRecordMapper;
    private final MallMemberWalletMapper mallMemberWalletMapper;
    private final MallMqRecordMapper mallMqRecordMapper;
    private final MallProductSellMapper mallProductSellMapper;
    private final MallProductSellRecordMapper mallProductSellRecordMapper;
    private final ICommonService commonService;
@@ -749,20 +751,6 @@
        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("无法购买套餐");
                }
            }
        }
        /**
         * 使用积分折扣现金
         */
@@ -781,6 +769,23 @@
        if(scorePercentMaxAmount.compareTo(score) < 0){
            throw new FebsException("最多可使用"+scorePercentMaxAmount+"积分");
        }
        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){
                    return new FebsResponse().success().message("购买套餐不会获得贡献点");
//                    throw new FebsException("无法购买套餐");
                }
            }
        }
        return new FebsResponse().success();
    }
@@ -800,4 +805,26 @@
        return apiScoreSetVo;
    }
    @Override
    public void fcmPayBuyTimeTTLMsg(Long id) {
        /**
         * 卖方
         * 1:冻结账户
         */
        MallProductSellRecord mallProductSellRecord = mallProductSellRecordMapper.selectById(id);
        if(ObjectUtil.isEmpty(mallProductSellRecord)){
            return;
        }
        MallProductSell mallProductSell = mallProductSellMapper.selectById(mallProductSellRecord.getSellId());
        if(ObjectUtil.isEmpty(mallProductSell)){
            return;
        }
        MallMember mallMember = memberMapper.selectById(mallProductSell.getMemberId());
        if(ObjectUtil.isEmpty(mallMember)){
            return;
        }
        mallMember.setIsFrozen(ProductEnum.MEMBER_FROZEN.getValue());
        memberMapper.updateById(mallMember);
    }
}