This commit is contained in:
dinggang 2022-08-12 17:21:35 +08:00
parent 81e13e7824
commit ce07b0ea32
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(); Map componentMap = new HashMap();
componentMap.put("title", "组件服务"); componentMap.put("title", "组件服务");
Map<String, List> map = new ConcurrentHashMap<>(); Map<String, List> map = new ConcurrentHashMap<>();
List<CompletableFuture> tasks = resourceTypeMap.get("组件服务").stream().map(it -> { CompletableFuture.allOf(resourceTypeMap.get("组件服务").stream().map(it -> CompletableFuture.runAsync(() -> selectAttrsByResourceId(Long.parseLong(it.get("id").toString())).stream().filter(temp -> "组件类型".equals(temp.getAttrType())).forEach(attr -> {
CompletableFuture task = CompletableFuture.runAsync(() -> { if (map.get(attr.getAttrValue()) != null) {
selectAttrsByResourceId(Long.parseLong(it.get("id").toString())).stream().filter(temp -> "组件类型".equals(temp.getAttrType())).forEach(attr -> { map.get(attr.getAttrValue()).add(it);
if (map.get(attr.getAttrValue()) != null) { } else {
map.get(attr.getAttrValue()).add(it); map.put(attr.getAttrValue(), (List) Collections.synchronizedList(new ArrayList() {{
} else { add(it);
map.put(attr.getAttrValue(), Collections.synchronizedList(new ArrayList() {{ }}));
add(it); }
}})); }), executor)).toArray(CompletableFuture[]::new)).join();
}
});
}, executor);
return task;
}).collect(Collectors.toList());
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
componentMap.put("children", map.entrySet().stream().map(it -> new HashMap() {{ componentMap.put("children", map.entrySet().stream().map(it -> new HashMap() {{
put("title", it.getKey()); put("title", it.getKey());
put("children", it.getValue()); put("children", it.getValue());