数据统计分析行政区域和上报部门统计报表导出

main
15036302109 2 months ago
parent 1e55445caa
commit eaa7fc6fce

@ -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<HiddenDangerStatisticsVo> list = ehsIndexStatisticsService.getHiddenDangerSituationList(dateTime);
ExcelUtil<HiddenDangerStatisticsVo> 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<HiddenDangerStatisticsVo> list = ehsIndexStatisticsService.getHiddenDangerSituationByEnterpriseNameList(dateTime);
List<HiddenDangerByEnterpriseVo> 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<HiddenDangerByEnterpriseVo> list = ehsIndexStatisticsService.getHiddenDangerSituationByEnterpriseNameList(dateTime);
ExcelUtil<HiddenDangerByEnterpriseVo> util = new ExcelUtil<>(HiddenDangerByEnterpriseVo.class);
util.exportExcel(response, list, "上报部门统计", month + "月上报部门统计隐患数据");
}
/**
*
*/

@ -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<HiddenDangerVo> getHiddenDangerVoList(@Param("vo") HiddenDangerVo vo);
List<HiddenDangerStatisticsVo> getHiddenDangerSituationList(@Param("targetTime") Date targetTime);
List<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList(@Param("targetTime") Date targetTime);
List<HiddenDangerByEnterpriseVo> getHiddenDangerSituationByEnterpriseNameList(@Param("targetTime") Date targetTime);
List<HiddenDangerRankVo> getHiddenDangerRankVoList();
List<HiddenDangerRankVo> getHiddenDangerRankVoByDeptIdList(@Param("targetTime") Date targetTime);
List<Map<String,Object>> getEnterpriseMapList(@Param("targetTime") Date targetTime, @Param("deptId") Long deptId);

@ -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<HiddenDangerStatisticsVo> getHiddenDangerSituationList(Date targetTime);
/**
*
*
*/
List<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList(Date targetTime);
List<HiddenDangerByEnterpriseVo> getHiddenDangerSituationByEnterpriseNameList(Date targetTime);
/**
*
*/

@ -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<HiddenDangerStatisticsVo> getHiddenDangerSituationByEnterpriseNameList(Date targetTime) {
public List<HiddenDangerByEnterpriseVo> getHiddenDangerSituationByEnterpriseNameList(Date targetTime) {
return mapper.getHiddenDangerSituationByEnterpriseNameList(targetTime);
}

@ -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;
}

@ -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;

@ -111,7 +111,7 @@ SELECT
c.dict_type = 'area_id'
</select>
<select id="getHiddenDangerSituationByEnterpriseNameList"
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerStatisticsVo">
resultType="com.ruoyi.ehsIndexStatistics.vo.HiddenDangerByEnterpriseVo">
SELECT
d.dept_name 'name',
sum(CASE WHEN r.hidden_danger_id IS NOT NULL AND r.check_time BETWEEN DATE_FORMAT( #{targetTime}, '%Y-%m-01 00:00:00' ) AND CONCAT(LAST_DAY(#{targetTime}), ' 23:59:59') THEN r.hd_count ELSE 0 END ) 'thisReportNum',

Loading…
Cancel
Save