|
|
|
@ -41,7 +41,7 @@ public class IHomeServiceImpl implements IHomeService {
|
|
|
|
|
private RedisCache redisCache;
|
|
|
|
|
private RedisTemplate<String, Object> redisTemplate;
|
|
|
|
|
private IDiamondService iDiamondService;
|
|
|
|
|
private ThreadPoolTaskExecutor homeThreadPoolTaskExecutor;
|
|
|
|
|
private ThreadPoolTaskExecutor commonThreadPoolTaskExecutor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -60,7 +60,7 @@ public class IHomeServiceImpl implements IHomeService {
|
|
|
|
|
}
|
|
|
|
|
List<CompletableFuture<Void>> list = new ArrayList<>(4);
|
|
|
|
|
CompletableFuture<Void> f1 = CompletableFuture.supplyAsync(
|
|
|
|
|
() -> iBannerService.list(Wrappers.lambdaQuery(Banner.class).eq(Banner::getStatus, 0).orderByAsc(Banner::getSort)), homeThreadPoolTaskExecutor)
|
|
|
|
|
() -> iBannerService.list(Wrappers.lambdaQuery(Banner.class).eq(Banner::getStatus, 0).orderByAsc(Banner::getSort)), commonThreadPoolTaskExecutor)
|
|
|
|
|
.thenAccept(data -> {
|
|
|
|
|
String key = "bannerList";
|
|
|
|
|
redisCache.setCacheMapValue(SHOP_HOME_INDEX_HASH, key, data);
|
|
|
|
@ -68,7 +68,7 @@ public class IHomeServiceImpl implements IHomeService {
|
|
|
|
|
success.add(key, data);
|
|
|
|
|
});
|
|
|
|
|
CompletableFuture<Void> f2 = CompletableFuture.supplyAsync(
|
|
|
|
|
() -> iDiamondService.list(Wrappers.lambdaQuery(Diamond.class).orderByAsc(Diamond::getSort).last("limit 10")), homeThreadPoolTaskExecutor)
|
|
|
|
|
() -> iDiamondService.list(Wrappers.lambdaQuery(Diamond.class).orderByAsc(Diamond::getSort).last("limit 10")), commonThreadPoolTaskExecutor)
|
|
|
|
|
.thenAccept(data -> {
|
|
|
|
|
String key = "categoryList";
|
|
|
|
|
redisCache.setCacheMapValue(SHOP_HOME_INDEX_HASH, key, data);
|
|
|
|
@ -76,7 +76,7 @@ public class IHomeServiceImpl implements IHomeService {
|
|
|
|
|
success.add(key, data);
|
|
|
|
|
});
|
|
|
|
|
CompletableFuture<Void> f3 = CompletableFuture.supplyAsync(
|
|
|
|
|
() -> iGoodsService.selectHomeIndexGoods(Goods.builder().isNew(true).build()), homeThreadPoolTaskExecutor)
|
|
|
|
|
() -> iGoodsService.selectHomeIndexGoods(Goods.builder().isNew(true).build()), commonThreadPoolTaskExecutor)
|
|
|
|
|
.thenAccept(data -> {
|
|
|
|
|
String key = "newGoodsList";
|
|
|
|
|
redisCache.setCacheMapValue(SHOP_HOME_INDEX_HASH, key, data);
|
|
|
|
@ -84,7 +84,7 @@ public class IHomeServiceImpl implements IHomeService {
|
|
|
|
|
success.add(key, data);
|
|
|
|
|
});
|
|
|
|
|
CompletableFuture<Void> f4 = CompletableFuture.supplyAsync(
|
|
|
|
|
() -> iGoodsService.selectHomeIndexGoods(Goods.builder().isHot(true).build()), homeThreadPoolTaskExecutor)
|
|
|
|
|
() -> iGoodsService.selectHomeIndexGoods(Goods.builder().isHot(true).build()), commonThreadPoolTaskExecutor)
|
|
|
|
|
.thenAccept(data -> {
|
|
|
|
|
String key = "hotGoodsList";
|
|
|
|
|
redisCache.setCacheMapValue(SHOP_HOME_INDEX_HASH, key, data);
|
|
|
|
|