!367 修复商品索引无效促销活动清理逻辑

Merge pull request !367 from 羚羊跳/N/A
This commit is contained in:
OceansDeep
2025-09-11 11:47:30 +00:00
committed by Gitee

View File

@@ -743,7 +743,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
} }
private void executeCleanInvalidPromotions() { private void executeCleanInvalidPromotions() {
for (int i = 1; ; i++) { for (int i = 0; ; i++) {
org.springframework.data.domain.Page<EsGoodsIndex> all = goodsIndexRepository.findAll(PageRequest.of(i, 1000)); org.springframework.data.domain.Page<EsGoodsIndex> all = goodsIndexRepository.findAll(PageRequest.of(i, 1000));
if (all.isEmpty()) { if (all.isEmpty()) {
break; break;
@@ -758,6 +758,9 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
BasePromotions promotion = promotionJson.toBean(BasePromotions.class); BasePromotions promotion = promotionJson.toBean(BasePromotions.class);
return promotion.getEndTime() != null && promotion.getEndTime().getTime() < DateUtil.date().getTime(); return promotion.getEndTime() != null && promotion.getEndTime().getTime() < DateUtil.date().getTime();
}); });
// 更新回 goodsIndex 对象
goodsIndex.setPromotionMapJson(JSONUtil.toJsonStr(promotionMap));
} }
} }
goodsIndexRepository.saveAll(all); goodsIndexRepository.saveAll(all);