package com.example.demo.model.enums; /** * 事件处理状态枚举。 *

* 定义事件从接收到处理完成的完整生命周期状态。 *

*/ public enum EventStatus { /** 待处理 - 事件已接收但尚未处理 */ PENDING(0, "待处理"), /** 处理中 - 正在对事件进行分析评估 */ PROCESSING(1, "处理中"), /** 已完成 - 事件已处理完成 */ COMPLETED(2, "已完成"), /** 已忽略 - 事件经评估无需生成任务 */ IGNORED(3, "已忽略"), /** 异常 - 事件处理过程中发生错误 */ ERROR(4, "异常"); private final int code; private final String description; EventStatus(int code, String description) { this.code = code; this.description = description; } public int getCode() { return code; } public String getDescription() { return description; } /** * 根据状态码获取枚举实例。 * * @param code 状态码 * @return 对应的枚举实例,未找到时返回 null */ public static EventStatus fromCode(int code) { for (EventStatus status : values()) { if (status.code == code) { return status; } } return null; } }