优化统计分析

main
liukewei 11 months ago
parent ee34dbc2d6
commit 34db7ce5af

@ -110,6 +110,13 @@ public class EhsIndexStatisticsController extends BaseController {
List<HiddenDangerRankVo> list = ehsIndexStatisticsService.getHiddenDangerRankVoList();
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> getHiddenDangerSituationByEnterpriseNameList();
List<HiddenDangerRankVo> getHiddenDangerRankVoList();
List<HiddenDangerRankVo> getHiddenDangerRankVoByDeptIdList();
List<Map<String,Object>> getEnterpriseMapList(@Param("deptId") Long deptId);
List<Map<String,Object>> geteconomicTypeMapList(@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> getHiddenDangerRankVoByDeptIdList();
List<Map<String,Object>> getEnterpriseMapList();
List<Map<String,Object>> geteconomicTypeMapList();
List<Map<String,Object>> getenterpriseScaleMapList();

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

@ -82,8 +82,12 @@
</select>
<select id="getHiddenDangerSituationList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo">
SELECT
d.dict_label 'name',
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
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) 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',
@ -100,12 +104,14 @@
WHERE
d.dict_type = 'area_id'
GROUP BY
r.area_id
r.area_id) a on a.area_id = c.dict_value
WHERE
c.dict_type = 'area_id'
</select>
<select id="getHiddenDangerSituationByEnterpriseNameList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo">
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 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',
@ -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.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
ehs_hidden_danger r
sys_dept d left join ehs_hidden_danger r on r.dept_id = d.dept_id
GROUP BY
r.enterprise_name
d.dept_id,d.dept_name
</select>
<select id="getHiddenDangerRankVoList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo">
@ -139,6 +145,23 @@
ORDER BY
s.reportHiddenNum DESC
</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"
resultType="map">
SELECT

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

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

Loading…
Cancel
Save