From ebb48c7d0fc32b4c1d26326a94e65712f903486e Mon Sep 17 00:00:00 2001 From: Chopper711 Date: Tue, 29 Aug 2023 16:00:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=95=86=E5=93=81=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=89=A9=E6=B5=81=E6=A8=A1=E6=9D=BF=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=88=A0=E9=99=A4=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/goods/serviceimpl/GoodsServiceImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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 601726c80..6029998aa 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 @@ -56,6 +56,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; /** * 商品业务层实现 @@ -426,7 +427,8 @@ public class GoodsServiceImpl extends ServiceImpl implements LambdaUpdateWrapper lambdaUpdateWrapper = Wrappers.lambdaUpdate(); lambdaUpdateWrapper.set(Goods::getTemplateId, templateId); lambdaUpdateWrapper.in(Goods::getId, goodsIds); - cache.multiDel(goodsIds); + List goodsCache = goodsIds.stream().map(item -> CachePrefix.GOODS.getPrefix() + item).collect(Collectors.toList()); + cache.multiDel(goodsCache); return this.update(lambdaUpdateWrapper); } @@ -548,7 +550,8 @@ public class GoodsServiceImpl extends ServiceImpl implements if (!GoodsStatusEnum.UPPER.name().equals(goods.getMarketEnable()) || !GoodsAuthEnum.PASS.name().equals(goods.getAuthFlag())) { return; } - applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("生成商品", rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.GENERATOR_GOODS_INDEX.name(), goods.getId())); + applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("生成商品", rocketmqCustomProperties.getGoodsTopic(), + GoodsTagsEnum.GENERATOR_GOODS_INDEX.name(), goods.getId())); } /** @@ -558,7 +561,8 @@ public class GoodsServiceImpl extends ServiceImpl implements */ @Transactional public void updateEsGoods(List goodsIds) { - applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("更新商品", rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.UPDATE_GOODS_INDEX.name(), goodsIds)); + applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("更新商品", rocketmqCustomProperties.getGoodsTopic(), + GoodsTagsEnum.UPDATE_GOODS_INDEX.name(), goodsIds)); } /** @@ -568,7 +572,8 @@ public class GoodsServiceImpl extends ServiceImpl implements */ @Transactional public void deleteEsGoods(List goodsIds) { - applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("删除商品", rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.GOODS_DELETE.name(), JSONUtil.toJsonStr(goodsIds))); + applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("删除商品", rocketmqCustomProperties.getGoodsTopic(), + GoodsTagsEnum.GOODS_DELETE.name(), JSONUtil.toJsonStr(goodsIds))); } /**