refactor(ops): 提取巡检结果和归属判定枚举,替换硬编码常量
新增 InspectionResultEnum(合格/不合格)和 InspectionAttributionEnum (个人责任/突发状况/正常),替换 InspectionRecordServiceImpl 和 InspectionAttributionServiceImpl 中的 private static final int 硬编码常量。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.viewsh.module.ops.enums;
|
||||
|
||||
import com.viewsh.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 巡检归属判定枚举
|
||||
*
|
||||
* @author lzh
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum InspectionAttributionEnum implements ArrayValuable<Integer> {
|
||||
|
||||
PERSONAL(1, "个人责任"),
|
||||
EMERGENCY(2, "突发状况"),
|
||||
NORMAL(3, "正常");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(InspectionAttributionEnum::getResult).toArray(Integer[]::new);
|
||||
|
||||
private final int result;
|
||||
private final String description;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.viewsh.module.ops.enums;
|
||||
|
||||
import com.viewsh.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 巡检结果枚举
|
||||
*
|
||||
* @author lzh
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum InspectionResultEnum implements ArrayValuable<Integer> {
|
||||
|
||||
FAILED(0, "不合格"),
|
||||
PASSED(1, "合格");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(InspectionResultEnum::getResult).toArray(Integer[]::new);
|
||||
|
||||
private final int result;
|
||||
private final String description;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user