fix: 优化商品搜索出现分类id问题

This commit is contained in:
misworga831 2023-08-24 14:17:21 +08:00
parent 4f4593e5f7
commit 94c87f5645
2 changed files with 17 additions and 13 deletions

View File

@ -116,7 +116,11 @@ public class CheckDataRender implements CartRenderStep {
//商品上架状态判定 sku为空sku非上架状态sku审核不通过
boolean checkGoodsStatus = dataSku == null || !GoodsAuthEnum.PASS.name().equals(dataSku.getAuthFlag()) || !GoodsStatusEnum.UPPER.name().equals(dataSku.getMarketEnable());
//商品有效性判定 sku不为空且sku的更新时间不为空且sku的更新时间在购物车sku的更新时间之后
boolean checkGoodsValid = dataSku != null && dataSku.getUpdateTime() != null && dataSku.getUpdateTime().after(cartSkuVO.getGoodsSku().getUpdateTime());
boolean checkGoodsValid = dataSku != null &&
dataSku.getUpdateTime() != null &&
cartSkuVO.getGoodsSku() != null &&
cartSkuVO.getGoodsSku().getUpdateTime() != null &&
dataSku.getUpdateTime().after(cartSkuVO.getGoodsSku().getUpdateTime());
if (checkGoodsStatus || checkGoodsValid) {

View File

@ -281,10 +281,8 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
List<? extends Terms.Bucket> categoryNameBuckets = categoryNameAgg.getBuckets();
String categoryNamePath = categoryPath;
if (!categoryNameBuckets.isEmpty()) {
categoryNamePath = categoryNameBuckets.get(0).getKey().toString();
}
String categoryNamePath = categoryNameBuckets.get(0).getKey().toString();
String[] split = ArrayUtil.distinct(categoryPath.split(","));
String[] nameSplit = categoryNamePath.split(",");
if (split.length == nameSplit.length) {
@ -298,6 +296,8 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
}
}
}
}
return categoryOptions;
}