统计分析
parent
21baf76da2
commit
a26f614db2
@ -0,0 +1,178 @@
|
|||||||
|
package com.ruoyi.web.controller.ehs;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.ehsEnterprise.domain.EhsEnterprise;
|
||||||
|
import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.service.EhsIndexStatisticsService;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.*;
|
||||||
|
import com.ruoyi.ehsMaterial.domain.EhsMaterial;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首页统计分析接口
|
||||||
|
*
|
||||||
|
* @author: 马腾达
|
||||||
|
* @date: 2023年12月12日 11:10
|
||||||
|
*/
|
||||||
|
@Api(tags = "首页统计分析接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ehs/indexStatistics")
|
||||||
|
public class EhsIndexStatisticsController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EhsIndexStatisticsService ehsIndexStatisticsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询首页上方文字数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/getEhsIndexStatistics")
|
||||||
|
public AjaxResult getEhsIndexStatistics()
|
||||||
|
{
|
||||||
|
EhsIndexStatistics ehsIndexStatistics = ehsIndexStatisticsService.getEhsIndexStatistics();
|
||||||
|
return AjaxResult.success(ehsIndexStatistics);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询首页上方文字数据--汇总数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/getSuperviseAndHandle")
|
||||||
|
public AjaxResult getSuperviseAndHandle()
|
||||||
|
{
|
||||||
|
EhsIndexStatistics ehsIndexStatistics = ehsIndexStatisticsService.getSuperviseAndHandle();
|
||||||
|
return AjaxResult.success(ehsIndexStatistics);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询首页上方文字数据----列表数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/getEhsIndexStatisticsList")
|
||||||
|
public AjaxResult getEhsIndexStatisticsList()
|
||||||
|
{
|
||||||
|
List<EhsIndexStatistics> list = ehsIndexStatisticsService.getEhsIndexStatisticsList();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询首页上方文字数据点击详情
|
||||||
|
*/
|
||||||
|
@GetMapping("/detailslist")
|
||||||
|
public TableDataInfo detailslist(HiddenDangerVo vo)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<HiddenDangerVo> list = ehsIndexStatisticsService.getHiddenDangerVoList(vo);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐患情况---按行政区域统计
|
||||||
|
*/
|
||||||
|
@ApiOperation("隐患情况---按行政区域统计")
|
||||||
|
@GetMapping("/getHiddenDangerSituationList")
|
||||||
|
public AjaxResult getHiddenDangerSituationList()
|
||||||
|
{
|
||||||
|
List<HiddenDangerStatisticsVo> list = ehsIndexStatisticsService.getHiddenDangerSituationList();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐患情况---按地址统计
|
||||||
|
*/
|
||||||
|
@ApiOperation("按地址统计")
|
||||||
|
@GetMapping("/getHiddenDangerSituationByEnterpriseNameList")
|
||||||
|
public AjaxResult getHiddenDangerSituationByEnterpriseNameList()
|
||||||
|
{
|
||||||
|
List<HiddenDangerStatisticsVo> list = ehsIndexStatisticsService.getHiddenDangerSituationByEnterpriseNameList();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 上报隐患排名
|
||||||
|
*/
|
||||||
|
@ApiOperation("上报隐患排名")
|
||||||
|
@GetMapping("/getHiddenDangerRankVoList")
|
||||||
|
public AjaxResult getHiddenDangerRankVoList()
|
||||||
|
{
|
||||||
|
List<HiddenDangerRankVo> list = ehsIndexStatisticsService.getHiddenDangerRankVoList();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 行业领域统计数量
|
||||||
|
*/
|
||||||
|
@ApiOperation("行业领域统计数量")
|
||||||
|
@GetMapping("/getEnterpriseMapList")
|
||||||
|
public AjaxResult getEnterpriseMapList()
|
||||||
|
{
|
||||||
|
List<Map<String,Object>> list = ehsIndexStatisticsService.getEnterpriseMapList();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 经济类型统计数量
|
||||||
|
*/
|
||||||
|
@ApiOperation("经济类型统计数量")
|
||||||
|
@GetMapping("/geteconomicTypeMapList")
|
||||||
|
public AjaxResult geteconomicTypeMapList()
|
||||||
|
{
|
||||||
|
List<Map<String,Object>> list = ehsIndexStatisticsService.geteconomicTypeMapList();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 企业规模统计数量
|
||||||
|
*/
|
||||||
|
@ApiOperation("企业规模统计数量")
|
||||||
|
@GetMapping("/getenterpriseScaleMapList")
|
||||||
|
public AjaxResult getenterpriseScaleMapList()
|
||||||
|
{
|
||||||
|
List<Map<String,Object>> list = ehsIndexStatisticsService.getenterpriseScaleMapList();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 隐患类型分析统计
|
||||||
|
*/
|
||||||
|
@ApiOperation("隐患类型分析统计")
|
||||||
|
@GetMapping("/getHiddenDangerTypeMapList")
|
||||||
|
public AjaxResult getHiddenDangerTypeMapList()
|
||||||
|
{
|
||||||
|
List<Map<String,Object>> list = ehsIndexStatisticsService.getHiddenDangerTypeMapList();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 隐患数据统计分析
|
||||||
|
*/
|
||||||
|
@ApiOperation("隐患数据统计分析")
|
||||||
|
@GetMapping("/getHiddenDangerDataMapList")
|
||||||
|
public AjaxResult getHiddenDangerDataMapList(String year)
|
||||||
|
{
|
||||||
|
JSONArray row = new JSONArray();
|
||||||
|
List<Map<String,Object>> list = ehsIndexStatisticsService.getHiddenDangerDataMapList(year);
|
||||||
|
if(StringUtils.isNotEmpty(list)){
|
||||||
|
LinkedHashMap<Object, List<Map<String, Object>>> nameList = list.stream().collect(Collectors.groupingBy(e -> e.get("name"), LinkedHashMap::new, Collectors.toList()));
|
||||||
|
if(StringUtils.isNotEmpty(nameList)){
|
||||||
|
for (Object key : nameList.keySet()) {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
System.out.println("map.get(" + key + ") = " + nameList.get(key));
|
||||||
|
obj.put("name",key);
|
||||||
|
List<Object> dataList = nameList.get(key).stream().map(e -> e.get("dataNum")).collect(Collectors.toList());
|
||||||
|
obj.put("data",dataList);
|
||||||
|
row.add(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.ruoyi.ehsIndexStatistics.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface EhsIndexStatisticsMapper {
|
||||||
|
|
||||||
|
EhsIndexStatistics getEhsIndexStatistics(@Param("deptId") Long deptId);
|
||||||
|
EhsIndexStatistics getSuperviseAndHandle(@Param("deptId") Long deptId);
|
||||||
|
List<EhsIndexStatistics> getEhsIndexStatisticsList(@Param("deptId") Long deptId);
|
||||||
|
|
||||||
|
List<HiddenDangerVo> getHiddenDangerVoList(@Param("vo") HiddenDangerVo vo);
|
||||||
|
|
||||||
|
List<HiddenDangerStatisticsVo> getHiddenDangerSituationList();
|
||||||
|
List<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList();
|
||||||
|
List<HiddenDangerRankVo> getHiddenDangerRankVoList();
|
||||||
|
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);
|
||||||
|
List<Map<String,Object>> getHiddenDangerTypeMapList(@Param("deptId") Long deptId);
|
||||||
|
List<Map<String,Object>> getHiddenDangerDataMapList(@Param("yearStr") String yearStr,@Param("deptId") Long deptId);
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.ruoyi.ehsIndexStatistics.service;
|
||||||
|
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface EhsIndexStatisticsService {
|
||||||
|
|
||||||
|
EhsIndexStatistics getEhsIndexStatistics();
|
||||||
|
EhsIndexStatistics getSuperviseAndHandle();
|
||||||
|
|
||||||
|
List<EhsIndexStatistics> getEhsIndexStatisticsList();
|
||||||
|
List<HiddenDangerVo> getHiddenDangerVoList(HiddenDangerVo vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按行政区域统计
|
||||||
|
*/
|
||||||
|
List<HiddenDangerStatisticsVo> getHiddenDangerSituationList();
|
||||||
|
/**
|
||||||
|
* 按公司统计
|
||||||
|
*/
|
||||||
|
List<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList();
|
||||||
|
/**
|
||||||
|
* 上报隐患排名
|
||||||
|
*/
|
||||||
|
List<HiddenDangerRankVo> getHiddenDangerRankVoList();
|
||||||
|
|
||||||
|
List<Map<String,Object>> getEnterpriseMapList();
|
||||||
|
List<Map<String,Object>> geteconomicTypeMapList();
|
||||||
|
List<Map<String,Object>> getenterpriseScaleMapList();
|
||||||
|
List<Map<String,Object>> getHiddenDangerTypeMapList();
|
||||||
|
List<Map<String,Object>> getHiddenDangerDataMapList(String yearStr);
|
||||||
|
}
|
@ -0,0 +1,172 @@
|
|||||||
|
package com.ruoyi.ehsIndexStatistics.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.ehsDocument.mapper.EhsDocumentMapper;
|
||||||
|
import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.mapper.EhsIndexStatisticsMapper;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.service.EhsIndexStatisticsService;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo;
|
||||||
|
import com.ruoyi.ehsIndexStatistics.vo.HiddenDangerVo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述
|
||||||
|
*
|
||||||
|
* @author: 马腾达
|
||||||
|
* @date: 2023年12月12日 15:06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EhsIndexStatisticsServiceImpl implements EhsIndexStatisticsService {
|
||||||
|
@Autowired
|
||||||
|
private EhsIndexStatisticsMapper mapper;
|
||||||
|
@Override
|
||||||
|
public EhsIndexStatistics getEhsIndexStatistics() {
|
||||||
|
Long deptId = null;
|
||||||
|
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
|
||||||
|
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||||
|
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||||
|
Long deptParentId = currentUser.getDept().getParentId();
|
||||||
|
if (!roleIds.contains(1L) &&
|
||||||
|
deptParentId != null &&
|
||||||
|
deptParentId.longValue() != 0) {
|
||||||
|
deptId = currentUser.getDept().getDeptId().longValue();
|
||||||
|
}
|
||||||
|
return mapper.getEhsIndexStatistics(deptId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public EhsIndexStatistics getSuperviseAndHandle() {
|
||||||
|
Long deptId = null;
|
||||||
|
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
|
||||||
|
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||||
|
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||||
|
Long deptParentId = currentUser.getDept().getParentId();
|
||||||
|
if (!roleIds.contains(1L) &&
|
||||||
|
deptParentId != null &&
|
||||||
|
deptParentId.longValue() != 0) {
|
||||||
|
deptId = currentUser.getDept().getDeptId().longValue();
|
||||||
|
}
|
||||||
|
return mapper.getSuperviseAndHandle(deptId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<EhsIndexStatistics> getEhsIndexStatisticsList() {
|
||||||
|
Long deptId = null;
|
||||||
|
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
|
||||||
|
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||||
|
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||||
|
Long deptParentId = currentUser.getDept().getParentId();
|
||||||
|
if (!roleIds.contains(1L) &&
|
||||||
|
deptParentId != null &&
|
||||||
|
deptParentId.longValue() != 0) {
|
||||||
|
deptId = currentUser.getDept().getDeptId().longValue();
|
||||||
|
}
|
||||||
|
return mapper.getEhsIndexStatisticsList(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HiddenDangerVo> getHiddenDangerVoList(HiddenDangerVo vo) {
|
||||||
|
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
|
||||||
|
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||||
|
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||||
|
Long deptParentId = currentUser.getDept().getParentId();
|
||||||
|
if (!roleIds.contains(1L) &&
|
||||||
|
deptParentId != null &&
|
||||||
|
deptParentId.longValue() != 0) {
|
||||||
|
vo.setDeptId(currentUser.getDept().getDeptId().longValue());
|
||||||
|
}
|
||||||
|
return mapper.getHiddenDangerVoList(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HiddenDangerStatisticsVo> getHiddenDangerSituationList() {
|
||||||
|
return mapper.getHiddenDangerSituationList();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList() {
|
||||||
|
return mapper.getHiddenDangerSituationByEnterpriseNameList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HiddenDangerRankVo> getHiddenDangerRankVoList() {
|
||||||
|
return mapper.getHiddenDangerRankVoList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String,Object>> getEnterpriseMapList() {
|
||||||
|
Long deptId = null;
|
||||||
|
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
|
||||||
|
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||||
|
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||||
|
Long deptParentId = currentUser.getDept().getParentId();
|
||||||
|
if (!roleIds.contains(1L) &&
|
||||||
|
deptParentId != null &&
|
||||||
|
deptParentId.longValue() != 0) {
|
||||||
|
deptId = currentUser.getDept().getDeptId().longValue();
|
||||||
|
}
|
||||||
|
return mapper.getEnterpriseMapList(deptId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<Map<String,Object>> geteconomicTypeMapList() {
|
||||||
|
Long deptId = null;
|
||||||
|
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
|
||||||
|
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||||
|
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||||
|
Long deptParentId = currentUser.getDept().getParentId();
|
||||||
|
if (!roleIds.contains(1L) &&
|
||||||
|
deptParentId != null &&
|
||||||
|
deptParentId.longValue() != 0) {
|
||||||
|
deptId = currentUser.getDept().getDeptId().longValue();
|
||||||
|
}
|
||||||
|
return mapper.geteconomicTypeMapList(deptId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<Map<String,Object>> getenterpriseScaleMapList() {
|
||||||
|
Long deptId = null;
|
||||||
|
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
|
||||||
|
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||||
|
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||||
|
Long deptParentId = currentUser.getDept().getParentId();
|
||||||
|
if (!roleIds.contains(1L) &&
|
||||||
|
deptParentId != null &&
|
||||||
|
deptParentId.longValue() != 0) {
|
||||||
|
deptId = currentUser.getDept().getDeptId().longValue();
|
||||||
|
}
|
||||||
|
return mapper.getenterpriseScaleMapList(deptId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<Map<String,Object>> getHiddenDangerTypeMapList() {
|
||||||
|
Long deptId = null;
|
||||||
|
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
|
||||||
|
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||||
|
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||||
|
Long deptParentId = currentUser.getDept().getParentId();
|
||||||
|
if (!roleIds.contains(1L) &&
|
||||||
|
deptParentId != null &&
|
||||||
|
deptParentId.longValue() != 0) {
|
||||||
|
deptId = currentUser.getDept().getDeptId().longValue();
|
||||||
|
}
|
||||||
|
return mapper.getHiddenDangerTypeMapList(deptId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<Map<String,Object>> getHiddenDangerDataMapList(String yearStr) {
|
||||||
|
Long deptId = null;
|
||||||
|
// 如果登录用户不是超级管理员,并且他的部门不是唐河县应急管理局(根节点),那么只能查询当前登录用户他的部门创建的公文
|
||||||
|
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||||
|
List<Long> roleIds = currentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||||
|
Long deptParentId = currentUser.getDept().getParentId();
|
||||||
|
if (!roleIds.contains(1L) &&
|
||||||
|
deptParentId != null &&
|
||||||
|
deptParentId.longValue() != 0) {
|
||||||
|
deptId = currentUser.getDept().getDeptId().longValue();
|
||||||
|
}
|
||||||
|
return mapper.getHiddenDangerDataMapList(yearStr,deptId);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.ruoyi.ehsIndexStatistics.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述
|
||||||
|
*
|
||||||
|
* @author: 马腾达
|
||||||
|
* @date: 2023年12月12日 13:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EhsIndexStatistics {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位数量
|
||||||
|
*/
|
||||||
|
private Integer unitNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐患数量
|
||||||
|
*/
|
||||||
|
private Integer hiddenDangerNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已整改
|
||||||
|
*/
|
||||||
|
private Integer haveRectifiedNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未整改
|
||||||
|
*/
|
||||||
|
private Integer notRectifiedNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过期未整改
|
||||||
|
*/
|
||||||
|
private Integer exceedNotRectifiedNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整改治理资金
|
||||||
|
*/
|
||||||
|
private BigDecimal rectifyMoneySum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整改率
|
||||||
|
*/
|
||||||
|
private String rectifyRate;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.ehsIndexStatistics.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报隐患排名
|
||||||
|
*
|
||||||
|
* @author: 马腾达
|
||||||
|
* @date: 2023年12月15日 9:08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HiddenDangerRankVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域名称
|
||||||
|
*/
|
||||||
|
private String areaName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报隐患数--当月
|
||||||
|
*/
|
||||||
|
private Integer reportHiddenNum;
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package com.ruoyi.ehsIndexStatistics.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐患统计
|
||||||
|
*
|
||||||
|
* @author: 马腾达
|
||||||
|
* @date: 2023年12月15日 9:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HiddenDangerStatisticsVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业注册数--当月
|
||||||
|
*/
|
||||||
|
private Integer thisUnitNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业注册数--累计
|
||||||
|
*/
|
||||||
|
private Integer totalUnitNum;
|
||||||
|
/**
|
||||||
|
* 上报隐患数--当月
|
||||||
|
*/
|
||||||
|
private Integer thisReportNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报隐患数--累计
|
||||||
|
*/
|
||||||
|
private Integer totalReportNum;
|
||||||
|
/**
|
||||||
|
* 已整改数量--当月
|
||||||
|
*/
|
||||||
|
private Integer thisHaveNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已整改数量--累计
|
||||||
|
*/
|
||||||
|
private Integer totalHaveNum;
|
||||||
|
/**
|
||||||
|
* 未整改数量--当月
|
||||||
|
*/
|
||||||
|
private Integer thisNotNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未整改数量--累计
|
||||||
|
*/
|
||||||
|
private Integer totalNotNum;
|
||||||
|
/**
|
||||||
|
* 整改率--当月
|
||||||
|
*/
|
||||||
|
private String thisRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整改率--累计
|
||||||
|
*/
|
||||||
|
private String totalRate;
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.ruoyi.ehsIndexStatistics.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐患信息
|
||||||
|
*
|
||||||
|
* @author: 马腾达
|
||||||
|
* @date: 2023年12月14日 17:03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class HiddenDangerVo extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 隐患内容
|
||||||
|
*/
|
||||||
|
private String hiddenDangerDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位名称
|
||||||
|
*/
|
||||||
|
private String enterpriseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐患类别
|
||||||
|
*/
|
||||||
|
private String hiddenDangerType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐患级别
|
||||||
|
*/
|
||||||
|
private String hiddenDangerGrade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排查出隐患日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date checkTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整改期限
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date rectifyTermTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整改责任人
|
||||||
|
*/
|
||||||
|
private String principalName;
|
||||||
|
/**
|
||||||
|
* 整改情况
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,294 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.ehsIndexStatistics.mapper.EhsIndexStatisticsMapper">
|
||||||
|
<select id="getEhsIndexStatistics" resultType="com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics">
|
||||||
|
SELECT
|
||||||
|
count(distinct enterprise_name) unitNum,
|
||||||
|
count( 1 ) hiddenDangerNum,
|
||||||
|
sum( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END ) haveRectifiedNum,
|
||||||
|
sum( CASE WHEN STATUS != 10 THEN 1 ELSE 0 END ) notRectifiedNum,
|
||||||
|
sum( CASE WHEN STATUS != 10 AND rectify_term_time < NOW() THEN 1 ELSE 0 END ) exceedNotRectifiedNum,
|
||||||
|
sum( rectify_money ) rectifyMoneySum,
|
||||||
|
CONCAT(round(
|
||||||
|
sum( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END )/ sum( CASE WHEN STATUS != 10 THEN 1 ELSE 0 END ),
|
||||||
|
2
|
||||||
|
)*100,'%') rectifyRate
|
||||||
|
FROM
|
||||||
|
`ehs_hidden_danger`
|
||||||
|
<where>
|
||||||
|
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="getSuperviseAndHandle" resultType="com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics">
|
||||||
|
SELECT
|
||||||
|
count( 1 ) hiddenDangerNum,
|
||||||
|
sum( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END ) haveRectifiedNum,
|
||||||
|
sum( CASE WHEN STATUS != 10 THEN 1 ELSE 0 END ) notRectifiedNum,
|
||||||
|
sum( CASE WHEN STATUS != 10 AND rectify_term_time < NOW() THEN 1 ELSE 0 END ) exceedNotRectifiedNum,
|
||||||
|
sum( rectify_money ) rectifyMoneySum,
|
||||||
|
CONCAT(round(
|
||||||
|
sum( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END )/ sum( CASE WHEN STATUS != 10 THEN 1 ELSE 0 END ),
|
||||||
|
2
|
||||||
|
)*100,'%') rectifyRate
|
||||||
|
FROM
|
||||||
|
`ehs_hidden_danger`
|
||||||
|
<where>
|
||||||
|
is_supervise = 1
|
||||||
|
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="getEhsIndexStatisticsList" resultType="com.ruoyi.ehsIndexStatistics.vo.EhsIndexStatistics">
|
||||||
|
SELECT
|
||||||
|
r.hidden_danger_grade,
|
||||||
|
d.dict_label name,
|
||||||
|
sum( CASE WHEN r.hidden_danger_id is not null THEN 1 ELSE 0 END ) hiddenDangerNum,
|
||||||
|
sum( CASE WHEN r.STATUS = 10 THEN 1 ELSE 0 END ) haveRectifiedNum,
|
||||||
|
sum( CASE WHEN r.STATUS != 10 THEN 1 ELSE 0 END ) notRectifiedNum,
|
||||||
|
sum( CASE WHEN r.STATUS != 10 AND r.rectify_term_time < NOW() THEN 1 ELSE 0 END ) exceedNotRectifiedNum,
|
||||||
|
ifnull(sum( r.rectify_money ),0) rectifyMoneySum,
|
||||||
|
CONCAT(ifnull(round(
|
||||||
|
sum( CASE WHEN r.STATUS = 10 THEN 1 ELSE 0 END )/ sum( CASE WHEN r.STATUS != 10 THEN 1 ELSE 0 END ),
|
||||||
|
2
|
||||||
|
)* 100,0),'%') rectifyRate
|
||||||
|
FROM
|
||||||
|
sys_dict_data d
|
||||||
|
LEFT JOIN ehs_hidden_danger r ON r.hidden_danger_grade = d.dict_value
|
||||||
|
<where>
|
||||||
|
d.dict_type = 'hidden_danger_grade'
|
||||||
|
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY
|
||||||
|
r.hidden_danger_grade
|
||||||
|
</select>
|
||||||
|
<select id="getHiddenDangerVoList" parameterType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerVo" resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerVo">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
ehs_hidden_danger
|
||||||
|
<where>
|
||||||
|
<if test="vo.deptId != null and vo.deptId != ''">and dept_id = #{vo.deptId}</if>
|
||||||
|
<if test="vo.enterpriseName != null and vo.enterpriseName != ''">and enterprise_name like CONCAT('%',#{vo.enterpriseName},'%')</if>
|
||||||
|
<if test="vo.hiddenDangerGrade != null and vo.hiddenDangerGrade != ''">and hidden_danger_grade = #{vo.hiddenDangerGrade}</if>
|
||||||
|
<if test="vo.status != null and vo.status != ''">and status = #{vo.status}</if>
|
||||||
|
<if test="vo.params.qxStartTime != null and vo.params.qxStartTime != ''">and rectify_term_time >= #{vo.params.qxStartTime}</if>
|
||||||
|
<if test="vo.params.qxEndTime != null and vo.params.qxEndTime != ''">and rectify_term_time < #{vo.params.qxEndTime}</if>
|
||||||
|
<if test="vo.params.pcStartTime != null and vo.params.pcStartTime != ''">and check_time >= #{vo.params.pcStartTime}</if>
|
||||||
|
<if test="vo.params.pcEndTime != null and vo.params.pcEndTime != ''">and check_time < #{vo.params.pcEndTime}</if>
|
||||||
|
<if test="vo.params.wcStartTime != null and vo.params.wcStartTime != ''">and rectify_time >= #{vo.params.wcStartTime}</if>
|
||||||
|
<if test="vo.params.wcEndTime != null and vo.params.wcEndTime != ''">and rectify_time < #{vo.params.wcEndTime}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="getHiddenDangerSituationList"
|
||||||
|
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo">
|
||||||
|
SELECT
|
||||||
|
d.dict_label 'name',
|
||||||
|
(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',
|
||||||
|
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.status = 10 THEN 1 ELSE 0 END ) 'totalHaveNum',
|
||||||
|
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 ) 'thisNotNum',
|
||||||
|
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status != 10 THEN 1 ELSE 0 END ) 'totalNotNum',
|
||||||
|
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
|
||||||
|
sys_dict_data d
|
||||||
|
LEFT JOIN ehs_hidden_danger r ON r.area_id = d.dict_value
|
||||||
|
WHERE
|
||||||
|
d.dict_type = 'area_id'
|
||||||
|
GROUP BY
|
||||||
|
r.area_id
|
||||||
|
</select>
|
||||||
|
<select id="getHiddenDangerSituationByEnterpriseNameList"
|
||||||
|
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo">
|
||||||
|
SELECT
|
||||||
|
r.enterprise_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',
|
||||||
|
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status = 10 THEN 1 ELSE 0 END ) 'totalHaveNum',
|
||||||
|
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 ) 'thisNotNum',
|
||||||
|
sum( CASE WHEN r.hidden_danger_id IS NOT NULL and r.status != 10 THEN 1 ELSE 0 END ) 'totalNotNum',
|
||||||
|
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
|
||||||
|
GROUP BY
|
||||||
|
r.enterprise_name
|
||||||
|
</select>
|
||||||
|
<select id="getHiddenDangerRankVoList"
|
||||||
|
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerRankVo">
|
||||||
|
SELECT
|
||||||
|
s.*
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
d.dict_label 'areaName',
|
||||||
|
sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ) 'reportHiddenNum'
|
||||||
|
FROM
|
||||||
|
sys_dict_data d
|
||||||
|
LEFT JOIN ehs_hidden_danger r ON r.area_id = d.dict_value
|
||||||
|
WHERE
|
||||||
|
d.dict_type = 'area_id'
|
||||||
|
GROUP BY
|
||||||
|
r.area_id
|
||||||
|
) s
|
||||||
|
ORDER BY
|
||||||
|
s.reportHiddenNum DESC
|
||||||
|
</select>
|
||||||
|
<select id="getEnterpriseMapList"
|
||||||
|
resultType="map">
|
||||||
|
SELECT
|
||||||
|
ifnull(d.dict_label,'未知') 'name',
|
||||||
|
count( 1 ) 'value'
|
||||||
|
FROM
|
||||||
|
ehs_enterprise e
|
||||||
|
LEFT JOIN sys_dict_data d ON e.enterprise_type = d.dict_value
|
||||||
|
AND d.dict_type = 'enterprise_type'
|
||||||
|
<where>
|
||||||
|
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY
|
||||||
|
e.enterprise_type
|
||||||
|
</select>
|
||||||
|
<select id="geteconomicTypeMapList"
|
||||||
|
resultType="map">
|
||||||
|
SELECT
|
||||||
|
ifnull(d.dict_label,'未知') 'name',
|
||||||
|
count( 1 ) 'value'
|
||||||
|
FROM
|
||||||
|
ehs_enterprise e
|
||||||
|
LEFT JOIN sys_dict_data d ON e.economic_type = d.dict_value
|
||||||
|
AND d.dict_type = 'economic_type'
|
||||||
|
<where>
|
||||||
|
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY
|
||||||
|
e.economic_type
|
||||||
|
</select>
|
||||||
|
<select id="getenterpriseScaleMapList"
|
||||||
|
resultType="map">
|
||||||
|
SELECT
|
||||||
|
ifnull(d.dict_label,'未知') 'name',
|
||||||
|
count( 1 ) 'value'
|
||||||
|
FROM
|
||||||
|
ehs_enterprise e
|
||||||
|
LEFT JOIN sys_dict_data d ON e.enterprise_scale = d.dict_value
|
||||||
|
AND d.dict_type = 'enterprise_scale'
|
||||||
|
<where>
|
||||||
|
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY
|
||||||
|
e.enterprise_scale
|
||||||
|
</select>
|
||||||
|
<select id="getHiddenDangerTypeMapList"
|
||||||
|
resultType="map">
|
||||||
|
SELECT
|
||||||
|
ifnull(d.dict_label,'未知') 'name',
|
||||||
|
count( 1 ) 'value'
|
||||||
|
FROM
|
||||||
|
ehs_hidden_danger e
|
||||||
|
LEFT JOIN sys_dict_data d ON e.hidden_danger_type = d.dict_value
|
||||||
|
AND d.dict_type = 'hidden_danger_type'
|
||||||
|
<where>
|
||||||
|
<if test="deptId != null and deptId != ''">and dept_id = #{deptId}</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY
|
||||||
|
e.hidden_danger_type
|
||||||
|
</select>
|
||||||
|
<select id="getHiddenDangerDataMapList"
|
||||||
|
resultType="map">
|
||||||
|
SELECT
|
||||||
|
g.date_time 'dayStr',
|
||||||
|
g.dict_label 'name',
|
||||||
|
CAST(ifnull( h.value, 0 ) AS CHAR) 'dataNum'
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
s.date_time,
|
||||||
|
d.dict_code,
|
||||||
|
d.dict_label,
|
||||||
|
d.dict_value
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT( date_add( CONCAT( #{yearStr}, '-01-01' ), INTERVAL ROW MONTH ), '%Y-%m' ) date_time
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
@ROW := @ROW + 1 AS ROW
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
0 UNION ALL
|
||||||
|
SELECT
|
||||||
|
1 UNION ALL
|
||||||
|
SELECT
|
||||||
|
2 UNION ALL
|
||||||
|
SELECT
|
||||||
|
3 UNION ALL
|
||||||
|
SELECT
|
||||||
|
4 UNION ALL
|
||||||
|
SELECT
|
||||||
|
5 UNION ALL
|
||||||
|
SELECT
|
||||||
|
6 UNION ALL
|
||||||
|
SELECT
|
||||||
|
7 UNION ALL
|
||||||
|
SELECT
|
||||||
|
8 UNION ALL
|
||||||
|
SELECT
|
||||||
|
9
|
||||||
|
) t,
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
0 UNION ALL
|
||||||
|
SELECT
|
||||||
|
1 UNION ALL
|
||||||
|
SELECT
|
||||||
|
2 UNION ALL
|
||||||
|
SELECT
|
||||||
|
3 UNION ALL
|
||||||
|
SELECT
|
||||||
|
4 UNION ALL
|
||||||
|
SELECT
|
||||||
|
5 UNION ALL
|
||||||
|
SELECT
|
||||||
|
6 UNION ALL
|
||||||
|
SELECT
|
||||||
|
7 UNION ALL
|
||||||
|
SELECT
|
||||||
|
8 UNION ALL
|
||||||
|
SELECT
|
||||||
|
9
|
||||||
|
) t2,
|
||||||
|
( SELECT @ROW :=- 1 ) r
|
||||||
|
) se
|
||||||
|
WHERE
|
||||||
|
DATE_FORMAT( date_add( CONCAT( #{yearStr}, '-01-01' ), INTERVAL ROW MONTH ), '%Y-%m' ) <= DATE_FORMAT( CONCAT( #{yearStr}, '-12-01' ), '%Y-%m' )) s,
|
||||||
|
sys_dict_data d
|
||||||
|
WHERE
|
||||||
|
d.dict_type = 'hidden_danger_grade'
|
||||||
|
) g
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT( r.check_time, '%Y-%m' ) date_time,
|
||||||
|
r.hidden_danger_grade,
|
||||||
|
sum( CASE WHEN r.hidden_danger_id IS NOT NULL THEN 1 ELSE 0 END ) 'value'
|
||||||
|
FROM
|
||||||
|
ehs_hidden_danger r
|
||||||
|
<where>
|
||||||
|
<if test="deptId != null and deptId != ''">and r.dept_id = #{deptId}</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY
|
||||||
|
r.hidden_danger_grade,
|
||||||
|
DATE_FORMAT( r.check_time, '%Y-%m' )) h ON g.date_time = h.date_time
|
||||||
|
AND g.dict_value = h.hidden_danger_grade
|
||||||
|
ORDER BY
|
||||||
|
g.date_time,
|
||||||
|
g.dict_value
|
||||||
|
</select>
|
||||||
|
</mapper>
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue