1、修改能力统计列表和详情-组件服务-使用情况统计相关代码修改为统计调用数和使用数
This commit is contained in:
parent
a5954e286e
commit
f367009215
|
@ -255,9 +255,17 @@ public class CensusControllerV3 {
|
||||||
})
|
})
|
||||||
public Result<List<Map<String, Object>>> assemblerUseInfo(@ApiIgnore @RequestParam Map<String, Object> params){
|
public Result<List<Map<String, Object>>> assemblerUseInfo(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||||
Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")};
|
Object[] ps = {params.get("id"),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 INNER JOIN sys_dept e ON b.dept_id = e.id\n" +
|
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT COUNT(n.id) AS num,n.attr_value FROM\n" +
|
||||||
" WHERE a.del_flag = 0 AND (e.id = ? OR INSTR(e.pids,?)) AND c.type = ? AND d.attr_type = '组件类型' \n" +
|
"(\n" +
|
||||||
"GROUP BY d.attr_value", ps);
|
"\tSELECT DISTINCT(c.id) AS id,c.name FROM \n" +
|
||||||
|
"\t(\n" +
|
||||||
|
"\t\tSELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id \n" +
|
||||||
|
"\t\tWHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = ? OR INSTR(b.pids,?))\n" +
|
||||||
|
"\t) a \n" +
|
||||||
|
"\tINNER JOIN tb_data_resource_rel b ON a.id = b.key_id INNER JOIN tb_data_resource c ON b.reference_id = c.id\n" +
|
||||||
|
"\tWHERE b.del_flag = 0 AND c.type = ? AND c.del_flag = 0 \n" +
|
||||||
|
"\t \n" +
|
||||||
|
") m INNER JOIN tb_data_attr n ON m.id = n.data_resource_id WHERE n.del_flag = 0 AND n.attr_type = '组件类型' GROUP BY n.attr_value", ps);
|
||||||
|
|
||||||
return new Result<List<Map<String,Object>>>().ok(maps);
|
return new Result<List<Map<String,Object>>>().ok(maps);
|
||||||
}
|
}
|
||||||
|
@ -303,10 +311,17 @@ public class CensusControllerV3 {
|
||||||
})
|
})
|
||||||
public Result<List<Map<String, Object>>> assemblerUseScoreTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
|
public Result<List<Map<String, Object>>> assemblerUseScoreTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||||
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")};
|
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")};
|
||||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT SUM(IFNULL(e.score,0)) as score,c.name 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\n" +
|
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT SUM(IFNULL(b.score,0)) as score,a.name FROM \n" +
|
||||||
"INNER JOIN sys_dept d ON b.dept_id = d.id INNER JOIN tb_resource_score e ON a.reference_id = e.resource_id \n" +
|
"(\n" +
|
||||||
"WHERE a.del_flag = 0 AND c.type = ? AND c.del_flag = 0 AND (d.id = ? OR INSTR(d.pids,?)) AND e.del_flag = 0\n" +
|
"\tSELECT DISTINCT(c.id) AS id,c.name FROM \n" +
|
||||||
"group by c.name order by score desc limit 5", ps);
|
"\t\t(\n" +
|
||||||
|
"\t\t\tSELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id \n" +
|
||||||
|
"\t\t\tWHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = ? OR INSTR(b.pids,?))\n" +
|
||||||
|
"\t\t) a \n" +
|
||||||
|
"\t\tINNER JOIN tb_data_resource_rel b ON a.id = b.key_id INNER JOIN tb_data_resource c ON b.reference_id = c.id\n" +
|
||||||
|
"\t\tWHERE b.del_flag = 0 AND c.type = ? AND c.del_flag = 0 \n" +
|
||||||
|
")\ta \n" +
|
||||||
|
"INNER JOIN tb_resource_score b ON a.id = b.resource_id AND b.del_flag = 0 GROUP BY a.name ORDER BY score DESC LIMIT 5", ps);
|
||||||
|
|
||||||
return new Result<List<Map<String,Object>>>().ok(maps);
|
return new Result<List<Map<String,Object>>>().ok(maps);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1408,21 +1408,22 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
return new PageData<>(list, list.size());
|
return new PageData<>(list, list.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
//分别根据部门获取组件使用总数和申请组件数
|
|
||||||
Map<String, Object> paraMap = new ConcurrentHashMap<>();
|
Map<String, Object> paraMap = new ConcurrentHashMap<>();
|
||||||
paraMap.put("resourceType", params.get("resourceType"));
|
paraMap.put("resourceType", params.get("resourceType"));
|
||||||
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
|
//分别根据部门获取组件使用总数和调用数
|
||||||
maps.forEach(m -> {
|
//申请数
|
||||||
paraMap.put("id", m.get("deptId"));
|
// CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
|
||||||
Map<String, Object> maps1 = new HashMap<>();
|
// maps.forEach(m -> {
|
||||||
maps1 = baseDao.assemblyCarByDept(paraMap);
|
// paraMap.put("id", m.get("deptId"));
|
||||||
if (maps1 == null) {
|
// Map<String, Object> maps1 = new HashMap<>();
|
||||||
m.put("resourceCarNum", 0);
|
// maps1 = baseDao.assemblyCarByDept(paraMap);
|
||||||
} else {
|
// if (maps1 == null) {
|
||||||
m.put("resourceCarNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum"));
|
// m.put("resourceCarNum", 0);
|
||||||
}
|
// } else {
|
||||||
});
|
// m.put("resourceCarNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum"));
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
//本部门的应用关联的组件数量
|
//本部门的应用关联的组件数量
|
||||||
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> {
|
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> {
|
||||||
|
@ -1437,6 +1438,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
//还缺少组件调用数,这先用假数据代替
|
||||||
|
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
|
||||||
|
maps.forEach(m -> {
|
||||||
|
m.put("resourceCallNum",0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
CompletableFuture<Void> all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02);
|
CompletableFuture<Void> all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02);
|
||||||
all.join();
|
all.join();
|
||||||
|
|
|
@ -1080,10 +1080,17 @@
|
||||||
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS type ,
|
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS type ,
|
||||||
COUNT( tdav.data_resource_id ) AS total
|
COUNT( tdav.data_resource_id ) AS total
|
||||||
FROM
|
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
|
SELECT b.* FROM
|
||||||
inner join sys_dept g on f.dept_id = g.id
|
(
|
||||||
where d.type=#{resourceType} and (g.id = #{id} OR instr(g.pids,#{id}))
|
SELECT DISTINCT(c.id) AS id FROM
|
||||||
|
(
|
||||||
|
SELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id
|
||||||
|
WHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = #{id} OR INSTR(b.pids,#{id}))
|
||||||
|
) a
|
||||||
|
INNER JOIN tb_data_resource_rel b ON a.id = b.key_id INNER JOIN tb_data_resource c ON b.reference_id = c.id
|
||||||
|
WHERE b.del_flag = 0 AND c.type = #{resourceType} AND c.del_flag = 0
|
||||||
|
) a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id AND b.del_flag = 0
|
||||||
) tdav
|
) tdav
|
||||||
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
|
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
|
||||||
';', '' ) ) + 1 )
|
';', '' ) ) + 1 )
|
||||||
|
|
Loading…
Reference in New Issue