From a01ecfc0fb40533bdc62160480dcd2e14ad20183 Mon Sep 17 00:00:00 2001 From: lizhicheng Date: Wed, 10 Aug 2022 19:43:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=9E=8D=E5=90=88=E6=9C=8D=E5=8A=A1=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fuse/service/impl/TbFuseServiceImpl.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java index 7f4f2c2e..76e82e2e 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/service/impl/TbFuseServiceImpl.java @@ -112,9 +112,8 @@ public class TbFuseServiceImpl extends CrudServiceImpl dtoList = baseDao.getFuseDTOList(params); - Map> dataResourceList=getDataResource(); dtoList.forEach(dto -> { - dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId(), dataResourceList)); + dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId())); dto.setFuseAttrList(getAttrByFuseId(dto.getId())); }); List result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); @@ -130,7 +129,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl getFuseResourceByFuseId(Long fuseId, Map> dataResourceMap) { + private List getFuseResourceByFuseId(Long fuseId) { + Map> dataResourceMap = new HashMap<>(); List result = new ArrayList(); QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("fuse_id", fuseId); List list = fuseResourceDao.selectList(wrapper); - list.stream().filter(index -> index.getType() != null).collect(Collectors.groupingBy(TbFuseResourceEntity::getType)).forEach((type, value) -> { + Map> resourceMap = list.stream().filter(index -> index.getType() != null).collect(Collectors.groupingBy(TbFuseResourceEntity::getType)); + if (resourceMap.containsKey("数据资源")) { + dataResourceMap.putAll(getDataResource()); + } + resourceMap.forEach((type, value) -> { if ("组件服务".equals(type)) { result.addAll(value.stream().map(attr -> { TbFuseResourceDTO dto = new TbFuseResourceDTO(); BeanUtils.copyProperties(attr, dto); - ResourceDTO resourceDTO=resourceService.get(dto.getResourceId()); + ResourceDTO resourceDTO = resourceService.get(dto.getResourceId()); resourceDTO.setDeptName(sysDeptService.get(resourceDTO.getDeptId()).getName()); dto.setResource(resourceDTO); return dto;