From 7a2c45ddb5fc2f986dbf462cd3c5aa3e91fc359c Mon Sep 17 00:00:00 2001 From: paulGao Date: Sat, 8 Oct 2022 11:51:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=95=86=E5=93=81?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=97=B6=EF=BC=8C=E6=9B=B4=E6=96=B0es?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lili/listener/GoodsMessageListener.java | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java b/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java index 1f6a98bd..fac6d784 100644 --- a/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java +++ b/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java @@ -294,32 +294,9 @@ public class GoodsMessageListener implements RocketMQListener { * @param goodsList 商品列表消息 */ private void updateGoodsIndex(List goodsList) { - List goodsIndices = new ArrayList<>(); for (Goods goods : goodsList) { - //如果商品通过审核&&并且已上架 - GoodsSearchParams searchParams = new GoodsSearchParams(); - searchParams.setGoodsId(goods.getId()); - searchParams.setGeQuantity(0); - List goodsSkuList = this.goodsSkuService.getGoodsSkuByList(searchParams); - if (goods.getAuthFlag().equals(GoodsAuthEnum.PASS.name()) - && goods.getMarketEnable().equals(GoodsStatusEnum.UPPER.name()) - && Boolean.FALSE.equals(goods.getDeleteFlag())) { - goodsSkuList.forEach(goodsSku -> { - EsGoodsIndex goodsIndex = this.settingUpGoodsIndexData(goods, goodsSku); - goodsIndices.add(goodsIndex); - }); - } - //如果商品状态值不支持es搜索,那么将商品信息做下架处理 - else { - for (GoodsSku goodsSku : goodsSkuList) { - EsGoodsIndex esGoodsOld = goodsIndexService.findById(goodsSku.getId()); - if (esGoodsOld != null) { - goodsIndexService.deleteIndexById(goodsSku.getId()); - } - } - } + this.updateGoodsIndex(goods); } - goodsIndexService.addIndex(goodsIndices); }