Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-08-12 17:22:24 +08:00
commit f33f32161e
1 changed files with 9 additions and 15 deletions

View File

@ -1979,21 +1979,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Map componentMap = new HashMap();
componentMap.put("title", "组件服务");
Map<String, List> map = new ConcurrentHashMap<>();
List<CompletableFuture> tasks = resourceTypeMap.get("组件服务").stream().map(it -> {
CompletableFuture task = CompletableFuture.runAsync(() -> {
selectAttrsByResourceId(Long.parseLong(it.get("id").toString())).stream().filter(temp -> "组件类型".equals(temp.getAttrType())).forEach(attr -> {
if (map.get(attr.getAttrValue()) != null) {
map.get(attr.getAttrValue()).add(it);
} else {
map.put(attr.getAttrValue(), Collections.synchronizedList(new ArrayList() {{
add(it);
}}));
}
});
}, executor);
return task;
}).collect(Collectors.toList());
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
CompletableFuture.allOf(resourceTypeMap.get("组件服务").stream().map(it -> CompletableFuture.runAsync(() -> selectAttrsByResourceId(Long.parseLong(it.get("id").toString())).stream().filter(temp -> "组件类型".equals(temp.getAttrType())).forEach(attr -> {
if (map.get(attr.getAttrValue()) != null) {
map.get(attr.getAttrValue()).add(it);
} else {
map.put(attr.getAttrValue(), (List) Collections.synchronizedList(new ArrayList() {{
add(it);
}}));
}
}), executor)).toArray(CompletableFuture[]::new)).join();
componentMap.put("children", map.entrySet().stream().map(it -> new HashMap() {{
put("title", it.getKey());
put("children", it.getValue());