Commit aedca692 by guiq

feat: [none] 编辑端首页热门应用列表过滤工具型APP

parent 345f928d
......@@ -6654,25 +6654,25 @@ public class BookGroupBizImpl implements BookGroupBiz {
return counts.stream().filter(x -> Objects.nonNull(x) && Objects.nonNull(x.getTypeCode()))
.collect(Collectors.toMap(AppTypeUseCount::getTypeCode, t -> t));
});
CompletableFuture<Map<String, Integer>> bookCount = CompletableFuture.supplyAsync(() -> {
List<HotAppDTO> hotAppDTOS = Optional.ofNullable(bookGroupDao.listHotApp()).orElse(new ArrayList<>());
return hotAppDTOS.stream().filter(x -> Objects.nonNull(x) && Objects.nonNull(x.getTypeCode()))
.collect(Collectors.toMap(HotAppDTO::getTypeCode, HotAppDTO::getCount));
});
CompletableFuture<Map<String, Integer>> bookIncrement = CompletableFuture.supplyAsync(() -> {
List<HotAppDTO> hotAppDTOS = Optional.ofNullable(bookGroupDao.listHotAppIncrement()).orElse(new ArrayList<>());
return hotAppDTOS.stream().filter(x -> Objects.nonNull(x) && Objects.nonNull(x.getTypeCode()))
.collect(Collectors.toMap(HotAppDTO::getTypeCode, HotAppDTO::getIncrement));
});
// CompletableFuture<Map<String, Integer>> bookCount = CompletableFuture.supplyAsync(() -> {
// List<HotAppDTO> hotAppDTOS = Optional.ofNullable(bookGroupDao.listHotApp()).orElse(new ArrayList<>());
// return hotAppDTOS.stream().filter(x -> Objects.nonNull(x) && Objects.nonNull(x.getTypeCode()))
// .collect(Collectors.toMap(HotAppDTO::getTypeCode, HotAppDTO::getCount));
// });
// CompletableFuture<Map<String, Integer>> bookIncrement = CompletableFuture.supplyAsync(() -> {
// List<HotAppDTO> hotAppDTOS = Optional.ofNullable(bookGroupDao.listHotAppIncrement()).orElse(new ArrayList<>());
// return hotAppDTOS.stream().filter(x -> Objects.nonNull(x) && Objects.nonNull(x.getTypeCode()))
// .collect(Collectors.toMap(HotAppDTO::getTypeCode, HotAppDTO::getIncrement));
// });
CompletableFuture<Map<String, AppTypeDto>> appInfo = CompletableFuture.supplyAsync(() -> appConsr.listAllCode());
// 聚合
CompletableFuture<Void> completableFuture = CompletableFuture.allOf(channel, bookCount, bookIncrement, appInfo);
CompletableFuture<Void> completableFuture = CompletableFuture.allOf(channel, /*bookCount, bookIncrement,*/ appInfo);
try {
completableFuture.get();
Map<String, AppTypeUseCount> channelMap = Optional.ofNullable(channel.get()).orElse(new HashMap<>());
Map<String, Integer> bookCountMap = Optional.ofNullable(bookCount.get()).orElse(new HashMap<>());
Map<String, Integer> bookIncrementMap = Optional.ofNullable(bookIncrement.get()).orElse(new HashMap<>());
// Map<String, Integer> bookCountMap = Optional.ofNullable(bookCount.get()).orElse(new HashMap<>());
// Map<String, Integer> bookIncrementMap = Optional.ofNullable(bookIncrement.get()).orElse(new HashMap<>());
Map<String, AppTypeDto> appInfoMap = Optional.ofNullable(appInfo.get()).orElse(new HashMap<>());
List<HotAppDTO> hotAppDTOS = new ArrayList<>();
......@@ -6684,15 +6684,15 @@ public class BookGroupBizImpl implements BookGroupBiz {
hotAppDTO.setTypeName(Optional.ofNullable(appInfoMap.get(key)).map(AppTypeDto::getTypeName).orElse(""));
hotAppDTO.setTypeCode(key);
hotAppDTO.setCount(
Optional.ofNullable(channelMap.get(key)).map(AppTypeUseCount::getCount).orElse(0) +
Optional.ofNullable(bookCountMap.get(key)).orElse(0)
Optional.ofNullable(channelMap.get(key)).map(AppTypeUseCount::getCount).orElse(0)
// + Optional.ofNullable(bookCountMap.get(key)).orElse(0)
);
if (hasOldData){
hotAppDTO.setIncrement(hotAppDTO.getCount() - Optional.ofNullable(oldMap.get(key)).orElse(0));
}else {
hotAppDTO.setIncrement(
Optional.ofNullable(channelMap.get(key)).map(AppTypeUseCount::getIncrement).orElse(0) +
Optional.ofNullable(bookIncrementMap.get(key)).orElse(0)
Optional.ofNullable(channelMap.get(key)).map(AppTypeUseCount::getIncrement).orElse(0)
// + Optional.ofNullable(bookIncrementMap.get(key)).orElse(0)
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment