fix: 优化批发商品,没有匹配规则时,显示异常,不在默认为第一个规则
This commit is contained in:
parent
26b58442c5
commit
1cc7486b0a
@ -81,6 +81,7 @@ public enum ResultCode {
|
|||||||
|
|
||||||
HAVE_INVALID_SALES_MODEL(11023, "批发规则存在小于等于0的无效数据!"),
|
HAVE_INVALID_SALES_MODEL(11023, "批发规则存在小于等于0的无效数据!"),
|
||||||
MUST_HAVE_GOODS_SKU_VALUE(11024, "规格值不能为空!"),
|
MUST_HAVE_GOODS_SKU_VALUE(11024, "规格值不能为空!"),
|
||||||
|
DO_NOT_MATCH_WHOLESALE(11025, "没有匹配的批发规则!"),
|
||||||
|
|
||||||
GOODS_PARAMS_ERROR(11013, "商品参数错误,刷新后重试"),
|
GOODS_PARAMS_ERROR(11013, "商品参数错误,刷新后重试"),
|
||||||
PHYSICAL_GOODS_NEED_TEMP(11014, "实物商品需选择配送模板"),
|
PHYSICAL_GOODS_NEED_TEMP(11014, "实物商品需选择配送模板"),
|
||||||
|
@ -2,6 +2,8 @@ package cn.lili.modules.goods.serviceimpl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.lili.cache.Cache;
|
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.entity.dos.Wholesale;
|
||||||
import cn.lili.modules.goods.mapper.WholesaleMapper;
|
import cn.lili.modules.goods.mapper.WholesaleMapper;
|
||||||
import cn.lili.modules.goods.service.WholesaleService;
|
import cn.lili.modules.goods.service.WholesaleService;
|
||||||
@ -75,7 +77,7 @@ public class WholesaleServiceImpl extends ServiceImpl<WholesaleMapper, Wholesale
|
|||||||
if (CollUtil.isNotEmpty(matchList)) {
|
if (CollUtil.isNotEmpty(matchList)) {
|
||||||
return matchList.get(matchList.size() - 1);
|
return matchList.get(matchList.size() - 1);
|
||||||
} else if (CollUtil.isNotEmpty(wholesaleList) && CollUtil.isEmpty(matchList)) {
|
} else if (CollUtil.isNotEmpty(wholesaleList) && CollUtil.isEmpty(matchList)) {
|
||||||
return wholesaleList.get(0);
|
throw new ServiceException(ResultCode.DO_NOT_MATCH_WHOLESALE);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user