diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java index 6d204c1f..d4cd6186 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV3.java @@ -234,10 +234,14 @@ public class CensusControllerV3 { @ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String") }) public Result>> assemblerUseTopInfo(@ApiIgnore @RequestParam Map params){ - Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")}; - List> 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" + - "inner join sys_user d on a.creator = d.id\n" + - "INNER JOIN sys_dept c ON d.dept_id = c.id WHERE a.del_flag = 0 AND b.type = ? AND (c.id = ? OR INSTR(c.pids,?)) GROUP BY b.name ORDER BY useNum desc LIMIT 5", ps); + Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")}; + List> maps = jdbcTemplate.queryForList("SELECT COUNT(c.id) as useNum,c.name FROM \n" + + "(\n" + + "\tSELECT a.id FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id \n" + + "\tWHERE a.del_flag = 0 AND a.type='应用资源' AND (b.id = ? OR INSTR(b.pids,?))\n" + + ") a \n" + + "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\n" + + "WHERE b.del_flag = 0 AND c.type = ? AND c.del_flag = 0 GROUP BY c.name ORDER BY useNum desc limit 5", ps); return new Result>>().ok(maps); } @@ -251,9 +255,17 @@ public class CensusControllerV3 { }) public Result>> assemblerUseInfo(@ApiIgnore @RequestParam Map params){ Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")}; - List> 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" + - " WHERE a.del_flag = 0 AND (e.id = ? OR INSTR(e.pids,?)) AND c.type = ? AND d.attr_type = '组件类型' \n" + - "GROUP BY d.attr_value", ps); + List> maps = jdbcTemplate.queryForList("SELECT COUNT(n.id) AS num,n.attr_value FROM\n" + + "(\n" + + "\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>>().ok(maps); } @@ -299,10 +311,17 @@ public class CensusControllerV3 { }) public Result>> assemblerUseScoreTopInfo(@ApiIgnore @RequestParam Map params){ Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")}; - List> 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" + - "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" + - "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" + - "group by c.name order by score desc limit 5", ps); + List> maps = jdbcTemplate.queryForList("SELECT SUM(IFNULL(b.score,0)) as score,a.name FROM \n" + + "(\n" + + "\tSELECT DISTINCT(c.id) AS id,c.name FROM \n" + + "\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>>().ok(maps); } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java index 766b274b..6aa66d84 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java @@ -4,6 +4,8 @@ import io.renren.common.constant.Constant; import io.renren.common.page.PageData; import io.renren.modules.activiti.dto.ProcessInstanceDTO; import io.renren.modules.activiti.dto.TaskDTO; +import io.renren.modules.demandComment.dto.TDemandCommentDTO; +import io.renren.modules.demandComment.service.TDemandCommentService; import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.service.TAbilityApplicationService; import io.renren.modules.resource.dto.ResourceDTO; @@ -78,6 +80,9 @@ public class ActHistoryService { @Autowired private TAbilityApplicationService tAbilityApplicationService; + @Autowired + private TDemandCommentService tDemandCommentService; + @Autowired private ProcessEngine processEngine_; @@ -302,6 +307,12 @@ public class ActHistoryService { if (resourceDTO != null) { dto.setName(resourceDTO.getName()); dto.setResourceId(resourceDTO.getId().toString()); + } else { + TDemandCommentDTO tDemandCommentDTO = tDemandCommentService.get(Long.valueOf(dto.getBusinessKey())); + if (tDemandCommentDTO != null) { + dto.setName("发表需求评论"); + dto.setResourceId(tDemandCommentDTO.getId().toString()); + } } } } diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 75c11e50..824f2418 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -1408,23 +1408,24 @@ public class ResourceServiceImpl extends CrudServiceImpl(list, list.size()); } - //分别根据部门获取组件使用总数和申请组件数 - Map paraMap = new ConcurrentHashMap<>(); - paraMap.put("resourceType", params.get("resourceType")); - CompletableFuture voidCompletableFuture01 = CompletableFuture.runAsync(() -> { - maps.forEach(m -> { - paraMap.put("id", m.get("deptId")); - Map maps1 = new HashMap<>(); - maps1 = baseDao.assemblyCarByDept(paraMap); - if (maps1 == null) { - m.put("resourceCarNum", 0); - } else { - m.put("resourceCarNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum")); - } - }); - }); + Map paraMap = new ConcurrentHashMap<>(); + paraMap.put("resourceType", params.get("resourceType")); + //分别根据部门获取组件使用总数和调用数 + //申请数 +// CompletableFuture voidCompletableFuture01 = CompletableFuture.runAsync(() -> { +// maps.forEach(m -> { +// paraMap.put("id", m.get("deptId")); +// Map maps1 = new HashMap<>(); +// maps1 = baseDao.assemblyCarByDept(paraMap); +// if (maps1 == null) { +// m.put("resourceCarNum", 0); +// } else { +// m.put("resourceCarNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum")); +// } +// }); +// }); - //这里的使用数应该就是调用数,先用这个,等查询调用数的接口开发完了再改,2020/07/01 ytl + //本部门的应用关联的组件数量 CompletableFuture voidCompletableFuture02 = CompletableFuture.runAsync(() -> { maps.forEach(m -> { paraMap.put("id", m.get("deptId")); @@ -1437,6 +1438,12 @@ public class ResourceServiceImpl extends CrudServiceImpl voidCompletableFuture01 = CompletableFuture.runAsync(() -> { + maps.forEach(m -> { + m.put("resourceCallNum",0); + }); + }); CompletableFuture all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02); all.join(); diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 9325b95a..d9b53aea 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -1080,10 +1080,17 @@ 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 - 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 b.* FROM + ( + 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 JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value, ';', '' ) ) + 1 ) @@ -1295,16 +1302,19 @@