Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-01 18:32:29 +08:00
commit 9e2e7fdbdd
4 changed files with 84 additions and 37 deletions

View File

@ -234,10 +234,14 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String") @ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
}) })
public Result<List<Map<String, Object>>> assemblerUseTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<List<Map<String, Object>>> assemblerUseTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")}; Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")};
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" + List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT COUNT(c.id) as useNum,c.name FROM \n" +
"inner join sys_user d on a.creator = d.id\n" + "(\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); "\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<List<Map<String,Object>>>().ok(maps); return new Result<List<Map<String,Object>>>().ok(maps);
} }
@ -251,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);
} }
@ -299,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);
} }

View File

@ -4,6 +4,8 @@ import io.renren.common.constant.Constant;
import io.renren.common.page.PageData; import io.renren.common.page.PageData;
import io.renren.modules.activiti.dto.ProcessInstanceDTO; import io.renren.modules.activiti.dto.ProcessInstanceDTO;
import io.renren.modules.activiti.dto.TaskDTO; 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.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.service.TAbilityApplicationService; import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.dto.ResourceDTO;
@ -78,6 +80,9 @@ public class ActHistoryService {
@Autowired @Autowired
private TAbilityApplicationService tAbilityApplicationService; private TAbilityApplicationService tAbilityApplicationService;
@Autowired
private TDemandCommentService tDemandCommentService;
@Autowired @Autowired
private ProcessEngine processEngine_; private ProcessEngine processEngine_;
@ -302,6 +307,12 @@ public class ActHistoryService {
if (resourceDTO != null) { if (resourceDTO != null) {
dto.setName(resourceDTO.getName()); dto.setName(resourceDTO.getName());
dto.setResourceId(resourceDTO.getId().toString()); dto.setResourceId(resourceDTO.getId().toString());
} else {
TDemandCommentDTO tDemandCommentDTO = tDemandCommentService.get(Long.valueOf(dto.getBusinessKey()));
if (tDemandCommentDTO != null) {
dto.setName("发表需求评论");
dto.setResourceId(tDemandCommentDTO.getId().toString());
}
} }
} }
} }

View File

@ -1408,23 +1408,24 @@ 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 -> { // CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> {
paraMap.put("id", m.get("deptId")); // maps.forEach(m -> {
Map<String, Object> maps1 = new HashMap<>(); // paraMap.put("id", m.get("deptId"));
maps1 = baseDao.assemblyCarByDept(paraMap); // Map<String, Object> maps1 = new HashMap<>();
if (maps1 == null) { // maps1 = baseDao.assemblyCarByDept(paraMap);
m.put("resourceCarNum", 0); // if (maps1 == null) {
} else { // m.put("resourceCarNum", 0);
m.put("resourceCarNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum")); // } else {
} // m.put("resourceCarNum", maps1.get("carNum") == null ? 0 : maps1.get("carNum"));
}); // }
}); // });
// });
//这里的使用数应该就是调用数先用这个等查询调用数的接口开发完了再改2020/07/01 ytl //本部门的应用关联的组件数量
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> { CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> {
maps.forEach(m -> { maps.forEach(m -> {
paraMap.put("id", m.get("deptId")); paraMap.put("id", m.get("deptId"));
@ -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();

View File

@ -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 &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value, JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
';', '' ) ) + 1 ) ';', '' ) ) + 1 )
@ -1295,16 +1302,19 @@
<!-- 根据组件类型查询部门申请组件的数量--> <!-- 根据组件类型查询部门申请组件的数量-->
<select id="assemblyCarByDept" parameterType="java.util.Map" resultType="java.util.Map"> <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 = SELECT COUNT(a.id) as carNum FROM tb_resource_car a INNER JOIN sys_user b ON a.user_id = b.id INNER JOIN sys_dept c
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 ON b.dept_id = c.id INNER JOIN tb_data_resource d ON a.resource_id = d.id
WHERE a.del_flag = 0 AND c.id =#{id} AND d.type = #{resourceType} group by c.id WHERE a.del_flag = 0 AND (c.id = #{id} OR INSTR(c.pids,#{id})) AND d.type = #{resourceType} AND d.del_flag = 0
</select> </select>
<!--根据组件类型查询部门使用组件的数量--> <!--根据组件类型查询部门使用组件的数量-->
<select id="assemblyUseByDept" parameterType="java.util.Map" resultType="java.util.Map"> <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 = SELECT COUNT(DISTINCT(b.reference_id)) AS useNum FROM
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} group by c.id 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 WHERE b.del_flag = 0
</select> </select>
<select id="selectCountByDepts" resultType="java.util.Map"> <select id="selectCountByDepts" resultType="java.util.Map">