规范status字段类型;添加Situation枚举类
This commit is contained in:
parent
77a0c62a3e
commit
92ab5142d3
|
@ -0,0 +1,44 @@
|
||||||
|
package org.dromara.scale.constant;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
|
||||||
|
public enum SituationEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
NONE(1, "未见异常"),
|
||||||
|
LOW(2, "低风险"),
|
||||||
|
MIDDEL(3, "中风险"),
|
||||||
|
HIGH(4, "高风险"),
|
||||||
|
MAJOR(5, "重大风险");
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
SituationEnum(Integer status, String name) {
|
||||||
|
this.status = status;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getValue() {
|
||||||
|
return this.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getNameByCode(Integer code){
|
||||||
|
for (SituationEnum value : SituationEnum.values()) {
|
||||||
|
if(value.getValue().equals(code)){
|
||||||
|
return value.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -59,9 +59,9 @@ public class SysScale extends BaseEntity {
|
||||||
private String scaleDetails;
|
private String scaleDetails;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0停用 1正常)
|
||||||
*/
|
*/
|
||||||
private String status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 适应人群:对应字典项people_type
|
* 适应人群:对应字典项people_type
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class SysScaleFactorRange extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 严重度,对应数据字典 YZD
|
* 严重度,对应数据字典 YZD
|
||||||
*/
|
*/
|
||||||
private Long situation;
|
private Integer situation;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,9 @@ public class SysScalePublish {
|
||||||
private Date expireTime;
|
private Date expireTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 0:正常;1:停用
|
* 状态 0:停用;1:正常
|
||||||
*/
|
*/
|
||||||
private Long status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0:不允许,1:允许
|
* 0:不允许,1:允许
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.dromara.scale.domain.bo;
|
package org.dromara.scale.domain.bo;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import io.github.linpeilie.annotations.AutoMapping;
|
import io.github.linpeilie.annotations.AutoMapping;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
@ -64,10 +63,10 @@ public class SysScaleBo extends BaseEntity {
|
||||||
private String scaleDetails;
|
private String scaleDetails;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0停用 1正常)
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "状态(0正常 1停用)不能为空", groups = {AddGroup.class, EditGroup.class})
|
@NotBlank(message = "状态(0停用 1正常)不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
private String status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 适应人群:对应字典项people_type
|
* 适应人群:对应字典项people_type
|
||||||
|
|
|
@ -67,10 +67,10 @@ public class SysScalePublishBo {
|
||||||
private Date expireTime;
|
private Date expireTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 0:正常;1:停用
|
* 状态 0:停用;1:正常
|
||||||
*/
|
*/
|
||||||
//@NotNull(message = "状态 0:正常;1:停用不能为空", groups = { AddGroup.class, EditGroup.class })
|
//@NotNull(message = "状态 0:停用;1:正常不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
private Long status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0:不允许,1:允许
|
* 0:不允许,1:允许
|
||||||
|
|
|
@ -81,7 +81,9 @@ public class SysEvaluationConclusionVo implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 风险等级
|
* 风险等级
|
||||||
*/
|
*/
|
||||||
private Long situation;
|
private Integer situation;
|
||||||
|
|
||||||
|
private String SituationName;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class SysScaleFactorRangeVo implements Serializable {
|
||||||
* 严重度,对应数据字典 YZD
|
* 严重度,对应数据字典 YZD
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "严重度,对应数据字典 YZD")
|
@ExcelProperty(value = "严重度,对应数据字典 YZD")
|
||||||
private Long situation;
|
private Integer situation;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,10 +69,10 @@ public class SysScalePublishVo implements Serializable {
|
||||||
private Date expireTime;
|
private Date expireTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态 0:正常;1:停用
|
* 状态 0:停用;1:正常
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "状态 0:正常;1:停用")
|
@ExcelProperty(value = "状态 0:停用;1:正常")
|
||||||
private Long status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0:不允许,1:允许
|
* 0:不允许,1:允许
|
||||||
|
|
|
@ -59,11 +59,11 @@ public class SysScaleVo implements Serializable {
|
||||||
private String scaleDetails;
|
private String scaleDetails;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0停用 1正常)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||||
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
|
@ExcelDictFormat(readConverterExp = "0=停用,1=正常")
|
||||||
private String status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 适应人群:对应字典项people_type
|
* 适应人群:对应字典项people_type
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.scale.constant.ScaleDimensionEnum;
|
import org.dromara.scale.constant.ScaleDimensionEnum;
|
||||||
import org.dromara.scale.constant.ScoreRuleTypeEnum;
|
import org.dromara.scale.constant.ScoreRuleTypeEnum;
|
||||||
|
import org.dromara.scale.constant.SituationEnum;
|
||||||
import org.dromara.scale.constant.StatusEnum;
|
import org.dromara.scale.constant.StatusEnum;
|
||||||
import org.dromara.scale.domain.*;
|
import org.dromara.scale.domain.*;
|
||||||
import org.dromara.scale.domain.bo.SysEvaluationAnswerBo;
|
import org.dromara.scale.domain.bo.SysEvaluationAnswerBo;
|
||||||
|
@ -119,13 +120,13 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
||||||
List<SysEvaluationConclusion> conclusionAdd = MapstructUtils.convert(list, SysEvaluationConclusion.class);
|
List<SysEvaluationConclusion> conclusionAdd = MapstructUtils.convert(list, SysEvaluationConclusion.class);
|
||||||
baseMapper.insertBatch(conclusionAdd);
|
baseMapper.insertBatch(conclusionAdd);
|
||||||
|
|
||||||
Long riskLevel = -1L;
|
Integer riskLevel = -1;
|
||||||
String riskName = "";
|
String riskName = "";
|
||||||
//选择风险等级最高
|
//选择风险等级最高
|
||||||
for (SysEvaluationConclusionVo ec : list) {
|
for (SysEvaluationConclusionVo ec : list) {
|
||||||
if (ec.getSituation() > riskLevel) {
|
if (ec.getSituation() > riskLevel) {
|
||||||
riskLevel = ec.getSituation();
|
riskLevel = ec.getSituation();
|
||||||
//riskName = ec.getSituationName();
|
riskName = ec.getSituationName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//判断风险等级是否为"高风险、重大风险",若是,则形成预警记录
|
//判断风险等级是否为"高风险、重大风险",若是,则形成预警记录
|
||||||
|
@ -223,7 +224,7 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
||||||
evalConclusion.setEvalPropose(range.getEvalPropose());
|
evalConclusion.setEvalPropose(range.getEvalPropose());
|
||||||
evalConclusion.setFactorRangeId(range.getRangeId());
|
evalConclusion.setFactorRangeId(range.getRangeId());
|
||||||
evalConclusion.setSituation(range.getSituation());
|
evalConclusion.setSituation(range.getSituation());
|
||||||
//evalConclusion.setSituationName(range.getSituationName());
|
evalConclusion.setSituationName(SituationEnum.getNameByCode(range.getSituation()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -234,7 +235,7 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
||||||
evalConclusion.setEvalPropose(range.getEvalPropose());
|
evalConclusion.setEvalPropose(range.getEvalPropose());
|
||||||
evalConclusion.setFactorRangeId(range.getRangeId());
|
evalConclusion.setFactorRangeId(range.getRangeId());
|
||||||
evalConclusion.setSituation(range.getSituation());
|
evalConclusion.setSituation(range.getSituation());
|
||||||
//evalConclusion.setSituationName(range.getSituationName());
|
evalConclusion.setSituationName(SituationEnum.getNameByCode(range.getSituation()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (Objects.nonNull(range.getMinValue()) && Objects.isNull(range.getMaxValue())) {
|
} else if (Objects.nonNull(range.getMinValue()) && Objects.isNull(range.getMaxValue())) {
|
||||||
|
@ -244,7 +245,7 @@ public class SysEvaluationConclusionServiceImpl implements ISysEvaluationConclus
|
||||||
evalConclusion.setEvalPropose(range.getEvalPropose());
|
evalConclusion.setEvalPropose(range.getEvalPropose());
|
||||||
evalConclusion.setFactorRangeId(range.getRangeId());
|
evalConclusion.setFactorRangeId(range.getRangeId());
|
||||||
evalConclusion.setSituation(range.getSituation());
|
evalConclusion.setSituation(range.getSituation());
|
||||||
//evalConclusion.setSituationName(range.getSituationName());
|
evalConclusion.setSituationName(SituationEnum.getNameByCode(range.getSituation()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} //else {
|
} //else {
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,7 +79,7 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
||||||
LambdaQueryWrapper<SysScale> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<SysScale> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getScaleName()), SysScale::getScaleName, bo.getScaleName());
|
lqw.like(StringUtils.isNotBlank(bo.getScaleName()), SysScale::getScaleName, bo.getScaleName());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getScaleCode()), SysScale::getScaleCode, bo.getScaleCode());
|
lqw.eq(StringUtils.isNotBlank(bo.getScaleCode()), SysScale::getScaleCode, bo.getScaleCode());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysScale::getStatus, bo.getStatus());
|
lqw.eq(bo.getStatus() != null, SysScale::getStatus, bo.getStatus());
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(bo.getScaleType())) {
|
if (CollUtil.isNotEmpty(bo.getScaleType())) {
|
||||||
lqw.like(CollUtil.isNotEmpty(bo.getScaleType()), SysScale::getScaleType, bo.getScaleType().get(0));
|
lqw.like(CollUtil.isNotEmpty(bo.getScaleType()), SysScale::getScaleType, bo.getScaleType().get(0));
|
||||||
|
|
Loading…
Reference in New Issue