From 459a736ebcc4a7e3161d56e083caf34af9a8e3ee Mon Sep 17 00:00:00 2001 From: paulGao Date: Tue, 11 Jan 2022 12:10:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=86=E5=93=81=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E5=92=8C=E7=BC=96=E8=BE=91=E5=95=86=E5=93=81=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1=E5=AF=B9es=E6=93=8D=E4=BD=9C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/lili/listener/GoodsMessageListener.java | 1 + .../lili/modules/goods/serviceimpl/GoodsServiceImpl.java | 8 ++++---- .../modules/goods/serviceimpl/GoodsSkuServiceImpl.java | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java b/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java index 053ffcd2..4b9f3053 100644 --- a/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java +++ b/consumer/src/main/java/cn/lili/listener/GoodsMessageListener.java @@ -188,6 +188,7 @@ public class GoodsMessageListener implements RocketMQListener { case GOODS_AUDIT: Goods goods = JSONUtil.toBean(new String(messageExt.getBody()), Goods.class); updateGoodsNum(goods); + updateGoodsIndex(goods); break; //删除商品 case GOODS_DELETE: diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index 683bf93b..b52dba6e 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -54,10 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; +import java.util.*; /** * 商品业务层实现 @@ -197,6 +194,9 @@ public class GoodsServiceImpl extends ServiceImpl implements if (goodsOperationDTO.getGoodsGalleryList() != null && !goodsOperationDTO.getGoodsGalleryList().isEmpty()) { this.goodsGalleryService.add(goodsOperationDTO.getGoodsGalleryList(), goods.getId()); } + if (GoodsAuthEnum.TOBEAUDITED.name().equals(goods.getAuthFlag())) { + this.deleteEsGoods(Collections.singletonList(goodsId)); + } cache.remove(CachePrefix.GOODS.getPrefix() + goodsId); } diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java index ded1bd6a..0badc920 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsSkuServiceImpl.java @@ -172,7 +172,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl i this.updateBatchById(newSkuList); } this.updateStock(newSkuList); - if (!newSkuList.isEmpty()) { + if (GoodsAuthEnum.PASS.name().equals(goods.getAuthFlag()) && !newSkuList.isEmpty()) { generateEs(goods); } }