From acd84f2b4e9313bcacb5b1c0a4eeb4cd7c17e68e Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 9 Jan 2023 10:13:01 +0800 Subject: [PATCH] ... --- .../modules/fuse/dto/TbFuseResourceDTO.java | 13 ++-- .../fuse/entity/TbFuseResourceEntity.java | 14 ++-- .../fuse/service/impl/TbFuseServiceImpl.java | 71 +++++++++---------- .../main/resources/db/V8.9__fuse_add_col.sql | 2 + 4 files changed, 52 insertions(+), 48 deletions(-) create mode 100644 renren-admin/src/main/resources/db/V8.9__fuse_add_col.sql diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/dto/TbFuseResourceDTO.java b/renren-admin/src/main/java/io/renren/modules/fuse/dto/TbFuseResourceDTO.java index fe406604..5a4405fc 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/dto/TbFuseResourceDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/dto/TbFuseResourceDTO.java @@ -18,17 +18,20 @@ public class TbFuseResourceDTO { private Long id; @ApiModelProperty(value = "融合服务id") private Long fuseId; - @ApiModelProperty(value = "资源id") - private String resourceId; + // @ApiModelProperty(value = "资源id") +// private String resourceId; @ApiModelProperty(value = "资源挂载顺序") private String sequence; - @ApiModelProperty(value = "资源") - private Object resource; - @ApiModelProperty(value = "资源类型") + // @ApiModelProperty(value = "资源") +// private Object resource; + @ApiModelProperty(value = "资源类型一级分类") private String type; @ApiModelProperty(value = "部门名称") private String deptName; @ApiModelProperty(value = "资源名称") private String resourceName; + @ApiModelProperty(value = "资源类型次级分类") + private String typeSecond; + } diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/entity/TbFuseResourceEntity.java b/renren-admin/src/main/java/io/renren/modules/fuse/entity/TbFuseResourceEntity.java index b4614c39..91f8f9e7 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/entity/TbFuseResourceEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/entity/TbFuseResourceEntity.java @@ -17,17 +17,16 @@ import lombok.EqualsAndHashCode; @TableName("tb_fuse_resource") public class TbFuseResourceEntity { private static final long serialVersionUID = 1L; - @TableId private Long id; /** * 融合服务id */ private Long fuseId; - /** - * 资源id - */ - private String resourceId; +// /** +// * 资源id +// */ +// private String resourceId; /** * 顺序 */ @@ -36,7 +35,10 @@ public class TbFuseResourceEntity { * 资源类型 */ private String type; - + /** + * 资源类型次级 + */ + private String typeSecond; private String deptName; private String resourceName; } 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 402304e1..c0aeb241 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 @@ -21,7 +21,6 @@ import io.renren.modules.monitor.mapper.CameraChannelMapper; import io.renren.modules.resource.dataResource.AbstractDataResourceService; import io.renren.modules.resource.dataResource.DataResourceFactory; import io.renren.modules.resource.dto.GetDataResourceListDto; -import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resource.service.impl.ResourceServiceImpl; import io.renren.modules.resourceCollection.dao.ResourceCollectionDao; @@ -242,43 +241,41 @@ public class TbFuseServiceImpl extends CrudServiceImpl list = fuseResourceDao.selectList(wrapper); 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); - if (org.apache.commons.lang3.StringUtils.isNumeric(dto.getResourceId())) { - ResourceDTO resourceDTO = resourceService.get(Long.parseLong(dto.getResourceId())); - resourceDTO.setDeptName(sysDeptService.get(resourceDTO.getDeptId()).getName()); - dto.setResource(resourceDTO); - } - return dto; - }).collect(Collectors.toList())); - } else if ("数据资源".equals(type)) { - result.addAll(value.stream().map(attr -> { - TbFuseResourceDTO dto = new TbFuseResourceDTO(); - BeanUtils.copyProperties(attr, dto); - HashMap map = new HashMap<>(); - map.put("resourceName", attr.getResourceName()); - map.put("resourceId", attr.getResourceId()); - map.put("deptName", attr.getDeptName()); - map.put("type", attr.getType()); - dto.setResource(map); - return dto; - }).collect(Collectors.toList())); - } else if ("基础设施".equals(type)) { - result.addAll(value.stream().map(attr -> { - TbFuseResourceDTO dto = new TbFuseResourceDTO(); - BeanUtils.copyProperties(attr, dto); - dto.setResource(cameraChannelMapper.selectById(dto.getResourceId().toString())); - return dto; - }).collect(Collectors.toList())); - } - }); +// resourceMap.forEach((type, value) -> { +// if ("组件服务".equals(type)) { +// result.addAll(value.stream().map(attr -> { +// TbFuseResourceDTO dto = new TbFuseResourceDTO(); +// BeanUtils.copyProperties(attr, dto); +// if (org.apache.commons.lang3.StringUtils.isNumeric(dto.getResourceId())) { +// ResourceDTO resourceDTO = resourceService.get(Long.parseLong(dto.getResourceId())); +// resourceDTO.setDeptName(sysDeptService.get(resourceDTO.getDeptId()).getName()); +// dto.setResource(resourceDTO); +// } +// +// return dto; +// }).collect(Collectors.toList())); +// } else if ("数据资源".equals(type)) { +// result.addAll(value.stream().map(attr -> { +// TbFuseResourceDTO dto = new TbFuseResourceDTO(); +// BeanUtils.copyProperties(attr, dto); +// HashMap map = new HashMap<>(); +// map.put("resourceName", attr.getResourceName()); +// map.put("resourceId", attr.getResourceId()); +// map.put("deptName", attr.getDeptName()); +// map.put("type", attr.getType()); +// dto.setResource(map); +// return dto; +// }).collect(Collectors.toList())); +// } else if ("基础设施".equals(type)) { +// result.addAll(value.stream().map(attr -> { +// TbFuseResourceDTO dto = new TbFuseResourceDTO(); +// BeanUtils.copyProperties(attr, dto); +// dto.setResource(cameraChannelMapper.selectById(dto.getResourceId().toString())); +// return dto; +// }).collect(Collectors.toList())); +// } +// }); return result; } diff --git a/renren-admin/src/main/resources/db/V8.9__fuse_add_col.sql b/renren-admin/src/main/resources/db/V8.9__fuse_add_col.sql new file mode 100644 index 00000000..73b87025 --- /dev/null +++ b/renren-admin/src/main/resources/db/V8.9__fuse_add_col.sql @@ -0,0 +1,2 @@ +ALTER TABLE `tb_fuse_resource` ADD COLUMN `type_second` varchar(255) NULL COMMENT '次级资源类型'; +ALTER TABLE `tb_fuse_resource` DROP `resource_id`; \ No newline at end of file