From c805c989d13d2e250acdacd7dbcc9cd01500361f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E5=9B=BD=E4=B8=9C?= Date: Tue, 14 Mar 2023 16:54:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=8E=E9=99=A9=E6=A8=A1=E5=9E=8B=E7=AE=A1?= =?UTF-8?q?=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/rzyc/bean/risk/RksensttiveDto.java | 43 ++ .../rzyc/mapper/RkCompanyDiagnosisMapper.java | 52 +++ .../com/rzyc/mapper/RkEntSensitiveMapper.java | 21 + .../rzyc/mapper/RkEnterpriseScoreMapper.java | 33 ++ .../com/rzyc/mapper/RkScoreTypeMapper.java | 33 ++ .../rzyc/mapper/RkSensitiveTypeMapper.java | 36 ++ .../java/com/rzyc/mapper/RkSourcesMapper.java | 9 + .../com/rzyc/model/RkCompanyDiagnosis.java | 260 ++++++++++++ .../java/com/rzyc/model/RkEntSensitive.java | 188 +++++++++ .../com/rzyc/model/RkEnterpriseScore.java | 214 ++++++++++ .../main/java/com/rzyc/model/RkScoreType.java | 258 ++++++++++++ .../java/com/rzyc/model/RkSensitiveType.java | 233 +++++++++++ .../mapper/RkCompanyDiagnosisMapper.xml | 253 ++++++++++++ .../resources/mapper/RkEntSensitiveMapper.xml | 154 +++++++ .../mapper/RkEnterpriseScoreMapper.xml | 194 +++++++++ .../resources/mapper/RkScoreTypeMapper.xml | 219 ++++++++++ .../mapper/RkSensitiveTypeMapper.xml | 166 ++++++++ .../main/resources/mapper/RkSourcesMapper.xml | 36 ++ .../com/rzyc/controller/BaseController.java | 35 ++ .../com/rzyc/controller/RiskController.java | 378 ++++++++++++++++- .../com/rzyc/controller/BaseController.java | 33 ++ .../rzyc/controller/ent/RiskController.java | 389 +++++++++++++++++- 22 files changed, 3218 insertions(+), 19 deletions(-) create mode 100644 inventory-dao/src/main/java/com/rzyc/bean/risk/RksensttiveDto.java create mode 100644 inventory-dao/src/main/java/com/rzyc/mapper/RkCompanyDiagnosisMapper.java create mode 100644 inventory-dao/src/main/java/com/rzyc/mapper/RkEntSensitiveMapper.java create mode 100644 inventory-dao/src/main/java/com/rzyc/mapper/RkEnterpriseScoreMapper.java create mode 100644 inventory-dao/src/main/java/com/rzyc/mapper/RkScoreTypeMapper.java create mode 100644 inventory-dao/src/main/java/com/rzyc/mapper/RkSensitiveTypeMapper.java create mode 100644 inventory-dao/src/main/java/com/rzyc/model/RkCompanyDiagnosis.java create mode 100644 inventory-dao/src/main/java/com/rzyc/model/RkEntSensitive.java create mode 100644 inventory-dao/src/main/java/com/rzyc/model/RkEnterpriseScore.java create mode 100644 inventory-dao/src/main/java/com/rzyc/model/RkScoreType.java create mode 100644 inventory-dao/src/main/java/com/rzyc/model/RkSensitiveType.java create mode 100644 inventory-dao/src/main/resources/mapper/RkCompanyDiagnosisMapper.xml create mode 100644 inventory-dao/src/main/resources/mapper/RkEntSensitiveMapper.xml create mode 100644 inventory-dao/src/main/resources/mapper/RkEnterpriseScoreMapper.xml create mode 100644 inventory-dao/src/main/resources/mapper/RkScoreTypeMapper.xml create mode 100644 inventory-dao/src/main/resources/mapper/RkSensitiveTypeMapper.xml diff --git a/inventory-dao/src/main/java/com/rzyc/bean/risk/RksensttiveDto.java b/inventory-dao/src/main/java/com/rzyc/bean/risk/RksensttiveDto.java new file mode 100644 index 0000000..ce3b2ca --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/bean/risk/RksensttiveDto.java @@ -0,0 +1,43 @@ +package com.rzyc.bean.risk; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; + +@ApiModel("企业敏感信息") +public class RksensttiveDto { + @ApiModelProperty("企业id") + @NotNull(message = "企业id不能为空") + private String enterpriseId; + + @ApiModelProperty("风险诊断类别") + private String category; + + @ApiModelProperty("包含类型id和数量 [{typeId:\"\",num:10},{typeId:\"\",num:10}]") + private String rkSensitive; + + public String getEnterpriseId() { + return enterpriseId; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public void setEnterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public String getRkSensitive() { + return rkSensitive; + } + + public void setRkSensitive(String rkSensitive) { + this.rkSensitive = rkSensitive; + } +} diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/RkCompanyDiagnosisMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/RkCompanyDiagnosisMapper.java new file mode 100644 index 0000000..47ac75e --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/mapper/RkCompanyDiagnosisMapper.java @@ -0,0 +1,52 @@ +package com.rzyc.mapper; + +import com.rzyc.model.RkCompanyDiagnosis; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface RkCompanyDiagnosisMapper { + + + int deleteByPrimaryKey(String diagnosisId); + + int insert(RkCompanyDiagnosis record); + + int insertSelective(RkCompanyDiagnosis record); + + + RkCompanyDiagnosis selectByPrimaryKey(String diagnosisId); + + int updateByPrimaryKeySelective(RkCompanyDiagnosis record); + + int updateByPrimaryKey(RkCompanyDiagnosis record); + + /** + * 根据企业id删除列表 + * @param enterpriseId + */ + void deletByEnterpriseId(String enterpriseId); + + /** + * 根据企业id返回诊断列表 + * @param enterpriseId + * @return + */ + RkCompanyDiagnosis selectByEnterpriseId(String enterpriseId); + + /** + * 条件查询诊断列表 + * @return + */ + List selectQueryCompanyDiagnosis(RkCompanyDiagnosis rkCompanyDiagnosis); + + /** + * 根据id查询数据 + * @param diagnosisId + * @return + */ + RkCompanyDiagnosis selectByDiagnosisId(String diagnosisId); + +} diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/RkEntSensitiveMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/RkEntSensitiveMapper.java new file mode 100644 index 0000000..bef96fb --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/mapper/RkEntSensitiveMapper.java @@ -0,0 +1,21 @@ +package com.rzyc.mapper; + +import com.rzyc.model.RkEntSensitive; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface RkEntSensitiveMapper { + + int insert(RkEntSensitive record); + + int insertSelective(RkEntSensitive record); + + //修改企业敏感信息 + void updateByRkEntSensitive(RkEntSensitive rkEntSensitive); + + //删除企业敏感信息 + void deleteByRkEntSensitive(String enterpriseId); +} diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/RkEnterpriseScoreMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/RkEnterpriseScoreMapper.java new file mode 100644 index 0000000..532d540 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/mapper/RkEnterpriseScoreMapper.java @@ -0,0 +1,33 @@ +package com.rzyc.mapper; + +import com.rzyc.model.RkEnterpriseScore; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface RkEnterpriseScoreMapper { + + + int deleteByPrimaryKey(String scoreId); + + int insert(RkEnterpriseScore record); + + int insertSelective(RkEnterpriseScore record); + + + RkEnterpriseScore selectByPrimaryKey(String scoreId); + + + + int updateByPrimaryKeySelective(RkEnterpriseScore record); + + int updateByPrimaryKey(RkEnterpriseScore record); + + /** + * 根据企业id删除企业得分信息 + * @param enterpriseId + */ + void deleteByEnterpriseId(String enterpriseId); +} diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/RkScoreTypeMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/RkScoreTypeMapper.java new file mode 100644 index 0000000..672be8b --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/mapper/RkScoreTypeMapper.java @@ -0,0 +1,33 @@ +package com.rzyc.mapper; + +import com.rzyc.model.RkScoreType; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface RkScoreTypeMapper { + + + int deleteByPrimaryKey(String typeId); + + int insert(RkScoreType record); + + int insertSelective(RkScoreType record); + + + RkScoreType selectByPrimaryKey(String typeId); + + + int updateByPrimaryKeySelective(RkScoreType record); + + int updateByPrimaryKey(RkScoreType record); + + /** + * 根据企业id返回企业风险得分 + * @param enterpriseId + * @return + */ + List selectByScoreType(String enterpriseId); +} diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/RkSensitiveTypeMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/RkSensitiveTypeMapper.java new file mode 100644 index 0000000..68e89c6 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/mapper/RkSensitiveTypeMapper.java @@ -0,0 +1,36 @@ +package com.rzyc.mapper; + +import com.rzyc.model.RkSensitiveType; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface RkSensitiveTypeMapper { + + + int insert(RkSensitiveType record); + + int insertSelective(RkSensitiveType record); + + /** + * 根据企业id获取企业敏感信息s + * @param enterpriseId + * @return + */ + List selectExample(String enterpriseId); + + + /** + * 删除敏感类型 + * @param typeId + */ + void deleteRkSensitiveTypeById(String typeId); + + /** + * 修改类型 + * @param record + */ + void updatebyRkSensitiveType(RkSensitiveType record); +} diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/RkSourcesMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/RkSourcesMapper.java index 29ea8d3..f08da24 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/RkSourcesMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/RkSourcesMapper.java @@ -1,5 +1,6 @@ package com.rzyc.mapper; +import com.rzyc.bean.risk.RkSourcesDto; import com.rzyc.model.RkSources; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import io.swagger.models.auth.In; @@ -37,4 +38,12 @@ public interface RkSourcesMapper extends BaseMapper { Integer changeIndex(@Param("sourceId") String sourceId); + /** + * 风险源信息分页查询 + * @param RkSourcesDto + * @return + */ + List selectPageRkSources(RkSourcesDto RkSourcesDto); + + } diff --git a/inventory-dao/src/main/java/com/rzyc/model/RkCompanyDiagnosis.java b/inventory-dao/src/main/java/com/rzyc/model/RkCompanyDiagnosis.java new file mode 100644 index 0000000..45bf206 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/RkCompanyDiagnosis.java @@ -0,0 +1,260 @@ +package com.rzyc.model; + +import com.common.utils.excel.ExcelColumn; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.rzyc.enums.FlowQueryStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @author + */ +@ApiModel("风险评估列表") +public class RkCompanyDiagnosis implements Serializable { + /** + * id + */ + @ApiModelProperty("id 空表示添加,有表示修改") + private String diagnosisId; + + /** + * 企业id + */ + @ApiModelProperty(value = "企业id",required = true) + @NotNull(message = "企业id不能为空") + private String enterpriseId; + + /** + * 最终得分 + */ + @ApiModelProperty("最终得分") + @ExcelColumn(value = "最终得分", col = 1) + private Integer score; + + /** + * 诊断等级 + */ + @ApiModelProperty("诊断等级") + private Integer grade; + + @ExcelColumn(value = "单位诊断等级", col = 2) + @ApiModelProperty("诊断等级名称") + private String gradeName; + + @ApiModelProperty("风险诊断类别") + private String category; + + /** + * 评估时间 + */ + @ApiModelProperty("评估时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date assessTime; + + /** + * 状态 + */ + @ApiModelProperty("状态") + private FlowQueryStatus status; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String created; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String modified; + + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date createTime; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date modifyTime; + + @ApiModelProperty("查询条件") + private String codition; + private static final long serialVersionUID = 1L; + + public String getGradeName() { + return gradeName; + } + + public void setGradeName(String gradeName) { + this.gradeName = gradeName; + } + + public String getCodition() { + return codition; + } + + public void setCodition(String codition) { + this.codition = codition; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getDiagnosisId() { + return diagnosisId; + } + + public void setDiagnosisId(String diagnosisId) { + this.diagnosisId = diagnosisId; + } + + public String getEnterpriseId() { + return enterpriseId; + } + + public void setEnterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public Integer getScore() { + return score; + } + + public void setScore(Integer score) { + this.score = score; + } + + public Integer getGrade() { + return grade; + } + + public void setGrade(Integer grade) { + this.grade = grade; + } + + public Date getAssessTime() { + return assessTime; + } + + public void setAssessTime(Date assessTime) { + this.assessTime = assessTime; + } + + public FlowQueryStatus getStatus() { + return status; + } + + public void setStatus(FlowQueryStatus status) { + this.status = status; + } + + public String getCreated() { + return created; + } + + public void setCreated(String created) { + this.created = created; + } + + public String getModified() { + return modified; + } + + public void setModified(String modified) { + this.modified = modified; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getModifyTime() { + return modifyTime; + } + + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + RkCompanyDiagnosis other = (RkCompanyDiagnosis) that; + return (this.getDiagnosisId() == null ? other.getDiagnosisId() == null : this.getDiagnosisId().equals(other.getDiagnosisId())) + && (this.getEnterpriseId() == null ? other.getEnterpriseId() == null : this.getEnterpriseId().equals(other.getEnterpriseId())) + && (this.getScore() == null ? other.getScore() == null : this.getScore().equals(other.getScore())) + && (this.getGrade() == null ? other.getGrade() == null : this.getGrade().equals(other.getGrade())) + && (this.getAssessTime() == null ? other.getAssessTime() == null : this.getAssessTime().equals(other.getAssessTime())) + && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (this.getCreated() == null ? other.getCreated() == null : this.getCreated().equals(other.getCreated())) + && (this.getModified() == null ? other.getModified() == null : this.getModified().equals(other.getModified())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getModifyTime() == null ? other.getModifyTime() == null : this.getModifyTime().equals(other.getModifyTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getDiagnosisId() == null) ? 0 : getDiagnosisId().hashCode()); + result = prime * result + ((getEnterpriseId() == null) ? 0 : getEnterpriseId().hashCode()); + result = prime * result + ((getScore() == null) ? 0 : getScore().hashCode()); + result = prime * result + ((getGrade() == null) ? 0 : getGrade().hashCode()); + result = prime * result + ((getAssessTime() == null) ? 0 : getAssessTime().hashCode()); + result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getCreated() == null) ? 0 : getCreated().hashCode()); + result = prime * result + ((getModified() == null) ? 0 : getModified().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getModifyTime() == null) ? 0 : getModifyTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", diagnosisId=").append(diagnosisId); + sb.append(", enterpriseId=").append(enterpriseId); + sb.append(", score=").append(score); + sb.append(", grade=").append(grade); + sb.append(", assessTime=").append(assessTime); + sb.append(", status=").append(status); + sb.append(", created=").append(created); + sb.append(", modified=").append(modified); + sb.append(", createTime=").append(createTime); + sb.append(", modifyTime=").append(modifyTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} diff --git a/inventory-dao/src/main/java/com/rzyc/model/RkEntSensitive.java b/inventory-dao/src/main/java/com/rzyc/model/RkEntSensitive.java new file mode 100644 index 0000000..0e27fe9 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/RkEntSensitive.java @@ -0,0 +1,188 @@ +package com.rzyc.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @author + */ +@ApiModel("企业敏感信息") +public class RkEntSensitive implements Serializable { + /** + * 企业敏感信息id + */ + @ApiModelProperty("企业敏感信息id") + private String sensitiveId; + + /** + * 企业id + */ + @ApiModelProperty(value = "企业id",required = true) + @NotNull(message = "企业id不能为空") + private String enterpriseId; + + /** + * 敏感分类id + */ + @ApiModelProperty("敏感分类id") + private String typeId; + + /** + * 企业数量 + */ + @ApiModelProperty("企业数量") + private Integer entNum; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String modified; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String created; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date modifyTime; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date createTime; + + private static final long serialVersionUID = 1L; + + public String getSensitiveId() { + return sensitiveId; + } + + public void setSensitiveId(String sensitiveId) { + this.sensitiveId = sensitiveId; + } + + public String getEnterpriseId() { + return enterpriseId; + } + + public void setEnterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + public Integer getEntNum() { + return entNum; + } + + public void setEntNum(Integer entNum) { + this.entNum = entNum; + } + + public String getModified() { + return modified; + } + + public void setModified(String modified) { + this.modified = modified; + } + + public String getCreated() { + return created; + } + + public void setCreated(String created) { + this.created = created; + } + + public Date getModifyTime() { + return modifyTime; + } + + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + RkEntSensitive other = (RkEntSensitive) that; + return (this.getSensitiveId() == null ? other.getSensitiveId() == null : this.getSensitiveId().equals(other.getSensitiveId())) + && (this.getEnterpriseId() == null ? other.getEnterpriseId() == null : this.getEnterpriseId().equals(other.getEnterpriseId())) + && (this.getTypeId() == null ? other.getTypeId() == null : this.getTypeId().equals(other.getTypeId())) + && (this.getEntNum() == null ? other.getEntNum() == null : this.getEntNum().equals(other.getEntNum())) + && (this.getModified() == null ? other.getModified() == null : this.getModified().equals(other.getModified())) + && (this.getCreated() == null ? other.getCreated() == null : this.getCreated().equals(other.getCreated())) + && (this.getModifyTime() == null ? other.getModifyTime() == null : this.getModifyTime().equals(other.getModifyTime())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getSensitiveId() == null) ? 0 : getSensitiveId().hashCode()); + result = prime * result + ((getEnterpriseId() == null) ? 0 : getEnterpriseId().hashCode()); + result = prime * result + ((getTypeId() == null) ? 0 : getTypeId().hashCode()); + result = prime * result + ((getEntNum() == null) ? 0 : getEntNum().hashCode()); + result = prime * result + ((getModified() == null) ? 0 : getModified().hashCode()); + result = prime * result + ((getCreated() == null) ? 0 : getCreated().hashCode()); + result = prime * result + ((getModifyTime() == null) ? 0 : getModifyTime().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", sensitiveId=").append(sensitiveId); + sb.append(", enterpriseId=").append(enterpriseId); + sb.append(", typeId=").append(typeId); + sb.append(", entNum=").append(entNum); + sb.append(", modified=").append(modified); + sb.append(", created=").append(created); + sb.append(", modifyTime=").append(modifyTime); + sb.append(", createTime=").append(createTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} diff --git a/inventory-dao/src/main/java/com/rzyc/model/RkEnterpriseScore.java b/inventory-dao/src/main/java/com/rzyc/model/RkEnterpriseScore.java new file mode 100644 index 0000000..740405e --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/RkEnterpriseScore.java @@ -0,0 +1,214 @@ +package com.rzyc.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; + +/** + * @author + */ +@ApiModel("企业风险评分得分信息") +public class RkEnterpriseScore implements Serializable { + /** + * 分数信息id + */ + @ApiModelProperty("id 空表示添加,有表示修改") + private String scoreId; + + /** + * 企业id + */ + @ApiModelProperty(value = "企业id",required = true) + @NotNull(message = "企业id不能为空") + private String enterpriseId; + + /** + * 分数类型id + */ + @ApiModelProperty(value = "得分类型id",required = true) + @NotNull(message = "得分类型id不能为空") + private String typeId; + + /** + * 父级分类id + */ + @ApiModelProperty("父级分类id") + private String parentId; + /** + * 得分 + * + */ + @ApiModelProperty("得分") + private Integer score; + + @ApiModelProperty("分数类型 1表示加分,2表示减分") + private Integer scoreType; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String modified; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String created; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date modifyTime; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date createTime; + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public Integer getScoreType() { + return scoreType; + } + + public void setScoreType(Integer scoreType) { + this.scoreType = scoreType; + } + + private static final long serialVersionUID = 1L; + + public String getScoreId() { + return scoreId; + } + + public void setScoreId(String scoreId) { + this.scoreId = scoreId; + } + + public String getEnterpriseId() { + return enterpriseId; + } + + public void setEnterpriseId(String enterpriseId) { + this.enterpriseId = enterpriseId; + } + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + public Integer getScore() { + return score; + } + + public void setScore(Integer score) { + this.score = score; + } + + public String getModified() { + return modified; + } + + public void setModified(String modified) { + this.modified = modified; + } + + public String getCreated() { + return created; + } + + public void setCreated(String created) { + this.created = created; + } + + public Date getModifyTime() { + return modifyTime; + } + + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + RkEnterpriseScore other = (RkEnterpriseScore) that; + return (this.getScoreId() == null ? other.getScoreId() == null : this.getScoreId().equals(other.getScoreId())) + && (this.getEnterpriseId() == null ? other.getEnterpriseId() == null : this.getEnterpriseId().equals(other.getEnterpriseId())) + && (this.getTypeId() == null ? other.getTypeId() == null : this.getTypeId().equals(other.getTypeId())) + && (this.getScore() == null ? other.getScore() == null : this.getScore().equals(other.getScore())) + && (this.getModified() == null ? other.getModified() == null : this.getModified().equals(other.getModified())) + && (this.getCreated() == null ? other.getCreated() == null : this.getCreated().equals(other.getCreated())) + && (this.getModifyTime() == null ? other.getModifyTime() == null : this.getModifyTime().equals(other.getModifyTime())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getScoreId() == null) ? 0 : getScoreId().hashCode()); + result = prime * result + ((getEnterpriseId() == null) ? 0 : getEnterpriseId().hashCode()); + result = prime * result + ((getTypeId() == null) ? 0 : getTypeId().hashCode()); + result = prime * result + ((getScore() == null) ? 0 : getScore().hashCode()); + result = prime * result + ((getModified() == null) ? 0 : getModified().hashCode()); + result = prime * result + ((getCreated() == null) ? 0 : getCreated().hashCode()); + result = prime * result + ((getModifyTime() == null) ? 0 : getModifyTime().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", scoreId=").append(scoreId); + sb.append(", enterpriseId=").append(enterpriseId); + sb.append(", typeId=").append(typeId); + sb.append(", score=").append(score); + sb.append(", modified=").append(modified); + sb.append(", created=").append(created); + sb.append(", modifyTime=").append(modifyTime); + sb.append(", createTime=").append(createTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} diff --git a/inventory-dao/src/main/java/com/rzyc/model/RkScoreType.java b/inventory-dao/src/main/java/com/rzyc/model/RkScoreType.java new file mode 100644 index 0000000..d09f997 --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/RkScoreType.java @@ -0,0 +1,258 @@ +package com.rzyc.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @author + */ +@ApiModel("企业风险评分类型") +public class RkScoreType implements Serializable { + /** + * 评分分类id + */ + @ApiModelProperty("id 空表示添加,有表示修改") + private String typeId; + + /** + * 分类名 + */ + @ApiModelProperty(value = "名称",required = true) + @NotNull(message = "分类名称不能为空") + private String name; + + /** + * 父级分类id + */ + @ApiModelProperty("父级分类id") + private String parentId; + + /** + * 排序 + */ + @ApiModelProperty("排序") + private Integer sortId; + + /** + * 1表示生成,2:重点风险源,3:较大风险源,4:重要场所\重要目标,5:人员密集场所 + */ + @ApiModelProperty("0:父节点不用计算1表示生成,2:重点风险源,3:较大风险源,4:重要场所\\重要目标,5:人员密集场所6:只能单选") + private Integer source; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String modified; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String created; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date modifyTime; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date createTime; + + /** + * 得分 + * + */ + @ApiModelProperty("得分") + private Integer score; + + @ApiModelProperty("分数类型 1表示加分,2表示减分") + private Integer scoreType; + + @ApiModelProperty("总分") + private Integer fullMarks; + + /** + * 子节点 + */ + @ApiModelProperty("子节点") + private List children; + + + public Integer getScoreType() { + return scoreType; + } + + public void setScoreType(Integer scoreType) { + this.scoreType = scoreType; + } + + public Integer getFullMarks() { + return fullMarks; + } + + public void setFullMarks(Integer fullMarks) { + this.fullMarks = fullMarks; + } + + public Integer getScore() { + return score; + } + + public void setScore(Integer score) { + this.score = score; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + private static final long serialVersionUID = 1L; + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public Integer getSortId() { + return sortId; + } + + public void setSortId(Integer sortId) { + this.sortId = sortId; + } + + public Integer getSource() { + return source; + } + + public void setSource(Integer source) { + this.source = source; + } + + public String getModified() { + return modified; + } + + public void setModified(String modified) { + this.modified = modified; + } + + public String getCreated() { + return created; + } + + public void setCreated(String created) { + this.created = created; + } + + public Date getModifyTime() { + return modifyTime; + } + + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + RkScoreType other = (RkScoreType) that; + return (this.getTypeId() == null ? other.getTypeId() == null : this.getTypeId().equals(other.getTypeId())) + && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) + && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId())) + && (this.getSortId() == null ? other.getSortId() == null : this.getSortId().equals(other.getSortId())) + && (this.getSource() == null ? other.getSource() == null : this.getSource().equals(other.getSource())) + && (this.getModified() == null ? other.getModified() == null : this.getModified().equals(other.getModified())) + && (this.getCreated() == null ? other.getCreated() == null : this.getCreated().equals(other.getCreated())) + && (this.getModifyTime() == null ? other.getModifyTime() == null : this.getModifyTime().equals(other.getModifyTime())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getTypeId() == null) ? 0 : getTypeId().hashCode()); + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode()); + result = prime * result + ((getSortId() == null) ? 0 : getSortId().hashCode()); + result = prime * result + ((getSource() == null) ? 0 : getSource().hashCode()); + result = prime * result + ((getModified() == null) ? 0 : getModified().hashCode()); + result = prime * result + ((getCreated() == null) ? 0 : getCreated().hashCode()); + result = prime * result + ((getModifyTime() == null) ? 0 : getModifyTime().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", typeId=").append(typeId); + sb.append(", name=").append(name); + sb.append(", parentId=").append(parentId); + sb.append(", sortId=").append(sortId); + sb.append(", source=").append(source); + sb.append(", modified=").append(modified); + sb.append(", created=").append(created); + sb.append(", modifyTime=").append(modifyTime); + sb.append(", createTime=").append(createTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} diff --git a/inventory-dao/src/main/java/com/rzyc/model/RkSensitiveType.java b/inventory-dao/src/main/java/com/rzyc/model/RkSensitiveType.java new file mode 100644 index 0000000..a85944b --- /dev/null +++ b/inventory-dao/src/main/java/com/rzyc/model/RkSensitiveType.java @@ -0,0 +1,233 @@ +package com.rzyc.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @author + */ +@ApiModel("企业敏感类型") +public class RkSensitiveType implements Serializable { + /** + * 敏感分类id + */ + @ApiModelProperty("敏感分类id 空新增 不空修改") + private String typeId; + + /** + * 分类名 + */ + @NotNull(message = "类型名称不能为空") + @ApiModelProperty(value = "类型名称",required = true) + private String name; + + /** + * 父级分类id + */ + @ApiModelProperty("父级分类id") + + private String parentId; + + /** + * 排序 + */ + @ApiModelProperty("排序") + private Integer sortId; + + /** + * 修改人 + */ + @ApiModelProperty("修改人") + private String modified; + + /** + * 创建人 + */ + @ApiModelProperty("创建人") + private String created; + + /** + * 修改时间 + */ + @ApiModelProperty("修改时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date modifyTime; + + /** + * 创建时间 + */ + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date createTime; + + /** + * 企业数量 + */ + @ApiModelProperty("企业数量") + private Integer entNum; + + /** + * 企业敏感信息id + */ + @ApiModelProperty("企业敏感信息id") + private String sensitiveId; + + + /** + * 子类 + */ + @ApiModelProperty("子分类集合") + private List children; + + private static final long serialVersionUID = 1L; + + public Integer getEntNum() { + return entNum; + } + + public void setEntNum(Integer entNum) { + this.entNum = entNum; + } + + public String getTypeId() { + return typeId; + } + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public Integer getSortId() { + return sortId; + } + + public void setSortId(Integer sortId) { + this.sortId = sortId; + } + + public String getModified() { + return modified; + } + + public void setModified(String modified) { + this.modified = modified; + } + + public String getCreated() { + return created; + } + + public void setCreated(String created) { + this.created = created; + } + + public Date getModifyTime() { + return modifyTime; + } + + public void setModifyTime(Date modifyTime) { + this.modifyTime = modifyTime; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + public String getSensitiveId() { + return sensitiveId; + } + + public void setSensitiveId(String sensitiveId) { + this.sensitiveId = sensitiveId; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + RkSensitiveType other = (RkSensitiveType) that; + return (this.getTypeId() == null ? other.getTypeId() == null : this.getTypeId().equals(other.getTypeId())) + && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) + && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId())) + && (this.getSortId() == null ? other.getSortId() == null : this.getSortId().equals(other.getSortId())) + && (this.getModified() == null ? other.getModified() == null : this.getModified().equals(other.getModified())) + && (this.getCreated() == null ? other.getCreated() == null : this.getCreated().equals(other.getCreated())) + && (this.getModifyTime() == null ? other.getModifyTime() == null : this.getModifyTime().equals(other.getModifyTime())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getTypeId() == null) ? 0 : getTypeId().hashCode()); + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode()); + result = prime * result + ((getSortId() == null) ? 0 : getSortId().hashCode()); + result = prime * result + ((getModified() == null) ? 0 : getModified().hashCode()); + result = prime * result + ((getCreated() == null) ? 0 : getCreated().hashCode()); + result = prime * result + ((getModifyTime() == null) ? 0 : getModifyTime().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", typeId=").append(typeId); + sb.append(", name=").append(name); + sb.append(", parentId=").append(parentId); + sb.append(", sortId=").append(sortId); + sb.append(", modified=").append(modified); + sb.append(", created=").append(created); + sb.append(", modifyTime=").append(modifyTime); + sb.append(", createTime=").append(createTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} diff --git a/inventory-dao/src/main/resources/mapper/RkCompanyDiagnosisMapper.xml b/inventory-dao/src/main/resources/mapper/RkCompanyDiagnosisMapper.xml new file mode 100644 index 0000000..2920413 --- /dev/null +++ b/inventory-dao/src/main/resources/mapper/RkCompanyDiagnosisMapper.xml @@ -0,0 +1,253 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + diagnosis_id, enterprise_id, score, grade, assess_time, status, created, modified, + create_time, modify_time + + + + + delete from rk_company_diagnosis + where diagnosis_id = #{diagnosisId,jdbcType=VARCHAR} + + + + insert into rk_company_diagnosis (diagnosis_id, enterprise_id, score, + grade, assess_time, status, + created, modified, create_time, + modify_time,category) + values (#{diagnosisId,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR}, #{score,jdbcType=INTEGER}, + #{grade,jdbcType=INTEGER}, #{assessTime,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR}, + #{created,jdbcType=VARCHAR}, #{modified,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{modifyTime,jdbcType=TIMESTAMP},#{category}) + + + insert into rk_company_diagnosis + + + diagnosis_id, + + + enterprise_id, + + + score, + + + grade, + + + assess_time, + + + status, + + + created, + + + modified, + + + create_time, + + + modify_time, + + + + + #{diagnosisId,jdbcType=VARCHAR}, + + + #{enterpriseId,jdbcType=VARCHAR}, + + + #{score,jdbcType=INTEGER}, + + + #{grade,jdbcType=INTEGER}, + + + #{assessTime,jdbcType=TIMESTAMP}, + + + #{status,jdbcType=VARCHAR}, + + + #{created,jdbcType=VARCHAR}, + + + #{modified,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{modifyTime,jdbcType=TIMESTAMP}, + + + + + + + + update rk_company_diagnosis + + + enterprise_id = #{enterpriseId,jdbcType=VARCHAR}, + + + score = #{score,jdbcType=INTEGER}, + + + grade = #{grade,jdbcType=INTEGER}, + + + assess_time = #{assessTime,jdbcType=TIMESTAMP}, + + + status = #{status,jdbcType=VARCHAR}, + + + created = #{created,jdbcType=VARCHAR}, + + + modified = #{modified,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + modify_time = #{modifyTime,jdbcType=TIMESTAMP}, + + + category = #{category} + + + where diagnosis_id = #{diagnosisId,jdbcType=VARCHAR} + + + update rk_company_diagnosis + set enterprise_id = #{enterpriseId,jdbcType=VARCHAR}, + score = #{score,jdbcType=INTEGER}, + grade = #{grade,jdbcType=INTEGER}, + assess_time = #{assessTime,jdbcType=TIMESTAMP}, + status = #{status,jdbcType=VARCHAR}, + created = #{created,jdbcType=VARCHAR}, + modified = #{modified,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + modify_time = #{modifyTime,jdbcType=TIMESTAMP} + where diagnosis_id = #{diagnosisId,jdbcType=VARCHAR} + + + + delete from rk_company_diagnosis + where enterprise_id = #{enterpriseId,jdbcType=VARCHAR} + + + + + + + + + + diff --git a/inventory-dao/src/main/resources/mapper/RkEntSensitiveMapper.xml b/inventory-dao/src/main/resources/mapper/RkEntSensitiveMapper.xml new file mode 100644 index 0000000..187cb02 --- /dev/null +++ b/inventory-dao/src/main/resources/mapper/RkEntSensitiveMapper.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + sensitive_id, enterprise_id, type_id, ent_num, modified, created, modify_time, create_time + + + + insert into rk_ent_sensitive (sensitive_id, enterprise_id, type_id, + ent_num, modified, created, + modify_time, create_time) + values (#{sensitiveId,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR}, #{typeId,jdbcType=VARCHAR}, + #{entNum,jdbcType=INTEGER}, #{modified,jdbcType=VARCHAR}, #{created,jdbcType=VARCHAR}, + #{modifyTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}) + + + insert into rk_ent_sensitive + + + sensitive_id, + + + enterprise_id, + + + type_id, + + + ent_num, + + + modified, + + + created, + + + modify_time, + + + create_time, + + + + + #{sensitiveId,jdbcType=VARCHAR}, + + + #{enterpriseId,jdbcType=VARCHAR}, + + + #{typeId,jdbcType=VARCHAR}, + + + #{entNum,jdbcType=INTEGER}, + + + #{modified,jdbcType=VARCHAR}, + + + #{created,jdbcType=VARCHAR}, + + + #{modifyTime,jdbcType=TIMESTAMP}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + + + + + + + + UPDATE rk_ent_sensitive + set enterprise_id = #{enterpriseId},type_id = #{typeId},ent_num = #{entNum},modified = #{modified},modify_time = #{modifyTime} + WHERE sensitive_id = #{sensitiveId} + + + + DELETE FROM rk_ent_sensitive WHERE enterprise_id = #{enterpriseId} + + + diff --git a/inventory-dao/src/main/resources/mapper/RkEnterpriseScoreMapper.xml b/inventory-dao/src/main/resources/mapper/RkEnterpriseScoreMapper.xml new file mode 100644 index 0000000..c1712fc --- /dev/null +++ b/inventory-dao/src/main/resources/mapper/RkEnterpriseScoreMapper.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + score_id, enterprise_id, type_id, score, modified, created, modify_time, create_time + + + + + delete from rk_enterprise_score + where score_id = #{scoreId,jdbcType=VARCHAR} + + + + insert into rk_enterprise_score (score_id, enterprise_id, type_id, + score, modified, created, + modify_time, create_time) + values (#{scoreId,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR}, #{typeId,jdbcType=VARCHAR}, + #{score,jdbcType=INTEGER}, #{modified,jdbcType=VARCHAR}, #{created,jdbcType=VARCHAR}, + #{modifyTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}) + + + insert into rk_enterprise_score + + + score_id, + + + enterprise_id, + + + type_id, + + + score, + + + modified, + + + created, + + + modify_time, + + + create_time, + + + + + #{scoreId,jdbcType=VARCHAR}, + + + #{enterpriseId,jdbcType=VARCHAR}, + + + #{typeId,jdbcType=VARCHAR}, + + + #{score,jdbcType=INTEGER}, + + + #{modified,jdbcType=VARCHAR}, + + + #{created,jdbcType=VARCHAR}, + + + #{modifyTime,jdbcType=TIMESTAMP}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + + + + + update rk_enterprise_score + + + enterprise_id = #{enterpriseId,jdbcType=VARCHAR}, + + + type_id = #{typeId,jdbcType=VARCHAR}, + + + score = #{score,jdbcType=INTEGER}, + + + modified = #{modified,jdbcType=VARCHAR}, + + + created = #{created,jdbcType=VARCHAR}, + + + modify_time = #{modifyTime,jdbcType=TIMESTAMP}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + where score_id = #{scoreId,jdbcType=VARCHAR} + + + update rk_enterprise_score + set enterprise_id = #{enterpriseId,jdbcType=VARCHAR}, + type_id = #{typeId,jdbcType=VARCHAR}, + score = #{score,jdbcType=INTEGER}, + modified = #{modified,jdbcType=VARCHAR}, + created = #{created,jdbcType=VARCHAR}, + modify_time = #{modifyTime,jdbcType=TIMESTAMP}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where score_id = #{scoreId,jdbcType=VARCHAR} + + + delete from rk_enterprise_score + where enterprise_id = #{enterpriseId,jdbcType=VARCHAR} + + diff --git a/inventory-dao/src/main/resources/mapper/RkScoreTypeMapper.xml b/inventory-dao/src/main/resources/mapper/RkScoreTypeMapper.xml new file mode 100644 index 0000000..666d3cf --- /dev/null +++ b/inventory-dao/src/main/resources/mapper/RkScoreTypeMapper.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + type_id, name, parent_id, sort_id, source, modified, created, modify_time, create_time + + + + + delete from rk_score_type + where type_id = #{typeId,jdbcType=VARCHAR} + + + + insert into rk_score_type (type_id, name, parent_id, + sort_id, source, modified, + created, modify_time, create_time,full_marks,score_type + ) + values (#{typeId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR}, + #{sortId,jdbcType=INTEGER}, #{source,jdbcType=INTEGER}, #{modified,jdbcType=VARCHAR}, + #{created,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},#{fullMarks},#{scoreType} + ) + + + insert into rk_score_type + + + type_id, + + + name, + + + parent_id, + + + sort_id, + + + source, + + + modified, + + + created, + + + modify_time, + + + create_time, + + + + + #{typeId,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{parentId,jdbcType=VARCHAR}, + + + #{sortId,jdbcType=INTEGER}, + + + #{source,jdbcType=INTEGER}, + + + #{modified,jdbcType=VARCHAR}, + + + #{created,jdbcType=VARCHAR}, + + + #{modifyTime,jdbcType=TIMESTAMP}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + + + + update rk_score_type + + + name = #{name,jdbcType=VARCHAR}, + + + parent_id = #{parentId,jdbcType=VARCHAR}, + + + sort_id = #{sortId,jdbcType=INTEGER}, + + + source = #{source,jdbcType=INTEGER}, + + + modified = #{modified,jdbcType=VARCHAR}, + + + created = #{created,jdbcType=VARCHAR}, + + + modify_time = #{modifyTime,jdbcType=TIMESTAMP}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + full_marks = #{fullMarks,jdbcType=INTEGER}, + + + score_type = #{scoreType} + + + where type_id = #{typeId,jdbcType=VARCHAR} + + + update rk_score_type + set name = #{name,jdbcType=VARCHAR}, + parent_id = #{parentId,jdbcType=VARCHAR}, + sort_id = #{sortId,jdbcType=INTEGER}, + source = #{source,jdbcType=INTEGER}, + modified = #{modified,jdbcType=VARCHAR}, + created = #{created,jdbcType=VARCHAR}, + modify_time = #{modifyTime,jdbcType=TIMESTAMP}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where type_id = #{typeId,jdbcType=VARCHAR} + + + + + diff --git a/inventory-dao/src/main/resources/mapper/RkSensitiveTypeMapper.xml b/inventory-dao/src/main/resources/mapper/RkSensitiveTypeMapper.xml new file mode 100644 index 0000000..678bbc5 --- /dev/null +++ b/inventory-dao/src/main/resources/mapper/RkSensitiveTypeMapper.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + type_id, name, parent_id, sort_id, modified, created, modify_time, create_time + + + + + + insert into rk_sensitive_type (type_id, name, parent_id, + sort_id, modified, created, + modify_time, create_time) + values (#{typeId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR}, + #{sortId,jdbcType=INTEGER}, #{modified,jdbcType=VARCHAR}, #{created,jdbcType=VARCHAR}, + #{modifyTime}, #{createTime}) + + + insert into rk_sensitive_type + + + type_id, + + + name, + + + parent_id, + + + sort_id, + + + modified, + + + created, + + + modify_time, + + + create_time, + + + + + #{typeId,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{parentId,jdbcType=VARCHAR}, + + + #{sortId,jdbcType=INTEGER}, + + + #{modified,jdbcType=VARCHAR}, + + + #{created,jdbcType=VARCHAR}, + + + #{modifyTime,jdbcType=TIMESTAMP}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + + + + + + + + + UPDATE rk_sensitive_type set `name` = #{name},modified=#{modified},modify_time=#{modifyTime} WHERE type_id = #{typeId} + + + + + + diff --git a/inventory-dao/src/main/resources/mapper/RkSourcesMapper.xml b/inventory-dao/src/main/resources/mapper/RkSourcesMapper.xml index c6d9494..8843596 100644 --- a/inventory-dao/src/main/resources/mapper/RkSourcesMapper.xml +++ b/inventory-dao/src/main/resources/mapper/RkSourcesMapper.xml @@ -93,4 +93,40 @@ where source_id = #{sourceId} + + + diff --git a/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java b/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java index db79b03..6b63268 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/BaseController.java @@ -552,6 +552,41 @@ public class BaseController { protected InPostItemMapper inPostItemMapper; + //企业周边情况 + @Autowired + protected RkSensitiveTypeMapper rkSensitiveTypeMapper; + + //企业周边数据信息 + @Autowired + protected RkEntSensitiveMapper rkEntSensitiveMapper; + + //企业风险分级条款 + @Autowired + protected RkScoreTypeMapper rkScoreTypeMapper; + + //企业风险评估分数 + @Autowired + protected RkEnterpriseScoreMapper rkEnterpriseScoreMapper; + + //风险评估分数 + @Autowired + protected RkCompanyDiagnosisMapper rkCompanyDiagnosisMapper; + + + /*高敏感场所*/ + protected String HIGH_SENSITIVE_PLACES = "502b1ff4-bd01-11eb-9d3c-00163e0c1c62"; + /*重要目标*/ + protected String KEY_OBJECTIVES = "502b2472-bd01-11eb-9d3c-00163e0c1c62"; + /*人员密集区域*/ + protected String DENSELY_POPULATED_PLACES = "c6d817c1-5eec-4c88-916c-4c2f20dec062"; + + + //安全事故情况 + protected String SAFETY_ACCIDENTS = "76752d5b-c787-413a-b228-63b5507eaa03"; + //安全生产标准化达标情况 + protected String STANDARDIZATION_OF_WORK_SAFETY = "2d32e694-5af5-4786-b540-c56a34196ff9"; + + /** * 新都文件地址处理 * @param url diff --git a/inventory-ent/src/main/java/com/rzyc/controller/RiskController.java b/inventory-ent/src/main/java/com/rzyc/controller/RiskController.java index 81b8ba5..19d291d 100644 --- a/inventory-ent/src/main/java/com/rzyc/controller/RiskController.java +++ b/inventory-ent/src/main/java/com/rzyc/controller/RiskController.java @@ -1,5 +1,8 @@ package com.rzyc.controller; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.common.utils.RandomNumber; import com.common.utils.StringUtils; import com.common.utils.TypeConversion; import com.common.utils.model.*; @@ -8,9 +11,9 @@ import com.github.pagehelper.PageHelper; import com.rzyc.advice.LoginAuth; import com.rzyc.bean.risk.*; import com.rzyc.enums.DelState; +import com.rzyc.enums.FlowQueryStatus; import com.rzyc.enums.ResourceRiskLevel; -import com.rzyc.model.RkRiskType; -import com.rzyc.model.RkSources; +import com.rzyc.model.*; import com.rzyc.model.ent.SysEnterprise; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -21,10 +24,9 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; /** * @author dong @@ -38,6 +40,370 @@ import java.util.Map; @Validated public class RiskController extends BaseController { + /** + * 获取单位敏感信息类型 + * @param enterpriseId + * @return + * @throws Exception + */ + @ApiOperation(value = "获取单位敏感信息类型", notes = "获取单位敏感信息类型") + @ApiImplicitParams({ + @ApiImplicitParam(name = "enterpriseId", value = "企业名称", required = false, dataType = "string"), + + }) + @GetMapping("/getRkSensitiveType/{enterpriseId}") + @ResponseBody + public MultiResult getRkSensitiveType(@PathVariable String enterpriseId)throws Exception{ + MultiResult singleResult = new MultiResult<>(); + List rkSensitiveTypes = rkSensitiveTypeMapper.selectExample(enterpriseId); + + if (rkSensitiveTypes.size()>0){ + singleResult.setMessage(Message.SUCCESS); + singleResult.setCode(Code.SUCCESS.getCode()); + JSONArray rkSensitiveTypeJson = handleResouceTree(rkSensitiveTypes); + List rkSensitiveTypeList = JSONArray.parseArray(JSONArray.toJSONString(rkSensitiveTypeJson), RkSensitiveType.class); + singleResult.setData(rkSensitiveTypeList); + }else{ + singleResult.setMessage(Message.ERROR); + singleResult.setCode(Code.ERROR.getCode()); + } + + return singleResult; + } + + + /** + * 功能项树形结构 + * @param resources + * @return + * @throws Exception + */ + private JSONArray handleResouceTree(List resources)throws Exception{ + List> data = new ArrayList<>(); + for(RkSensitiveType resource : resources){ + + if(StringUtils.isBlank(resource.getParentId())){ + resource.setParentId(""); + } + Map entUserMap = new HashMap(); + entUserMap.put("typeId",resource.getTypeId()); + entUserMap.put("parentId",resource.getParentId()); + entUserMap.put("name",resource.getName()); + entUserMap.put("sortId",resource.getSortId()); + entUserMap.put("entNum",resource.getEntNum()); + entUserMap.put("sensitiveId",resource.getSensitiveId()); + data.add(entUserMap); + } + JSONArray result = TypeConversion.listToTree(JSONArray.parseArray(JSON.toJSONString(data)),"typeId","parentId","children"); + return result; + } + + + /** + * 修改单位周围敏感目标数量 + * @param rkEntSensitiveDto + * @return + * @throws Exception + */ + @ApiOperation(value = "修改单位周围敏感目标数量", notes = "修改单位周围敏感目标数量") + @PostMapping("/updateRkSensitive") + @ResponseBody + public SingleResult updateRkSensitive(@Valid @RequestBody RksensttiveDto rkEntSensitiveDto)throws Exception{ + SingleResult singleResult = new SingleResult<>(); + //操作人 + String chinaName = getChinaName(); + List rkEntSensitiveList = JSONArray.parseArray(rkEntSensitiveDto.getRkSensitive(), RkEntSensitive.class); + Date date = new Date(); + if (rkEntSensitiveList.size()>0){ + //先删除已有的信息 + rkEntSensitiveMapper.deleteByRkEntSensitive(rkEntSensitiveDto.getEnterpriseId()); + rkEntSensitiveList.stream().forEach(rkEntSensitive -> { + rkEntSensitive.setEnterpriseId(rkEntSensitiveDto.getEnterpriseId()); + rkEntSensitive.setModified(chinaName); + rkEntSensitive.setModifyTime(date); + rkEntSensitive.setSensitiveId(RandomNumber.getUUid()); + rkEntSensitive.setCreated(chinaName); + rkEntSensitive.setCreateTime(date); + rkEntSensitiveMapper.insert(rkEntSensitive); + }); + + singleResult.setMessage(Message.SUCCESS); + singleResult.setCode(Code.SUCCESS.getCode()); + }else{ + singleResult.setCode(Code.NO_DATA.getCode()); + singleResult.setMessage(Message.NO_DATA); + } + + return singleResult; + } + + /** + * 获取当前企业风险评分类型与得分 + * @param enterpriseId + * @return + * @throws Exception + */ + + @ApiOperation(value = "获取当前企业风险评分类型与得分", notes = "获取当前企业风险评分类型与得分") + @ApiImplicitParams({ + @ApiImplicitParam(name = "enterpriseId", value = "企业Id", required = false, dataType = "string"), + + }) + @GetMapping("/getScoreType/{enterpriseId}") + @ResponseBody + public MultiResult getScoreType(@PathVariable String enterpriseId)throws Exception{ + MultiResult multiResult = new MultiResult<>(); + List rkScoreTypes = rkScoreTypeMapper.selectByScoreType(enterpriseId); + List rkSensitiveTypes = rkSensitiveTypeMapper.selectExample(enterpriseId); + RkSourcesDto rkSourcesDto = new RkSourcesDto(); + rkSourcesDto.setEnterpriseId(enterpriseId); + List rkSources = rkSourcesMapper.selectPageRkSources(rkSourcesDto); + if (rkScoreTypes.size() == 0){ + multiResult.setCode(Code.NO_DATA.getCode()); + multiResult.setMessage(Message.NO_DATA); + return multiResult; + } + List rkScoreTypesTree = this.setScoreType(rkScoreTypes, rkSensitiveTypes, rkSources); + rkScoreTypes.stream().sorted(Comparator.comparing(RkScoreType::getSortId)); + multiResult.setData(rkScoreTypesTree); + return multiResult; + + } + + + /** + * 修改评分类型需要查询的分数并返回树形 + * @param rkScoreTypes + * @param rkSensitiveTypes + * @param rkSources + * @return + * @throws Exception + */ + private List setScoreType(List rkScoreTypes,List rkSensitiveTypes, List rkSources)throws Exception{ + List rkSensitiveTypeList = null; + + if (rkSensitiveTypes.size() >0){ + JSONArray rkSensitiveTypeJson = this.handleResouceTree(rkSensitiveTypes); + rkSensitiveTypeList = JSONArray.parseArray(JSONArray.toJSONString(rkSensitiveTypeJson), RkSensitiveType.class); + } + if (rkScoreTypes.size()>0){ + List finalRkSensitiveTypeList = rkSensitiveTypeList; + rkScoreTypes.stream().forEach(rkScoreType -> { + //1.存在重大安全风险源的,每个扣10分;3个及以上的,扣40分; + if (rkScoreType.getSource()==2){ + List collect = rkSources.stream().filter(rkSource -> { + return rkSource.getRiskGrade() > 3; + }).collect(Collectors.toList()); + if (collect.size() >= 3){ + rkScoreType.setScore(40); + }else if (collect.size()>0 && collect.size() < 3){ + rkScoreType.setScore(collect.size()*10); + }else{ + rkScoreType.setScore(0); + } + } + //存在较大安全风险源的,每个扣5分;4个及以上的,扣20分。 + if (rkScoreType.getSource() == 3){ + List collect = rkSources.stream().filter(rkSource -> { + return rkSource.getRiskGrade() == 3; + }).collect(Collectors.toList()); + if (collect.size()>=4){ + rkScoreType.setScore(20); + }else if (collect.size()>0 && collect.size() < 4){ + rkScoreType.setScore(collect.size()*5); + }else{ + rkScoreType.setScore(0); + } + } + + //1.生产经营单位周边存在重要场所(如学校、医院、养老院等)、重要目标(如党政机关、军事管理区、文物保护单位,主要道路桥梁等),每处扣5分; + if (rkScoreType.getSource() == 4){ + AtomicReference score = new AtomicReference<>(0); + if (finalRkSensitiveTypeList.size()>0){ + finalRkSensitiveTypeList.forEach(rkSensitiveType -> { + if (rkSensitiveType.getTypeId().equals(HIGH_SENSITIVE_PLACES) || rkSensitiveType.getTypeId().equals(KEY_OBJECTIVES)){ + rkSensitiveType.getChildren().forEach(child ->{ + if (child.getEntNum() != null){ + score.set(child.getEntNum() + score.get()); + } + }); + } + }); + + rkScoreType.setScore((score.get() *5)>20?20:(score.get() *5)); + } + } + //2.生产经营单位周边存在人员密集场所(如居民小区、大型城市综合体、商场市场、宾馆饭店、娱乐场所、体育场馆、交通枢纽等)的,每处扣3分。 + if (rkScoreType.getSource() == 5){ + AtomicReference score = new AtomicReference<>(0); + if (finalRkSensitiveTypeList.size()>0){ + finalRkSensitiveTypeList.forEach(rkSensitiveType -> { + if (rkSensitiveType.getTypeId().equals(DENSELY_POPULATED_PLACES) ){ + if ( rkSensitiveType.getChildren() != null && rkSensitiveType.getChildren().size()>0 ){ + rkSensitiveType.getChildren().forEach(child ->{ + if (child.getEntNum() != null){ + score.set(child.getEntNum() + score.get()); + } + }); + } + } + }); + } + rkScoreType.setScore((score.get() *3)>20?20:(score.get() *3)); + } + + }); + } + JSONArray jsonArray = this.handleScoreTypeTree(rkScoreTypes); + List rkScoreTypeList = JSONArray.parseArray(JSONArray.toJSONString(jsonArray), RkScoreType.class); + //计算最终得分 + rkScoreTypeList.forEach(types ->{ + List children = types.getChildren(); + AtomicReference score = new AtomicReference<>(types.getFullMarks()); + children.forEach(chil ->{ + chil.getChildren().forEach(type ->{ + if(type.getScoreType() == 2){ + if (type.getScore() != null && score.get() != null){ + score.set(score.get() - type.getScore()); + } + }else{ + if (type.getScore() != null && score.get() != null){ + score.set(score.get() + type.getScore()); + } + } + }); + }); + types.setScore(score.get()<0?0:score.get()); + }); + + + + return rkScoreTypeList; + } + + + /** + * 评分类型树结构 + * @param scoreTypes + * @return + * @throws Exception + */ + private JSONArray handleScoreTypeTree(List scoreTypes)throws Exception{ + List> data = new ArrayList<>(); + for(RkScoreType resource : scoreTypes){ + + if(StringUtils.isBlank(resource.getParentId())){ + resource.setParentId(""); + } + Map entUserMap = new HashMap(); + entUserMap.put("typeId",resource.getTypeId()); + entUserMap.put("parentId",resource.getParentId()); + entUserMap.put("name",resource.getName()); + entUserMap.put("sortId",resource.getSortId().toString()); + entUserMap.put("score",resource.getScore()); + entUserMap.put("source",resource.getSource().toString()); + if (resource.getFullMarks() != null){ + entUserMap.put("fullMarks",resource.getFullMarks().toString()); + } + if (resource.getScoreType() != null){ + entUserMap.put("scoreType",resource.getScoreType()); + } + data.add(entUserMap); + } + JSONArray result = TypeConversion.listToTree(JSONArray.parseArray(JSON.toJSONString(data)),"typeId","parentId","children"); + return result; + } + + + + @ApiOperation(value = "修改当前企业风险得分", notes = "修改当前企业风险得分") + @PostMapping("/UpdateRkEnterpriseScore") + @ResponseBody + public SingleResult UpdateRkEnterpriseScore(@Valid @RequestBody RksensttiveDto rkEntSensitiveDto)throws Exception{ + SingleResult singleResult = new SingleResult(); + String chinaName = getChinaName(); + Date date = new Date(); + String enterpriseId = rkEntSensitiveDto.getEnterpriseId(); + List rkEnterpriseScores = JSONArray.parseArray(rkEntSensitiveDto.getRkSensitive(), RkEnterpriseScore.class); + AtomicReference score = new AtomicReference<>(80); + AtomicReference securityScore = new AtomicReference<>(20); + if (rkEnterpriseScores.size()>0){ + //先删除所有 + rkEnterpriseScoreMapper.deleteByEnterpriseId(enterpriseId); + //添加 + rkEnterpriseScores.forEach(rkEnterpriseScore -> { + rkEnterpriseScore.setScoreId(RandomNumber.getUUid()); + if (rkEnterpriseScore.getScore() != null){ + if(rkEnterpriseScore.getParentId().equals(SAFETY_ACCIDENTS) || rkEnterpriseScore.getParentId().equals(STANDARDIZATION_OF_WORK_SAFETY) ){ + if (rkEnterpriseScore.getScoreType() == 1){ + securityScore.set(rkEnterpriseScore.getScore()+securityScore.get()); + }else{ + securityScore.set(securityScore.get() - rkEnterpriseScore.getScore()); + } + }else{ + if (rkEnterpriseScore.getScoreType() == 1){ + score.set(rkEnterpriseScore.getScore()+score.get()); + }else{ + score.set(score.get() - rkEnterpriseScore.getScore()); + } + } + + } + rkEnterpriseScore.setEnterpriseId(enterpriseId); + rkEnterpriseScore.setCreated(chinaName); + rkEnterpriseScore.setModified(chinaName); + rkEnterpriseScore.setCreateTime(date); + rkEnterpriseScore.setModifyTime(date); + rkEnterpriseScoreMapper.insert(rkEnterpriseScore); + }); + if (securityScore.get()>20){ + securityScore.set(20); + }else if (securityScore.get() <0){ + securityScore.set(0); + } + + score.set(score.get()+securityScore.get()); + + //保存诊断列表 + this.updateOrAddDiagnosis(score.get(),enterpriseId,rkEntSensitiveDto.getCategory()); + } + return singleResult; + + } + + + /** + * 修改诊断列表 + * @param score + * @return + * @throws Exception + */ + public void updateOrAddDiagnosis(Integer score,String enterpriseId,String category)throws Exception{ + String chinaName = getChinaName(); + Date date = new Date(); + rkCompanyDiagnosisMapper.deletByEnterpriseId(enterpriseId); + RkCompanyDiagnosis rkCompanyDiagnosis = new RkCompanyDiagnosis(); + rkCompanyDiagnosis.setDiagnosisId(RandomNumber.getUUid()); + rkCompanyDiagnosis.setModified(chinaName); + rkCompanyDiagnosis.setCreated(chinaName); + rkCompanyDiagnosis.setModifyTime(date); + rkCompanyDiagnosis.setCreateTime(date); + rkCompanyDiagnosis.setEnterpriseId(enterpriseId); + rkCompanyDiagnosis.setAssessTime(date); + rkCompanyDiagnosis.setScore(score); + rkCompanyDiagnosis.setCategory(category); + rkCompanyDiagnosis.setStatus(FlowQueryStatus.PENDING); + if (score < 60){ + rkCompanyDiagnosis.setGrade(1); + }else if (score >59 && score < 75){ + rkCompanyDiagnosis.setGrade(2); + }else if (score > 74 && score < 90){ + rkCompanyDiagnosis.setGrade(3); + }else{ + rkCompanyDiagnosis.setGrade(4); + } + rkCompanyDiagnosisMapper.insert(rkCompanyDiagnosis); + } /** * 企业重大危险源新增修改 diff --git a/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java b/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java index 0e5f5f0..36d37d9 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/BaseController.java @@ -524,6 +524,26 @@ public class BaseController { @Autowired protected ListchangeMapper listchangeMapper; + //企业周边情况 + @Autowired + protected RkSensitiveTypeMapper rkSensitiveTypeMapper; + + //企业周边数据信息 + @Autowired + protected RkEntSensitiveMapper rkEntSensitiveMapper; + + //企业风险分级条款 + @Autowired + protected RkScoreTypeMapper rkScoreTypeMapper; + + //企业风险评估分数 + @Autowired + protected RkEnterpriseScoreMapper rkEnterpriseScoreMapper; + + //风险评估分数 + @Autowired + protected RkCompanyDiagnosisMapper rkCompanyDiagnosisMapper; + /** * 岗位不需要的字符串 @@ -633,6 +653,19 @@ public class BaseController { } + /*高敏感场所*/ + protected String HIGH_SENSITIVE_PLACES = "502b1ff4-bd01-11eb-9d3c-00163e0c1c62"; + /*重要目标*/ + protected String KEY_OBJECTIVES = "502b2472-bd01-11eb-9d3c-00163e0c1c62"; + /*人员密集区域*/ + protected String DENSELY_POPULATED_PLACES = "c6d817c1-5eec-4c88-916c-4c2f20dec062"; + + + //安全事故情况 + protected String SAFETY_ACCIDENTS = "76752d5b-c787-413a-b228-63b5507eaa03"; + //安全生产标准化达标情况 + protected String STANDARDIZATION_OF_WORK_SAFETY = "2d32e694-5af5-4786-b540-c56a34196ff9"; + /** * 新都文件地址处理 diff --git a/inventory-gov/src/main/java/com/rzyc/controller/ent/RiskController.java b/inventory-gov/src/main/java/com/rzyc/controller/ent/RiskController.java index 1bc2f53..eb900a3 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/ent/RiskController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/ent/RiskController.java @@ -1,21 +1,19 @@ package com.rzyc.controller.ent; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.common.utils.RandomNumber; import com.common.utils.StringUtils; import com.common.utils.TypeConversion; -import com.common.utils.model.MultiResult; -import com.common.utils.model.Pager; -import com.common.utils.model.SingleResult; +import com.common.utils.model.*; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; -import com.rzyc.bean.risk.SourcesAddDto; -import com.rzyc.bean.risk.SourcesDelDto; -import com.rzyc.bean.risk.SourcesPageDto; -import com.rzyc.bean.risk.SourcesSignDto; +import com.rzyc.bean.risk.*; import com.rzyc.controller.BaseController; import com.rzyc.enums.DelState; +import com.rzyc.enums.FlowQueryStatus; import com.rzyc.enums.ResourceRiskLevel; -import com.rzyc.model.RkRiskType; -import com.rzyc.model.RkSources; +import com.rzyc.model.*; import com.rzyc.model.ent.SysEnterprise; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -26,10 +24,9 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; /** * @author dong @@ -44,6 +41,372 @@ import java.util.Map; public class RiskController extends BaseController { + /** + * 获取单位敏感信息类型 + * @param enterpriseId + * @return + * @throws Exception + */ + @ApiOperation(value = "获取单位敏感信息类型", notes = "获取单位敏感信息类型") + @ApiImplicitParams({ + @ApiImplicitParam(name = "enterpriseId", value = "企业名称", required = false, dataType = "string"), + + }) + @GetMapping("/getRkSensitiveType/{enterpriseId}") + @ResponseBody + public MultiResult getRkSensitiveType(@PathVariable String enterpriseId)throws Exception{ + MultiResult singleResult = new MultiResult<>(); + List rkSensitiveTypes = rkSensitiveTypeMapper.selectExample(enterpriseId); + + if (rkSensitiveTypes.size()>0){ + singleResult.setMessage(Message.SUCCESS); + singleResult.setCode(Code.SUCCESS.getCode()); + JSONArray rkSensitiveTypeJson = handleResouceTree(rkSensitiveTypes); + List rkSensitiveTypeList = JSONArray.parseArray(JSONArray.toJSONString(rkSensitiveTypeJson), RkSensitiveType.class); + singleResult.setData(rkSensitiveTypeList); + }else{ + singleResult.setMessage(Message.ERROR); + singleResult.setCode(Code.ERROR.getCode()); + } + + return singleResult; + } + + + /** + * 功能项树形结构 + * @param resources + * @return + * @throws Exception + */ + private JSONArray handleResouceTree(List resources)throws Exception{ + List> data = new ArrayList<>(); + for(RkSensitiveType resource : resources){ + + if(StringUtils.isBlank(resource.getParentId())){ + resource.setParentId(""); + } + Map entUserMap = new HashMap(); + entUserMap.put("typeId",resource.getTypeId()); + entUserMap.put("parentId",resource.getParentId()); + entUserMap.put("name",resource.getName()); + entUserMap.put("sortId",resource.getSortId()); + entUserMap.put("entNum",resource.getEntNum()); + entUserMap.put("sensitiveId",resource.getSensitiveId()); + data.add(entUserMap); + } + JSONArray result = TypeConversion.listToTree(JSONArray.parseArray(JSON.toJSONString(data)),"typeId","parentId","children"); + return result; + } + + + /** + * 修改单位周围敏感目标数量 + * @param rkEntSensitiveDto + * @return + * @throws Exception + */ + @ApiOperation(value = "修改单位周围敏感目标数量", notes = "修改单位周围敏感目标数量") + @PostMapping("/updateRkSensitive") + @ResponseBody + public SingleResult updateRkSensitive(@Valid @RequestBody RksensttiveDto rkEntSensitiveDto)throws Exception{ + SingleResult singleResult = new SingleResult<>(); + //操作人 + String chinaName = getChinaName(); + List rkEntSensitiveList = JSONArray.parseArray(rkEntSensitiveDto.getRkSensitive(), RkEntSensitive.class); + Date date = new Date(); + if (rkEntSensitiveList.size()>0){ + //先删除已有的信息 + rkEntSensitiveMapper.deleteByRkEntSensitive(rkEntSensitiveDto.getEnterpriseId()); + rkEntSensitiveList.stream().forEach(rkEntSensitive -> { + rkEntSensitive.setEnterpriseId(rkEntSensitiveDto.getEnterpriseId()); + rkEntSensitive.setModified(chinaName); + rkEntSensitive.setModifyTime(date); + rkEntSensitive.setSensitiveId(RandomNumber.getUUid()); + rkEntSensitive.setCreated(chinaName); + rkEntSensitive.setCreateTime(date); + rkEntSensitiveMapper.insert(rkEntSensitive); + }); + + singleResult.setMessage(Message.SUCCESS); + singleResult.setCode(Code.SUCCESS.getCode()); + }else{ + singleResult.setCode(Code.NO_DATA.getCode()); + singleResult.setMessage(Message.NO_DATA); + } + + return singleResult; + } + + /** + * 获取当前企业风险评分类型与得分 + * @param enterpriseId + * @return + * @throws Exception + */ + + @ApiOperation(value = "获取当前企业风险评分类型与得分", notes = "获取当前企业风险评分类型与得分") + @ApiImplicitParams({ + @ApiImplicitParam(name = "enterpriseId", value = "企业Id", required = false, dataType = "string"), + + }) + @GetMapping("/getScoreType/{enterpriseId}") + @ResponseBody + public MultiResult getScoreType(@PathVariable String enterpriseId)throws Exception{ + MultiResult multiResult = new MultiResult<>(); + List rkScoreTypes = rkScoreTypeMapper.selectByScoreType(enterpriseId); + List rkSensitiveTypes = rkSensitiveTypeMapper.selectExample(enterpriseId); + RkSourcesDto rkSourcesDto = new RkSourcesDto(); + rkSourcesDto.setEnterpriseId(enterpriseId); + List rkSources = rkSourcesMapper.selectPageRkSources(rkSourcesDto); + if (rkScoreTypes.size() == 0){ + multiResult.setCode(Code.NO_DATA.getCode()); + multiResult.setMessage(Message.NO_DATA); + return multiResult; + } + List rkScoreTypesTree = this.setScoreType(rkScoreTypes, rkSensitiveTypes, rkSources); + rkScoreTypes.stream().sorted(Comparator.comparing(RkScoreType::getSortId)); + multiResult.setData(rkScoreTypesTree); + return multiResult; + + } + + + /** + * 修改评分类型需要查询的分数并返回树形 + * @param rkScoreTypes + * @param rkSensitiveTypes + * @param rkSources + * @return + * @throws Exception + */ + private List setScoreType(List rkScoreTypes,List rkSensitiveTypes, List rkSources)throws Exception{ + List rkSensitiveTypeList = null; + + if (rkSensitiveTypes.size() >0){ + JSONArray rkSensitiveTypeJson = this.handleResouceTree(rkSensitiveTypes); + rkSensitiveTypeList = JSONArray.parseArray(JSONArray.toJSONString(rkSensitiveTypeJson), RkSensitiveType.class); + } + if (rkScoreTypes.size()>0){ + List finalRkSensitiveTypeList = rkSensitiveTypeList; + rkScoreTypes.stream().forEach(rkScoreType -> { + //1.存在重大安全风险源的,每个扣10分;3个及以上的,扣40分; + if (rkScoreType.getSource()==2){ + List collect = rkSources.stream().filter(rkSource -> { + return rkSource.getRiskGrade() > 3; + }).collect(Collectors.toList()); + if (collect.size() >= 3){ + rkScoreType.setScore(40); + }else if (collect.size()>0 && collect.size() < 3){ + rkScoreType.setScore(collect.size()*10); + }else{ + rkScoreType.setScore(0); + } + } + //存在较大安全风险源的,每个扣5分;4个及以上的,扣20分。 + if (rkScoreType.getSource() == 3){ + List collect = rkSources.stream().filter(rkSource -> { + return rkSource.getRiskGrade() == 3; + }).collect(Collectors.toList()); + if (collect.size()>=4){ + rkScoreType.setScore(20); + }else if (collect.size()>0 && collect.size() < 4){ + rkScoreType.setScore(collect.size()*5); + }else{ + rkScoreType.setScore(0); + } + } + + //1.生产经营单位周边存在重要场所(如学校、医院、养老院等)、重要目标(如党政机关、军事管理区、文物保护单位,主要道路桥梁等),每处扣5分; + if (rkScoreType.getSource() == 4){ + AtomicReference score = new AtomicReference<>(0); + if (finalRkSensitiveTypeList.size()>0){ + finalRkSensitiveTypeList.forEach(rkSensitiveType -> { + if (rkSensitiveType.getTypeId().equals(HIGH_SENSITIVE_PLACES) || rkSensitiveType.getTypeId().equals(KEY_OBJECTIVES)){ + rkSensitiveType.getChildren().forEach(child ->{ + if (child.getEntNum() != null){ + score.set(child.getEntNum() + score.get()); + } + }); + } + }); + + rkScoreType.setScore((score.get() *5)>20?20:(score.get() *5)); + } + } + //2.生产经营单位周边存在人员密集场所(如居民小区、大型城市综合体、商场市场、宾馆饭店、娱乐场所、体育场馆、交通枢纽等)的,每处扣3分。 + if (rkScoreType.getSource() == 5){ + AtomicReference score = new AtomicReference<>(0); + if (finalRkSensitiveTypeList.size()>0){ + finalRkSensitiveTypeList.forEach(rkSensitiveType -> { + if (rkSensitiveType.getTypeId().equals(DENSELY_POPULATED_PLACES) ){ + if ( rkSensitiveType.getChildren() != null && rkSensitiveType.getChildren().size()>0 ){ + rkSensitiveType.getChildren().forEach(child ->{ + if (child.getEntNum() != null){ + score.set(child.getEntNum() + score.get()); + } + }); + } + } + }); + } + rkScoreType.setScore((score.get() *3)>20?20:(score.get() *3)); + } + + }); + } + JSONArray jsonArray = this.handleScoreTypeTree(rkScoreTypes); + List rkScoreTypeList = JSONArray.parseArray(JSONArray.toJSONString(jsonArray), RkScoreType.class); + //计算最终得分 + rkScoreTypeList.forEach(types ->{ + List children = types.getChildren(); + AtomicReference score = new AtomicReference<>(types.getFullMarks()); + children.forEach(chil ->{ + chil.getChildren().forEach(type ->{ + if(type.getScoreType() == 2){ + if (type.getScore() != null && score.get() != null){ + score.set(score.get() - type.getScore()); + } + }else{ + if (type.getScore() != null && score.get() != null){ + score.set(score.get() + type.getScore()); + } + } + }); + }); + types.setScore(score.get()<0?0:score.get()); + }); + + + + return rkScoreTypeList; + } + + + /** + * 评分类型树结构 + * @param scoreTypes + * @return + * @throws Exception + */ + private JSONArray handleScoreTypeTree(List scoreTypes)throws Exception{ + List> data = new ArrayList<>(); + for(RkScoreType resource : scoreTypes){ + + if(StringUtils.isBlank(resource.getParentId())){ + resource.setParentId(""); + } + Map entUserMap = new HashMap(); + entUserMap.put("typeId",resource.getTypeId()); + entUserMap.put("parentId",resource.getParentId()); + entUserMap.put("name",resource.getName()); + entUserMap.put("sortId",resource.getSortId().toString()); + entUserMap.put("score",resource.getScore()); + entUserMap.put("source",resource.getSource().toString()); + if (resource.getFullMarks() != null){ + entUserMap.put("fullMarks",resource.getFullMarks().toString()); + } + if (resource.getScoreType() != null){ + entUserMap.put("scoreType",resource.getScoreType()); + } + data.add(entUserMap); + } + JSONArray result = TypeConversion.listToTree(JSONArray.parseArray(JSON.toJSONString(data)),"typeId","parentId","children"); + return result; + } + + + + @ApiOperation(value = "修改当前企业风险得分", notes = "修改当前企业风险得分") + @PostMapping("/UpdateRkEnterpriseScore") + @ResponseBody + public SingleResult UpdateRkEnterpriseScore(@Valid @RequestBody RksensttiveDto rkEntSensitiveDto)throws Exception{ + SingleResult singleResult = new SingleResult(); + String chinaName = getChinaName(); + Date date = new Date(); + String enterpriseId = rkEntSensitiveDto.getEnterpriseId(); + List rkEnterpriseScores = JSONArray.parseArray(rkEntSensitiveDto.getRkSensitive(), RkEnterpriseScore.class); + AtomicReference score = new AtomicReference<>(80); + AtomicReference securityScore = new AtomicReference<>(20); + if (rkEnterpriseScores.size()>0){ + //先删除所有 + rkEnterpriseScoreMapper.deleteByEnterpriseId(enterpriseId); + //添加 + rkEnterpriseScores.forEach(rkEnterpriseScore -> { + rkEnterpriseScore.setScoreId(RandomNumber.getUUid()); + if (rkEnterpriseScore.getScore() != null){ + if(rkEnterpriseScore.getParentId().equals(SAFETY_ACCIDENTS) || rkEnterpriseScore.getParentId().equals(STANDARDIZATION_OF_WORK_SAFETY) ){ + if (rkEnterpriseScore.getScoreType() == 1){ + securityScore.set(rkEnterpriseScore.getScore()+securityScore.get()); + }else{ + securityScore.set(securityScore.get() - rkEnterpriseScore.getScore()); + } + }else{ + if (rkEnterpriseScore.getScoreType() == 1){ + score.set(rkEnterpriseScore.getScore()+score.get()); + }else{ + score.set(score.get() - rkEnterpriseScore.getScore()); + } + } + + } + rkEnterpriseScore.setEnterpriseId(enterpriseId); + rkEnterpriseScore.setCreated(chinaName); + rkEnterpriseScore.setModified(chinaName); + rkEnterpriseScore.setCreateTime(date); + rkEnterpriseScore.setModifyTime(date); + rkEnterpriseScoreMapper.insert(rkEnterpriseScore); + }); + if (securityScore.get()>20){ + securityScore.set(20); + }else if (securityScore.get() <0){ + securityScore.set(0); + } + + score.set(score.get()+securityScore.get()); + + //保存诊断列表 + this.updateOrAddDiagnosis(score.get(),enterpriseId,rkEntSensitiveDto.getCategory()); + } + return singleResult; + + } + + + /** + * 修改诊断列表 + * @param score + * @return + * @throws Exception + */ + public void updateOrAddDiagnosis(Integer score,String enterpriseId,String category)throws Exception{ + String chinaName = getChinaName(); + Date date = new Date(); + rkCompanyDiagnosisMapper.deletByEnterpriseId(enterpriseId); + RkCompanyDiagnosis rkCompanyDiagnosis = new RkCompanyDiagnosis(); + rkCompanyDiagnosis.setDiagnosisId(RandomNumber.getUUid()); + rkCompanyDiagnosis.setModified(chinaName); + rkCompanyDiagnosis.setCreated(chinaName); + rkCompanyDiagnosis.setModifyTime(date); + rkCompanyDiagnosis.setCreateTime(date); + rkCompanyDiagnosis.setEnterpriseId(enterpriseId); + rkCompanyDiagnosis.setAssessTime(date); + rkCompanyDiagnosis.setScore(score); + rkCompanyDiagnosis.setCategory(category); + rkCompanyDiagnosis.setStatus(FlowQueryStatus.PENDING); + if (score < 60){ + rkCompanyDiagnosis.setGrade(1); + }else if (score >59 && score < 75){ + rkCompanyDiagnosis.setGrade(2); + }else if (score > 74 && score < 90){ + rkCompanyDiagnosis.setGrade(3); + }else{ + rkCompanyDiagnosis.setGrade(4); + } + rkCompanyDiagnosisMapper.insert(rkCompanyDiagnosis); + } + + /** * 企业重大危险源新增修改 *