package org.sxkj.common.enums; import com.fasterxml.jackson.annotation.JsonValue; import java.util.Arrays; import java.util.List; /** * 工单类型枚举 */ public enum WorkOrderTypeEnum { /** * 无人机工单 */ DRONE_ORDER("0", "无人机工单"), /** * 人工工单 */ MANUAL_ORDER("1", "人工工单"), /** * AI识别分析 */ AI_ANALYSIS("2", "AI识别分析"), /** * 变化检测工单 */ CHANGE_DETECTION_ORDER("3", "变化检测"); private final String code; private final String description; WorkOrderTypeEnum(String code, String description) { this.code = code; this.description = description; } @JsonValue public String getCode() { return code; } public String getDescription() { return description; } /** * 根据编码获取枚举值 * * @param code 编码 * @return 枚举值 */ public static WorkOrderTypeEnum getByCode(String code) { for (WorkOrderTypeEnum type : values()) { if (type.code.equals(code)) { return type; } } return null; } /** * 获取 0,2,3工单类型编码列表 * * @return 工单类型编码列表 */ public static List getOrderTypeList() { return Arrays.asList("0", "2", "3"); } /** * 验证工单类型编码是否有效 * * @param code 工单类型编码 * @return 是否有效 */ public static boolean isValidCode(String code) { return getByCode(code) != null; } }