Compare commits
5 Commits
4058089bcd
...
2954ede07a
Author | SHA1 | Date |
---|---|---|
wangliwen | 2954ede07a | |
wangliwen | 0562a1548f | |
yitonglei | 0adb6b095c | |
yitonglei | 8efd7866aa | |
yitonglei | ceb9c747e2 |
|
@ -335,23 +335,13 @@ public class CensusControllerV3 {
|
|||
@GetMapping("/applicationUsedCapabilityNum")
|
||||
@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>>> applicationUsedCapabilityNum(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
List<Map<String,Object>> result = new ArrayList<>();
|
||||
Object[] ps = {params.get("resourceType"),params.get("id")};
|
||||
result = jdbcTemplate.queryForList("SELECT a.name,b.attr_value FROM tb_data_resource a INNER JOIN tb_data_attr b \n" +
|
||||
"ON a.id = b.data_resource_id\n" +
|
||||
"WHERE a.type = ? and a.dept_id = ?\n" +
|
||||
"and b.attr_type = '应用领域'",ps);
|
||||
result.forEach(r->{
|
||||
String[] strArr = r.get("attr_value").toString().split(",");
|
||||
r.put("usedNum",strArr.length);
|
||||
});
|
||||
@ApiImplicitParam(name = "keyId", value = "应用id", paramType = "query", required = true, dataType = "long")
|
||||
public Result<List<Map<String,Object>>> applicationUsedCapabilityNum(Long keyId){
|
||||
Object[] ps = {keyId};
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("select count(b.id) as useNum,c.name from (select reference_id from tb_data_resource_rel where del_flag = 0 and key_id = ? ) a inner join tb_data_resource_rel b on a.reference_id = b.reference_id inner join tb_data_resource c\n" +
|
||||
"on a.reference_id = c.id where c.del_flag = 0 group by c.name", ps);
|
||||
|
||||
return new Result<List<Map<String,Object>>>().ok(result);
|
||||
return new Result<List<Map<String,Object>>>().ok(maps);
|
||||
}
|
||||
|
||||
//以下是基础设施和数据资源使用情况点击详情(申请明细)
|
||||
|
|
|
@ -133,4 +133,9 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
|||
List<Map<String, Object>> applicationUsedAreaCapabilityList(Map params);
|
||||
|
||||
List<Map<String, Object>> applicationAreaCapabilityUseList(Map params);
|
||||
|
||||
Map<String,Object> assemblyCarByDept(Map params);
|
||||
|
||||
Map<String,Object> assemblyUseByDept(Map params);
|
||||
|
||||
}
|
|
@ -104,4 +104,5 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
|
|||
List<Map<String, Object>> applicationAreaCapabilityList(Map params);
|
||||
|
||||
List<Map<String, Object>> applicationAreaCapabilityUseList(Map params);
|
||||
|
||||
}
|
|
@ -548,7 +548,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Override
|
||||
@CachePut(cacheNames = {selectDeptListKey}, key = "#p1")
|
||||
public Object selectDeptList(JSONObject jsonObject, String type) {
|
||||
ArrayList<Map> resultList = new ArrayList<>();
|
||||
List<Map> resultList = new CopyOnWriteArrayList<Map>();
|
||||
HashMap<String, Object> resourceMap = new HashMap<>();
|
||||
resourceMap.put("type", "全部能力目录");
|
||||
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
|
||||
|
@ -561,7 +561,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
|
||||
//区级要根据行政区划多加一层结构
|
||||
listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).forEach(item -> {
|
||||
listMap.entrySet().parallelStream().filter(index -> !"区级".equals(index.getKey())).forEach(item -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("type", item.getKey());
|
||||
Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"));
|
||||
|
@ -1184,15 +1184,43 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
// }
|
||||
@Override
|
||||
public List<Map<String, Object>> resourceBusinessUseDetails(Map<String, Object> params) {
|
||||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
params.put("pageNum", (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()));
|
||||
params.put("pageSize", params.get("limit"));
|
||||
result = baseDao.selectResurceCarDetails(params);
|
||||
List<Map<String, Object>> maps = new CopyOnWriteArrayList<>();
|
||||
Object[] ps = {params.get("id"),params.get("id"),(Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()),Integer.parseInt(params.get("limit").toString())};
|
||||
//获取部门列表
|
||||
List<Map<String,Object>> list = jdbcTemplate.queryForList("SELECT id,name FROM sys_dept WHERE id = ? OR INSTR(pids,?) LIMIT ?,?",ps);
|
||||
maps.addAll(list);
|
||||
//分别根据部门获取应用组件数和收藏组件数
|
||||
Map<String,Object> paraMap = new ConcurrentHashMap<>();
|
||||
paraMap.put("resourceType",params.get("resourceType"));
|
||||
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
|
||||
maps.forEach(m -> {
|
||||
paraMap.put("id", m.get("id"));
|
||||
Map<String, Object> maps1 = new HashMap<>();
|
||||
maps1 = baseDao.assemblyCarByDept(paraMap);
|
||||
if(maps1==null){
|
||||
m.put("carNum",0);
|
||||
}else{
|
||||
m.put("carNum", maps1.get("carNum") == null ? 0:maps1.get("carNum"));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//还缺少调用总数
|
||||
//CompletableFuture<Void> all = CompletableFuture.allOf(resourceCarNums);
|
||||
//all.join();
|
||||
return result;
|
||||
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> {
|
||||
maps.forEach(m -> {
|
||||
paraMap.put("id", m.get("id"));
|
||||
Map<String, Object> maps2 = new HashMap<>();
|
||||
maps2 = baseDao.assemblyUseByDept(paraMap);
|
||||
if(maps2==null){
|
||||
m.put("useNum",0);
|
||||
}else{
|
||||
m.put("useNum", maps2.get("useNum") == null ? 0 : maps2.get("useNum"));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02);
|
||||
all.join();
|
||||
return maps;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,6 +8,8 @@ alter table `t_ability_application` drop index `userId`;
|
|||
alter table `tb_data_resource` drop index `type`;
|
||||
alter table `tb_data_attr` drop index `attr_value`;
|
||||
alter table `tb_data_resource` drop index `name`;
|
||||
alter table `tb_data_resource` drop index `deptId`;
|
||||
alter table `sys_dept` drop index `type`;
|
||||
-- 创建索引
|
||||
alter table `tb_resource_collection` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '收藏的资源id';
|
||||
alter table`tb_resource_car` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '加入申购车的id';
|
||||
|
@ -17,4 +19,6 @@ alter table `t_ability_application` ADD INDEX `resourceid`(`resource_id`) USING
|
|||
alter table `t_ability_application` ADD INDEX `userId`(`user_id`) USING BTREE comment '用户';
|
||||
alter table `tb_data_resource` ADD FULLTEXT INDEX `type`(`type`);
|
||||
alter table `tb_data_attr` ADD FULLTEXT INDEX `attr_value`(`attr_value`);
|
||||
alter table `tb_data_resource` ADD FULLTEXT INDEX `name`(`name`);
|
||||
alter table `tb_data_resource` ADD FULLTEXT INDEX `name`(`name`);
|
||||
ALTER TABLE `tb_data_resource` ADD INDEX `deptId`(`dept_id`) USING BTREE;
|
||||
ALTER TABLE `sys_dept` ADD INDEX `type`(`type`) USING BTREE;
|
|
@ -1264,5 +1264,14 @@
|
|||
LIMIT ${pageNum}, ${pageSize}
|
||||
</select>
|
||||
|
||||
<select id = "assemblyCarByDept" parameterType="java.util.Map" resultType="java.util.Map">
|
||||
SELECT COUNT(distinct(a.resource_id)) as carNum,c.id FROM tb_resource_car a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN sys_dept c ON b.dept_id = c.id INNER JOIN tb_data_resource d on a.resource_id = d.id
|
||||
WHERE a.del_flag = 0 AND d.type = #{resourceType} AND (c.id =#{id} or INSTR(c.pids,#{id})) group by c.id
|
||||
</select>
|
||||
|
||||
<select id = "assemblyUseByDept" parameterType="java.util.Map" resultType="java.util.Map">
|
||||
SELECT COUNT(distinct(a.key_id)) as useNum,c.id FROM tb_data_resource_rel a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN sys_dept c ON b.dept_id = c.id INNER JOIN tb_data_resource d on a.key_id = d.id
|
||||
WHERE a.del_flag = 0 AND d.type = #{resourceType} AND (c.id = #{id} or INSTR(c.pids,#{id} )) group by c.id
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue