Merge branch 'master' into docker_package
This commit is contained in:
commit
0fa6b6fba1
|
@ -375,6 +375,7 @@ public class CensusController {
|
|||
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
|
||||
@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) {
|
||||
return new Result().ok(resourceService.selectApplyDeptDetailTypeCountList(params));
|
||||
|
@ -388,6 +389,7 @@ public class CensusController {
|
|||
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
|
||||
@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 {
|
||||
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 = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
|
||||
@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) {
|
||||
return new Result().ok(resourceService.selectDeptDetailTypeCountList(params));
|
||||
|
@ -434,6 +437,7 @@ public class CensusController {
|
|||
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
|
||||
@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 {
|
||||
ArrayList<Map> resultList = (ArrayList<Map>) resourceService.selectDeptDetailTypeCountList(params);
|
||||
|
|
|
@ -2040,7 +2040,36 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
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);
|
||||
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
|
||||
ArrayList<Map> resultList = new ArrayList<>();
|
||||
|
@ -2196,6 +2225,35 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
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>> 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 { // 全部部门
|
||||
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
|
||||
Map<String, List<Map<String, Object>>> typeCountListMap = // 市级部门
|
||||
|
|
|
@ -1766,6 +1766,9 @@
|
|||
<if test="type != null and type != ''">
|
||||
AND tdr.type = #{type}
|
||||
</if>
|
||||
<if test="region != null and region != ''">
|
||||
AND sd.district = #{region}
|
||||
</if>
|
||||
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
|
||||
AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
|
||||
</if>
|
||||
|
@ -1851,6 +1854,9 @@
|
|||
<if test="deptId != null and deptId != ''">
|
||||
AND sd.id = #{deptId}
|
||||
</if>
|
||||
<if test="region != null and region != ''">
|
||||
AND sd.district = #{region}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
AND tdr.type = #{type}
|
||||
</if>
|
||||
|
@ -1960,7 +1966,8 @@
|
|||
'青岛市大数据发展管理局' AS 'resourceDeptName',
|
||||
'会议室' AS 'type',
|
||||
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'
|
||||
FROM
|
||||
t_meetingroom_book tmb,
|
||||
|
@ -2011,49 +2018,49 @@
|
|||
|
||||
<select id="getPraiseList" resultType="java.util.Map">
|
||||
SELECT
|
||||
tdr.id AS "resourceId",
|
||||
tdr.NAME AS "resourceName",
|
||||
IFNULL( AVG( trs.score ), 3 ) AS "score",
|
||||
tdr.create_date AS "createDate"
|
||||
tdr.id AS "resourceId",
|
||||
tdr.NAME AS "resourceName",
|
||||
IFNULL( AVG( trs.score ), 3 ) AS "score",
|
||||
tdr.create_date AS "createDate"
|
||||
FROM
|
||||
tb_data_resource tdr LEFT JOIN
|
||||
tb_resource_score trs ON tdr.id = trs.resource_id
|
||||
tb_data_resource tdr LEFT JOIN
|
||||
tb_resource_score trs ON tdr.id = trs.resource_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
AND tdr.type IN('组件服务', '应用资源')
|
||||
1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
AND tdr.type IN('组件服务', '应用资源')
|
||||
GROUP BY
|
||||
resourceId
|
||||
resourceId
|
||||
ORDER BY
|
||||
score DESC, createDate
|
||||
score DESC, createDate
|
||||
LIMIT 10
|
||||
</select>
|
||||
|
||||
<select id="getPopularList" resultType="java.util.Map">
|
||||
SELECT
|
||||
tdr.id AS "resourceId",
|
||||
tdr.NAME AS "resourceName",
|
||||
IFNULL(taa.applyCount, 0) AS "applyCount",
|
||||
IFNULL(trc.collectCount, 0) AS "collectCount",
|
||||
IFNULL(trb.browseCount, 0) AS "browseCount",
|
||||
tdr.create_date
|
||||
tdr.id AS "resourceId",
|
||||
tdr.NAME AS "resourceName",
|
||||
IFNULL(taa.applyCount, 0) AS "applyCount",
|
||||
IFNULL(trc.collectCount, 0) AS "collectCount",
|
||||
IFNULL(trb.browseCount, 0) AS "browseCount",
|
||||
tdr.create_date
|
||||
FROM
|
||||
tb_data_resource tdr
|
||||
LEFT JOIN ( SELECT resource_id, COUNT( id ) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag
|
||||
= 0 AND create_date > #{startDate} GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
||||
LEFT JOIN ( SELECT resource_id, COUNT( id ) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND
|
||||
del_flag = 0 AND create_date > #{startDate} GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
|
||||
LEFT JOIN (SELECT resource_id, COUNT(id) AS "browseCount" FROM tb_resource_browse WHERE 1 = 1
|
||||
AND create_date > #{startDate} GROUP BY resource_id) trb ON tdr.id = trb.resource_id
|
||||
tb_data_resource tdr
|
||||
LEFT JOIN ( SELECT resource_id, COUNT( id ) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag
|
||||
= 0 AND create_date > #{startDate} GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
|
||||
LEFT JOIN ( SELECT resource_id, COUNT( id ) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND
|
||||
del_flag = 0 AND create_date > #{startDate} GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
|
||||
LEFT JOIN (SELECT resource_id, COUNT(id) AS "browseCount" FROM tb_resource_browse WHERE 1 = 1
|
||||
AND create_date > #{startDate} GROUP BY resource_id) trb ON tdr.id = trb.resource_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
AND tdr.type IN('组件服务', '应用资源')
|
||||
1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
AND tdr.type IN('组件服务', '应用资源')
|
||||
ORDER BY
|
||||
applyCount DESC,
|
||||
collectCount DESC,
|
||||
browseCount DESC,
|
||||
tdr.create_date
|
||||
applyCount DESC,
|
||||
collectCount DESC,
|
||||
browseCount DESC,
|
||||
tdr.create_date
|
||||
LIMIT 10
|
||||
</select>
|
||||
|
||||
|
@ -2107,46 +2114,54 @@
|
|||
|
||||
<select id="getStarList" resultType="java.util.Map">
|
||||
SELECT list.resourceId,
|
||||
list.resourceName,
|
||||
(list.applyNum + list.browseNum + list.collectNum + list.scoreNum) AS "fireNum",
|
||||
list.create_date AS "createDate"
|
||||
list.resourceName,
|
||||
(list.applyNum + list.browseNum + list.collectNum + list.scoreNum) AS "fireNum",
|
||||
list.create_date AS "createDate"
|
||||
FROM (
|
||||
|
||||
SELECT
|
||||
tdr.id AS "resourceId",
|
||||
tdr.name AS "resourceName",
|
||||
IFNULL((taa.count / temp1.maxApplyCount), 0) * 1.5 AS "applyNum",
|
||||
IFNULL((trc.count / temp2.maxCopllectCount), 0) * 1 AS "collectNum",
|
||||
IFNULL((trb.count / temp3.maxBrowseCount), 0) * 0.5 AS "browseNum",
|
||||
IFNULL((trs.score / temp4.maxScore), 0 ) * 2 AS "scoreNum",
|
||||
tdr.create_date
|
||||
FROM
|
||||
tb_data_resource tdr
|
||||
SELECT
|
||||
tdr.id AS "resourceId",
|
||||
tdr.name AS "resourceName",
|
||||
IFNULL((taa.count / temp1.maxApplyCount), 0) * 1.5 AS "applyNum",
|
||||
IFNULL((trc.count / temp2.maxCopllectCount), 0) * 1 AS "collectNum",
|
||||
IFNULL((trb.count / temp3.maxBrowseCount), 0) * 0.5 AS "browseNum",
|
||||
IFNULL((trs.score / temp4.maxScore), 0 ) * 2 AS "scoreNum",
|
||||
tdr.create_date
|
||||
FROM
|
||||
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
|
||||
ON tdr.id = trc.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
|
||||
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
|
||||
ON tdr.id = trb.resource_id
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
AND tdr.del_flag = 0
|
||||
AND tdr.type IN ('组件服务', '应用资源')
|
||||
WHERE 1 = 1
|
||||
AND tdr.del_flag = 0
|
||||
AND tdr.type IN ('组件服务', '应用资源')
|
||||
|
||||
)list
|
||||
)list
|
||||
|
||||
ORDER BY fireNum DESC, create_date DESC LIMIT 10
|
||||
</select>
|
||||
|
|
Loading…
Reference in New Issue