新增上架统计api

按照部门、能力类型、组件类型统计能力上架情况
This commit is contained in:
lizhicheng 2022-09-14 14:19:50 +08:00
parent c3541440c5
commit 3f0f344d5b
5 changed files with 88 additions and 1 deletions

View File

@ -359,4 +359,17 @@ public class CensusController {
return new Result().ok(resourceService.selectApplyDeptDetailTypeCountList(params));
}
@GetMapping("/selectDeptDetailTypeCountList")
@ApiOperation("按照部门、能力类型、组件类型统计能力上架情况")
@LogOperation("按照部门、能力类型、组件类型统计能力上架情况")
@ApiImplicitParams({
@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态", paramType = "query", dataType = "String"),
})
public Result selectDeptDetailTypeCountList(@RequestParam Map<String, Object> params) {
return new Result().ok(resourceService.selectDeptDetailTypeCountList(params));
}
}

View File

@ -187,4 +187,9 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<Map> cimAssemblyResources(@Param("deptid") Long deptid);
List<Map<String, Object>> selectApplyDeptDetailTypeCountList(Map params);
List<Map<String, Object>> selectDeptDetailTypeCountList(@Param("delFlags") List<Integer> delFlags,
@Param("deptId") Long deptId,
@Param("startDate") String startDate,
@Param("endDate") String endDate);
}

View File

@ -140,4 +140,6 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object getCountByFuzzyQuery(String keyWorld);
Object selectApplyDeptDetailTypeCountList(Map params);
Object selectDeptDetailTypeCountList(Map params);
}

View File

@ -2021,4 +2021,34 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return resultList;
}
@Override
public Object selectDeptDetailTypeCountList(Map params) {
String startDate= (String) params.get("startDate");
String endDate= (String) params.get("endDate");
Long deptId= Long.parseLong((String) params.get("deptId"));
List<Integer> delFlags=new ArrayList<>();
if(params.get("approveStatus") != null){
if("审核完成".equals(params.get("approveStatus"))){
delFlags.add(0);
}else if("审核中".equals(params.get("approveStatus"))){
delFlags.add(2);
delFlags.add(3);
}
}else {
delFlags.add(0);
delFlags.add(2);
delFlags.add(3);
}
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(delFlags, deptId, startDate, endDate);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
typeCountListMap.forEach((k, v) -> {
HashMap<Object, Object> map = new HashMap<>();
map.put("name", k);
v.forEach(item -> map.put(item.get("type").toString(), item.get("count")));
resultList.add(map);
});
return resultList;
}
}

View File

@ -1701,7 +1701,7 @@
END
) AS "type"
FROM
(SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.del_flag FROM tb_data_resource d LEFT JOIN tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型') tdr,
(SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.del_flag FROM tb_data_resource d LEFT JOIN tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型' AND a.del_flag=0) tdr,
sys_dept sd,
sys_user su,
t_ability_application taa
@ -1724,4 +1724,41 @@
sd.id,
tdr.type
</select>
<select id="selectDeptDetailTypeCountList" resultType="java.util.Map">
SELECT
COUNT( tdr.id ) AS "count",
sd.NAME AS "deptName",
(CASE tdr.type
WHEN '应用资源' THEN 'yyzy'
WHEN '智能算法' THEN 'znsf'
WHEN '图层服务' THEN 'tcfw'
WHEN '开发组件' THEN 'kfzj'
WHEN '业务组件' THEN 'ywzj'
WHEN '基础设施' THEN 'jcss'
WHEN '知识库' THEN 'zsk'
WHEN '数据资源' THEN 'sjzy'
ELSE 'yyzy' END)AS "type"
FROM
(SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.del_flag, d.dept_id, d.create_date FROM tb_data_resource d LEFT JOIN tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型' AND a.del_flag=0) tdr,
sys_dept sd
WHERE
1 = 1
AND tdr.dept_id = sd.id
<if test="null != delFlags">
AND tdr.del_flag in
<foreach item="delFlag" collection="delFlags" open="(" separator="," close=")">
#{delFlag}
</foreach>
</if>
<if test="deptId != null and deptId != ''">
AND sd.id = #{deptId}
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(tdr.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if>
GROUP BY
tdr.dept_id,
tdr.type
</select>
</mapper>