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 601726c8..6029998a 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))); } /**