From eaa7fc6fce9f0c8276ab878b1c51c13b73b0b52d Mon Sep 17 00:00:00 2001 From: 15036302109 Date: Mon, 22 Jul 2024 15:43:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1=E5=88=86?= =?UTF-8?q?=E6=9E=90=E8=A1=8C=E6=94=BF=E5=8C=BA=E5=9F=9F=E5=92=8C=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5=E9=83=A8=E9=97=A8=E7=BB=9F=E8=AE=A1=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ehs/EhsIndexStatisticsController.java | 56 +++++++++++++- .../mapper/EhsIndexStatisticsMapper.java | 7 +- .../service/EhsIndexStatisticsService.java | 9 +-- .../impl/EhsIndexStatisticsServiceImpl.java | 7 +- .../vo/HiddenDangerByEnterpriseVo.java | 74 +++++++++++++++++++ .../vo/HiddenDangerStatisticsVo.java | 12 +++ .../mapper/ehs/EhsIndexStatisticsMapper.xml | 2 +- 7 files changed, 147 insertions(+), 20 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/vo/HiddenDangerByEnterpriseVo.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsIndexStatisticsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsIndexStatisticsController.java index 2e6e5b4..a8ef680 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsIndexStatisticsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/ehs/EhsIndexStatisticsController.java @@ -9,6 +9,7 @@ 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.common.utils.poi.ExcelUtil; import com.ruoyi.ehsEnterprise.domain.EhsEnterprise; import com.ruoyi.ehsEnterprise.service.IEhsEnterpriseService; import com.ruoyi.ehsIndexStatistics.service.EhsIndexStatisticsService; @@ -19,9 +20,11 @@ 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.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletResponse; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; @@ -101,9 +104,32 @@ public class EhsIndexStatisticsController extends BaseController { } /** - * 隐患情况---按地址统计 + * 隐患情况---按行政区域统计--导出 */ - @ApiOperation("按地址统计") + @ApiOperation("隐患情况---按行政区域统计--导出") + @PostMapping("/getHiddenDangerSituationList/export") + public void hiddenDangerSituationListExport(HttpServletResponse response, String targetTime) + { + DateTime dateTime = null; + Integer month = null; + if (targetTime != null) { + targetTime = targetTime + "-01 00:00:00"; + dateTime = DateUtil.parse(targetTime, "yyyy-MM-dd HH:mm:ss"); + month = Integer.valueOf(dateTime.toString("MM")); + } + if (targetTime == null) { + dateTime = DateTime.now(); + month = Integer.valueOf(dateTime.toString("MM")); + } + List list = ehsIndexStatisticsService.getHiddenDangerSituationList(dateTime); + ExcelUtil util = new ExcelUtil<>(HiddenDangerStatisticsVo.class); + util.exportExcel(response, list, "行政区域统计", month + "月行政区域统计隐患数据"); + } + + /** + * 隐患情况---按上报部门统计 + */ + @ApiOperation("按上报部门统计") @GetMapping("/getHiddenDangerSituationByEnterpriseNameList") public AjaxResult getHiddenDangerSituationByEnterpriseNameList(String targetTime) { @@ -115,9 +141,33 @@ public class EhsIndexStatisticsController extends BaseController { if(targetTime == null) { dateTime = DateTime.now(); } - List list = ehsIndexStatisticsService.getHiddenDangerSituationByEnterpriseNameList(dateTime); + List list = ehsIndexStatisticsService.getHiddenDangerSituationByEnterpriseNameList(dateTime); return AjaxResult.success(list); } + + /** + * 隐患情况--上报部门统计--导出 + */ + @ApiOperation("按上报部门统计") + @PostMapping("/getHiddenDangerSituationByEnterpriseNameList/export") + public void hiddenDangerSituationByEnterpriseNameListExport(HttpServletResponse response, String targetTime) + { + DateTime dateTime = null; + Integer month = null; + if (targetTime != null) { + targetTime = targetTime + "-01 00:00:00"; + dateTime = DateUtil.parse(targetTime, "yyyy-MM-dd HH:mm:ss"); + month = Integer.valueOf(dateTime.toString("MM")); + } + if(targetTime == null) { + dateTime = DateTime.now(); + month = Integer.valueOf(dateTime.toString("MM")); + } + List list = ehsIndexStatisticsService.getHiddenDangerSituationByEnterpriseNameList(dateTime); + ExcelUtil util = new ExcelUtil<>(HiddenDangerByEnterpriseVo.class); + util.exportExcel(response, list, "上报部门统计", month + "月上报部门统计隐患数据"); + } + /** * 上报隐患排名 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/mapper/EhsIndexStatisticsMapper.java b/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/mapper/EhsIndexStatisticsMapper.java index 7dd3476..b47c92b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/mapper/EhsIndexStatisticsMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/mapper/EhsIndexStatisticsMapper.java @@ -1,9 +1,6 @@ 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 com.ruoyi.ehsIndexStatistics.vo.*; import org.apache.ibatis.annotations.Param; import java.util.Date; @@ -19,7 +16,7 @@ public interface EhsIndexStatisticsMapper { List getHiddenDangerVoList(@Param("vo") HiddenDangerVo vo); List getHiddenDangerSituationList(@Param("targetTime") Date targetTime); - List getHiddenDangerSituationByEnterpriseNameList(@Param("targetTime") Date targetTime); + List getHiddenDangerSituationByEnterpriseNameList(@Param("targetTime") Date targetTime); List getHiddenDangerRankVoList(); List getHiddenDangerRankVoByDeptIdList(@Param("targetTime") Date targetTime); List> getEnterpriseMapList(@Param("targetTime") Date targetTime, @Param("deptId") Long deptId); diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/service/EhsIndexStatisticsService.java b/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/service/EhsIndexStatisticsService.java index 15cbcfe..07e49b0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/service/EhsIndexStatisticsService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/service/EhsIndexStatisticsService.java @@ -1,9 +1,6 @@ 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 com.ruoyi.ehsIndexStatistics.vo.*; import org.apache.ibatis.annotations.Param; import java.util.Date; @@ -23,9 +20,9 @@ public interface EhsIndexStatisticsService { */ List getHiddenDangerSituationList(Date targetTime); /** - * 按公司统计 + * 按上报部门统计 */ - List getHiddenDangerSituationByEnterpriseNameList(Date targetTime); + List getHiddenDangerSituationByEnterpriseNameList(Date targetTime); /** * 上报隐患排名 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/service/impl/EhsIndexStatisticsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/service/impl/EhsIndexStatisticsServiceImpl.java index 4557518..6452c73 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/service/impl/EhsIndexStatisticsServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/service/impl/EhsIndexStatisticsServiceImpl.java @@ -7,10 +7,7 @@ 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 com.ruoyi.ehsIndexStatistics.vo.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -91,7 +88,7 @@ public class EhsIndexStatisticsServiceImpl implements EhsIndexStatisticsService return mapper.getHiddenDangerSituationList(targetTime); } @Override - public List getHiddenDangerSituationByEnterpriseNameList(Date targetTime) { + public List getHiddenDangerSituationByEnterpriseNameList(Date targetTime) { return mapper.getHiddenDangerSituationByEnterpriseNameList(targetTime); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/vo/HiddenDangerByEnterpriseVo.java b/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/vo/HiddenDangerByEnterpriseVo.java new file mode 100644 index 0000000..be1d124 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/vo/HiddenDangerByEnterpriseVo.java @@ -0,0 +1,74 @@ +package com.ruoyi.ehsIndexStatistics.vo; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +/** + * 数据统计分析--上报部门统计 + * @author 张浩朴 + */ + +@Data +public class HiddenDangerByEnterpriseVo { + /** + * 名称 + */ + @Excel(name = "各部门") + private String name; + + /** + * 企业注册数--当月 + */ +// private Integer thisUnitNum; + + /** + * 企业注册数--累计 + */ +// private Integer totalUnitNum; + /** + * 上报隐患数--当月 + */ + @Excel(name = "当月上报隐患数") + private Integer thisReportNum; + + /** + * 上报隐患数--累计 + */ + @Excel(name = "累计上报隐患数") + private Integer totalReportNum; + /** + * 已整改数量--当月 + */ + @Excel(name = "当月已整改数量") + private Integer thisHaveNum; + + /** + * 已整改数量--累计 + */ + @Excel(name = "累计已整改数量") + private Integer totalHaveNum; + /** + * 未整改数量--当月 + */ + @Excel(name = "当月未整改数量") + private Integer thisNotNum; + + /** + * 未整改数量--累计 + */ + @Excel(name = "累计未整改数量") + private Integer totalNotNum; + /** + * 整改率--当月 + */ + @Excel(name = "当月整改率") + private String thisRate; + + /** + * 整改率--累计 + */ + @Excel(name = "累计整改率") + private String totalRate; + + private String deptId; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/vo/HiddenDangerStatisticsVo.java b/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/vo/HiddenDangerStatisticsVo.java index bbf5c0f..1216128 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/vo/HiddenDangerStatisticsVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/ehsIndexStatistics/vo/HiddenDangerStatisticsVo.java @@ -1,5 +1,6 @@ package com.ruoyi.ehsIndexStatistics.vo; +import com.ruoyi.common.annotation.Excel; import lombok.Data; /** @@ -14,52 +15,63 @@ public class HiddenDangerStatisticsVo { /** * 名称 */ + @Excel(name = "各区(县)") private String name; /** * 企业注册数--当月 */ + @Excel(name = "当月注册企业数") private Integer thisUnitNum; /** * 企业注册数--累计 */ + @Excel(name = "累计注册企业数") private Integer totalUnitNum; /** * 上报隐患数--当月 */ + @Excel(name = "当月上报隐患数") private Integer thisReportNum; /** * 上报隐患数--累计 */ + @Excel(name = "累计上报隐患数") private Integer totalReportNum; /** * 已整改数量--当月 */ + @Excel(name = "当月已整改数量") private Integer thisHaveNum; /** * 已整改数量--累计 */ + @Excel(name = "累计已整改数量") private Integer totalHaveNum; /** * 未整改数量--当月 */ + @Excel(name = "当月未整改数量") private Integer thisNotNum; /** * 未整改数量--累计 */ + @Excel(name = "累计未整改数量") private Integer totalNotNum; /** * 整改率--当月 */ + @Excel(name = "当月整改率") private String thisRate; /** * 整改率--累计 */ + @Excel(name = "累计整改率") private String totalRate; private String deptId; diff --git a/ruoyi-system/src/main/resources/mapper/ehs/EhsIndexStatisticsMapper.xml b/ruoyi-system/src/main/resources/mapper/ehs/EhsIndexStatisticsMapper.xml index e858b28..f531a38 100644 --- a/ruoyi-system/src/main/resources/mapper/ehs/EhsIndexStatisticsMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/ehs/EhsIndexStatisticsMapper.xml @@ -111,7 +111,7 @@ SELECT c.dict_type = 'area_id'