Compare commits

...

2 Commits

Author SHA1 Message Date
wangliwen 4bfdfbb72d Merge branch 'dev' 2023-01-09 10:13:09 +08:00
wangliwen acd84f2b4e ... 2023-01-09 10:13:01 +08:00
4 changed files with 52 additions and 48 deletions

View File

@ -18,17 +18,20 @@ public class TbFuseResourceDTO {
private Long id; private Long id;
@ApiModelProperty(value = "融合服务id") @ApiModelProperty(value = "融合服务id")
private Long fuseId; private Long fuseId;
@ApiModelProperty(value = "资源id") // @ApiModelProperty(value = "资源id")
private String resourceId; // private String resourceId;
@ApiModelProperty(value = "资源挂载顺序") @ApiModelProperty(value = "资源挂载顺序")
private String sequence; private String sequence;
@ApiModelProperty(value = "资源") // @ApiModelProperty(value = "资源")
private Object resource; // private Object resource;
@ApiModelProperty(value = "资源类型") @ApiModelProperty(value = "资源类型一级分类")
private String type; private String type;
@ApiModelProperty(value = "部门名称") @ApiModelProperty(value = "部门名称")
private String deptName; private String deptName;
@ApiModelProperty(value = "资源名称") @ApiModelProperty(value = "资源名称")
private String resourceName; private String resourceName;
@ApiModelProperty(value = "资源类型次级分类")
private String typeSecond;
} }

View File

@ -17,17 +17,16 @@ import lombok.EqualsAndHashCode;
@TableName("tb_fuse_resource") @TableName("tb_fuse_resource")
public class TbFuseResourceEntity { public class TbFuseResourceEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId @TableId
private Long id; private Long id;
/** /**
* 融合服务id * 融合服务id
*/ */
private Long fuseId; private Long fuseId;
/** // /**
* 资源id // * 资源id
*/ // */
private String resourceId; // private String resourceId;
/** /**
* 顺序 * 顺序
*/ */
@ -36,7 +35,10 @@ public class TbFuseResourceEntity {
* 资源类型 * 资源类型
*/ */
private String type; private String type;
/**
* 资源类型次级
*/
private String typeSecond;
private String deptName; private String deptName;
private String resourceName; private String resourceName;
} }

View File

@ -21,7 +21,6 @@ import io.renren.modules.monitor.mapper.CameraChannelMapper;
import io.renren.modules.resource.dataResource.AbstractDataResourceService; import io.renren.modules.resource.dataResource.AbstractDataResourceService;
import io.renren.modules.resource.dataResource.DataResourceFactory; import io.renren.modules.resource.dataResource.DataResourceFactory;
import io.renren.modules.resource.dto.GetDataResourceListDto; 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.ResourceService;
import io.renren.modules.resource.service.impl.ResourceServiceImpl; import io.renren.modules.resource.service.impl.ResourceServiceImpl;
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao; import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
@ -242,43 +241,41 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
wrapper.eq("fuse_id", fuseId); wrapper.eq("fuse_id", fuseId);
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper); List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
Map<String, List<TbFuseResourceEntity>> resourceMap = list.stream().filter(index -> index.getType() != null).collect(Collectors.groupingBy(TbFuseResourceEntity::getType)); Map<String, List<TbFuseResourceEntity>> 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; // resourceMap.forEach((type, value) -> {
}).collect(Collectors.toList())); // if ("组件服务".equals(type)) {
} else if ("数据资源".equals(type)) { // result.addAll(value.stream().map(attr -> {
result.addAll(value.stream().map(attr -> { // TbFuseResourceDTO dto = new TbFuseResourceDTO();
TbFuseResourceDTO dto = new TbFuseResourceDTO(); // BeanUtils.copyProperties(attr, dto);
BeanUtils.copyProperties(attr, dto); // if (org.apache.commons.lang3.StringUtils.isNumeric(dto.getResourceId())) {
HashMap<Object, Object> map = new HashMap<>(); // ResourceDTO resourceDTO = resourceService.get(Long.parseLong(dto.getResourceId()));
map.put("resourceName", attr.getResourceName()); // resourceDTO.setDeptName(sysDeptService.get(resourceDTO.getDeptId()).getName());
map.put("resourceId", attr.getResourceId()); // dto.setResource(resourceDTO);
map.put("deptName", attr.getDeptName()); // }
map.put("type", attr.getType()); //
dto.setResource(map); // return dto;
return dto; // }).collect(Collectors.toList()));
}).collect(Collectors.toList())); // } else if ("数据资源".equals(type)) {
} else if ("基础设施".equals(type)) { // result.addAll(value.stream().map(attr -> {
result.addAll(value.stream().map(attr -> { // TbFuseResourceDTO dto = new TbFuseResourceDTO();
TbFuseResourceDTO dto = new TbFuseResourceDTO(); // BeanUtils.copyProperties(attr, dto);
BeanUtils.copyProperties(attr, dto); // HashMap<Object, Object> map = new HashMap<>();
dto.setResource(cameraChannelMapper.selectById(dto.getResourceId().toString())); // map.put("resourceName", attr.getResourceName());
return dto; // map.put("resourceId", attr.getResourceId());
}).collect(Collectors.toList())); // 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; return result;
} }

View File

@ -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`;