forked from xxhjsb/wit-park-backend
统计接口改动
parent
458f3ee4b0
commit
c29f407cfb
|
@ -74,5 +74,5 @@ public interface HiddenDangerMapper
|
||||||
*/
|
*/
|
||||||
List<Date> selectHiddenDangerSubmitDats(Date yearAgo);
|
List<Date> selectHiddenDangerSubmitDats(Date yearAgo);
|
||||||
|
|
||||||
List<Date> selectHiddenDangerSubmitDat(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
List<String> selectHiddenDangerSubmitDat(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ public interface RiskMapper
|
||||||
* @param yearAgo 一年前的时间
|
* @param yearAgo 一年前的时间
|
||||||
* @return 返回值
|
* @return 返回值
|
||||||
*/
|
*/
|
||||||
List<Date> selectRiskSubmitDats(Date yearAgo);
|
List<String> selectRiskSubmitDats(Date yearAgo);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,5 +94,5 @@ public interface RiskMapper
|
||||||
* @param endTime 结束时间
|
* @param endTime 结束时间
|
||||||
* @return 返回值
|
* @return 返回值
|
||||||
*/
|
*/
|
||||||
List<Date> selectRiskSubmitDat(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
List<String> selectRiskSubmitDat(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package com.hbt.safety.supervision.pojo;
|
package com.hbt.safety.supervision.pojo;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.hbt.common.core.annotation.Excel;
|
|
||||||
import com.hbt.common.core.web.domain.BaseEntity;
|
import com.hbt.common.core.web.domain.BaseEntity;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 风险对象 risk
|
* 风险对象 risk
|
||||||
|
@ -14,6 +12,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
* @date 2023-02-14
|
* @date 2023-02-14
|
||||||
*/
|
*/
|
||||||
@ApiModel
|
@ApiModel
|
||||||
|
@Data
|
||||||
public class Risk extends BaseEntity
|
public class Risk extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -64,172 +63,21 @@ public class Risk extends BaseEntity
|
||||||
|
|
||||||
/** 最后一次审查日期 */
|
/** 最后一次审查日期 */
|
||||||
@ApiModelProperty(value = "最后一次审查日期")
|
@ApiModelProperty(value = "最后一次审查日期")
|
||||||
private Date lastReviewDate;
|
private String lastReviewDate;
|
||||||
|
|
||||||
/** 重大危险源id */
|
/** 重大危险源id */
|
||||||
@ApiModelProperty(value = "重大危险源id")
|
@ApiModelProperty(value = "重大危险源id")
|
||||||
private int majorHazardSourcesId;
|
private int majorHazardSourcesId;
|
||||||
|
|
||||||
|
/** 重大危险源名称 */
|
||||||
|
@ApiModelProperty(value = "重大危险源名称")
|
||||||
|
private String majorHazardSourcesName;
|
||||||
|
|
||||||
/** 上报时间 */
|
/** 上报时间 */
|
||||||
@ApiModelProperty(value = "上报时间")
|
@ApiModelProperty(value = "上报时间")
|
||||||
private Date submitDate;
|
private String submitDate;
|
||||||
|
|
||||||
/** 上报人id */
|
/** 上报人id */
|
||||||
@ApiModelProperty(value = "上报人id")
|
@ApiModelProperty(value = "上报人id")
|
||||||
private int submitPersonId;
|
private int submitPersonId;
|
||||||
|
|
||||||
|
|
||||||
public void setId(int id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setRiskProbability(String riskProbability)
|
|
||||||
{
|
|
||||||
this.riskProbability = riskProbability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRiskProbability()
|
|
||||||
{
|
|
||||||
return riskProbability;
|
|
||||||
}
|
|
||||||
public void setRiskFactor(String riskFactor)
|
|
||||||
{
|
|
||||||
this.riskFactor = riskFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRiskFactor()
|
|
||||||
{
|
|
||||||
return riskFactor;
|
|
||||||
}
|
|
||||||
public void setAffectConsequences(String affectConsequences)
|
|
||||||
{
|
|
||||||
this.affectConsequences = affectConsequences;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAffectConsequences()
|
|
||||||
{
|
|
||||||
return affectConsequences;
|
|
||||||
}
|
|
||||||
public void setLevel(int level)
|
|
||||||
{
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLevel()
|
|
||||||
{
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
public void setEnterpriseId(int enterpriseId)
|
|
||||||
{
|
|
||||||
this.enterpriseId = enterpriseId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEnterpriseId()
|
|
||||||
{
|
|
||||||
return enterpriseId;
|
|
||||||
}
|
|
||||||
public void setResponsiblePersonId(int responsiblePersonId)
|
|
||||||
{
|
|
||||||
this.responsiblePersonId = responsiblePersonId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getResponsiblePersonId()
|
|
||||||
{
|
|
||||||
return responsiblePersonId;
|
|
||||||
}
|
|
||||||
public void setRiskControlMeasures(String riskControlMeasures)
|
|
||||||
{
|
|
||||||
this.riskControlMeasures = riskControlMeasures;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRiskControlMeasures()
|
|
||||||
{
|
|
||||||
return riskControlMeasures;
|
|
||||||
}
|
|
||||||
public void setLastReviewDate(Date lastReviewDate)
|
|
||||||
{
|
|
||||||
this.lastReviewDate = lastReviewDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getLastReviewDate()
|
|
||||||
{
|
|
||||||
return lastReviewDate;
|
|
||||||
}
|
|
||||||
public void setMajorHazardSourcesId(int majorHazardSourcesId)
|
|
||||||
{
|
|
||||||
this.majorHazardSourcesId = majorHazardSourcesId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMajorHazardSourcesId()
|
|
||||||
{
|
|
||||||
return majorHazardSourcesId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEnterprise() {
|
|
||||||
return enterprise;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEnterprise(String enterprise) {
|
|
||||||
this.enterprise = enterprise;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResponsiblePerson() {
|
|
||||||
return responsiblePerson;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResponsiblePerson(String responsiblePerson) {
|
|
||||||
this.responsiblePerson = responsiblePerson;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getSubmitDate() {
|
|
||||||
return submitDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubmitDate(Date submitDate) {
|
|
||||||
this.submitDate = submitDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSubmitPersonId() {
|
|
||||||
return submitPersonId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubmitPersonId(int submitPersonId) {
|
|
||||||
this.submitPersonId = submitPersonId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Risk{" +
|
|
||||||
"id=" + id +
|
|
||||||
", name='" + name + '\'' +
|
|
||||||
", riskProbability='" + riskProbability + '\'' +
|
|
||||||
", riskFactor='" + riskFactor + '\'' +
|
|
||||||
", affectConsequences='" + affectConsequences + '\'' +
|
|
||||||
", level=" + level +
|
|
||||||
", enterpriseId=" + enterpriseId +
|
|
||||||
", enterprise='" + enterprise + '\'' +
|
|
||||||
", responsiblePersonId=" + responsiblePersonId +
|
|
||||||
", responsiblePerson='" + responsiblePerson + '\'' +
|
|
||||||
", riskControlMeasures='" + riskControlMeasures + '\'' +
|
|
||||||
", lastReviewDate=" + lastReviewDate +
|
|
||||||
", majorHazardSourcesId=" + majorHazardSourcesId +
|
|
||||||
", submitDate=" + submitDate +
|
|
||||||
", submitPersonId=" + submitPersonId +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService
|
||||||
String endTime = statisticsList.get(statisticsList.size()-1).get("endTime");
|
String endTime = statisticsList.get(statisticsList.size()-1).get("endTime");
|
||||||
|
|
||||||
// 查询时间范围内隐患数据
|
// 查询时间范围内隐患数据
|
||||||
List<Date> list = hiddenDangerMapper.selectHiddenDangerSubmitDat(startTime, endTime);
|
List<String> list = hiddenDangerMapper.selectHiddenDangerSubmitDat(startTime, endTime);
|
||||||
return YearWeeksUtil.getResultData(statisticsList, list, date);
|
return YearWeeksUtil.getResultData(statisticsList, list, date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class RiskServiceImpl implements IRiskService
|
||||||
String endTime = statisticsList.get(statisticsList.size()-1).get("endTime");
|
String endTime = statisticsList.get(statisticsList.size()-1).get("endTime");
|
||||||
|
|
||||||
// 查询时间范围内隐患数据
|
// 查询时间范围内隐患数据
|
||||||
List<Date> list = riskMapper.selectRiskSubmitDat(startTime, endTime);
|
List<String> list = riskMapper.selectRiskSubmitDat(startTime, endTime);
|
||||||
|
|
||||||
return YearWeeksUtil.getResultData(statisticsList, list, date);
|
return YearWeeksUtil.getResultData(statisticsList, list, date);
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,14 +339,14 @@ public class YearWeeksUtil {
|
||||||
return dateVo;
|
return dateVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getResultData(List<Map<String, String>> statisticsList, List<Date> list, List<String> date) {
|
public static String getResultData(List<Map<String, String>> statisticsList, List<String> list, List<String> date) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
List<WeekDateVo> weekDateVos = new ArrayList<>();
|
List<WeekDateVo> weekDateVos = new ArrayList<>();
|
||||||
// 组装数据
|
// 组装数据
|
||||||
for (int i = 0; i < statisticsList.size(); i++) {
|
for (int i = 0; i < statisticsList.size(); i++) {
|
||||||
int finalI = i;
|
int finalI = i;
|
||||||
int hiddenDangerCount = (int) list.stream()
|
int hiddenDangerCount = (int) list.stream()
|
||||||
.filter(s -> YearWeeksUtil.belongCalendar(sdf.format(s), statisticsList.get(finalI).get("startTime"),
|
.filter(s -> YearWeeksUtil.belongCalendar(s, statisticsList.get(finalI).get("startTime"),
|
||||||
statisticsList.get(finalI).get("endTime"))).count();
|
statisticsList.get(finalI).get("endTime"))).count();
|
||||||
WeekDateVo weekDateVo = new WeekDateVo();
|
WeekDateVo weekDateVo = new WeekDateVo();
|
||||||
weekDateVo.setDate(date.get(i));
|
weekDateVo.setDate(date.get(i));
|
||||||
|
|
|
@ -108,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="hazardousOperationVariationTendency" resultType="HazardousOperation">
|
<select id="hazardousOperationVariationTendency" resultType="HazardousOperation">
|
||||||
select operation_start operationStart, operation_end operationEnd from hazardous_operation where DATE_FORMAT(operation_start,'%Y-%m-%d') >= #{startTime}
|
select DATE_FORMAT(operation_start,'%Y-%m-%d') operationStart, DATE_FORMAT(operation_end,'%Y-%m-%d') operationEnd from hazardous_operation where DATE_FORMAT(operation_start,'%Y-%m-%d') >= #{startTime}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="hazardousOperationLevelStatistics" resultType="java.util.Map">
|
<select id="hazardousOperationLevelStatistics" resultType="java.util.Map">
|
||||||
|
|
|
@ -121,11 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select name, reform_status reformStatus from hidden_danger where exceed_time_limit_status = 0
|
select name, reform_status reformStatus from hidden_danger where exceed_time_limit_status = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectHiddenDangerSubmitDats" resultType="java.util.Date">
|
<select id="selectHiddenDangerSubmitDat" resultType="String">
|
||||||
select submit_date from hidden_danger where DATE_FORMAT(submit_date,'%Y-%m-%d') >= DATE_FORMAT(#{yearAgo},'%Y-%m-%d')
|
select DATE_FORMAT(submit_date,'%Y-%m-%d') submit_date from hidden_danger where DATE_FORMAT(submit_date,'%Y-%m-%d') >= #{startTime} and DATE_FORMAT(submit_date,'%Y-%m-%d') <= #{endTime}
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectHiddenDangerSubmitDat" resultType="java.util.Date">
|
|
||||||
select submit_date from hidden_danger where DATE_FORMAT(submit_date,'%Y-%m-%d') >= #{startTime} and DATE_FORMAT(submit_date,'%Y-%m-%d') <= #{endTime}
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectRiskVo">
|
<sql id="selectRiskVo">
|
||||||
select id, name, risk_probability, risk_factor, affect_consequences, level, enterprise_id, responsible_person_id, risk_control_measures, last_review_date, major_hazard_sources_id from risk
|
select id, name, risk_probability, risk_factor, affect_consequences, level, enterprise_id, responsible_person_id, risk_control_measures, DATE_FORMAT(a.last_review_date,'%Y-%m-%d %H:%i:%S') lastReviewDate, major_hazard_sources_id from risk
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectRiskList" parameterType="com.hbt.safety.supervision.pojo.Risk" resultMap="RiskResult">
|
<select id="selectRiskList" parameterType="com.hbt.safety.supervision.pojo.Risk" resultMap="RiskResult">
|
||||||
|
@ -30,12 +30,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
|
|
||||||
<sql id="selectRisk">
|
<sql id="selectRisk">
|
||||||
select distinct(a.id) id, a.name name, a.risk_probability riskProbability, a.risk_factor riskFactor, a.affect_consequences affectConsequences, a.level level, a.enterprise_id enterpriseId, a.responsible_person_id responsiblePersonId, a.risk_control_measures riskControlMeasures, a.last_review_date lastReviewDate, a.major_hazard_sources_id majorHazardSourcesId,
|
select distinct(a.id) id, a.name name, a.risk_probability riskProbability, a.risk_factor riskFactor, a.affect_consequences affectConsequences, a.level level, a.enterprise_id enterpriseId, a.responsible_person_id responsiblePersonId, a.risk_control_measures riskControlMeasures, DATE_FORMAT(a.last_review_date,'%Y-%m-%d %H:%i:%S') lastReviewDate, a.major_hazard_sources_id majorHazardSourcesId,
|
||||||
b.name as enterprise,
|
b.name as enterprise,
|
||||||
p.name as responsiblePerson
|
p.name as responsiblePerson,
|
||||||
|
m.name as majorHazardSourcesName,
|
||||||
|
a.major_hazard_sources_id as majorHazardSourcesId
|
||||||
from risk as a
|
from risk as a
|
||||||
left join enterprise_information as b on a.enterprise_id = b.id
|
left join enterprise_information as b on a.enterprise_id = b.id
|
||||||
left join person as p on a.responsible_person_id = p.id
|
left join person as p on a.responsible_person_id = p.id
|
||||||
|
left join major_hazard_sources as m on m.id = a.major_hazard_sources_id
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectRiskById" parameterType="Integer" resultType="Risk">
|
<select id="selectRiskById" parameterType="Integer" resultType="Risk">
|
||||||
<include refid="selectRisk"/>
|
<include refid="selectRisk"/>
|
||||||
|
@ -108,11 +111,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select name, level from risk
|
select name, level from risk
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRiskSubmitDats" resultType="java.util.Date">
|
<select id="selectRiskSubmitDats" resultType="String">
|
||||||
select submit_date from risk where DATE_FORMAT(submit_date,'%Y-%m-%d') >= DATE_FORMAT(#{yearAgo},'%Y-%m-%d')
|
select DATE_FORMAT(submit_date,'%Y-%m-%d %H:%i:%S') as submit_date from risk where DATE_FORMAT(submit_date,'%Y-%m-%d') >= DATE_FORMAT(#{yearAgo},'%Y-%m-%d')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRiskSubmitDat" resultType="java.util.Date">
|
<select id="selectRiskSubmitDat" resultType="String">
|
||||||
select submit_date from risk where DATE_FORMAT(submit_date,'%Y-%m-%d') >= #{startTime} and DATE_FORMAT(submit_date,'%Y-%m-%d') <= #{endTime}
|
select DATE_FORMAT(submit_date,'%Y-%m-%d') as submit_date from risk where DATE_FORMAT(submit_date,'%Y-%m-%d') >= #{startTime} and DATE_FORMAT(submit_date,'%Y-%m-%d') <= #{endTime}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue