namespace Model.Entity.Inspection
{
///
/// 告警级别(与规则引擎 AlertRuleEntity.AlarmLevel 字符串"信息/警告/紧急"保持一致)
///
public enum AlertLevelEnum
{
///
/// 信息
///
Info = 1,
///
/// 警告
///
Warning = 2,
///
/// 紧急
///
Urgent = 3
}
///
/// 告警状态(闭环流转:未确认 → 已确认 → 已处理 → 已关闭;可忽略/转工单)
///
public enum AlertStatusEnum
{
///
/// 未确认
///
Unacknowledged = 1,
///
/// 已确认
///
Acknowledged = 2,
///
/// 已处理
///
Handled = 3,
///
/// 已关闭
///
Closed = 4,
///
/// 已忽略
///
Ignored = 5,
///
/// 已转工单
///
ToWorkOrder = 6
}
///
/// 告警来源(标识上报模块,便于其它模块调用与统计)
///
public enum AlertSourceEnum
{
///
/// 规则引擎
///
RuleEngine = 1,
///
/// 自动巡检
///
AutoPatrol = 2,
///
/// 数据看板
///
Dashboard = 3,
///
/// 数据采集
///
Collection = 4,
///
/// 手动/API 上报
///
Manual = 5,
///
/// 其它
///
Other = 99
}
///
/// 告警类型
///
public enum AlertTypeEnum
{
///
/// 阈值超限
///
ThresholdExceed = 1,
///
/// 设备离线
///
DeviceOffline = 2,
///
/// 通讯故障
///
CommFault = 3,
///
/// 巡检异常
///
PatrolAbnormal = 4,
///
/// 自定义
///
Custom = 99
}
///
/// 通知渠道类型(一期仅支持飞书/钉钉/企微 Webhook 机器人)
///
public enum NotifyChannelTypeEnum
{
///
/// 飞书
///
Feishu = 1,
///
/// 钉钉
///
DingTalk = 2,
///
/// 企业微信
///
WeCom = 3
}
///
/// 渠道推送模式
///
public enum NotifyPushModeEnum
{
///
/// 直连推送(服务器可直接访问外网 Webhook)
///
Direct = 1,
///
/// Outbox 中转(跨网场景:内网写发件箱,跳板机 AlertBridge 拉取后在外网推送)
///
Outbox = 2
}
///
/// 跨网发件箱状态
///
public enum OutboxStatusEnum
{
///
/// 待推送
///
Pending = 1,
///
/// 已拉取(跳板机取走,等待回写结果)
///
Pulled = 2,
///
/// 推送成功
///
Success = 3,
///
/// 推送失败
///
Failed = 4
}
///
/// 告警级别枚举 ↔ 规则引擎字符串 映射工具
///
public static class AlertLevelMap
{
///
/// 字符串(信息/警告/紧急)→ 枚举,无法识别时默认 Info
///
public static AlertLevelEnum FromString(string level)
{
return level?.Trim() switch
{
"警告" => AlertLevelEnum.Warning,
"紧急" => AlertLevelEnum.Urgent,
_ => AlertLevelEnum.Info
};
}
///
/// 枚举 → 字符串(信息/警告/紧急)
///
public static string ToLabel(AlertLevelEnum level)
{
return level switch
{
AlertLevelEnum.Warning => "警告",
AlertLevelEnum.Urgent => "紧急",
_ => "信息"
};
}
}
}