1、继续修改代码
This commit is contained in:
parent
316adc2c4a
commit
142ab2d84a
|
@ -202,9 +202,13 @@ public class CensusControllerV3 {
|
|||
}
|
||||
|
||||
|
||||
|
||||
//以下是组件使用情况点击详情
|
||||
|
||||
/**
|
||||
* 使用次数是去tb_data_resource_rel查
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/assemblerUseTopInfo")
|
||||
@ApiOperation("TOP5使用组件")
|
||||
@LogOperation("TOP5使用组件")
|
||||
|
@ -213,25 +217,57 @@ public class CensusControllerV3 {
|
|||
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
|
||||
})
|
||||
public Result<List<Map<String, Object>>> assemblerUseTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
Object[] ps = {params.get("resourceType"),params.get("id")};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT b.name,count(a.id) AS useNum FROM tb_data_resource_rel a INNER JOIN tb_data_resource b ON a.reference_id = b.id\n" +
|
||||
"WHERE a.del_flag = 0 AND b.type = ? AND b.dept_id = ? GROUP BY b.name ORDER BY useNum desc LIMIT 5", ps);
|
||||
|
||||
return null;
|
||||
return new Result<List<Map<String,Object>>>().ok(maps);
|
||||
}
|
||||
|
||||
@GetMapping("/assemblerUseInfo")
|
||||
@ApiOperation("使用组件数量分布(算法、图层、开发、业务")
|
||||
@LogOperation("使用组件数量分布(算法、图层、开发、业务")
|
||||
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long")
|
||||
public Result<List<Map<String, Object>>> assemblerUseInfo(Long id){
|
||||
return null;
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
|
||||
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
|
||||
})
|
||||
public Result<List<Map<String, Object>>> assemblerUseInfo(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
Object[] ps = {params.get("id"),params.get("resourceType")};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(d.id) as num,d.attr_value FROM tb_data_resource_rel a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN tb_data_resource c ON a.reference_id = c.id INNER JOIN tb_data_attr d ON c.id = d.data_resource_id\n" +
|
||||
"WHERE a.del_flag = 0 AND b.dept_id = ? AND c.type = ? AND d.attr_type = '组件类型' \n" +
|
||||
"GROUP BY d.attr_value", ps);
|
||||
|
||||
return new Result<List<Map<String,Object>>>().ok(maps);
|
||||
}
|
||||
|
||||
@GetMapping("/assemblerUseProjectInfo")
|
||||
@ApiOperation("应用贡献组件数量分布(算法、图层、开发、业务)")
|
||||
@LogOperation("应用贡献组件数量分布(算法、图层、开发、业务)")
|
||||
@ApiImplicitParam(name = "keyId", value = "应用的id", paramType = "query", required = true, dataType = "long")
|
||||
public Result<List<Map<String, Object>>> assemblerUseProjectInfo(Long keyId){
|
||||
Object[] ps = {keyId};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("select count(b.id),b.attr_value from (select reference_id from tb_data_resource_rel where del_flag = 0 and key_id = ? ) a inner join tb_data_attr b on a.reference_id = b.data_resource_id \n" +
|
||||
" and b.attr_type = '应用类型' group by b.attr_value ", ps);
|
||||
|
||||
return new Result<List<Map<String,Object>>>().ok(maps);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/assemblerUseScoreTopInfo")
|
||||
@ApiOperation("使用组件评分top5")
|
||||
@LogOperation("使用组件评分top5")
|
||||
public Result<List<Map<String, Object>>> assemblerUseScoreTopInfo(Long id){
|
||||
return null;
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
|
||||
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
|
||||
})
|
||||
public Result<List<Map<String, Object>>> assemblerUseScoreTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
Object[] ps = {params.get("resourceType"),params.get("id")};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("select AVG(a.score) as score,b.name from tb_resource_score a inner join tb_data_resource b on a.resource_id = b.id\n" +
|
||||
"inner join sys_user c on a.user_id = c.id \n" +
|
||||
"where a.del_flag = 0 and b.type = ? and c.dept_id = ?\n" +
|
||||
"group by b.name order by score desc limit 5", ps);
|
||||
|
||||
return new Result<List<Map<String,Object>>>().ok(maps);
|
||||
}
|
||||
|
||||
|
||||
|
@ -248,14 +284,16 @@ public class CensusControllerV3 {
|
|||
|
||||
|
||||
@GetMapping("applicationUsedAreaCapabilityList")
|
||||
@ApiOperation("使用组件的应用领域分布情况")
|
||||
@LogOperation("使用组件的应用领域分布情况")
|
||||
@ApiOperation("使用组件应用领域分布情况")
|
||||
@LogOperation("使用组件应用领域分布情况")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
|
||||
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
|
||||
})
|
||||
public Result<List<Map<String,Object>>> applicationUsedAreaCapabilityList(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||
return null;
|
||||
|
||||
List<Map<String, Object>> maps = resourceService.applicationAreaCapabilityUseList(params);
|
||||
return new Result<List<Map<String,Object>>>().ok(maps);
|
||||
}
|
||||
|
||||
|
||||
|
@ -295,8 +333,8 @@ public class CensusControllerV3 {
|
|||
return new Result<List<Map<String,Object>>>().ok(result);
|
||||
}
|
||||
@GetMapping("/applicationUsedCapabilityNum")
|
||||
@ApiOperation("贡献组件被多少应用使用")
|
||||
@LogOperation("贡献组件被多少应用使用")
|
||||
@ApiOperation("贡献组件分别被多少应用使用")
|
||||
@LogOperation("贡献组件分别被多少应用使用")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
|
||||
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
|
||||
|
|
|
@ -121,4 +121,5 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
|||
List<Map<String,Object>> selectResurceCarDetails(Map params);
|
||||
List<Map<String,Object>> applicationAreaCapabilityList(Map params);
|
||||
List<Map<String,Object>> applicationUsedAreaCapabilityList(Map params);
|
||||
List<Map<String,Object>> applicationAreaCapabilityUseList(Map params);
|
||||
}
|
|
@ -102,4 +102,6 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
|
|||
List<Map<String, Object>> assemblerCarDetail(Map<String, Object> params);
|
||||
|
||||
List<Map<String, Object>> applicationAreaCapabilityList(Map params);
|
||||
|
||||
List<Map<String, Object>> applicationAreaCapabilityUseList(Map params);
|
||||
}
|
|
@ -745,6 +745,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
return resourceDao.applicationAreaCapabilityList(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> applicationAreaCapabilityUseList(Map params){
|
||||
return resourceDao.applicationAreaCapabilityUseList(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object selectResourceListByType(String type) {
|
||||
return resourceDao.selectByType(type);
|
||||
|
|
|
@ -8,6 +8,7 @@ import io.renren.common.validator.group.AddGroup;
|
|||
import io.renren.common.validator.group.DefaultGroup;
|
||||
import io.renren.common.validator.group.UpdateGroup;
|
||||
import io.renren.modules.security.user.SecurityUser;
|
||||
import io.renren.modules.security.user.UserDetail;
|
||||
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -40,29 +41,39 @@ public class SysDeptController {
|
|||
@ApiOperation("根据当前用户所在部门查询下属部门tree,可以根据部门名称模糊查询")
|
||||
@LogOperation("根据当前用户所在部门查询下属部门")
|
||||
public Result<List<SysDeptDTO>> treeList(@RequestParam(required = false,value = "模糊查询,部门名称") String keywords){
|
||||
Long deptId = SecurityUser.getDeptId();
|
||||
List<SysDeptDTO> result = new ArrayList<>();
|
||||
SysDeptDTO sysDeptDTO = sysDeptService.get(deptId);
|
||||
|
||||
//市大数据局展示全部部门,区大数据局展示本区所有部门,委办局展示自己部门及下级部门
|
||||
if(StringUtils.contains(sysDeptDTO.getName(),"青岛市大数据发展管理局")){//市大数据局
|
||||
UserDetail user = SecurityUser.getUser();
|
||||
if(user.getUsername().equals("admin")){//admin账户
|
||||
List<Map<String,Object>> deptMaps = jdbcTemplate.queryForList("SELECT id FROM sys_dept where pid = 0");
|
||||
deptMaps.forEach(dept->{
|
||||
SysDeptDTO depts = sysDeptService.getDeptListByPid(Long.valueOf(dept.get("id").toString()));
|
||||
result.add(depts);
|
||||
});
|
||||
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){//各区大数据局
|
||||
|
||||
SysDeptDTO depts = sysDeptService.getDeptListByPid(sysDeptDTO.getPid());
|
||||
result.add(depts);
|
||||
}else{
|
||||
SysDeptDTO deptListByPid = sysDeptService.getDeptListByPid(deptId);
|
||||
result.add(deptListByPid);
|
||||
Long deptId = SecurityUser.getDeptId();
|
||||
SysDeptDTO sysDeptDTO = sysDeptService.get(deptId);
|
||||
|
||||
//市大数据局展示全部部门,区大数据局展示本区所有部门,委办局展示自己部门及下级部门
|
||||
if(StringUtils.contains(sysDeptDTO.getName(),"青岛市大数据发展管理局")){//市大数据局
|
||||
List<Map<String,Object>> deptMaps = jdbcTemplate.queryForList("SELECT id FROM sys_dept where pid = 0");
|
||||
deptMaps.forEach(dept->{
|
||||
SysDeptDTO depts = sysDeptService.getDeptListByPid(Long.valueOf(dept.get("id").toString()));
|
||||
result.add(depts);
|
||||
});
|
||||
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){//各区大数据局
|
||||
|
||||
SysDeptDTO depts = sysDeptService.getDeptListByPid(sysDeptDTO.getPid());
|
||||
result.add(depts);
|
||||
}else{
|
||||
SysDeptDTO deptListByPid = sysDeptService.getDeptListByPid(deptId);
|
||||
result.add(deptListByPid);
|
||||
}
|
||||
}
|
||||
|
||||
if(keywords != null){
|
||||
treeMatch(result,keywords);
|
||||
}
|
||||
System.out.println("部门树--》"+result.size());
|
||||
|
||||
return new Result<List<SysDeptDTO>>().ok(result);
|
||||
}
|
||||
/** ytl 2022-06-23 新增 end **/
|
||||
|
|
|
@ -938,7 +938,25 @@
|
|||
GROUP BY
|
||||
type
|
||||
</select>
|
||||
|
||||
<select id="applicationAreaCapabilityUseList" parameterType="java.util.Map" resultType="java.util.Map">
|
||||
SELECT
|
||||
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS type ,
|
||||
COUNT( tdav.data_resource_id ) AS total
|
||||
FROM
|
||||
( select a.* from tb_data_attr a inner join tb_data_resource d on a.data_resource_id = d.id
|
||||
inner join tb_data_resource_rel e on e.reference_id = d.id inner join sys_user f on e.creator = f.id where d.type=#{resourceType}
|
||||
and f.dept_id = #{id}
|
||||
) tdav
|
||||
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
|
||||
';', '' ) ) + 1 )
|
||||
WHERE
|
||||
1 = 1
|
||||
AND tdav.attr_type = '应用领域'
|
||||
AND tdav.del_flag = 0
|
||||
AND SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) != ''
|
||||
GROUP BY
|
||||
type
|
||||
</select>
|
||||
|
||||
<select id="selectTopFiveComponentServiceApplications" resultType="java.util.Map">
|
||||
SELECT
|
||||
|
@ -1095,29 +1113,36 @@
|
|||
|
||||
<select id="selectResurceCarDetails" parameterType="java.util.Map" resultType="java.util.Map">
|
||||
SELECT COUNT(a.id) AS resourceCarNum,
|
||||
c.name as deptName
|
||||
c.name as deptName,c.id,COUNT(e.id) as useNum
|
||||
FROM
|
||||
tb_resource_car a
|
||||
tb_resource_car a
|
||||
INNER JOIN
|
||||
sys_user b
|
||||
sys_user b
|
||||
ON
|
||||
a.user_id = b.id
|
||||
a.user_id = b.id
|
||||
INNER JOIN
|
||||
sys_dept c
|
||||
sys_dept c
|
||||
ON
|
||||
b.dept_id = c.id
|
||||
b.dept_id = c.id
|
||||
INNER JOIN
|
||||
tb_data_resource d
|
||||
tb_data_resource d
|
||||
ON
|
||||
a.resource_id = d.id
|
||||
a.resource_id = d.id
|
||||
INNER JOIN tb_data_resource_rel e
|
||||
ON
|
||||
b.id = e.creator
|
||||
where
|
||||
(c.id = #{id} or c.pids LIKE CONCAT('%',CONCAT(#{id},'%')))
|
||||
AND
|
||||
d.type = #{resourceType}
|
||||
(c.id = #{id} or c.pids LIKE CONCAT('%',CONCAT(#{id},'%')))
|
||||
AND
|
||||
d.type = #{resourceType}
|
||||
AND
|
||||
a.del_flag = 0
|
||||
AND
|
||||
d.del_flag = 0
|
||||
group by
|
||||
c.name
|
||||
c.name,c.id
|
||||
order by
|
||||
c.name
|
||||
c.name,c.id
|
||||
LIMIT ${pageNum}, ${pageSize}
|
||||
</select>
|
||||
|
||||
|
|
Loading…
Reference in New Issue