融合服务完善
This commit is contained in:
parent
79807f44e2
commit
b525a1d50a
|
@ -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 '资源类型';
|
|
@ -49,12 +49,7 @@ public class FuseController {
|
||||||
@ApiImplicitParam(name = "description", value = "融合服务描述", paramType = "query", dataType = "String"),
|
@ApiImplicitParam(name = "description", value = "融合服务描述", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "type", value = "融合服务类型", paramType = "query", dataType = "String"),
|
@ApiImplicitParam(name = "type", value = "融合服务类型", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "applicationArea", value = "应用领域", paramType = "query", dataType = "String"),
|
@ApiImplicitParam(name = "applicationArea", value = "应用领域", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "int"),
|
@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")
|
|
||||||
})
|
})
|
||||||
public Result<PageData<TbFuseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
|
public Result<PageData<TbFuseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
PageData<TbFuseDTO> page = tbFuseService.page(params);
|
PageData<TbFuseDTO> page = tbFuseService.page(params);
|
||||||
|
|
|
@ -18,6 +18,4 @@ public interface TbFuseDao extends BaseDao<TbFuseEntity> {
|
||||||
|
|
||||||
List<TbFuseDTO> getFuseDTOList(Map params);
|
List<TbFuseDTO> getFuseDTOList(Map params);
|
||||||
|
|
||||||
List<Map<String, Object>> selectGroupByDeptId();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,16 +29,6 @@ public class TbFuseDTO {
|
||||||
private String applicationArea;
|
private String applicationArea;
|
||||||
@ApiModelProperty(value = "所属部门")
|
@ApiModelProperty(value = "所属部门")
|
||||||
private Long deptId;
|
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 = "创建人")
|
@ApiModelProperty(value = "创建人")
|
||||||
private Long creator;
|
private Long creator;
|
||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package io.renren.modules.fuse.dto;
|
package io.renren.modules.fuse.dto;
|
||||||
|
|
||||||
import io.renren.modules.resource.dto.ResourceDTO;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -24,6 +23,8 @@ public class TbFuseResourceDTO {
|
||||||
@ApiModelProperty(value = "资源挂载顺序")
|
@ApiModelProperty(value = "资源挂载顺序")
|
||||||
private String sequence;
|
private String sequence;
|
||||||
@ApiModelProperty(value = "资源")
|
@ApiModelProperty(value = "资源")
|
||||||
private ResourceDTO resource;
|
private Object resource;
|
||||||
|
@ApiModelProperty(value = "资源类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,26 +43,6 @@ public class TbFuseEntity extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
/**
|
|
||||||
* 部门联系人
|
|
||||||
*/
|
|
||||||
private String deptUser;
|
|
||||||
/**
|
|
||||||
* 部门联系人电话
|
|
||||||
*/
|
|
||||||
private String mobile;
|
|
||||||
/**
|
|
||||||
* 服务商
|
|
||||||
*/
|
|
||||||
private String provider;
|
|
||||||
/**
|
|
||||||
* 服务商联系人
|
|
||||||
*/
|
|
||||||
private String providerUser;
|
|
||||||
/**
|
|
||||||
* 服务商联系人电话
|
|
||||||
*/
|
|
||||||
private String providerMobile;
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,4 +32,8 @@ public class TbFuseResourceEntity {
|
||||||
* 顺序
|
* 顺序
|
||||||
*/
|
*/
|
||||||
private String sequence;
|
private String sequence;
|
||||||
|
/**
|
||||||
|
* 资源类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,4 @@ public interface TbFuseService extends CrudService<TbFuseEntity, TbFuseDTO> {
|
||||||
|
|
||||||
Integer deleteFuse(Long id);
|
Integer deleteFuse(Long id);
|
||||||
|
|
||||||
Integer count(Map<String, Object> params);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import io.renren.common.constant.Constant;
|
import io.renren.common.constant.Constant;
|
||||||
import io.renren.common.page.PageData;
|
import io.renren.common.page.PageData;
|
||||||
import io.renren.common.service.impl.CrudServiceImpl;
|
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.TbFuseAttrDao;
|
||||||
import io.renren.modules.fuse.dao.TbFuseDao;
|
import io.renren.modules.fuse.dao.TbFuseDao;
|
||||||
import io.renren.modules.fuse.dao.TbFuseResourceDao;
|
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.TbFuseEntity;
|
||||||
import io.renren.modules.fuse.entity.TbFuseResourceEntity;
|
import io.renren.modules.fuse.entity.TbFuseResourceEntity;
|
||||||
import io.renren.modules.fuse.service.TbFuseService;
|
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.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;
|
||||||
import io.renren.modules.security.user.SecurityUser;
|
import io.renren.modules.security.user.SecurityUser;
|
||||||
|
import io.renren.modules.sys.service.SysDeptService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
@ -50,6 +57,10 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
private ResourceService resourceService;
|
private ResourceService resourceService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResourceCollectionDao resourceCollectionDao;
|
private ResourceCollectionDao resourceCollectionDao;
|
||||||
|
@Autowired
|
||||||
|
private CameraChannelMapper cameraChannelMapper;
|
||||||
|
@Autowired
|
||||||
|
private SysDeptService sysDeptService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper<TbFuseEntity> getWrapper(Map<String, Object> params) {
|
public QueryWrapper<TbFuseEntity> getWrapper(Map<String, Object> params) {
|
||||||
|
@ -71,21 +82,6 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
case "deptId":
|
case "deptId":
|
||||||
wrapper.eq(StringUtils.isNotBlank(params.get("deptId").toString()), "dept_id", params.get("deptId").toString());
|
wrapper.eq(StringUtils.isNotBlank(params.get("deptId").toString()), "dept_id", params.get("deptId").toString());
|
||||||
break;
|
break;
|
||||||
case "deptUser":
|
|
||||||
wrapper.like(StringUtils.isNotBlank(params.get("deptUser").toString()), "dept_user", params.get("deptUser").toString());
|
|
||||||
break;
|
|
||||||
case "mobile":
|
|
||||||
wrapper.like(StringUtils.isNotBlank(params.get("mobile").toString()), "mobile", params.get("mobile").toString());
|
|
||||||
break;
|
|
||||||
case "provider":
|
|
||||||
wrapper.like(StringUtils.isNotBlank(params.get("provider").toString()), "provider", params.get("provider").toString());
|
|
||||||
break;
|
|
||||||
case "providerUser":
|
|
||||||
wrapper.like(StringUtils.isNotBlank(params.get("providerUser").toString()), "provider_user", params.get("providerUser").toString());
|
|
||||||
break;
|
|
||||||
case "providerMobile":
|
|
||||||
wrapper.like(StringUtils.isNotBlank(params.get("providerMobile").toString()), "provider_mobile", params.get("providerMobile").toString());
|
|
||||||
break;
|
|
||||||
case "creator":
|
case "creator":
|
||||||
wrapper.eq(StringUtils.isNotBlank(params.get("creator").toString()), "creator", params.get("creator").toString());
|
wrapper.eq(StringUtils.isNotBlank(params.get("creator").toString()), "creator", params.get("creator").toString());
|
||||||
break;
|
break;
|
||||||
|
@ -115,23 +111,15 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
}
|
}
|
||||||
params.put("userId", SecurityUser.getUserId());
|
params.put("userId", SecurityUser.getUserId());
|
||||||
List<TbFuseDTO> dtoList = baseDao.getFuseDTOList(params);
|
List<TbFuseDTO> dtoList = baseDao.getFuseDTOList(params);
|
||||||
|
Map<String, Map<String, Object>> dataResourceList=getDataResource();
|
||||||
dtoList.forEach(dto -> {
|
dtoList.forEach(dto -> {
|
||||||
dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId()));
|
dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId(), dataResourceList));
|
||||||
dto.setFuseAttrList(getAttrByFuseId(dto.getId()));
|
dto.setFuseAttrList(getAttrByFuseId(dto.getId()));
|
||||||
});
|
});
|
||||||
List<TbFuseDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
|
List<TbFuseDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
|
||||||
return new PageData(result, dtoList.size());
|
return new PageData(result, dtoList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer count(Map<String, Object> params) {
|
|
||||||
if (params != null) {
|
|
||||||
return baseDao.selectCount(getWrapper(params));
|
|
||||||
} else {
|
|
||||||
return baseDao.selectCount(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TbFuseDTO getFuseById(Long id) {
|
public TbFuseDTO getFuseById(Long id) {
|
||||||
TbFuseEntity fuseEntity = fuseDao.selectById(id);
|
TbFuseEntity fuseEntity = fuseDao.selectById(id);
|
||||||
|
@ -141,7 +129,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
TbFuseDTO fuseDTO = new TbFuseDTO();
|
TbFuseDTO fuseDTO = new TbFuseDTO();
|
||||||
BeanUtils.copyProperties(fuseEntity, fuseDTO);
|
BeanUtils.copyProperties(fuseEntity, fuseDTO);
|
||||||
fuseDTO.setFuseAttrList(getAttrByFuseId(id));
|
fuseDTO.setFuseAttrList(getAttrByFuseId(id));
|
||||||
fuseDTO.setFuseResourceList(getFuseResourceByFuseId(id));
|
fuseDTO.setFuseResourceList(getFuseResourceByFuseId(id, getDataResource()));
|
||||||
setCollection(fuseDTO);
|
setCollection(fuseDTO);
|
||||||
return fuseDTO;
|
return fuseDTO;
|
||||||
}
|
}
|
||||||
|
@ -166,16 +154,58 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TbFuseResourceDTO> getFuseResourceByFuseId(Long fuseId) {
|
private Map<String, Map<String, Object>> getDataResource() {
|
||||||
|
Map<String, Map<String, Object>> result = new HashMap<>();
|
||||||
|
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
|
||||||
|
if (factory.isPresent()) {
|
||||||
|
GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(0).setPageSize(30);
|
||||||
|
Map<String, Object> dataMap = (Map<String, Object>) factory.get().getDataResource(dto);
|
||||||
|
if (dataMap != null) {
|
||||||
|
List<Map<String, Object>> list = (List<Map<String, Object>>) 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<TbFuseResourceDTO> getFuseResourceByFuseId(Long fuseId, Map<String, Map<String, Object>> dataResourceMap) {
|
||||||
|
List<TbFuseResourceDTO> result = new ArrayList();
|
||||||
QueryWrapper wrapper = new QueryWrapper();
|
QueryWrapper wrapper = new QueryWrapper();
|
||||||
wrapper.eq("fuse_id", fuseId);
|
wrapper.eq("fuse_id", fuseId);
|
||||||
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
|
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
|
||||||
return list.stream().map(attr -> {
|
list.stream().collect(Collectors.groupingBy(TbFuseResourceEntity::getType)).forEach((type, value) -> {
|
||||||
|
if ("组件服务".equals(type)) {
|
||||||
|
result.addAll(value.stream().map(attr -> {
|
||||||
TbFuseResourceDTO dto = new TbFuseResourceDTO();
|
TbFuseResourceDTO dto = new TbFuseResourceDTO();
|
||||||
BeanUtils.copyProperties(attr, dto);
|
BeanUtils.copyProperties(attr, dto);
|
||||||
dto.setResource(resourceService.get(dto.getResourceId()));
|
ResourceDTO resourceDTO=resourceService.get(dto.getResourceId());
|
||||||
|
resourceDTO.setDeptName(sysDeptService.get(resourceDTO.getDeptId()).getName());
|
||||||
|
dto.setResource(resourceDTO);
|
||||||
return dto;
|
return dto;
|
||||||
}).collect(Collectors.toList());
|
}).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
|
@Override
|
||||||
|
|
|
@ -551,13 +551,6 @@ public class ResourceController {
|
||||||
return new Result().ok(resourceService.selectInfrastructureList());
|
return new Result().ok(resourceService.selectInfrastructureList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
|
||||||
@ApiOperation("能力查询")
|
|
||||||
@LogOperation("能力查询")
|
|
||||||
public Result list(@ApiIgnore @RequestParam Map<String, Object> params) {
|
|
||||||
return new Result<>().ok(resourceService.list(params));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/selectDevelopDoc")
|
@GetMapping("/selectDevelopDoc")
|
||||||
@ApiOperation("查询能力开发文档目录")
|
@ApiOperation("查询能力开发文档目录")
|
||||||
@LogOperation("查询能力开发文档目录")
|
@LogOperation("查询能力开发文档目录")
|
||||||
|
|
|
@ -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 '资源类型';
|
|
@ -38,6 +38,9 @@
|
||||||
<if test="deptId != null and deptId != ''">
|
<if test="deptId != null and deptId != ''">
|
||||||
and deptId = #{deptId}
|
and deptId = #{deptId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
and type = #{type}
|
||||||
|
</if>
|
||||||
<if test="deptUser != null and deptUser != ''">
|
<if test="deptUser != null and deptUser != ''">
|
||||||
and dept_user like concat('%', #{deptUser}, '%')
|
and dept_user like concat('%', #{deptUser}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
@ -69,17 +72,4 @@
|
||||||
ORDER BY ${orderField} ${orderType}
|
ORDER BY ${orderField} ${orderType}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGroupByDeptId" resultType="java.util.Map">
|
|
||||||
SELECT ( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
|
||||||
sd.NAME AS "deptName",
|
|
||||||
count(tdr.id) AS "deptCount",
|
|
||||||
sd.id AS "deptId",
|
|
||||||
sr.name AS "districtName",
|
|
||||||
sr.id AS "districtId"
|
|
||||||
FROM sys_dept sd
|
|
||||||
inner join tb_fuse tdr on sd.id=tdr.dept_id
|
|
||||||
left join sys_region sr on sr.id=sd.district
|
|
||||||
group by sd.id
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue