!166 修复商品编辑规格时,删除规格后。es中没有删除问题。
Merge pull request !166 from OceansDeep/feature/pg
This commit is contained in:
commit
8596175f8e
@ -138,7 +138,7 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
|||||||
String goodsId = new String(messageExt.getBody());
|
String goodsId = new String(messageExt.getBody());
|
||||||
log.info("生成索引: {}", goodsId);
|
log.info("生成索引: {}", goodsId);
|
||||||
Goods goods = this.goodsService.getById(goodsId);
|
Goods goods = this.goodsService.getById(goodsId);
|
||||||
updateGoodsIndex(goods);
|
this.updateGoodsIndex(goods);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("生成商品索引事件执行异常,商品信息: " + new String(messageExt.getBody()), e);
|
log.error("生成商品索引事件执行异常,商品信息: " + new String(messageExt.getBody()), e);
|
||||||
}
|
}
|
||||||
@ -214,10 +214,7 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
|||||||
if (goodsById != null) {
|
if (goodsById != null) {
|
||||||
this.deleteGoods(goodsById);
|
this.deleteGoods(goodsById);
|
||||||
this.updateGoodsNum(goodsById);
|
this.updateGoodsNum(goodsById);
|
||||||
List<String> skuIdsByGoodsId = this.goodsSkuService.getSkuIdsByGoodsId(goodsId);
|
goodsIndexService.deleteIndex(MapUtil.builder(new HashMap<String, Object>()).put("goodsId", goodsId).build());
|
||||||
if (skuIdsByGoodsId != null && !skuIdsByGoodsId.isEmpty()) {
|
|
||||||
this.goodsIndexService.deleteIndexByIds(skuIdsByGoodsId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,6 +389,7 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
|||||||
esGoodsIndices.add(goodsIndex);
|
esGoodsIndices.add(goodsIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.goodsIndexService.deleteIndex(MapUtil.builder(new HashMap<String, Object>()).put("goodsId", goods.getId()).build());
|
||||||
this.goodsIndexService.addIndex(esGoodsIndices);
|
this.goodsIndexService.addIndex(esGoodsIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user