From ce07b0ea32045f6cd74436502ab026a9e26384c1 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Fri, 12 Aug 2022 17:21:35 +0800 Subject: [PATCH] .. --- .../service/impl/ResourceServiceImpl.java | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 7c4ca376..4e84e4ac 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -1979,21 +1979,15 @@ public class ResourceServiceImpl extends CrudServiceImpl map = new ConcurrentHashMap<>(); - List 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());