实现列表查询活跃告警和历史告警
This commit is contained in:
557
docs/docs.go
557
docs/docs.go
@@ -23,6 +23,339 @@ const docTemplate = `{
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/api/v1/alarm/threshold/active-alarms": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据过滤条件和分页参数查询活跃告警列表",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"告警管理"
|
||||
],
|
||||
"summary": "批量查询活跃告警",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "告警触发时间范围 - 结束时间",
|
||||
"name": "end_time",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"description": "按是否被忽略过滤",
|
||||
"name": "is_ignored",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"Debug",
|
||||
"Info",
|
||||
"Warn",
|
||||
"Error",
|
||||
"DPanic",
|
||||
"Panic",
|
||||
"Fatal"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-varnames": [
|
||||
"DebugLevel",
|
||||
"InfoLevel",
|
||||
"WarnLevel",
|
||||
"ErrorLevel",
|
||||
"DPanicLevel",
|
||||
"PanicLevel",
|
||||
"FatalLevel"
|
||||
],
|
||||
"description": "按告警严重性等级过滤",
|
||||
"name": "level",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "排序字段,例如 \"trigger_time DESC\"",
|
||||
"name": "order_by",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "page_size",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "按告警来源ID过滤",
|
||||
"name": "source_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"普通设备",
|
||||
"区域主控",
|
||||
"系统"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-varnames": [
|
||||
"AlarmSourceTypeDevice",
|
||||
"AlarmSourceTypeAreaController",
|
||||
"AlarmSourceTypeSystem"
|
||||
],
|
||||
"description": "按告警来源类型过滤",
|
||||
"name": "source_type",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "告警触发时间范围 - 开始时间",
|
||||
"name": "trigger_time",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功获取活跃告警列表",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/dto.ListActiveAlarmResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/alarm/threshold/historical-alarms": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据过滤条件和分页参数查询历史告警列表",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"告警管理"
|
||||
],
|
||||
"summary": "批量查询历史告警",
|
||||
"parameters": [
|
||||
{
|
||||
"enum": [
|
||||
"Debug",
|
||||
"Info",
|
||||
"Warn",
|
||||
"Error",
|
||||
"DPanic",
|
||||
"Panic",
|
||||
"Fatal"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-varnames": [
|
||||
"DebugLevel",
|
||||
"InfoLevel",
|
||||
"WarnLevel",
|
||||
"ErrorLevel",
|
||||
"DPanicLevel",
|
||||
"PanicLevel",
|
||||
"FatalLevel"
|
||||
],
|
||||
"description": "按告警严重性等级过滤",
|
||||
"name": "level",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "排序字段,例如 \"trigger_time DESC\"",
|
||||
"name": "order_by",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "page_size",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "告警解决时间范围 - 结束时间",
|
||||
"name": "resolve_time_end",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "告警解决时间范围 - 开始时间",
|
||||
"name": "resolve_time_start",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "按告警来源ID过滤",
|
||||
"name": "source_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"普通设备",
|
||||
"区域主控",
|
||||
"系统"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-varnames": [
|
||||
"AlarmSourceTypeDevice",
|
||||
"AlarmSourceTypeAreaController",
|
||||
"AlarmSourceTypeSystem"
|
||||
],
|
||||
"description": "按告警来源类型过滤",
|
||||
"name": "source_type",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "告警触发时间范围 - 结束时间",
|
||||
"name": "trigger_time_end",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "告警触发时间范围 - 开始时间",
|
||||
"name": "trigger_time_start",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功获取历史告警列表",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/dto.ListHistoricalAlarmResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/alarm/threshold/{id}/cancel-snooze": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据告警ID取消对一个阈值告警的忽略状态",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"告警管理"
|
||||
],
|
||||
"summary": "取消忽略阈值告警",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "告警ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功取消忽略告警",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/alarm/threshold/{id}/snooze": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据告警ID忽略一个活跃的阈值告警,或更新其忽略时间",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"告警管理"
|
||||
],
|
||||
"summary": "忽略阈值告警",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "告警ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "忽略告警请求体",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.SnoozeAlarmRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功忽略告警",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/area-controllers": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -4170,6 +4503,50 @@ const docTemplate = `{
|
||||
"CodeServiceUnavailable"
|
||||
]
|
||||
},
|
||||
"dto.ActiveAlarmDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alarm_code": {
|
||||
"$ref": "#/definitions/models.AlarmCode"
|
||||
},
|
||||
"alarm_details": {
|
||||
"type": "string"
|
||||
},
|
||||
"alarm_summary": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"ignored_until": {
|
||||
"type": "string"
|
||||
},
|
||||
"is_ignored": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"last_notified_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"level": {
|
||||
"$ref": "#/definitions/models.SeverityLevel"
|
||||
},
|
||||
"source_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"source_type": {
|
||||
"$ref": "#/definitions/models.AlarmSourceType"
|
||||
},
|
||||
"trigger_time": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.AreaControllerResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4589,6 +4966,58 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.HistoricalAlarmDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alarm_code": {
|
||||
"$ref": "#/definitions/models.AlarmCode"
|
||||
},
|
||||
"alarm_details": {
|
||||
"type": "string"
|
||||
},
|
||||
"alarm_summary": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"level": {
|
||||
"$ref": "#/definitions/models.SeverityLevel"
|
||||
},
|
||||
"resolve_method": {
|
||||
"type": "string"
|
||||
},
|
||||
"resolve_time": {
|
||||
"type": "string"
|
||||
},
|
||||
"resolved_by": {
|
||||
"type": "integer"
|
||||
},
|
||||
"source_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"source_type": {
|
||||
"$ref": "#/definitions/models.AlarmSourceType"
|
||||
},
|
||||
"trigger_time": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ListActiveAlarmResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.ActiveAlarmDTO"
|
||||
}
|
||||
},
|
||||
"pagination": {
|
||||
"$ref": "#/definitions/dto.PaginationDTO"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ListDeviceCommandLogResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4617,6 +5046,20 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ListHistoricalAlarmResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.HistoricalAlarmDTO"
|
||||
}
|
||||
},
|
||||
"pagination": {
|
||||
"$ref": "#/definitions/dto.PaginationDTO"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ListMedicationLogResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -4984,13 +5427,13 @@ const docTemplate = `{
|
||||
"type": "integer"
|
||||
},
|
||||
"level": {
|
||||
"$ref": "#/definitions/zapcore.Level"
|
||||
"$ref": "#/definitions/models.SeverityLevel"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"notifier_type": {
|
||||
"$ref": "#/definitions/notify.NotifierType"
|
||||
"$ref": "#/definitions/models.NotifierType"
|
||||
},
|
||||
"status": {
|
||||
"$ref": "#/definitions/models.NotificationStatus"
|
||||
@@ -5882,7 +6325,7 @@ const docTemplate = `{
|
||||
"description": "Type 指定要测试的通知渠道",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/notify.NotifierType"
|
||||
"$ref": "#/definitions/models.NotifierType"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5911,6 +6354,19 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.SnoozeAlarmRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"duration_minutes"
|
||||
],
|
||||
"properties": {
|
||||
"duration_minutes": {
|
||||
"description": "忽略时长,单位分钟",
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.SubPlanResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -6412,6 +6868,40 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.AlarmCode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"温度阈值",
|
||||
"湿度阈值",
|
||||
"重量阈值",
|
||||
"电池电量阈值",
|
||||
"信号强度阈值",
|
||||
"设备离线",
|
||||
"区域主控离线"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"AlarmCodeTemperature",
|
||||
"AlarmCodeHumidity",
|
||||
"AlarmCodeWeight",
|
||||
"AlarmCodeBatteryLevel",
|
||||
"AlarmCodeSignalMetrics",
|
||||
"AlarmCodeDeviceOffline",
|
||||
"AlarmCodeAreaControllerOffline"
|
||||
]
|
||||
},
|
||||
"models.AlarmSourceType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"普通设备",
|
||||
"区域主控",
|
||||
"系统"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"AlarmSourceTypeDevice",
|
||||
"AlarmSourceTypeAreaController",
|
||||
"AlarmSourceTypeSystem"
|
||||
]
|
||||
},
|
||||
"models.AuditStatus": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -6522,6 +7012,21 @@ const docTemplate = `{
|
||||
"NotificationStatusSkipped"
|
||||
]
|
||||
},
|
||||
"models.NotifierType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"邮件",
|
||||
"企业微信",
|
||||
"飞书",
|
||||
"日志"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"NotifierTypeSMTP",
|
||||
"NotifierTypeWeChat",
|
||||
"NotifierTypeLark",
|
||||
"NotifierTypeLog"
|
||||
]
|
||||
},
|
||||
"models.PenStatus": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -6805,6 +7310,27 @@ const docTemplate = `{
|
||||
"SensorTypeWeight"
|
||||
]
|
||||
},
|
||||
"models.SeverityLevel": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Debug",
|
||||
"Info",
|
||||
"Warn",
|
||||
"Error",
|
||||
"DPanic",
|
||||
"Panic",
|
||||
"Fatal"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"DebugLevel",
|
||||
"InfoLevel",
|
||||
"WarnLevel",
|
||||
"ErrorLevel",
|
||||
"DPanicLevel",
|
||||
"PanicLevel",
|
||||
"FatalLevel"
|
||||
]
|
||||
},
|
||||
"models.StockLogSourceType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -6830,10 +7356,12 @@ const docTemplate = `{
|
||||
"计划分析",
|
||||
"等待",
|
||||
"下料",
|
||||
"全量采集"
|
||||
"全量采集",
|
||||
"告警通知"
|
||||
],
|
||||
"x-enum-comments": {
|
||||
"TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务",
|
||||
"TaskTypeAlarmNotification": "告警通知任务",
|
||||
"TaskTypeFullCollection": "新增的全量采集任务",
|
||||
"TaskTypeReleaseFeedWeight": "下料口释放指定重量任务",
|
||||
"TaskTypeWaiting": "等待任务"
|
||||
@@ -6842,13 +7370,15 @@ const docTemplate = `{
|
||||
"解析Plan的Task列表并添加到待执行队列的特殊任务",
|
||||
"等待任务",
|
||||
"下料口释放指定重量任务",
|
||||
"新增的全量采集任务"
|
||||
"新增的全量采集任务",
|
||||
"告警通知任务"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"TaskPlanAnalysis",
|
||||
"TaskTypeWaiting",
|
||||
"TaskTypeReleaseFeedWeight",
|
||||
"TaskTypeFullCollection"
|
||||
"TaskTypeFullCollection",
|
||||
"TaskTypeAlarmNotification"
|
||||
]
|
||||
},
|
||||
"models.ValueDescriptor": {
|
||||
@@ -6867,21 +7397,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"notify.NotifierType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"邮件",
|
||||
"企业微信",
|
||||
"飞书",
|
||||
"日志"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"NotifierTypeSMTP",
|
||||
"NotifierTypeWeChat",
|
||||
"NotifierTypeLark",
|
||||
"NotifierTypeLog"
|
||||
]
|
||||
},
|
||||
"repository.PlanTypeFilter": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
|
||||
Reference in New Issue
Block a user