...
This commit is contained in:
parent
59d13aadc8
commit
ba372c2386
|
@ -167,4 +167,15 @@ public class CensusController {
|
|||
resultMap.put("browseDayList", resourceBrowseService.selectDayList(startDate, endDate));
|
||||
return new Result().ok(resultMap);
|
||||
}
|
||||
|
||||
@GetMapping("/sourceDepartmentStatistics")
|
||||
@ApiOperation("来源部门统计")
|
||||
@LogOperation("来源部门统计")
|
||||
public Result sourceDepartmentStatistics() {
|
||||
return new Result().ok(resourceService.selectSourceDepartmentStatistics());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -62,4 +62,10 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
|||
Integer selectTypeCountByDist(@Param(("districtName")) String districtName, @Param("resourceType") String resourceType);
|
||||
|
||||
Long countAllVisits();
|
||||
|
||||
Integer selectDeptCount();
|
||||
|
||||
List<Map> selectDeptTypeCount();
|
||||
|
||||
List<Map> selectDeptTotalCount();
|
||||
}
|
|
@ -49,4 +49,6 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
|
|||
|
||||
Long countAllVisits();
|
||||
|
||||
Object selectSourceDepartmentStatistics();
|
||||
|
||||
}
|
|
@ -374,4 +374,47 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
public Long countAllVisits() {
|
||||
return baseDao.countAllVisits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object selectSourceDepartmentStatistics() {
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("deptCount", resourceDao.selectDeptCount());
|
||||
HashMap<String, Object> map = new HashMap() {
|
||||
{
|
||||
put("省级", "0");
|
||||
put("市级", "0");
|
||||
put("区级", "0");
|
||||
put("企业", "0");
|
||||
put("其他", "0");
|
||||
}
|
||||
};
|
||||
List<Map> deptTypeCount = resourceDao.selectDeptTypeCount();
|
||||
map.entrySet().forEach(item -> {
|
||||
deptTypeCount.forEach(index -> {
|
||||
if (index.get("type").equals(item.getKey())) {
|
||||
item.setValue(index.get("count"));
|
||||
}
|
||||
});
|
||||
});
|
||||
resultMap.put("deptTypeCount", map);
|
||||
List<Map> deptTotalCount = resourceDao.selectDeptTotalCount();
|
||||
HashMap<String, Object> map1 = new HashMap() {
|
||||
{
|
||||
put("0", 0);
|
||||
put("5", 0);
|
||||
put("10", 0);
|
||||
put("15", 0);
|
||||
put("20", 0);
|
||||
}
|
||||
};
|
||||
map1.entrySet().forEach(item -> {
|
||||
deptTotalCount.forEach(index -> {
|
||||
if (index.get("type").equals(item.getKey())) {
|
||||
item.setValue(index.get("total"));
|
||||
}
|
||||
});
|
||||
});
|
||||
resultMap.put("deptTotalCount", map1);
|
||||
return resultMap;
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ spring:
|
|||
multi-statement-allow: true
|
||||
#上传的静态资源配置
|
||||
resource:
|
||||
root_url: 15.2.21.238
|
||||
root_url: 15.72.183.90
|
||||
path: /data/services/nengli/files/
|
||||
devModelFilePath: /data/services/nengli/files/devModelFile
|
||||
# 大数据部门相关配置
|
||||
|
|
|
@ -80,5 +80,7 @@ mybatis-plus:
|
|||
call-setters-on-nulls: true
|
||||
jdbc-type-for-null: 'null'
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
#系统上线日期,用于统计能力浏览记录
|
||||
system:
|
||||
startDay: 2022-01-01
|
|
@ -464,4 +464,67 @@
|
|||
tb_data_resource
|
||||
</select>
|
||||
|
||||
<select id="selectDeptCount" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
( SELECT DISTINCT dept_id FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 AND dept_id IS NOT NULL ) temp
|
||||
</select>
|
||||
|
||||
<select id="selectDeptTypeCount" resultType="java.util.Map">
|
||||
SELECT IFNULL(COUNT(deptId),0) AS "count",
|
||||
type
|
||||
FROM (
|
||||
SELECT DISTINCT
|
||||
tbr.dept_id AS "deptId",
|
||||
(CASE sd.type
|
||||
WHEN 1 THEN
|
||||
'省级'
|
||||
WHEN 2 THEN
|
||||
'市级'
|
||||
WHEN 3 THEN
|
||||
'区级'
|
||||
WHEN 4 THEN
|
||||
'企业' ELSE '其他'
|
||||
END ) AS "type"
|
||||
FROM
|
||||
sys_dept sd
|
||||
RIGHT JOIN tb_data_resource tbr ON tbr.dept_id = sd.id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND del_flag = 0
|
||||
AND dept_id IS NOT NULL) temp GROUP BY type
|
||||
</select>
|
||||
|
||||
<select id="selectDeptTotalCount" resultType="java.util.Map">
|
||||
SELECT
|
||||
COUNT( type ) AS "total",
|
||||
type
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
(
|
||||
CASE
|
||||
WHEN ( COUNT( id ) BETWEEN 0 AND 5 ) THEN
|
||||
'0'
|
||||
WHEN ( COUNT( id ) BETWEEN 5 AND 10 ) THEN
|
||||
'5'
|
||||
WHEN ( COUNT( id ) BETWEEN 10 AND 15 ) THEN
|
||||
'10'
|
||||
WHEN ( COUNT( id ) BETWEEN 15 AND 20 ) THEN
|
||||
'15' ELSE '20'
|
||||
END
|
||||
) AS "type"
|
||||
FROM
|
||||
tb_data_resource
|
||||
WHERE
|
||||
del_flag = 0
|
||||
AND dept_id IS NOT NULL
|
||||
GROUP BY
|
||||
dept_id
|
||||
) temp
|
||||
GROUP BY
|
||||
type
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue