Skip to content

Commit

Permalink
修复商品编辑规格时,删除规格后。es中没有删除问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiGaoRobot committed May 25, 2022
1 parent 026b6ac commit e9fdec6
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void onMessage(MessageExt messageExt) {
String goodsId = new String(messageExt.getBody());
log.info("生成索引: {}", goodsId);
Goods goods = this.goodsService.getById(goodsId);
updateGoodsIndex(goods);
this.updateGoodsIndex(goods);
} catch (Exception e) {
log.error("生成商品索引事件执行异常,商品信息: " + new String(messageExt.getBody()), e);
}
Expand Down Expand Up @@ -214,10 +214,7 @@ public void onMessage(MessageExt messageExt) {
if (goodsById != null) {
this.deleteGoods(goodsById);
this.updateGoodsNum(goodsById);
List<String> skuIdsByGoodsId = this.goodsSkuService.getSkuIdsByGoodsId(goodsId);
if (skuIdsByGoodsId != null && !skuIdsByGoodsId.isEmpty()) {
this.goodsIndexService.deleteIndexByIds(skuIdsByGoodsId);
}
goodsIndexService.deleteIndex(MapUtil.builder(new HashMap<String, Object>()).put("goodsId", goodsId).build());
}
}

Expand Down Expand Up @@ -392,6 +389,7 @@ private void generatorGoodsIndex(Goods goods, List<GoodsSku> goodsSkuList) {
esGoodsIndices.add(goodsIndex);
}
}
this.goodsIndexService.deleteIndex(MapUtil.builder(new HashMap<String, Object>()).put("goodsId", goods.getId()).build());
this.goodsIndexService.addIndex(esGoodsIndices);
}

Expand Down

0 comments on commit e9fdec6

Please sign in to comment.