!282 优化es生成索引sku取分可能为复数问题

Merge pull request !282 from OceansDeep/pg
This commit is contained in:
OceansDeep 2023-05-08 09:38:19 +00:00 committed by Gitee
commit 5d598d9034
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 11 additions and 1 deletions

View File

@ -382,7 +382,11 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
List<EsGoodsIndex> esGoodsIndices = new ArrayList<>();
for (GoodsSku goodsSku : goodsSkuList) {
EsGoodsIndex goodsIndex = this.settingUpGoodsIndexData(goods, goodsSku);
goodsIndex.setSkuSource(skuSource--);
skuSource--;
if (skuSource <= 0) {
skuSource = 1;
}
goodsIndex.setSkuSource(skuSource);
log.info("goodsSku{}", goodsSku);
log.info("生成商品索引 {}", goodsIndex);
esGoodsIndices.add(goodsIndex);

View File

@ -88,6 +88,9 @@ public class FootprintServiceImpl extends ServiceImpl<FootprintMapper, FootPrint
.mapToObj(i -> {
if (goodsSkuByIdFromCache.get(i) == null) {
EsGoodsIndex esGoodsIndex = new EsGoodsIndex();
FootPrint footPrint = footPrintPages.getRecords().get(i);
esGoodsIndex.setGoodsId(footPrint.getGoodsId());
esGoodsIndex.setId(footPrint.getSkuId());
esGoodsIndex.setReleaseTime(footPrintPages.getRecords().get(i).getCreateTime().getTime());
return esGoodsIndex;
}

View File

@ -235,6 +235,9 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
if (count >= 1) {
skuSource -= count;
}
if (skuSource <= 0) {
skuSource = 1;
}
esGoodsIndex.setSkuSource(skuSource);