Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop into pg

This commit is contained in:
misworga831 2023-09-14 17:04:46 +08:00
commit 49af6777ee
3 changed files with 14 additions and 8 deletions

View File

@ -23,7 +23,8 @@ public class ThreadPoolUtil {
* 线程缓冲队列 * 线程缓冲队列
*/ */
private static final BlockingQueue<Runnable> BQUEUE = new ArrayBlockingQueue<Runnable>(100); private static final BlockingQueue<Runnable> BQUEUE = new ArrayBlockingQueue<Runnable>(100);
private static final ThreadPoolExecutor POOL = new ThreadPoolExecutor(SIZE_CORE_POOL, SIZE_MAX_POOL, ALIVE_TIME, TimeUnit.MILLISECONDS, BQUEUE, new ThreadPoolExecutor.CallerRunsPolicy()); private static final ThreadPoolExecutor POOL = new ThreadPoolExecutor(SIZE_CORE_POOL, SIZE_MAX_POOL, ALIVE_TIME, TimeUnit.MILLISECONDS, BQUEUE,
new ThreadPoolExecutor.CallerRunsPolicy());
/** /**
* volatile禁止指令重排 * volatile禁止指令重排
*/ */
@ -34,7 +35,7 @@ public class ThreadPoolUtil {
} }
/** /**
* 无返回值直接执行, 管他娘的 * 执行方法
* *
* @param runnable * @param runnable
*/ */
@ -43,7 +44,7 @@ public class ThreadPoolUtil {
} }
/** /**
* 返回值直接执行, 管他娘的 * 提交返回值
* *
* @param callable * @param callable
*/ */

View File

@ -101,7 +101,7 @@ public class GoodsGalleryServiceImpl extends ServiceImpl<GoodsGalleryMapper, Goo
switch (OssEnum.valueOf(ossSetting.getType())) { switch (OssEnum.valueOf(ossSetting.getType())) {
case MINIO: case MINIO:
//缩略图全路径 //缩略图全路径
return url + "?x-oss-process=style/" + width + "X" + height; return url;
case ALI_OSS: case ALI_OSS:
//缩略图全路径 //缩略图全路径
return url + "?x-oss-process=style/" + width + "X" + height; return url + "?x-oss-process=style/" + width + "X" + height;

View File

@ -56,6 +56,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 商品业务层实现 * 商品业务层实现
@ -426,7 +427,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
LambdaUpdateWrapper<Goods> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); LambdaUpdateWrapper<Goods> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
lambdaUpdateWrapper.set(Goods::getTemplateId, templateId); lambdaUpdateWrapper.set(Goods::getTemplateId, templateId);
lambdaUpdateWrapper.in(Goods::getId, goodsIds); lambdaUpdateWrapper.in(Goods::getId, goodsIds);
cache.multiDel(goodsIds); List<String> goodsCache = goodsIds.stream().map(item -> CachePrefix.GOODS.getPrefix() + item).collect(Collectors.toList());
cache.multiDel(goodsCache);
return this.update(lambdaUpdateWrapper); return this.update(lambdaUpdateWrapper);
} }
@ -548,7 +550,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
if (!GoodsStatusEnum.UPPER.name().equals(goods.getMarketEnable()) || !GoodsAuthEnum.PASS.name().equals(goods.getAuthFlag())) { if (!GoodsStatusEnum.UPPER.name().equals(goods.getMarketEnable()) || !GoodsAuthEnum.PASS.name().equals(goods.getAuthFlag())) {
return; 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<GoodsMapper, Goods> implements
*/ */
@Transactional @Transactional
public void updateEsGoods(List<String> goodsIds) { public void updateEsGoods(List<String> 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<GoodsMapper, Goods> implements
*/ */
@Transactional @Transactional
public void deleteEsGoods(List<String> goodsIds) { public void deleteEsGoods(List<String> 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)));
} }
/** /**