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:
lzh
2026-03-19 09:43:37 +08:00
parent a4ab24b29c
commit 4a105da46e
5 changed files with 81 additions and 22 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}
}