Merge branch 'dev'
This commit is contained in:
commit
4bfdfbb72d
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<TbFuseDao, TbFuseEntity,
|
|||
wrapper.eq("fuse_id", fuseId);
|
||||
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
|
||||
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;
|
||||
}).collect(Collectors.toList()));
|
||||
} else if ("数据资源".equals(type)) {
|
||||
result.addAll(value.stream().map(attr -> {
|
||||
TbFuseResourceDTO dto = new TbFuseResourceDTO();
|
||||
BeanUtils.copyProperties(attr, dto);
|
||||
HashMap<Object, Object> 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<Object, Object> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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`;
|
Loading…
Reference in New Issue