能力统计增加区域参数

This commit is contained in:
wangliwen 2022-10-25 10:05:13 +08:00
parent 4ab4265e19
commit 00b55a9c6b
3 changed files with 138 additions and 61 deletions

View File

@ -375,6 +375,7 @@ public class CensusController {
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "region", value = "所属区域id", paramType = "query", dataType = "String"),
}) })
public Result selectApplyDeptDetailTypeCountList(@RequestParam Map<String, Object> params) { public Result selectApplyDeptDetailTypeCountList(@RequestParam Map<String, Object> params) {
return new Result().ok(resourceService.selectApplyDeptDetailTypeCountList(params)); return new Result().ok(resourceService.selectApplyDeptDetailTypeCountList(params));
@ -388,6 +389,7 @@ public class CensusController {
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "region", value = "所属区域id", paramType = "query", dataType = "String"),
}) })
public void exportSelectApplyDeptDetailTypeCountList(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException { public void exportSelectApplyDeptDetailTypeCountList(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException {
ArrayList<Map> resultList = (ArrayList<Map>) resourceService.selectApplyDeptDetailTypeCountList(params); ArrayList<Map> resultList = (ArrayList<Map>) resourceService.selectApplyDeptDetailTypeCountList(params);
@ -421,6 +423,7 @@ public class CensusController {
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "region", value = "所属区域id", paramType = "query", dataType = "String"),
}) })
public Result selectDeptDetailTypeCountList(@RequestParam Map<String, Object> params) { public Result selectDeptDetailTypeCountList(@RequestParam Map<String, Object> params) {
return new Result().ok(resourceService.selectDeptDetailTypeCountList(params)); return new Result().ok(resourceService.selectDeptDetailTypeCountList(params));
@ -434,6 +437,7 @@ public class CensusController {
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"), @ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "region", value = "所属区域id", paramType = "query", dataType = "String"),
}) })
public void exportSelectDeptDetailTypeCountList(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException { public void exportSelectDeptDetailTypeCountList(@RequestParam Map<String, Object> params, HttpServletResponse response) throws IOException {
ArrayList<Map> resultList = (ArrayList<Map>) resourceService.selectDeptDetailTypeCountList(params); ArrayList<Map> resultList = (ArrayList<Map>) resourceService.selectDeptDetailTypeCountList(params);

View File

@ -2040,7 +2040,36 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public Object selectApplyDeptDetailTypeCountList(Map params) { public Object selectApplyDeptDetailTypeCountList(Map params) {
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) { if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) { // 部门精准查
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
Map<String, Integer> countMap = new HashMap<>();
typeCountListMap.forEach((k, v) -> {
HashMap<Object, Object> map = new HashMap<>();
map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
map.put("name", k);
v.forEach(item -> {
map.put(item.get("type").toString(), item.get("count"));
if (countMap.containsKey(item.get("type"))) {
countMap.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + countMap.get(item.get("type")));
} else {
countMap.put(item.get("type").toString(), Integer.parseInt(item.get("count").toString()));
}
});
resultList.add(map);
});
Integer total = 0;
for (Integer count : countMap.values()) {
total += count;
}
countMap.put("count", total);
HashMap<String, Object> count = new HashMap<>();
count.put("name", "总计");
count.putAll(countMap);
resultList.add(count);
return resultList;
} else if (params.containsKey("region") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("region").toString())) { // 查区域
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>(); ArrayList<Map> resultList = new ArrayList<>();
@ -2196,6 +2225,35 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
count.putAll(countMap); count.putAll(countMap);
resultList.add(count); resultList.add(count);
return resultList; return resultList;
} else if (params.containsKey("region") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("region").toString())) { // 按区域出数据
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
Map<String, Integer> countMap = new HashMap<>();
typeCountListMap.forEach((k, v) -> {
HashMap<Object, Object> map = new HashMap<>();
map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
map.put("name", k);
v.forEach(item -> {
map.put(item.get("type").toString(), item.get("count"));
if (countMap.containsKey(item.get("type"))) {
countMap.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + countMap.get(item.get("type")));
} else {
countMap.put(item.get("type").toString(), Integer.parseInt(item.get("count").toString()));
}
});
resultList.add(map);
});
Integer total = 0;
for (Integer count : countMap.values()) {
total += count;
}
countMap.put("count", total);
HashMap<String, Object> count = new HashMap<>();
count.put("name", "总计");
count.putAll(countMap);
resultList.add(count);
return resultList;
} else { // 全部部门 } else { // 全部部门
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params); List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = // 市级部门 Map<String, List<Map<String, Object>>> typeCountListMap = // 市级部门

View File

@ -1766,6 +1766,9 @@
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND tdr.type = #{type} AND tdr.type = #{type}
</if> </if>
<if test="region != null and region != ''">
AND sd.district = #{region}
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''"> <if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate} AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if> </if>
@ -1851,6 +1854,9 @@
<if test="deptId != null and deptId != ''"> <if test="deptId != null and deptId != ''">
AND sd.id = #{deptId} AND sd.id = #{deptId}
</if> </if>
<if test="region != null and region != ''">
AND sd.district = #{region}
</if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND tdr.type = #{type} AND tdr.type = #{type}
</if> </if>
@ -1960,7 +1966,8 @@
'青岛市大数据发展管理局' AS 'resourceDeptName', '青岛市大数据发展管理局' AS 'resourceDeptName',
'会议室' AS 'type', '会议室' AS 'type',
tmb.create_date AS 'createDate', tmb.create_date AS 'createDate',
CASE tmb.state WHEN 1 THEN '审核中' WHEN 2 THEN '通过' WHEN 3 THEN '不通过' ELSE '审核中' END AS 'approveStatus', CASE tmb.state WHEN 1 THEN '审核中' WHEN 2 THEN '通过' WHEN 3 THEN '不通过' ELSE '审核中' END AS
'approveStatus',
'' AS 'applyNumber' '' AS 'applyNumber'
FROM FROM
t_meetingroom_book tmb, t_meetingroom_book tmb,
@ -2123,24 +2130,32 @@
FROM FROM
tb_data_resource tdr tb_data_resource tdr
LEFT JOIN (SELECT COUNT(id) AS "count", resource_id FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND camera_list IS NULL GROUP BY resource_id ) taa ON tdr.id = taa.resource_id LEFT JOIN (SELECT COUNT(id) AS "count", resource_id FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND
camera_list IS NULL GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
LEFT JOIN (SELECT COUNT(id) AS "count", resource_id FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id) trc LEFT JOIN (SELECT COUNT(id) AS "count", resource_id FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0
GROUP BY resource_id) trc
ON tdr.id = trc.resource_id ON tdr.id = trc.resource_id
LEFT JOIN (SELECT COUNT(id) AS "count", resource_id FROM tb_resource_browse WHERE 1 = 1 GROUP BY resource_id) trb LEFT JOIN (SELECT COUNT(id) AS "count", resource_id FROM tb_resource_browse WHERE 1 = 1 GROUP BY resource_id)
trb
ON tdr.id = trb.resource_id ON tdr.id = trb.resource_id
LEFT JOIN (SELECT AVG(score) AS "score", resource_id FROM tb_resource_score WHERE 1 = 1 GROUP BY resource_id) trs LEFT JOIN (SELECT AVG(score) AS "score", resource_id FROM tb_resource_score WHERE 1 = 1 GROUP BY resource_id)
trs
ON tdr.id = trs.resource_id ON tdr.id = trs.resource_id
JOIN (SELECT IFNULL(MAX(count), 0) AS "maxApplyCount" FROM (SELECT COUNT(id) AS "count" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND camera_list IS NULL GROUP BY resource_id ) taa) temp1 JOIN (SELECT IFNULL(MAX(count), 0) AS "maxApplyCount" FROM (SELECT COUNT(id) AS "count" FROM
t_ability_application WHERE 1 = 1 AND del_flag = 0 AND camera_list IS NULL GROUP BY resource_id ) taa) temp1
JOIN (SELECT IFNULL(MAX(count), 0) AS "maxCopllectCount" FROM(SELECT COUNT(id) AS "count" FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id)trc) temp2 JOIN (SELECT IFNULL(MAX(count), 0) AS "maxCopllectCount" FROM(SELECT COUNT(id) AS "count" FROM
tb_resource_collection WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id)trc) temp2
JOIN (SELECT IFNULL(MAX(count), 0) AS "maxBrowseCount" FROM(SELECT COUNT(id) AS "count" FROM tb_resource_browse WHERE 1 = 1 GROUP BY resource_id) trb) temp3 JOIN (SELECT IFNULL(MAX(count), 0) AS "maxBrowseCount" FROM(SELECT COUNT(id) AS "count" FROM tb_resource_browse
WHERE 1 = 1 GROUP BY resource_id) trb) temp3
JOIN (SELECT IFNULL(MAX(score), 0) AS "maxScore" FROM(SELECT AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 GROUP BY resource_id) trs) temp4 JOIN (SELECT IFNULL(MAX(score), 0) AS "maxScore" FROM(SELECT AVG(score) AS "score" FROM tb_resource_score WHERE
1 = 1 GROUP BY resource_id) trs) temp4
WHERE 1 = 1 WHERE 1 = 1
AND tdr.del_flag = 0 AND tdr.del_flag = 0