diff --git a/config/db/V4.3__fuse_drop_col.sql b/config/db/V4.3__fuse_drop_col.sql new file mode 100644 index 00000000..093b48bf --- /dev/null +++ b/config/db/V4.3__fuse_drop_col.sql @@ -0,0 +1,10 @@ +ALTER TABLE `tb_fuse` +MODIFY COLUMN `description` varchar(1000) DEFAULT NULL COMMENT '融合服务描述', +DROP COLUMN `dept_user`, +DROP COLUMN `mobile`, +DROP COLUMN `provider`, +DROP COLUMN `provider_user`, +DROP COLUMN `provider_mobile`; + +ALTER TABLE `tb_fuse_resource` +ADD COLUMN `type` varchar(128) NULL COMMENT '资源类型'; \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java b/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java index da0a3fa6..be37b1e0 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/controller/FuseController.java @@ -49,12 +49,7 @@ public class FuseController { @ApiImplicitParam(name = "description", value = "融合服务描述", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "type", value = "融合服务类型", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "applicationArea", value = "应用领域", paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "int"), - @ApiImplicitParam(name = "deptUser", value = "部门联系人", paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "mobile", value = "部门联系人电话", paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "provider", value = "服务商", paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "providerUser", value = "服务商联系人", paramType = "query", dataType = "String"), - @ApiImplicitParam(name = "providerMobile", value = "服务商联系人电话", paramType = "query", dataType = "String") + @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "int") }) public Result> page(@ApiIgnore @RequestParam Map params) { PageData page = tbFuseService.page(params); diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/dao/TbFuseDao.java b/renren-admin/src/main/java/io/renren/modules/fuse/dao/TbFuseDao.java index 6a3aa6f8..2336dca0 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/dao/TbFuseDao.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/dao/TbFuseDao.java @@ -18,6 +18,4 @@ public interface TbFuseDao extends BaseDao { List getFuseDTOList(Map params); - List> selectGroupByDeptId(); - } diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/dto/TbFuseDTO.java b/renren-admin/src/main/java/io/renren/modules/fuse/dto/TbFuseDTO.java index d1d84a05..66f23296 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/dto/TbFuseDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/dto/TbFuseDTO.java @@ -29,16 +29,6 @@ public class TbFuseDTO { private String applicationArea; @ApiModelProperty(value = "所属部门") private Long deptId; - @ApiModelProperty(value = "部门联系人") - private String deptUser; - @ApiModelProperty(value = "部门联系人电话") - private String mobile; - @ApiModelProperty(value = "服务商") - private String provider; - @ApiModelProperty(value = "服务商联系人") - private String providerUser; - @ApiModelProperty(value = "服务商联系人电话") - private String providerMobile; @ApiModelProperty(value = "创建人") private Long creator; @ApiModelProperty(value = "创建时间") 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 44f2e440..51e0be83 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 @@ -1,6 +1,5 @@ package io.renren.modules.fuse.dto; -import io.renren.modules.resource.dto.ResourceDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -24,6 +23,8 @@ public class TbFuseResourceDTO { @ApiModelProperty(value = "资源挂载顺序") private String sequence; @ApiModelProperty(value = "资源") - private ResourceDTO resource; + private Object resource; + @ApiModelProperty(value = "资源类型") + private String type; } diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/entity/TbFuseEntity.java b/renren-admin/src/main/java/io/renren/modules/fuse/entity/TbFuseEntity.java index 102799eb..beea7fc0 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/entity/TbFuseEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/entity/TbFuseEntity.java @@ -43,26 +43,6 @@ public class TbFuseEntity extends BaseEntity { */ @TableField(fill = FieldFill.INSERT) private Long deptId; - /** - * 部门联系人 - */ - private String deptUser; - /** - * 部门联系人电话 - */ - private String mobile; - /** - * 服务商 - */ - private String provider; - /** - * 服务商联系人 - */ - private String providerUser; - /** - * 服务商联系人电话 - */ - private String providerMobile; /** * 创建人 */ 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 d32186d8..f0cf9734 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 @@ -32,4 +32,8 @@ public class TbFuseResourceEntity { * 顺序 */ private String sequence; + /** + * 资源类型 + */ + private String type; } diff --git a/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java b/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java index bc872ee0..d731cc86 100644 --- a/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java +++ b/renren-admin/src/main/java/io/renren/modules/fuse/service/TbFuseService.java @@ -21,6 +21,4 @@ public interface TbFuseService extends CrudService { Integer deleteFuse(Long id); - Integer count(Map params); - } 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 79204729..99f1d749 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 @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import io.renren.common.constant.Constant; import io.renren.common.page.PageData; import io.renren.common.service.impl.CrudServiceImpl; +import io.renren.common.utils.Result; import io.renren.modules.fuse.dao.TbFuseAttrDao; import io.renren.modules.fuse.dao.TbFuseDao; import io.renren.modules.fuse.dao.TbFuseResourceDao; @@ -16,10 +17,16 @@ import io.renren.modules.fuse.entity.TbFuseAttrEntity; import io.renren.modules.fuse.entity.TbFuseEntity; import io.renren.modules.fuse.entity.TbFuseResourceEntity; import io.renren.modules.fuse.service.TbFuseService; +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; import io.renren.modules.security.user.SecurityUser; +import io.renren.modules.sys.service.SysDeptService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; @@ -50,6 +57,10 @@ public class TbFuseServiceImpl extends CrudServiceImpl getWrapper(Map params) { @@ -71,21 +82,6 @@ public class TbFuseServiceImpl extends CrudServiceImpl dtoList = baseDao.getFuseDTOList(params); + Map> dataResourceList=getDataResource(); dtoList.forEach(dto -> { - dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId())); + dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId(), dataResourceList)); dto.setFuseAttrList(getAttrByFuseId(dto.getId())); }); List result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); return new PageData(result, dtoList.size()); } - @Override - public Integer count(Map params) { - if (params != null) { - return baseDao.selectCount(getWrapper(params)); - } else { - return baseDao.selectCount(null); - } - } - @Override public TbFuseDTO getFuseById(Long id) { TbFuseEntity fuseEntity = fuseDao.selectById(id); @@ -141,7 +129,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl getFuseResourceByFuseId(Long fuseId) { + private Map> getDataResource() { + Map> result = new HashMap<>(); + Optional factory = DataResourceFactory.build(); + if (factory.isPresent()) { + GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(0).setPageSize(30); + Map dataMap = (Map) factory.get().getDataResource(dto); + if (dataMap != null) { + List> list = (List>) dataMap.get("data"); + list.stream().forEach(map -> { + if (map.containsKey("zyname")) { + result.put(map.get("guid").toString(), map); + } else { + result.put(map.get("serviceId").toString(), map); + } + }); + } + } + return result; + } + + private List getFuseResourceByFuseId(Long fuseId, Map> dataResourceMap) { + List result = new ArrayList(); QueryWrapper wrapper = new QueryWrapper(); wrapper.eq("fuse_id", fuseId); List list = fuseResourceDao.selectList(wrapper); - return list.stream().map(attr -> { - TbFuseResourceDTO dto = new TbFuseResourceDTO(); - BeanUtils.copyProperties(attr, dto); - dto.setResource(resourceService.get(dto.getResourceId())); - return dto; - }).collect(Collectors.toList()); + list.stream().collect(Collectors.groupingBy(TbFuseResourceEntity::getType)).forEach((type, value) -> { + if ("组件服务".equals(type)) { + result.addAll(value.stream().map(attr -> { + TbFuseResourceDTO dto = new TbFuseResourceDTO(); + BeanUtils.copyProperties(attr, dto); + ResourceDTO resourceDTO=resourceService.get(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); + dto.setResource(dataResourceMap.get(dto.getResourceId())); + 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; } @Override diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index 787ce2ad..4cb3304e 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -551,13 +551,6 @@ public class ResourceController { return new Result().ok(resourceService.selectInfrastructureList()); } - @GetMapping("/list") - @ApiOperation("能力查询") - @LogOperation("能力查询") - public Result list(@ApiIgnore @RequestParam Map params) { - return new Result<>().ok(resourceService.list(params)); - } - @GetMapping("/selectDevelopDoc") @ApiOperation("查询能力开发文档目录") @LogOperation("查询能力开发文档目录") diff --git a/renren-admin/src/main/resources/db/V4.3__fuse_drop_col.sql b/renren-admin/src/main/resources/db/V4.3__fuse_drop_col.sql new file mode 100644 index 00000000..093b48bf --- /dev/null +++ b/renren-admin/src/main/resources/db/V4.3__fuse_drop_col.sql @@ -0,0 +1,10 @@ +ALTER TABLE `tb_fuse` +MODIFY COLUMN `description` varchar(1000) DEFAULT NULL COMMENT '融合服务描述', +DROP COLUMN `dept_user`, +DROP COLUMN `mobile`, +DROP COLUMN `provider`, +DROP COLUMN `provider_user`, +DROP COLUMN `provider_mobile`; + +ALTER TABLE `tb_fuse_resource` +ADD COLUMN `type` varchar(128) NULL COMMENT '资源类型'; \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/fuse/TbFuseDao.xml b/renren-admin/src/main/resources/mapper/fuse/TbFuseDao.xml index aa4328e1..44f246cf 100644 --- a/renren-admin/src/main/resources/mapper/fuse/TbFuseDao.xml +++ b/renren-admin/src/main/resources/mapper/fuse/TbFuseDao.xml @@ -38,6 +38,9 @@ and deptId = #{deptId} + + and type = #{type} + and dept_user like concat('%', #{deptUser}, '%') @@ -69,17 +72,4 @@ ORDER BY ${orderField} ${orderType} - - \ No newline at end of file