From 679dfe8a68fe56100e708f112c1060d661d7b136 Mon Sep 17 00:00:00 2001 From: huangzhen <867127663@qq.com> Date: 星期五, 30 九月 2022 16:41:03 +0800 Subject: [PATCH] 完成SPI数据提供接口 --- src/main/java/com/ruoyi/doublePrevention/repository/TrHiddenDangerCheckPointRepository.java | 24 src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerLevelRectifiedRespDO.java | 28 src/main/java/com/ruoyi/doublePrevention/service/SPIDataCountService.java | 13 src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerLevelRespDO.java | 27 src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml | 27 src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerResultRespDO.java | 48 + src/main/java/com/ruoyi/doublePrevention/service/impl/SPIDataCountServiceImpl.java | 200 ++++++ src/main/java/com/ruoyi/doublePrevention/entity/DoublePreventDept.java | 175 +++++ pom.xml | 7 src/main/java/com/ruoyi/doublePrevention/service/baseService/DoublePreventionDeptService.java | 19 src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventRiskDangerInfoServiceImpl.java | 16 src/main/resources/mybatis/doublePrevention/DoublePreventDeptMapper.xml | 33 + src/main/java/com/ruoyi/doublePrevention/repository/PreventRiskDangerInfoRepository.java | 11 src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/TrHiddenDangerCheckPointServiceImpl.java | 34 + src/main/java/com/ruoyi/doublePrevention/entity/dto/resp/SPIDataCountRespDTO.java | 134 ++++ src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/DoublePreventionDeptServiceImpl.java | 33 + src/main/resources/mybatis/doublePrevention/TrHiddenDangerCheckPointMapper.xml | 111 +++ src/main/java/com/ruoyi/doublePrevention/repository/param/DataCountStartAndEndTimeParams.java | 27 src/main/java/com/ruoyi/doublePrevention/entity/TrHiddenDangerCheckPoint.java | 658 +++++++++++++++++++++ src/main/java/com/ruoyi/doublePrevention/controller/SPIDataCountController.java | 29 src/main/java/com/ruoyi/doublePrevention/repository/DoublePreventDeptRepository.java | 20 src/main/java/com/ruoyi/doublePrevention/entity/dto/req/SPIDataCountReqDTO.java | 46 + src/main/java/com/ruoyi/doublePrevention/service/baseService/TrHiddenDangerCheckPointService.java | 21 src/main/java/com/ruoyi/doublePrevention/service/baseService/PreventRiskDangerInfoService.java | 11 24 files changed, 1,752 insertions(+), 0 deletions(-) diff --git a/pom.xml b/pom.xml index 9fc3a70..4da3b93 100644 --- a/pom.xml +++ b/pom.xml @@ -317,6 +317,13 @@ <artifactId>core</artifactId> <version>3.2.1</version> </dependency> + + <!--后面是新增的依赖--> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.11</version> + </dependency> <!--mybatis-plus--> <dependency> <groupId>com.baomidou</groupId> diff --git a/src/main/java/com/ruoyi/doublePrevention/controller/SPIDataCountController.java b/src/main/java/com/ruoyi/doublePrevention/controller/SPIDataCountController.java new file mode 100644 index 0000000..417032e --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/controller/SPIDataCountController.java @@ -0,0 +1,29 @@ +package com.ruoyi.doublePrevention.controller; + + +import com.ruoyi.doublePrevention.entity.dto.req.SPIDataCountReqDTO; +import com.ruoyi.doublePrevention.entity.dto.resp.SPIDataCountRespDTO; +import com.ruoyi.doublePrevention.service.SPIDataCountService; +import com.ruoyi.doublePrevention.vo.ResultVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/SPIDataCount") +public class SPIDataCountController { + + @Autowired + private SPIDataCountService spiDataCountService; + + /** + * @description 按年或者月统计隐患数量 + */ + @PostMapping("/select/listDangerResultCountByMonthOrYear") + public ResultVO<SPIDataCountRespDTO> listDangerResultCountByMonthOrYear(@RequestBody SPIDataCountReqDTO spiDataCountReqDTO) { + return spiDataCountService.listDangerResultCountByMonthOrYear(spiDataCountReqDTO); + } + +} diff --git a/src/main/java/com/ruoyi/doublePrevention/entity/DoublePreventDept.java b/src/main/java/com/ruoyi/doublePrevention/entity/DoublePreventDept.java new file mode 100644 index 0000000..71e030f --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/entity/DoublePreventDept.java @@ -0,0 +1,175 @@ +package com.ruoyi.doublePrevention.entity; + +import com.ruoyi.project.system.company.domain.Company; + +import java.util.Date; +import java.util.List; + +public class DoublePreventDept { + + /** 部门ID */ + private Long deptId; + + /** 父部门ID */ + private Long parentId; + + /** 祖级列表 */ + private String ancestors; + + /** 部门名称 */ + private String deptName; + + /** 显示顺序 */ + private String orderNum; + + /** 负责人 */ + private String leader; + + /** 联系电话 */ + private String phone; + + /** 邮箱 */ + private String email; + + /** 部门状态:0正常,1停用 */ + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 创建人 */ + private String createBy; + + /** 创建时间 */ + private Date createTime; + + /** 更新人 */ + private String updateBy; + + /** 更新时间 */ + private Date updateTime; + + /** 所属公司 */ + private Long companyId; + + + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public String getAncestors() { + return ancestors; + } + + public void setAncestors(String ancestors) { + this.ancestors = ancestors; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getOrderNum() { + return orderNum; + } + + public void setOrderNum(String orderNum) { + this.orderNum = orderNum; + } + + public String getLeader() { + return leader; + } + + public void setLeader(String leader) { + this.leader = leader; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Long getCompanyId() { + return companyId; + } + + public void setCompanyId(Long companyId) { + this.companyId = companyId; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/entity/TrHiddenDangerCheckPoint.java b/src/main/java/com/ruoyi/doublePrevention/entity/TrHiddenDangerCheckPoint.java new file mode 100644 index 0000000..427585e --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/entity/TrHiddenDangerCheckPoint.java @@ -0,0 +1,658 @@ +package com.ruoyi.doublePrevention.entity; + +import com.alibaba.fastjson.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.framework.aspectj.lang.annotation.Excel; + +import java.util.Date; +import java.util.List; + +/** + * @description 只用于接收对象 新增不用这个实体类 用源系统的实体类 + */ +@TableName("tr_hidden_danger_check_point") +public class TrHiddenDangerCheckPoint { + + /** 主键ID */ + private Long id; + + /** 隐患排查检查点信息ID */ + private Long checkPointId; + + /** 隐患排查ID */ + private Long checkId; + + /** 创建人 */ + private String createBy; + + /** 创建时间 */ + private Date createTime; + + /** 更新人 */ + private String updateBy; + + /** 更新时间 */ + private Date updateTime; + + /** 备注 */ + private String remark; + + /** 是否为隐患 */ + private String whetherDanger; + + /** 隐患名称 */ + private String dangerName; + + /** 隐患描述 */ + private String dangerDescription; + + /** 隐患级别(0一般隐患 1重大隐患) */ + private String dangerLevel; + + /** 隐患类别ID */ + private Long troubleTypeId; + + /** 隐患类别名称 */ + private String troubleTypeName; + + /** 排查时间 */ + private Date checkTime; + + /** 隐患整改前照片 */ + private String preRectifyPhoto; + + /** 登记人ID */ + private Long registerUserId; + + /** 登记人名称 */ + private String registerUserName; + + /** 登记创建时间 */ + private Date registerCreateTime; + + + /** 登记提交时间 */ + private Date registerSubmitTime; + + /** 判定人ID */ + private Long judgeUserId; + + /** 判定人名称 */ + private String judgeUserName; + + + /** 判定创建时间 */ + private Date judgeCreateTime; + + + /** 隐患上报创建人ID */ + private Long judgeCreateUserId; + + /** 隐患来源(1隐患计划排查生成 2隐患上报生成) */ + private String dangerSources; + + /** 上报判定结果(0未判定 1不是隐患 2是隐患) */ + private String reportStatus; + + /** 核查人ID */ + private Long examineUserId; + + /** 核查人名称 */ + private String examineUserName; + + /** 核查状态(0待核查 1已核查) */ + private String examineStatus; + + /** 隐患核查意见 */ + private String examineOpinion; + + /** 隐患核查结果(0一般隐患 1重大隐患) */ + private String examineResult; + + /** 核查创建时间 */ + private Date examineCreateTime; + + /** 治理措施 */ + private String treatMeasure; + + /** 整改人ID */ + private Long rectifyUserId; + + /** 整改人名称 */ + private String rectifyUserName; + + /** 隐患整改责任部门ID */ + private Long rectifyDeptId; + + /** 隐患整改责任部门名称 */ + private String rectifyDeptName; + + /** 完成期限 */ + private Date rectifyDeadlineTime; + + /** 整改类型(1立即整改 2限期整改 3停产停业整改) */ + private String rectifyType; + + /** 整改附件地址 */ + private String rectifyAttachment; + + /** 整改措施 */ + private String rectifyMeasure; + + /** 整改情况 */ + private String rectifyCondition; + + /** 整改资金 */ + private String rectifyFund; + + /** 整改完成时间 */ + private Date rectifyCompleteTime; + + /** 整改状态(0未整改 1已整改) */ + private String rectifyStatus; + + /** 整改创建时间 */ + private Date rectifyCreateTime; + + /** 验收负责人ID */ + private Long acceptUserId; + + /** 验收负责人姓名 */ + private String acceptUserName; + + /** 隐患整改后照片 */ + private String postRectifyPhoto; + + /** 验收结果 */ + private String acceptResult; + + /** 验收意见 */ + private String acceptOpinion; + + /** 验收文件 */ + private String acceptFile; + + /** 验收状态(0未验收 1验收通过) */ + private String acceptStatus; + + + /** 验收创建时间 */ + private Date acceptCreateTime; + + /** 隐患排查阶段(1隐患排查计划制定阶段 2隐患排查计划执行阶段 3隐患核查阶段 4隐患整改阶段 5隐患验收阶段) */ + private String stage; + + /** 排查状态(0待排查 1已排查)(定时任务生成的数据) */ + private String scheduleCheckStatus; + + //排查类型(1基础清单排查 2选择风险单元清单排查) + private String checkType; + + /** 公司id */ + private Long companyId; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getCheckPointId() { + return checkPointId; + } + + public void setCheckPointId(Long checkPointId) { + this.checkPointId = checkPointId; + } + + public Long getCheckId() { + return checkId; + } + + public void setCheckId(Long checkId) { + this.checkId = checkId; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getWhetherDanger() { + return whetherDanger; + } + + public void setWhetherDanger(String whetherDanger) { + this.whetherDanger = whetherDanger; + } + + public String getDangerName() { + return dangerName; + } + + public void setDangerName(String dangerName) { + this.dangerName = dangerName; + } + + public String getDangerDescription() { + return dangerDescription; + } + + public void setDangerDescription(String dangerDescription) { + this.dangerDescription = dangerDescription; + } + + public String getDangerLevel() { + return dangerLevel; + } + + public void setDangerLevel(String dangerLevel) { + this.dangerLevel = dangerLevel; + } + + public Long getTroubleTypeId() { + return troubleTypeId; + } + + public void setTroubleTypeId(Long troubleTypeId) { + this.troubleTypeId = troubleTypeId; + } + + public String getTroubleTypeName() { + return troubleTypeName; + } + + public void setTroubleTypeName(String troubleTypeName) { + this.troubleTypeName = troubleTypeName; + } + + public Date getCheckTime() { + return checkTime; + } + + public void setCheckTime(Date checkTime) { + this.checkTime = checkTime; + } + + public String getPreRectifyPhoto() { + return preRectifyPhoto; + } + + public void setPreRectifyPhoto(String preRectifyPhoto) { + this.preRectifyPhoto = preRectifyPhoto; + } + + public Long getRegisterUserId() { + return registerUserId; + } + + public void setRegisterUserId(Long registerUserId) { + this.registerUserId = registerUserId; + } + + public String getRegisterUserName() { + return registerUserName; + } + + public void setRegisterUserName(String registerUserName) { + this.registerUserName = registerUserName; + } + + public Date getRegisterCreateTime() { + return registerCreateTime; + } + + public void setRegisterCreateTime(Date registerCreateTime) { + this.registerCreateTime = registerCreateTime; + } + + public Date getRegisterSubmitTime() { + return registerSubmitTime; + } + + public void setRegisterSubmitTime(Date registerSubmitTime) { + this.registerSubmitTime = registerSubmitTime; + } + + public Long getJudgeUserId() { + return judgeUserId; + } + + public void setJudgeUserId(Long judgeUserId) { + this.judgeUserId = judgeUserId; + } + + public String getJudgeUserName() { + return judgeUserName; + } + + public void setJudgeUserName(String judgeUserName) { + this.judgeUserName = judgeUserName; + } + + public Date getJudgeCreateTime() { + return judgeCreateTime; + } + + public void setJudgeCreateTime(Date judgeCreateTime) { + this.judgeCreateTime = judgeCreateTime; + } + + public Long getJudgeCreateUserId() { + return judgeCreateUserId; + } + + public void setJudgeCreateUserId(Long judgeCreateUserId) { + this.judgeCreateUserId = judgeCreateUserId; + } + + public String getDangerSources() { + return dangerSources; + } + + public void setDangerSources(String dangerSources) { + this.dangerSources = dangerSources; + } + + public String getReportStatus() { + return reportStatus; + } + + public void setReportStatus(String reportStatus) { + this.reportStatus = reportStatus; + } + + public Long getExamineUserId() { + return examineUserId; + } + + public void setExamineUserId(Long examineUserId) { + this.examineUserId = examineUserId; + } + + public String getExamineUserName() { + return examineUserName; + } + + public void setExamineUserName(String examineUserName) { + this.examineUserName = examineUserName; + } + + public String getExamineStatus() { + return examineStatus; + } + + public void setExamineStatus(String examineStatus) { + this.examineStatus = examineStatus; + } + + public String getExamineOpinion() { + return examineOpinion; + } + + public void setExamineOpinion(String examineOpinion) { + this.examineOpinion = examineOpinion; + } + + public String getExamineResult() { + return examineResult; + } + + public void setExamineResult(String examineResult) { + this.examineResult = examineResult; + } + + public Date getExamineCreateTime() { + return examineCreateTime; + } + + public void setExamineCreateTime(Date examineCreateTime) { + this.examineCreateTime = examineCreateTime; + } + + public String getTreatMeasure() { + return treatMeasure; + } + + public void setTreatMeasure(String treatMeasure) { + this.treatMeasure = treatMeasure; + } + + public Long getRectifyUserId() { + return rectifyUserId; + } + + public void setRectifyUserId(Long rectifyUserId) { + this.rectifyUserId = rectifyUserId; + } + + public String getRectifyUserName() { + return rectifyUserName; + } + + public void setRectifyUserName(String rectifyUserName) { + this.rectifyUserName = rectifyUserName; + } + + public Long getRectifyDeptId() { + return rectifyDeptId; + } + + public void setRectifyDeptId(Long rectifyDeptId) { + this.rectifyDeptId = rectifyDeptId; + } + + public String getRectifyDeptName() { + return rectifyDeptName; + } + + public void setRectifyDeptName(String rectifyDeptName) { + this.rectifyDeptName = rectifyDeptName; + } + + public Date getRectifyDeadlineTime() { + return rectifyDeadlineTime; + } + + public void setRectifyDeadlineTime(Date rectifyDeadlineTime) { + this.rectifyDeadlineTime = rectifyDeadlineTime; + } + + public String getRectifyType() { + return rectifyType; + } + + public void setRectifyType(String rectifyType) { + this.rectifyType = rectifyType; + } + + public String getRectifyAttachment() { + return rectifyAttachment; + } + + public void setRectifyAttachment(String rectifyAttachment) { + this.rectifyAttachment = rectifyAttachment; + } + + public String getRectifyMeasure() { + return rectifyMeasure; + } + + public void setRectifyMeasure(String rectifyMeasure) { + this.rectifyMeasure = rectifyMeasure; + } + + public String getRectifyCondition() { + return rectifyCondition; + } + + public void setRectifyCondition(String rectifyCondition) { + this.rectifyCondition = rectifyCondition; + } + + public String getRectifyFund() { + return rectifyFund; + } + + public void setRectifyFund(String rectifyFund) { + this.rectifyFund = rectifyFund; + } + + public Date getRectifyCompleteTime() { + return rectifyCompleteTime; + } + + public void setRectifyCompleteTime(Date rectifyCompleteTime) { + this.rectifyCompleteTime = rectifyCompleteTime; + } + + public String getRectifyStatus() { + return rectifyStatus; + } + + public void setRectifyStatus(String rectifyStatus) { + this.rectifyStatus = rectifyStatus; + } + + public Date getRectifyCreateTime() { + return rectifyCreateTime; + } + + public void setRectifyCreateTime(Date rectifyCreateTime) { + this.rectifyCreateTime = rectifyCreateTime; + } + + public Long getAcceptUserId() { + return acceptUserId; + } + + public void setAcceptUserId(Long acceptUserId) { + this.acceptUserId = acceptUserId; + } + + public String getAcceptUserName() { + return acceptUserName; + } + + public void setAcceptUserName(String acceptUserName) { + this.acceptUserName = acceptUserName; + } + + public String getPostRectifyPhoto() { + return postRectifyPhoto; + } + + public void setPostRectifyPhoto(String postRectifyPhoto) { + this.postRectifyPhoto = postRectifyPhoto; + } + + public String getAcceptResult() { + return acceptResult; + } + + public void setAcceptResult(String acceptResult) { + this.acceptResult = acceptResult; + } + + public String getAcceptOpinion() { + return acceptOpinion; + } + + public void setAcceptOpinion(String acceptOpinion) { + this.acceptOpinion = acceptOpinion; + } + + public String getAcceptFile() { + return acceptFile; + } + + public void setAcceptFile(String acceptFile) { + this.acceptFile = acceptFile; + } + + public String getAcceptStatus() { + return acceptStatus; + } + + public void setAcceptStatus(String acceptStatus) { + this.acceptStatus = acceptStatus; + } + + public Date getAcceptCreateTime() { + return acceptCreateTime; + } + + public void setAcceptCreateTime(Date acceptCreateTime) { + this.acceptCreateTime = acceptCreateTime; + } + + public String getStage() { + return stage; + } + + public void setStage(String stage) { + this.stage = stage; + } + + public String getScheduleCheckStatus() { + return scheduleCheckStatus; + } + + public void setScheduleCheckStatus(String scheduleCheckStatus) { + this.scheduleCheckStatus = scheduleCheckStatus; + } + + public String getCheckType() { + return checkType; + } + + public void setCheckType(String checkType) { + this.checkType = checkType; + } + + public Long getCompanyId() { + return companyId; + } + + public void setCompanyId(Long companyId) { + this.companyId = companyId; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerLevelRectifiedRespDO.java b/src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerLevelRectifiedRespDO.java new file mode 100644 index 0000000..dbee092 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerLevelRectifiedRespDO.java @@ -0,0 +1,28 @@ +package com.ruoyi.doublePrevention.entity.dto; + +public class DataCountDangerLevelRectifiedRespDO { + + + //重大隐患数量-已经整改 + private Integer heavyRiskRectifyCount; + + //一般隐患数量-已经整改 + private Integer lightRiskRectifyCount; + + + public Integer getHeavyRiskRectifyCount() { + return heavyRiskRectifyCount; + } + + public void setHeavyRiskRectifyCount(Integer heavyRiskRectifyCount) { + this.heavyRiskRectifyCount = heavyRiskRectifyCount; + } + + public Integer getLightRiskRectifyCount() { + return lightRiskRectifyCount; + } + + public void setLightRiskRectifyCount(Integer lightRiskRectifyCount) { + this.lightRiskRectifyCount = lightRiskRectifyCount; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerLevelRespDO.java b/src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerLevelRespDO.java new file mode 100644 index 0000000..0516b55 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerLevelRespDO.java @@ -0,0 +1,27 @@ +package com.ruoyi.doublePrevention.entity.dto; + +public class DataCountDangerLevelRespDO { + + //重大隐患数量 + private Integer heavyRiskCount; + + //一般隐患数量 + private Integer lightRiskCount; + + + public Integer getHeavyRiskCount() { + return heavyRiskCount; + } + + public void setHeavyRiskCount(Integer heavyRiskCount) { + this.heavyRiskCount = heavyRiskCount; + } + + public Integer getLightRiskCount() { + return lightRiskCount; + } + + public void setLightRiskCount(Integer lightRiskCount) { + this.lightRiskCount = lightRiskCount; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerResultRespDO.java b/src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerResultRespDO.java new file mode 100644 index 0000000..8cc0bf6 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/entity/dto/DataCountDangerResultRespDO.java @@ -0,0 +1,48 @@ +package com.ruoyi.doublePrevention.entity.dto; + +public class DataCountDangerResultRespDO { + + //一段时间内的隐患数量 + private Integer riskCount; + + //导致死亡的的隐患数量 + private Integer deathCount; + + //导致重伤的隐患数量 + private Integer heavyInjureCount; + + //导致轻伤的隐患数量 + private Integer lightInjureCount; + + public Integer getRiskCount() { + return riskCount; + } + + public void setRiskCount(Integer riskCount) { + this.riskCount = riskCount; + } + + public Integer getDeathCount() { + return deathCount; + } + + public void setDeathCount(Integer deathCount) { + this.deathCount = deathCount; + } + + public Integer getHeavyInjureCount() { + return heavyInjureCount; + } + + public void setHeavyInjureCount(Integer heavyInjureCount) { + this.heavyInjureCount = heavyInjureCount; + } + + public Integer getLightInjureCount() { + return lightInjureCount; + } + + public void setLightInjureCount(Integer lightInjureCount) { + this.lightInjureCount = lightInjureCount; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/entity/dto/req/SPIDataCountReqDTO.java b/src/main/java/com/ruoyi/doublePrevention/entity/dto/req/SPIDataCountReqDTO.java new file mode 100644 index 0000000..18e9d98 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/entity/dto/req/SPIDataCountReqDTO.java @@ -0,0 +1,46 @@ +package com.ruoyi.doublePrevention.entity.dto.req; + +public class SPIDataCountReqDTO { + + private Integer month; + + private Integer year; + + /* 时间类型,1-月; 2-年*/ + private Byte type; + + /* 部门id*/ + private Long depId; + + public Integer getMonth() { + return month; + } + + public void setMonth(Integer month) { + this.month = month; + } + + public Integer getYear() { + return year; + } + + public void setYear(Integer year) { + this.year = year; + } + + public Byte getType() { + return type; + } + + public void setType(Byte type) { + this.type = type; + } + + public Long getDepId() { + return depId; + } + + public void setDepId(Long depId) { + this.depId = depId; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/entity/dto/resp/SPIDataCountRespDTO.java b/src/main/java/com/ruoyi/doublePrevention/entity/dto/resp/SPIDataCountRespDTO.java new file mode 100644 index 0000000..dfe1f3c --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/entity/dto/resp/SPIDataCountRespDTO.java @@ -0,0 +1,134 @@ +package com.ruoyi.doublePrevention.entity.dto.resp; + +public class SPIDataCountRespDTO { + + private Integer year; + + private Integer month; + + //一段时间内的隐患数量 + private Integer riskCount; + + //导致死亡的的隐患数量 + private Integer deathCount; + + //导致重伤的隐患数量 + private Integer heavyInjureCount; + + //导致轻伤的隐患数量 + private Integer lightInjureCount; + + //重大隐患数量 + private Integer heavyRiskCount; + + //一般隐患数量 + private Integer lightRiskCount; + + //重大隐患数量-已经整改 + private Integer heavyRiskRectifyCount; + + //一般隐患数量-已经整改 + private Integer lightRiskRectifyCount; + + /* 部门id*/ + private Long depId; + + /* 部门名称*/ + private String dep; + + public Integer getYear() { + return year; + } + + public void setYear(Integer year) { + this.year = year; + } + + public Integer getMonth() { + return month; + } + + public void setMonth(Integer month) { + this.month = month; + } + + public Integer getRiskCount() { + return riskCount; + } + + public void setRiskCount(Integer riskCount) { + this.riskCount = riskCount; + } + + public Integer getDeathCount() { + return deathCount; + } + + public void setDeathCount(Integer deathCount) { + this.deathCount = deathCount; + } + + public Integer getHeavyInjureCount() { + return heavyInjureCount; + } + + public void setHeavyInjureCount(Integer heavyInjureCount) { + this.heavyInjureCount = heavyInjureCount; + } + + public Integer getLightInjureCount() { + return lightInjureCount; + } + + public void setLightInjureCount(Integer lightInjureCount) { + this.lightInjureCount = lightInjureCount; + } + + public Long getDepId() { + return depId; + } + + public void setDepId(Long depId) { + this.depId = depId; + } + + public String getDep() { + return dep; + } + + public void setDep(String dep) { + this.dep = dep; + } + + public Integer getHeavyRiskCount() { + return heavyRiskCount; + } + + public void setHeavyRiskCount(Integer heavyRiskCount) { + this.heavyRiskCount = heavyRiskCount; + } + + public Integer getLightRiskCount() { + return lightRiskCount; + } + + public void setLightRiskCount(Integer lightRiskCount) { + this.lightRiskCount = lightRiskCount; + } + + public Integer getHeavyRiskRectifyCount() { + return heavyRiskRectifyCount; + } + + public void setHeavyRiskRectifyCount(Integer heavyRiskRectifyCount) { + this.heavyRiskRectifyCount = heavyRiskRectifyCount; + } + + public Integer getLightRiskRectifyCount() { + return lightRiskRectifyCount; + } + + public void setLightRiskRectifyCount(Integer lightRiskRectifyCount) { + this.lightRiskRectifyCount = lightRiskRectifyCount; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/repository/DoublePreventDeptRepository.java b/src/main/java/com/ruoyi/doublePrevention/repository/DoublePreventDeptRepository.java new file mode 100644 index 0000000..c2a0eda --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/repository/DoublePreventDeptRepository.java @@ -0,0 +1,20 @@ +package com.ruoyi.doublePrevention.repository; + +import com.ruoyi.doublePrevention.entity.DoublePreventDept; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface DoublePreventDeptRepository { + + /** + * @description 根据部门id查询部门 + */ + DoublePreventDept getDepInfoByDepId(Long depId); + + /** + * @description 根据当前部门的祖级列表获取子部门的deptId + */ + List<Long> listDepAndSubDepIds(String ancestors); +} diff --git a/src/main/java/com/ruoyi/doublePrevention/repository/PreventRiskDangerInfoRepository.java b/src/main/java/com/ruoyi/doublePrevention/repository/PreventRiskDangerInfoRepository.java index ab46936..946f7de8 100644 --- a/src/main/java/com/ruoyi/doublePrevention/repository/PreventRiskDangerInfoRepository.java +++ b/src/main/java/com/ruoyi/doublePrevention/repository/PreventRiskDangerInfoRepository.java @@ -1,7 +1,13 @@ package com.ruoyi.doublePrevention.repository; import com.ruoyi.doublePrevention.entity.PreventRiskDangerInfo; +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerResultRespDO; +import com.ruoyi.doublePrevention.repository.param.DataCountStartAndEndTimeParams; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; + +import java.util.Date; +import java.util.List; @Repository public interface PreventRiskDangerInfoRepository { @@ -16,4 +22,9 @@ int updateDangerInfo(PreventRiskDangerInfo dangerInfo); int deleteDangerInfo(Long id); + + /** + * @description 统计时间段内所有、死亡、重伤、轻伤的隐患数量 + */ + DataCountDangerResultRespDO listDangerResultCountByTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime,@Param("depIds") List<Long> depIds); } diff --git a/src/main/java/com/ruoyi/doublePrevention/repository/TrHiddenDangerCheckPointRepository.java b/src/main/java/com/ruoyi/doublePrevention/repository/TrHiddenDangerCheckPointRepository.java new file mode 100644 index 0000000..2a53c96 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/repository/TrHiddenDangerCheckPointRepository.java @@ -0,0 +1,24 @@ +package com.ruoyi.doublePrevention.repository; + +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRectifiedRespDO; +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRespDO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.Date; +import java.util.List; + +@Repository +public interface TrHiddenDangerCheckPointRepository { + + /** + * @description 统计时间段内一般、重大、一般已整改、重大已整改的隐患数量 + */ + DataCountDangerLevelRespDO listDangerLevelCountByTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("depIds") List<Long> depIds); + + /** + * @description 统计时间段内一般已整改、重大已整改的隐患数量 + */ + DataCountDangerLevelRectifiedRespDO listDangerLevelRectifiedCountByTime(@Param("startTime") Date startTime, + @Param("endTime") Date endTime,@Param("depIds") List<Long> depIds); +} diff --git a/src/main/java/com/ruoyi/doublePrevention/repository/param/DataCountStartAndEndTimeParams.java b/src/main/java/com/ruoyi/doublePrevention/repository/param/DataCountStartAndEndTimeParams.java new file mode 100644 index 0000000..2a04913 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/repository/param/DataCountStartAndEndTimeParams.java @@ -0,0 +1,27 @@ +package com.ruoyi.doublePrevention.repository.param; + +import java.util.Date; + +public class DataCountStartAndEndTimeParams { + + private Date startTime; + + private Date endTime; + + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/service/SPIDataCountService.java b/src/main/java/com/ruoyi/doublePrevention/service/SPIDataCountService.java new file mode 100644 index 0000000..2262ada --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/service/SPIDataCountService.java @@ -0,0 +1,13 @@ +package com.ruoyi.doublePrevention.service; + +import com.ruoyi.doublePrevention.entity.dto.req.SPIDataCountReqDTO; +import com.ruoyi.doublePrevention.entity.dto.resp.SPIDataCountRespDTO; +import com.ruoyi.doublePrevention.vo.ResultVO; + +public interface SPIDataCountService { + + /** + * 数据统计-隐患数据统计-根据月或者年 + */ + ResultVO<SPIDataCountRespDTO> listDangerResultCountByMonthOrYear(SPIDataCountReqDTO spiDataCountReqDTO); +} diff --git a/src/main/java/com/ruoyi/doublePrevention/service/baseService/DoublePreventionDeptService.java b/src/main/java/com/ruoyi/doublePrevention/service/baseService/DoublePreventionDeptService.java new file mode 100644 index 0000000..e5a60ea --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/service/baseService/DoublePreventionDeptService.java @@ -0,0 +1,19 @@ +package com.ruoyi.doublePrevention.service.baseService; + +import com.ruoyi.doublePrevention.entity.DoublePreventDept; + +import java.util.List; + +public interface DoublePreventionDeptService { + + /** + * @description 根据部门id查询部门 + */ + DoublePreventDept getDepInfoByDepId(Long depId); + + /** + * @description 根据当前部门的祖级列表获取子部门的deptId + */ + List<Long> listDepAndSubDepIds(String ancestors); + +} diff --git a/src/main/java/com/ruoyi/doublePrevention/service/baseService/PreventRiskDangerInfoService.java b/src/main/java/com/ruoyi/doublePrevention/service/baseService/PreventRiskDangerInfoService.java index aeb1695..a5c5aac 100644 --- a/src/main/java/com/ruoyi/doublePrevention/service/baseService/PreventRiskDangerInfoService.java +++ b/src/main/java/com/ruoyi/doublePrevention/service/baseService/PreventRiskDangerInfoService.java @@ -1,6 +1,11 @@ package com.ruoyi.doublePrevention.service.baseService; import com.ruoyi.doublePrevention.entity.PreventRiskDangerInfo; +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerResultRespDO; +import com.ruoyi.doublePrevention.repository.param.DataCountStartAndEndTimeParams; + +import java.util.Date; +import java.util.List; public interface PreventRiskDangerInfoService { @@ -16,4 +21,10 @@ * 删除隐患上报 */ int deleteDangerInfo(Long id); + + /** + * @description 统计时间段内所有、死亡、重伤、轻伤的隐患数量 + */ + DataCountDangerResultRespDO listDangerResultCountByTime(Date startTime, Date endTime, List<Long> depIds); + } diff --git a/src/main/java/com/ruoyi/doublePrevention/service/baseService/TrHiddenDangerCheckPointService.java b/src/main/java/com/ruoyi/doublePrevention/service/baseService/TrHiddenDangerCheckPointService.java new file mode 100644 index 0000000..29c1e05 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/service/baseService/TrHiddenDangerCheckPointService.java @@ -0,0 +1,21 @@ +package com.ruoyi.doublePrevention.service.baseService; + +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRectifiedRespDO; +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRespDO; + +import java.util.Date; +import java.util.List; + +public interface TrHiddenDangerCheckPointService { + + /** + * @description 统计时间段内一般、重大的隐患数量 + */ + DataCountDangerLevelRespDO listDangerLevelCountByTime(Date startTime, Date endTime, List<Long> depIds); + + + /** + * @description 统计时间段内一般已整改、重大已整改的隐患数量 + */ + DataCountDangerLevelRectifiedRespDO listDangerLevelRectifiedCountByTime(Date startTime, Date endTime, List<Long> depIds); +} diff --git a/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/DoublePreventionDeptServiceImpl.java b/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/DoublePreventionDeptServiceImpl.java new file mode 100644 index 0000000..061d041 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/DoublePreventionDeptServiceImpl.java @@ -0,0 +1,33 @@ +package com.ruoyi.doublePrevention.service.baseService.impl; + +import com.ruoyi.doublePrevention.entity.DoublePreventDept; +import com.ruoyi.doublePrevention.repository.DoublePreventDeptRepository; +import com.ruoyi.doublePrevention.service.baseService.DoublePreventionDeptService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service("DoublePreventionDeptService") +public class DoublePreventionDeptServiceImpl implements DoublePreventionDeptService { + + @Autowired + private DoublePreventDeptRepository doublePreventDeptRepository; + + /** + * @description 根据部门id查询部门 + */ + @Override + public DoublePreventDept getDepInfoByDepId(Long depId) { + return doublePreventDeptRepository.getDepInfoByDepId(depId); + } + + + /** + * @description 根据当前部门的祖级列表获取子部门的deptId + */ + @Override + public List<Long> listDepAndSubDepIds(String ancestors) { + return doublePreventDeptRepository.listDepAndSubDepIds(ancestors); + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventRiskDangerInfoServiceImpl.java b/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventRiskDangerInfoServiceImpl.java index d0a54da..6a3d98e 100644 --- a/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventRiskDangerInfoServiceImpl.java +++ b/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventRiskDangerInfoServiceImpl.java @@ -1,10 +1,15 @@ package com.ruoyi.doublePrevention.service.baseService.impl; import com.ruoyi.doublePrevention.entity.PreventRiskDangerInfo; +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerResultRespDO; import com.ruoyi.doublePrevention.repository.PreventRiskDangerInfoRepository; +import com.ruoyi.doublePrevention.repository.param.DataCountStartAndEndTimeParams; import com.ruoyi.doublePrevention.service.baseService.PreventRiskDangerInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; @Service("PreventRiskDangerInfoService") public class PreventRiskDangerInfoServiceImpl implements PreventRiskDangerInfoService { @@ -35,4 +40,15 @@ public int deleteDangerInfo(Long id) { return preventRiskDangerInfoRepository.deleteDangerInfo(id); } + + + /** + * @description 统计时间段内所有、死亡、重伤、轻伤的隐患数量 + */ + @Override + public DataCountDangerResultRespDO listDangerResultCountByTime(Date startTime, Date endTime, List<Long> depIds) { + return preventRiskDangerInfoRepository.listDangerResultCountByTime(startTime,endTime,depIds); + } + + } diff --git a/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/TrHiddenDangerCheckPointServiceImpl.java b/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/TrHiddenDangerCheckPointServiceImpl.java new file mode 100644 index 0000000..052c7d6 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/TrHiddenDangerCheckPointServiceImpl.java @@ -0,0 +1,34 @@ +package com.ruoyi.doublePrevention.service.baseService.impl; + +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRectifiedRespDO; +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRespDO; +import com.ruoyi.doublePrevention.repository.TrHiddenDangerCheckPointRepository; +import com.ruoyi.doublePrevention.service.baseService.TrHiddenDangerCheckPointService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service("TrHiddenDangerCheckPointService") +public class TrHiddenDangerCheckPointServiceImpl implements TrHiddenDangerCheckPointService { + + @Autowired + private TrHiddenDangerCheckPointRepository checkPointRepository; + + /** + * @description 统计时间段内一般、重大的隐患数量 + */ + @Override + public DataCountDangerLevelRespDO listDangerLevelCountByTime(Date startTime, Date endTime, List<Long> depIds) { + return checkPointRepository.listDangerLevelCountByTime(startTime,endTime,depIds); + } + + /** + * @description 统计时间段内一般已整改、重大已整改的隐患数量 + */ + @Override + public DataCountDangerLevelRectifiedRespDO listDangerLevelRectifiedCountByTime(Date startTime, Date endTime, List<Long> depIds) { + return checkPointRepository.listDangerLevelRectifiedCountByTime(startTime,endTime,depIds); + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/service/impl/SPIDataCountServiceImpl.java b/src/main/java/com/ruoyi/doublePrevention/service/impl/SPIDataCountServiceImpl.java new file mode 100644 index 0000000..5531f62 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/service/impl/SPIDataCountServiceImpl.java @@ -0,0 +1,200 @@ +package com.ruoyi.doublePrevention.service.impl; + +import com.ruoyi.doublePrevention.entity.DoublePreventDept; +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRectifiedRespDO; +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRespDO; +import com.ruoyi.doublePrevention.entity.dto.DataCountDangerResultRespDO; +import com.ruoyi.doublePrevention.entity.dto.req.SPIDataCountReqDTO; +import com.ruoyi.doublePrevention.entity.dto.resp.SPIDataCountRespDTO; +import com.ruoyi.doublePrevention.repository.param.DataCountStartAndEndTimeParams; +import com.ruoyi.doublePrevention.service.SPIDataCountService; +import com.ruoyi.doublePrevention.service.baseService.DoublePreventionDeptService; +import com.ruoyi.doublePrevention.service.baseService.PreventRiskDangerInfoService; +import com.ruoyi.doublePrevention.service.baseService.TrHiddenDangerCheckPointService; +import com.ruoyi.doublePrevention.vo.ResultVO; +import io.swagger.models.auth.In; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +@Service("SPIDataCountService") +public class SPIDataCountServiceImpl implements SPIDataCountService { + + + @Autowired + private DoublePreventionDeptService doublePreventionDeptService; + + @Autowired + private PreventRiskDangerInfoService preventRiskDangerInfoService; + + @Autowired + private TrHiddenDangerCheckPointService checkPointService; + + + /** + * 数据统计-隐患数据统计-根据月或者年 + */ + @Override + public ResultVO<SPIDataCountRespDTO> listDangerResultCountByMonthOrYear(SPIDataCountReqDTO spiDataCountReqDTO) { + ResultVO<SPIDataCountRespDTO> parameterVerificationResult = parameterVerification(spiDataCountReqDTO); + if ("400".equals(parameterVerificationResult.getCode())){ + return parameterVerificationResult; + } + Integer month = spiDataCountReqDTO.getMonth(); + Integer year = spiDataCountReqDTO.getYear(); + + Long depId = spiDataCountReqDTO.getDepId(); + //获取部门信息 + DoublePreventDept depInfoByDepId = doublePreventionDeptService.getDepInfoByDepId(depId); + //获取部门及所有子部门信息 + //祖级列表 + String ancestors = depInfoByDepId.getAncestors(); + ancestors = ancestors + ","; + List<Long> depIds = doublePreventionDeptService.listDepAndSubDepIds(ancestors); + depIds.add(depId); + if (CollectionUtils.isEmpty(depIds)){ + throw new RuntimeException("部门不存在"); + } + + DataCountDangerResultRespDO resultCountByTime = null; + DataCountDangerLevelRespDO levelCountByTime = null; + DataCountDangerLevelRectifiedRespDO levelRectifiedCountByTime = null; + + if (ObjectUtils.isNotEmpty(month) && ObjectUtils.isNotEmpty(year)){ + DataCountStartAndEndTimeParams params = timeInterval(month, year); + // 月-统计时间段内所有、死亡、重伤、轻伤的隐患数量 + resultCountByTime = preventRiskDangerInfoService.listDangerResultCountByTime(params.getStartTime(), params.getEndTime(), depIds); + + // 月-统计时间段内一般、重大的隐患数量 + levelCountByTime = checkPointService.listDangerLevelCountByTime(params.getStartTime(), params.getEndTime(), depIds); + + // 月-统计时间段内一般已整改、重大已整改的隐患数量 + levelRectifiedCountByTime = checkPointService.listDangerLevelRectifiedCountByTime(params.getStartTime(), params.getEndTime(), depIds); + }else { + DataCountStartAndEndTimeParams params = timeInterval(null, year); + // 年-统计时间段内所有、死亡、重伤、轻伤的隐患数量 + resultCountByTime = preventRiskDangerInfoService.listDangerResultCountByTime(params.getStartTime(), params.getEndTime(), depIds); + + // 年-统计时间段内一般、重大的隐患数量 + levelCountByTime = checkPointService.listDangerLevelCountByTime(params.getStartTime(), params.getEndTime(), depIds); + + // 年-统计时间段内一般已整改、重大已整改的隐患数量 + levelRectifiedCountByTime = checkPointService.listDangerLevelRectifiedCountByTime(params.getStartTime(), params.getEndTime(), depIds); + } + if (resultCountByTime == null || levelCountByTime == null || levelRectifiedCountByTime == null){ + parameterVerificationResult.setCode("400"); + parameterVerificationResult.setMsg("数据统计异常"); + return parameterVerificationResult; + } + SPIDataCountRespDTO spiDataCountRespDTO = new SPIDataCountRespDTO(); + BeanUtils.copyProperties(resultCountByTime,spiDataCountRespDTO); + BeanUtils.copyProperties(levelCountByTime,spiDataCountRespDTO); + BeanUtils.copyProperties(levelRectifiedCountByTime,spiDataCountRespDTO); + BeanUtils.copyProperties(spiDataCountReqDTO,spiDataCountRespDTO); + spiDataCountRespDTO.setDep(depInfoByDepId.getDeptName()); + parameterVerificationResult.setData(spiDataCountRespDTO); + return parameterVerificationResult; + } + + + /** + * @description 参数校验 + */ + private ResultVO<SPIDataCountRespDTO> parameterVerification(SPIDataCountReqDTO spiDataCountReqDTO){ + ResultVO resultVO = new ResultVO<>(); + resultVO.setCode("200"); + resultVO.setMsg("查询成功"); + if (ObjectUtils.isEmpty(spiDataCountReqDTO)){ + resultVO.setCode("400"); + resultVO.setMsg("参数为空,查询失败"); + return resultVO; + } + + if (ObjectUtils.isEmpty(spiDataCountReqDTO.getMonth())){ + if (ObjectUtils.isEmpty(spiDataCountReqDTO.getYear())){ + resultVO.setCode("400"); + resultVO.setMsg("查询年份不能为空"); + return resultVO; + } + }else { + if (ObjectUtils.isEmpty(spiDataCountReqDTO.getYear())){ + resultVO.setCode("400"); + resultVO.setMsg("查询年份不能为空"); + return resultVO; + } + } + + if (ObjectUtils.isNotEmpty(spiDataCountReqDTO.getDepId())){ + DoublePreventDept depInfoByDepId = doublePreventionDeptService.getDepInfoByDepId(spiDataCountReqDTO.getDepId()); + if (depInfoByDepId == null){ + resultVO.setCode("400"); + resultVO.setMsg("查询的部门不存在"); + return resultVO; + } + } + return resultVO; + } + + + + /** + * 数据统计-统计时间处理:根据传参判断是否为统计月还是统计年,月份为空表明是统计年 月份不为空表明是统计月 + */ + private DataCountStartAndEndTimeParams timeInterval(Integer month, Integer year){ + + //确定结束时间 + Calendar calendar = Calendar.getInstance(); + int nowYear = calendar.get(Calendar.YEAR); + Date startTime = null; + Date endTime = null; + if (month == null){ + //说明统计的是当前年份 + if (nowYear == year){ + endTime =calendar.getTime(); + + calendar.clear(); + calendar.set(Calendar.YEAR,nowYear); + startTime = calendar.getTime(); + + }else { + calendar.clear(); + calendar.set(Calendar.YEAR,year); + startTime = calendar.getTime(); + + calendar.set(Calendar.YEAR,year+1); + calendar.set(Calendar.DAY_OF_YEAR,-1); + calendar.set(Calendar.SECOND,59); + calendar.set(Calendar.MINUTE,59); + calendar.set(Calendar.HOUR_OF_DAY,23); + endTime = calendar.getTime(); + + } + //统计的是指定月份 + }else{ + calendar.set(year, month - 1, 1); + calendar.set(Calendar.SECOND,0); + calendar.set(Calendar.MINUTE,0); + calendar.set(Calendar.HOUR_OF_DAY,0); + startTime = calendar.getTime(); + + calendar.set(Calendar.DATE,calendar.getActualMaximum(Calendar.DATE)); //指定月份的最后一天 + calendar.set(Calendar.SECOND,59); + calendar.set(Calendar.MINUTE,59); + calendar.set(Calendar.HOUR_OF_DAY,23); + endTime = calendar.getTime(); + + } + DataCountStartAndEndTimeParams params = new DataCountStartAndEndTimeParams(); + params.setStartTime(startTime); + params.setEndTime(endTime); + return params; + } + + +} diff --git a/src/main/resources/mybatis/doublePrevention/DoublePreventDeptMapper.xml b/src/main/resources/mybatis/doublePrevention/DoublePreventDeptMapper.xml new file mode 100644 index 0000000..df88df4 --- /dev/null +++ b/src/main/resources/mybatis/doublePrevention/DoublePreventDeptMapper.xml @@ -0,0 +1,33 @@ +<?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.doublePrevention.repository.DoublePreventDeptRepository"> + <resultMap type="com.ruoyi.doublePrevention.entity.DoublePreventDept" id="DeptResult"> + <id property="deptId" column="dept_id" /> + <result property="parentId" column="parent_id" /> + <result property="ancestors" column="ancestors" /> + <result property="deptName" column="dept_name" /> + <result property="orderNum" column="order_num" /> + <result property="leader" column="leader" /> + <result property="phone" column="phone" /> + <result property="email" column="email" /> + <result property="status" column="status" /> + <result property="delFlag" column="del_flag" /> + <result property="createBy" column="create_by" /> + <result property="createTime" column="create_time" /> + <result property="updateBy" column="update_by" /> + <result property="updateTime" column="update_time" /> + <result property="companyId" column="company_id"/> + </resultMap> + + <select id="getDepInfoByDepId" resultMap="DeptResult"> + select * + from sys_dept + where dept_id = #{depId} and status = 0 and del_flag = 0 + </select> + + <select id="listDepAndSubDepIds" resultType="java.lang.Long"> + select dept_id + from sys_dept + where ancestors like #{ancestors}"%" and status = 0 and del_flag = 0 + </select> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml b/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml index 880f172..44f0894 100644 --- a/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml +++ b/src/main/resources/mybatis/doublePrevention/PreventRiskDangerInfoMapper.xml @@ -48,5 +48,32 @@ delete from prevent_risk_danger_info where danger_check_point_id = #{id} </delete> + <resultMap id="listDangerResultCountByTimeResultMap" type="com.ruoyi.doublePrevention.entity.dto.DataCountDangerResultRespDO"> + <result property="riskCount" column="risk_count" /> + <result property="deathCount" column="death_count" /> + <result property="heavyInjureCount" column="heavy_injure_count" /> + <result property="lightInjureCount" column="light_injure_count" /> + </resultMap> + + <select id="listDangerResultCountByTime" resultMap="listDangerResultCountByTimeResultMap"> + select + count(id) risk_count, + IFNULL(sum(CASE WHEN danger_result='2' then 1 else 0 END),0) light_injure_count, + IFNULL(sum(CASE WHEN danger_result='3' then 1 else 0 END),0) heavy_injure_count, + IFNULL(sum(CASE WHEN danger_result='4' then 1 else 0 END),0) death_count + from (SELECT p.id,p.rectify_dept_id,p.examine_create_time,p.whether_danger,p.examine_status,i.danger_check_point_id,i.danger_result + from tr_hidden_danger_check_point as p , prevent_risk_danger_info i WHERE p.id = i.danger_check_point_id) as t + WHERE whether_danger = 1 + and examine_status = 1 + and examine_create_time >= #{startTime} + and examine_create_time <= #{endTime} + <if test="depIds != null and depIds.size() > 0"> + and rectify_dept_id in ( + <foreach collection="depIds" item="depId" index="index" separator=","> + #{depId} + </foreach> ) + </if> + </select> + </mapper> diff --git a/src/main/resources/mybatis/doublePrevention/TrHiddenDangerCheckPointMapper.xml b/src/main/resources/mybatis/doublePrevention/TrHiddenDangerCheckPointMapper.xml new file mode 100644 index 0000000..435914b --- /dev/null +++ b/src/main/resources/mybatis/doublePrevention/TrHiddenDangerCheckPointMapper.xml @@ -0,0 +1,111 @@ +<?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.doublePrevention.repository.TrHiddenDangerCheckPointRepository"> + <resultMap id="BaseFields" type="com.ruoyi.doublePrevention.entity.TrHiddenDangerCheckPoint"> + <result property="id" column="id"/> + <result property="checkPointId" column="check_point_id"/> + <result property="checkId" column="check_id"/> + <result property="createBy" column="create_by"/> + <result property="createTime" column="create_time"/> + <result property="updateBy" column="update_by"/> + <result property="updateTime" column="update_time"/> + <result property="remark" column="remark"/> + <result property="whetherDanger" column="whether_danger"/> + <result property="dangerName" column="danger_name"/> + <result property="dangerDescription" column="danger_description"/> + <result property="dangerLevel" column="danger_level"/> + <result property="troubleTypeId" column="trouble_type_id"/> + <result property="troubleTypeName" column="trouble_type_name"/> + <result property="checkTime" column="check_time"/> + <result property="preRectifyPhoto" column="pre_rectify_photo"/> + <result property="registerUserId" column="register_user_id"/> + <result property="registerUserName" column="register_user_name"/> + <result property="registerCreateTime" column="register_create_time"/> + <result property="registerSubmitTime" column="register_submit_time"/> + <result property="judgeUserId" column="judge_user_id"/> + <result property="judgeUserName" column="judge_user_name"/> + <result property="judgeCreateTime" column="judge_create_time"/> + <result property="judgeCreateUserId" column="judge_create_user_id"/> + <result property="dangerSources" column="danger_sources"/> + <result property="reportStatus" column="report_status"/> + <result property="examineUserId" column="examine_user_id"/> + <result property="examineUserName" column="examine_user_name"/> + <result property="examineStatus" column="examine_status"/> + <result property="examineOpinion" column="examine_opinion"/> + <result property="examineResult" column="examine_result"/> + <result property="examineCreateTime" column="examine_create_time"/> + <result property="treatMeasure" column="treat_measure"/> + <result property="rectifyUserId" column="rectify_user_id"/> + <result property="rectifyUserName" column="rectify_user_name"/> + <result property="rectifyDeptId" column="rectify_dept_id"/> + <result property="rectifyDeptName" column="rectify_dept_name"/> + <result property="rectifyDeadlineTime" column="rectify_deadline_time"/> + <result property="rectifyType" column="rectify_type"/> + <result property="rectifyAttachment" column="rectify_attachment"/> + <result property="rectifyMeasure" column="rectify_measure"/> + <result property="rectifyCondition" column="rectify_condition"/> + <result property="rectifyFund" column="rectify_fund"/> + <result property="rectifyCompleteTime" column="rectify_complete_time"/> + <result property="rectifyStatus" column="rectify_status"/> + <result property="rectifyCreateTime" column="rectify_create_time"/> + <result property="acceptUserId" column="accept_user_id"/> + <result property="acceptUserName" column="accept_user_name"/> + <result property="postRectifyPhoto" column="post_rectify_photo"/> + <result property="acceptResult" column="accept_result"/> + <result property="acceptOpinion" column="accept_opinion"/> + <result property="acceptFile" column="accept_file"/> + <result property="acceptCreateTime" column="accept_create_time"/> + <result property="acceptStatus" column="accept_status"/> + <result property="stage" column="stage"/> + <result property="scheduleCheckStatus" column="schedule_check_status"/> + <result property="checkType" column="check_type"/> + <result property="companyId" column="company_id"/> + </resultMap> + + + + <resultMap id="ListDangerLevelCountByTime" type="com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRespDO"> + <result property="heavyRiskCount" column="heavy_risk_count" /> + <result property="lightRiskCount" column="light_risk_count" /> + </resultMap> + <select id="listDangerLevelCountByTime" resultMap="ListDangerLevelCountByTime"> + select + IFNULL(sum(CASE WHEN danger_level='0' then 1 else 0 END),0) light_risk_count, + IFNULL(sum(CASE WHEN danger_level='1' then 1 else 0 END),0) heavy_risk_count + from tr_hidden_danger_check_point + WHERE whether_danger = '1' + and examine_status = '1' + and examine_create_time >= #{startTime} + and examine_create_time <= #{endTime} + <if test="depIds != null and depIds.size() > 0"> + and rectify_dept_id in ( + <foreach collection="depIds" item="depId" index="index" separator=","> + #{depId} + </foreach> ) + </if> + </select> + + + <resultMap id="ListDangerLevelRectifiedCountByTime" type="com.ruoyi.doublePrevention.entity.dto.DataCountDangerLevelRectifiedRespDO"> + <result property="heavyRiskRectifyCount" column="heavy_risk_rectify_count" /> + <result property="lightRiskRectifyCount" column="light_risk_rectify_count" /> + </resultMap> + <select id="listDangerLevelRectifiedCountByTime" resultMap="ListDangerLevelRectifiedCountByTime"> + select + IFNULL(sum(CASE WHEN danger_level='0' then 1 else 0 END),0) light_risk_rectify_count, + IFNULL(sum(CASE WHEN danger_level='1' then 1 else 0 END),0) heavy_risk_rectify_count + from tr_hidden_danger_check_point + WHERE whether_danger = '1' + and examine_status = '1' + and accept_status = '1' + and accept_create_time >= #{startTime} + and accept_create_time <= #{endTime} + <if test="depIds != null and depIds.size() > 0"> + and rectify_dept_id in ( + <foreach collection="depIds" item="depId" index="index" separator=","> + #{depId} + </foreach> ) + </if> + </select> + +</mapper> \ No newline at end of file -- Gitblit v1.9.2