Compare commits

..

No commits in common. "c9a5332fdb617df7cd12c48f9f18d25873d46fc9" and "2a315cbbe678cac9982564c7da71c2988c697121" have entirely different histories.

4 changed files with 48 additions and 52 deletions

View File

@ -18,20 +18,17 @@ 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,16 +17,17 @@ 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;
/** /**
* 顺序 * 顺序
*/ */
@ -35,10 +36,7 @@ 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,6 +21,7 @@ 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;
@ -241,41 +242,43 @@ 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);
}
// resourceMap.forEach((type, value) -> { return dto;
// if ("组件服务".equals(type)) { }).collect(Collectors.toList()));
// result.addAll(value.stream().map(attr -> { } else if ("数据资源".equals(type)) {
// TbFuseResourceDTO dto = new TbFuseResourceDTO(); result.addAll(value.stream().map(attr -> {
// BeanUtils.copyProperties(attr, dto); TbFuseResourceDTO dto = new TbFuseResourceDTO();
// if (org.apache.commons.lang3.StringUtils.isNumeric(dto.getResourceId())) { BeanUtils.copyProperties(attr, dto);
// ResourceDTO resourceDTO = resourceService.get(Long.parseLong(dto.getResourceId())); HashMap<Object, Object> map = new HashMap<>();
// resourceDTO.setDeptName(sysDeptService.get(resourceDTO.getDeptId()).getName()); map.put("resourceName", attr.getResourceName());
// dto.setResource(resourceDTO); map.put("resourceId", attr.getResourceId());
// } map.put("deptName", attr.getDeptName());
// map.put("type", attr.getType());
// return dto; dto.setResource(map);
// }).collect(Collectors.toList())); return dto;
// } else if ("数据资源".equals(type)) { }).collect(Collectors.toList()));
// result.addAll(value.stream().map(attr -> { } else if ("基础设施".equals(type)) {
// TbFuseResourceDTO dto = new TbFuseResourceDTO(); result.addAll(value.stream().map(attr -> {
// BeanUtils.copyProperties(attr, dto); TbFuseResourceDTO dto = new TbFuseResourceDTO();
// HashMap<Object, Object> map = new HashMap<>(); BeanUtils.copyProperties(attr, dto);
// map.put("resourceName", attr.getResourceName()); dto.setResource(cameraChannelMapper.selectById(dto.getResourceId().toString()));
// map.put("resourceId", attr.getResourceId()); return dto;
// map.put("deptName", attr.getDeptName()); }).collect(Collectors.toList()));
// 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

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