Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
wangw 2025-09-12 14:14:59 +08:00
commit f703028fa1
1 changed files with 12 additions and 11 deletions

View File

@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.czg.constant.TableValueConstant; import com.czg.constant.TableValueConstant;
import com.czg.exception.ApiNotPrintException;
import com.czg.market.dto.MemberConfigDTO; import com.czg.market.dto.MemberConfigDTO;
import com.czg.market.dto.MemberLevelDTO; import com.czg.market.dto.MemberLevelDTO;
import com.czg.account.entity.*; 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.service.MemberOrderService;
import com.czg.market.vo.MemberConfigVO; import com.czg.market.vo.MemberConfigVO;
import com.czg.market.vo.MemberLevelVO; 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.MemberLevelConfigService;
import com.czg.market.service.TbMemberConfigService; import com.czg.market.service.TbMemberConfigService;
import com.czg.order.service.OrderInfoService; import com.czg.order.service.OrderInfoService;
@ -98,14 +99,14 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
BeanUtil.copyProperties(memberDTO, memberConfig); BeanUtil.copyProperties(memberDTO, memberConfig);
if ((memberDTO.getConfigList() == null || memberDTO.getConfigList().isEmpty()) && if ((memberDTO.getConfigList() == null || memberDTO.getConfigList().isEmpty()) &&
(memberDTO.getConditionList() == null || memberDTO.getConditionList().isEmpty())) { (memberDTO.getConditionList() == null || memberDTO.getConditionList().isEmpty())) {
throw new CzgException("会员开通方式必须选择一个"); throw new ApiNotPrintException("会员开通方式必须选择一个");
} }
if (memberDTO.getConfigList() != null && !memberDTO.getConfigList().isEmpty()) { if (memberDTO.getConfigList() != null && !memberDTO.getConfigList().isEmpty()) {
memberDTO.getConfigList().forEach(item -> { memberDTO.getConfigList().forEach(item -> {
if (item.getReward() == null && (item.getCouponList() == null || item.getCouponList().isEmpty())) { if (item.getReward() == null && (item.getCouponList() == null || item.getCouponList().isEmpty())) {
throw new CzgException("方案列表中赠送成长值和赠送优惠券不能同时为空"); throw new ApiNotPrintException("方案列表中赠送成长值和赠送优惠券不能同时为空");
} }
}); });
memberConfig.setConfigList(JSONObject.toJSONString(memberDTO.getConfigList())); memberConfig.setConfigList(JSONObject.toJSONString(memberDTO.getConfigList()));
@ -113,14 +114,14 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
// if (memberConfig.getConfigList() != null && !memberConfig.getConfigList().isEmpty() && // if (memberConfig.getConfigList() != null && !memberConfig.getConfigList().isEmpty() &&
// (memberConfig.getConditionList() != null || !memberConfig.getConditionList().isEmpty())) { // (memberConfig.getConditionList() != null || !memberConfig.getConditionList().isEmpty())) {
// throw new CzgException("会员开通方式为单选条件"); // throw new ApiNotPrintException("会员开通方式为单选条件");
// } // }
if (memberDTO.getConditionList() != null && !memberDTO.getConditionList().isEmpty()) { if (memberDTO.getConditionList() != null && !memberDTO.getConditionList().isEmpty()) {
// ArrayList<String> conditionList = CollUtil.newArrayList(conditionMap); // ArrayList<String> conditionList = CollUtil.newArrayList(conditionMap);
memberDTO.getConditionList().forEach(item -> { memberDTO.getConditionList().forEach(item -> {
if (!conditionMap.contains(item.getCode())) { if (!conditionMap.contains(item.getCode())) {
throw new CzgException("条件列表中code值错误"); throw new ApiNotPrintException("条件列表中code值错误");
} }
}); });
// conditionList.forEach(item -> { // conditionList.forEach(item -> {
@ -139,21 +140,21 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
private void checkLevelDto(Long shopId, MemberLevelDTO levelDTO) { private void checkLevelDto(Long shopId, MemberLevelDTO levelDTO) {
long count = levelConfigService.count(new QueryWrapper().eq(MemberLevelConfig::getShopId, shopId).eq(MemberLevelConfig::getName, levelDTO.getName()).ne(MemberLevelConfig::getId, levelDTO.getId())); long count = levelConfigService.count(new QueryWrapper().eq(MemberLevelConfig::getShopId, shopId).eq(MemberLevelConfig::getName, levelDTO.getName()).ne(MemberLevelConfig::getId, levelDTO.getId()));
if (count > 0) { if (count > 0) {
throw new CzgException("会员等级名称已存在"); throw new ApiNotPrintException("会员等级名称已存在");
} }
MemberLevelConfig lastConfig = levelConfigService.getOne(new QueryWrapper().eq(MemberLevelConfig::getShopId, shopId) MemberLevelConfig lastConfig = levelConfigService.getOne(new QueryWrapper().eq(MemberLevelConfig::getShopId, shopId)
.lt(MemberLevelConfig::getId, levelDTO.getId()) .lt(MemberLevelConfig::getId, levelDTO.getId())
.limit(1).orderBy(MemberLevelConfig::getExperienceValue, true).ne(MemberLevelConfig::getId, levelDTO.getId())); .limit(1).orderBy(MemberLevelConfig::getExperienceValue, true).ne(MemberLevelConfig::getId, levelDTO.getId()));
if (lastConfig == null && levelDTO.getExperienceValue() > 0) { if (lastConfig == null && levelDTO.getExperienceValue() > 0) {
throw new CzgException("1级时本字段必须为0"); throw new ApiNotPrintException("1级时本字段必须为0");
} else if (lastConfig != null && levelDTO.getExperienceValue() <= lastConfig.getExperienceValue()) { } else if (lastConfig != null && levelDTO.getExperienceValue() <= lastConfig.getExperienceValue()) {
throw new CzgException("会员等级经验值必须大于上一等级经验值"); throw new ApiNotPrintException("会员等级经验值必须大于上一等级经验值");
} }
if (levelDTO.getIsCycleReward() == 1) { if (levelDTO.getIsCycleReward() == 1) {
if (levelDTO.getCycleRewardPoints() == null && (levelDTO.getCycleRewardCouponList() == null || levelDTO.getCycleRewardCouponList().isEmpty())) { if (levelDTO.getCycleRewardPoints() == null && (levelDTO.getCycleRewardCouponList() == null || levelDTO.getCycleRewardCouponList().isEmpty())) {
throw new CzgException("周期奖励成长值和优惠券不能同时为空"); throw new ApiNotPrintException("周期奖励成长值和优惠券不能同时为空");
} }
ValidatorUtil.validateEntity(levelDTO, MemberLevelCycleRewardGroup.class); ValidatorUtil.validateEntity(levelDTO, MemberLevelCycleRewardGroup.class);
@ -176,7 +177,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
@Override @Override
public Boolean editLevel(Long shopId, MemberLevelDTO levelDTO) { public Boolean editLevel(Long shopId, MemberLevelDTO levelDTO) {
MemberLevelConfig levelConfig = levelConfigService.getOne(new QueryWrapper().eq(MemberLevelConfig::getId, levelDTO.getId()).eq(MemberLevelConfig::getShopId, shopId)); MemberLevelConfig levelConfig = levelConfigService.getOne(new QueryWrapper().eq(MemberLevelConfig::getId, levelDTO.getId()).eq(MemberLevelConfig::getShopId, shopId));
Optional.ofNullable(levelConfig).orElseThrow(() -> new CzgException("会员等级不存在")); Optional.ofNullable(levelConfig).orElseThrow(() -> new ApiNotPrintException("会员等级不存在"));
checkLevelDto(shopId, levelDTO); checkLevelDto(shopId, levelDTO);
BeanUtil.copyProperties(levelDTO, levelConfig); BeanUtil.copyProperties(levelDTO, levelConfig);
@ -318,7 +319,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl<TbMemberConfigMapper,
shopUser.setEndTime(shopUser.getEndTime().plusYears(memberOrder.getCircleTime())); shopUser.setEndTime(shopUser.getEndTime().plusYears(memberOrder.getCircleTime()));
break; break;
default: default:
throw new CzgException("周期单位错误"); throw new ApiNotPrintException("周期单位错误");
} }
if (memberOrder.getReward() != null) { if (memberOrder.getReward() != null) {