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;