Compare commits
No commits in common. "4bfdfbb72d8d952465b00e71cbefd7a7110bf803" and "5a88fb6847ff273c56bc244df81e7164dbe3b04c" have entirely different histories.
4bfdfbb72d
...
5a88fb6847
|
@ -18,20 +18,17 @@ 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,16 +17,17 @@ 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;
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
|
@ -35,10 +36,7 @@ public class TbFuseResourceEntity {
|
|||
* 资源类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 资源类型次级
|
||||
*/
|
||||
private String typeSecond;
|
||||
|
||||
private String deptName;
|
||||
private String resourceName;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ 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;
|
||||
|
@ -241,41 +242,43 @@ 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);
|
||||
}
|
||||
|
||||
// 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 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
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