优化统计分析

main
liukewei 11 months ago
parent ee34dbc2d6
commit 34db7ce5af

@ -110,6 +110,13 @@ public class EhsIndexStatisticsController extends BaseController {
List<HiddenDangerRankVo> list = ehsIndexStatisticsService.getHiddenDangerRankVoList(); List<HiddenDangerRankVo> list = ehsIndexStatisticsService.getHiddenDangerRankVoList();
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@ApiOperation("部门上报隐患排名")
@GetMapping("/getHiddenDangerRankVoByDeptIdList")
public AjaxResult getHiddenDangerRankVoByDeptIdList()
{
List<HiddenDangerRankVo> list = ehsIndexStatisticsService.getHiddenDangerRankVoByDeptIdList();
return AjaxResult.success(list);
}
/** /**
* *
*/ */

@ -20,6 +20,7 @@ public interface EhsIndexStatisticsMapper {
List<HiddenDangerStatisticsVo> getHiddenDangerSituationList(); List<HiddenDangerStatisticsVo> getHiddenDangerSituationList();
List<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList(); List<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList();
List<HiddenDangerRankVo> getHiddenDangerRankVoList(); List<HiddenDangerRankVo> getHiddenDangerRankVoList();
List<HiddenDangerRankVo> getHiddenDangerRankVoByDeptIdList();
List<Map<String,Object>> getEnterpriseMapList(@Param("deptId") Long deptId); List<Map<String,Object>> getEnterpriseMapList(@Param("deptId") Long deptId);
List<Map<String,Object>> geteconomicTypeMapList(@Param("deptId") Long deptId); List<Map<String,Object>> geteconomicTypeMapList(@Param("deptId") Long deptId);
List<Map<String,Object>> getenterpriseScaleMapList(@Param("deptId") Long deptId); List<Map<String,Object>> getenterpriseScaleMapList(@Param("deptId") Long deptId);

@ -29,7 +29,7 @@ public interface EhsIndexStatisticsService {
* *
*/ */
List<HiddenDangerRankVo> getHiddenDangerRankVoList(); List<HiddenDangerRankVo> getHiddenDangerRankVoList();
List<HiddenDangerRankVo> getHiddenDangerRankVoByDeptIdList();
List<Map<String,Object>> getEnterpriseMapList(); List<Map<String,Object>> getEnterpriseMapList();
List<Map<String,Object>> geteconomicTypeMapList(); List<Map<String,Object>> geteconomicTypeMapList();
List<Map<String,Object>> getenterpriseScaleMapList(); List<Map<String,Object>> getenterpriseScaleMapList();

@ -98,7 +98,10 @@ public class EhsIndexStatisticsServiceImpl implements EhsIndexStatisticsService
public List<HiddenDangerRankVo> getHiddenDangerRankVoList() { public List<HiddenDangerRankVo> getHiddenDangerRankVoList() {
return mapper.getHiddenDangerRankVoList(); return mapper.getHiddenDangerRankVoList();
} }
@Override
public List<HiddenDangerRankVo> getHiddenDangerRankVoByDeptIdList() {
return mapper.getHiddenDangerRankVoByDeptIdList();
}
@Override @Override
public List<Map<String,Object>> getEnterpriseMapList() { public List<Map<String,Object>> getEnterpriseMapList() {
Long deptId = null; Long deptId = null;

@ -82,8 +82,12 @@
</select> </select>
<select id="getHiddenDangerSituationList" <select id="getHiddenDangerSituationList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo"> resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo">
select c.dict_label 'name',ifnull(a.thisUnitNum,0) thisUnitNum,ifnull(a.totalUnitNum,0) totalUnitNum,ifnull(a.thisReportNum,0) thisReportNum,ifnull(a.totalReportNum,0) totalReportNum
,ifnull(a.thisHaveNum,0)thisHaveNum,ifnull(a.totalHaveNum,0)totalHaveNum,ifnull(a.thisNotNum,0)thisNotNum,ifnull(a.totalNotNum,0)totalNotNum,ifnull(a.thisRate,0)thisRate,ifnull(a.totalRate,0)totalRate
from sys_dict_data c left join(
SELECT SELECT
d.dict_label 'name', r.area_id ,
(select count(1) from ehs_enterprise e where e.area_id = d.dict_value and e.create_time>= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' )) thisUnitNum, (select count(1) from ehs_enterprise e where e.area_id = d.dict_value and e.create_time>= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' )) thisUnitNum,
(select count(1) from ehs_enterprise e where e.area_id = d.dict_value) totalUnitNum, (select count(1) from ehs_enterprise e where e.area_id = d.dict_value) totalUnitNum,
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) THEN 1 ELSE 0 END ) 'thisReportNum', sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) THEN 1 ELSE 0 END ) 'thisReportNum',
@ -100,12 +104,14 @@
WHERE WHERE
d.dict_type = 'area_id' d.dict_type = 'area_id'
GROUP BY GROUP BY
r.area_id r.area_id) a on a.area_id = c.dict_value
WHERE
c.dict_type = 'area_id'
</select> </select>
<select id="getHiddenDangerSituationByEnterpriseNameList" <select id="getHiddenDangerSituationByEnterpriseNameList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo"> resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo">
SELECT SELECT
r.enterprise_name 'name', d.dept_name 'name',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) THEN 1 ELSE 0 END ) 'thisReportNum', sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) THEN 1 ELSE 0 END ) 'thisReportNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ) 'totalReportNum', sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ) 'totalReportNum',
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) and r.status = 10 THEN 1 ELSE 0 END ) 'thisHaveNum', sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) and r.status = 10 THEN 1 ELSE 0 END ) 'thisHaveNum',
@ -115,9 +121,9 @@
CONCAT(round(ifnull(sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) and r.status = 10 THEN 1 ELSE 0 END )/sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) THEN 1 ELSE 0 END ),0)*100,2),'%') 'thisRate', CONCAT(round(ifnull(sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) and r.status = 10 THEN 1 ELSE 0 END )/sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.check_time >= DATE_FORMAT( now(), '%Y-%m-01 00:00:00' ) THEN 1 ELSE 0 END ),0)*100,2),'%') 'thisRate',
CONCAT(round(ifnull(sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status = 10 THEN 1 ELSE 0 END )/sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ),0)*100,2),'%') 'totalRate' CONCAT(round(ifnull(sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status = 10 THEN 1 ELSE 0 END )/sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ),0)*100,2),'%') 'totalRate'
FROM FROM
ehs_hidden_danger r sys_dept d left join ehs_hidden_danger r on r.dept_id = d.dept_id
GROUP BY GROUP BY
r.enterprise_name d.dept_id,d.dept_name
</select> </select>
<select id="getHiddenDangerRankVoList" <select id="getHiddenDangerRankVoList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo"> resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo">
@ -139,6 +145,23 @@
ORDER BY ORDER BY
s.reportHiddenNum DESC s.reportHiddenNum DESC
</select> </select>
<select id="getHiddenDangerRankVoByDeptIdList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo">
SELECT
s.*
FROM
(
SELECT
d.dept_name 'areaName',
count(r.dept_id) 'reportHiddenNum'
FROM
sys_dept d left join ehs_hidden_danger r on r.dept_id = d.dept_id
GROUP BY
d.dept_id,d.dept_name
) s
ORDER BY
s.reportHiddenNum DESC
</select>
<select id="getEnterpriseMapList" <select id="getEnterpriseMapList"
resultType="map"> resultType="map">
SELECT SELECT

@ -22,7 +22,13 @@ export function getDanger() {
method: 'get', method: 'get',
}) })
} }
// 查询上报隐患数量
export function getDangerByDeptId() {
return request({
url: '/ehs/indexStatistics/getHiddenDangerRankVoByDeptIdList',
method: 'get',
})
}
// 查询隐患数据统计分析 柱 // 查询隐患数据统计分析 柱
export function getDangerList(year) { export function getDangerList(year) {
return request({ return request({

@ -176,6 +176,7 @@ import {
getAdministeration, getAdministeration,
getPlace, getPlace,
getDanger, getDanger,
getDangerByDeptId,
getTrade, getTrade,
getEconomics, getEconomics,
getScale, getScale,
@ -488,7 +489,7 @@ export default {
}); });
// //
getDanger() getDangerByDeptId()
.then((response) => { .then((response) => {
if (response.code == 200) { if (response.code == 200) {
response.data.map((item,index)=>{ response.data.map((item,index)=>{

Loading…
Cancel
Save