fix: 优化批发商品,没有匹配规则时,显示异常,不在默认为第一个规则

This commit is contained in:
paulGao 2022-11-28 10:52:34 +08:00
parent 26b58442c5
commit 1cc7486b0a
2 changed files with 4 additions and 1 deletions

View File

@ -81,6 +81,7 @@ public enum ResultCode {
HAVE_INVALID_SALES_MODEL(11023, "批发规则存在小于等于0的无效数据"),
MUST_HAVE_GOODS_SKU_VALUE(11024, "规格值不能为空!"),
DO_NOT_MATCH_WHOLESALE(11025, "没有匹配的批发规则!"),
GOODS_PARAMS_ERROR(11013, "商品参数错误,刷新后重试"),
PHYSICAL_GOODS_NEED_TEMP(11014, "实物商品需选择配送模板"),

View File

@ -2,6 +2,8 @@ package cn.lili.modules.goods.serviceimpl;
import cn.hutool.core.collection.CollUtil;
import cn.lili.cache.Cache;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.modules.goods.entity.dos.Wholesale;
import cn.lili.modules.goods.mapper.WholesaleMapper;
import cn.lili.modules.goods.service.WholesaleService;
@ -75,7 +77,7 @@ public class WholesaleServiceImpl extends ServiceImpl<WholesaleMapper, Wholesale
if (CollUtil.isNotEmpty(matchList)) {
return matchList.get(matchList.size() - 1);
} else if (CollUtil.isNotEmpty(wholesaleList) && CollUtil.isEmpty(matchList)) {
return wholesaleList.get(0);
throw new ServiceException(ResultCode.DO_NOT_MATCH_WHOLESALE);
}
return null;
}