fix: 修复商品索引初始化时,店铺全品类优惠券和平台全品类优惠券没有区分问题

This commit is contained in:
paulGao 2023-01-11 11:32:27 +08:00
parent 5080cf65c7
commit 3c568a7d42
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,6 @@ import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.lili.cache.Cache;
import cn.lili.common.enums.PromotionTypeEnum;
import cn.lili.common.utils.StringUtils;
import cn.lili.common.vo.PageVO;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsSkuDTO;
@ -100,7 +99,7 @@ public class PromotionGoodsServiceImpl extends ServiceImpl<PromotionGoodsMapper,
List<String> skuIds = skus.stream().map(GoodsSku::getId).collect(Collectors.toList());
List<String> categoriesPath = new ArrayList<>();
categories.forEach(i -> {
if (StringUtils.isNotEmpty(i)) {
if (CharSequenceUtil.isNotEmpty(i)) {
categoriesPath.addAll(Arrays.asList(i.split(",")));
}
}

View File

@ -239,7 +239,8 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
List<PromotionGoods> promotionGoods = skuValidPromotions.stream()
.filter(j ->
(CharSequenceUtil.isNotEmpty(j.getSkuId()) && j.getSkuId().equals(goodsSku.getId())) ||
j.getScopeType().equals(PromotionsScopeTypeEnum.ALL.name()) ||
(j.getScopeType().equals(PromotionsScopeTypeEnum.ALL.name()) && j.getStoreId().equals("0")) ||
(j.getScopeType().equals(PromotionsScopeTypeEnum.ALL.name()) && j.getStoreId().equals(esGoodsIndex.getStoreId())) ||
(j.getScopeType().equals(PromotionsScopeTypeEnum.PORTION_GOODS_CATEGORY.name()) && j.getScopeId().contains(goodsSku.getCategoryPath())))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(promotionGoods)) {