diff --git a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java index 320dfb9b..0ef4e817 100644 --- a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java +++ b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java @@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.czg.constant.TableValueConstant; +import com.czg.exception.ApiNotPrintException; import com.czg.market.dto.MemberConfigDTO; import com.czg.market.dto.MemberLevelDTO; import com.czg.account.entity.*; @@ -16,7 +17,7 @@ import com.czg.market.service.MemberExpFlowService; import com.czg.market.service.MemberOrderService; import com.czg.market.vo.MemberConfigVO; import com.czg.market.vo.MemberLevelVO; -import com.czg.exception.CzgException; +import com.czg.exception.ApiNotPrintException; import com.czg.market.service.MemberLevelConfigService; import com.czg.market.service.TbMemberConfigService; import com.czg.order.service.OrderInfoService; @@ -98,14 +99,14 @@ public class TbMemberConfigServiceImpl extends ServiceImpl { if (item.getReward() == null && (item.getCouponList() == null || item.getCouponList().isEmpty())) { - throw new CzgException("方案列表中赠送成长值和赠送优惠券不能同时为空"); + throw new ApiNotPrintException("方案列表中赠送成长值和赠送优惠券不能同时为空"); } }); memberConfig.setConfigList(JSONObject.toJSONString(memberDTO.getConfigList())); @@ -113,14 +114,14 @@ public class TbMemberConfigServiceImpl extends ServiceImpl conditionList = CollUtil.newArrayList(conditionMap); memberDTO.getConditionList().forEach(item -> { if (!conditionMap.contains(item.getCode())) { - throw new CzgException("条件列表中code值错误"); + throw new ApiNotPrintException("条件列表中code值错误"); } }); // conditionList.forEach(item -> { @@ -139,21 +140,21 @@ public class TbMemberConfigServiceImpl extends ServiceImpl 0) { - throw new CzgException("会员等级名称已存在"); + throw new ApiNotPrintException("会员等级名称已存在"); } MemberLevelConfig lastConfig = levelConfigService.getOne(new QueryWrapper().eq(MemberLevelConfig::getShopId, shopId) .lt(MemberLevelConfig::getId, levelDTO.getId()) .limit(1).orderBy(MemberLevelConfig::getExperienceValue, true).ne(MemberLevelConfig::getId, levelDTO.getId())); if (lastConfig == null && levelDTO.getExperienceValue() > 0) { - throw new CzgException("1级时本字段必须为0"); + throw new ApiNotPrintException("1级时本字段必须为0"); } else if (lastConfig != null && levelDTO.getExperienceValue() <= lastConfig.getExperienceValue()) { - throw new CzgException("会员等级经验值必须大于上一等级经验值"); + throw new ApiNotPrintException("会员等级经验值必须大于上一等级经验值"); } if (levelDTO.getIsCycleReward() == 1) { if (levelDTO.getCycleRewardPoints() == null && (levelDTO.getCycleRewardCouponList() == null || levelDTO.getCycleRewardCouponList().isEmpty())) { - throw new CzgException("周期奖励成长值和优惠券不能同时为空"); + throw new ApiNotPrintException("周期奖励成长值和优惠券不能同时为空"); } ValidatorUtil.validateEntity(levelDTO, MemberLevelCycleRewardGroup.class); @@ -176,7 +177,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl new CzgException("会员等级不存在")); + Optional.ofNullable(levelConfig).orElseThrow(() -> new ApiNotPrintException("会员等级不存在")); checkLevelDto(shopId, levelDTO); BeanUtil.copyProperties(levelDTO, levelConfig); @@ -318,7 +319,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl