实现列表查询活跃告警和历史告警
This commit is contained in:
@@ -53,6 +53,35 @@ definitions:
|
||||
- CodeConflict
|
||||
- CodeInternalError
|
||||
- CodeServiceUnavailable
|
||||
dto.ActiveAlarmDTO:
|
||||
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
|
||||
type: object
|
||||
dto.AreaControllerResponse:
|
||||
properties:
|
||||
created_at:
|
||||
@@ -340,6 +369,40 @@ definitions:
|
||||
remarks:
|
||||
type: string
|
||||
type: object
|
||||
dto.HistoricalAlarmDTO:
|
||||
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
|
||||
type: object
|
||||
dto.ListActiveAlarmResponse:
|
||||
properties:
|
||||
list:
|
||||
items:
|
||||
$ref: '#/definitions/dto.ActiveAlarmDTO'
|
||||
type: array
|
||||
pagination:
|
||||
$ref: '#/definitions/dto.PaginationDTO'
|
||||
type: object
|
||||
dto.ListDeviceCommandLogResponse:
|
||||
properties:
|
||||
list:
|
||||
@@ -358,6 +421,15 @@ definitions:
|
||||
pagination:
|
||||
$ref: '#/definitions/dto.PaginationDTO'
|
||||
type: object
|
||||
dto.ListHistoricalAlarmResponse:
|
||||
properties:
|
||||
list:
|
||||
items:
|
||||
$ref: '#/definitions/dto.HistoricalAlarmDTO'
|
||||
type: array
|
||||
pagination:
|
||||
$ref: '#/definitions/dto.PaginationDTO'
|
||||
type: object
|
||||
dto.ListMedicationLogResponse:
|
||||
properties:
|
||||
list:
|
||||
@@ -600,11 +672,11 @@ definitions:
|
||||
id:
|
||||
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'
|
||||
title:
|
||||
@@ -1199,7 +1271,7 @@ definitions:
|
||||
properties:
|
||||
type:
|
||||
allOf:
|
||||
- $ref: '#/definitions/notify.NotifierType'
|
||||
- $ref: '#/definitions/models.NotifierType'
|
||||
description: Type 指定要测试的通知渠道
|
||||
required:
|
||||
- type
|
||||
@@ -1219,6 +1291,15 @@ definitions:
|
||||
time:
|
||||
type: string
|
||||
type: object
|
||||
dto.SnoozeAlarmRequest:
|
||||
properties:
|
||||
duration_minutes:
|
||||
description: 忽略时长,单位分钟
|
||||
minimum: 1
|
||||
type: integer
|
||||
required:
|
||||
- duration_minutes
|
||||
type: object
|
||||
dto.SubPlanResponse:
|
||||
properties:
|
||||
child_plan:
|
||||
@@ -1558,6 +1639,34 @@ definitions:
|
||||
weight:
|
||||
type: number
|
||||
type: object
|
||||
models.AlarmCode:
|
||||
enum:
|
||||
- 温度阈值
|
||||
- 湿度阈值
|
||||
- 重量阈值
|
||||
- 电池电量阈值
|
||||
- 信号强度阈值
|
||||
- 设备离线
|
||||
- 区域主控离线
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- AlarmCodeTemperature
|
||||
- AlarmCodeHumidity
|
||||
- AlarmCodeWeight
|
||||
- AlarmCodeBatteryLevel
|
||||
- AlarmCodeSignalMetrics
|
||||
- AlarmCodeDeviceOffline
|
||||
- AlarmCodeAreaControllerOffline
|
||||
models.AlarmSourceType:
|
||||
enum:
|
||||
- 普通设备
|
||||
- 区域主控
|
||||
- 系统
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- AlarmSourceTypeDevice
|
||||
- AlarmSourceTypeAreaController
|
||||
- AlarmSourceTypeSystem
|
||||
models.AuditStatus:
|
||||
enum:
|
||||
- 成功
|
||||
@@ -1646,6 +1755,18 @@ definitions:
|
||||
- NotificationStatusSuccess
|
||||
- NotificationStatusFailed
|
||||
- NotificationStatusSkipped
|
||||
models.NotifierType:
|
||||
enum:
|
||||
- 邮件
|
||||
- 企业微信
|
||||
- 飞书
|
||||
- 日志
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- NotifierTypeSMTP
|
||||
- NotifierTypeWeChat
|
||||
- NotifierTypeLark
|
||||
- NotifierTypeLog
|
||||
models.PenStatus:
|
||||
enum:
|
||||
- 空闲
|
||||
@@ -1877,6 +1998,24 @@ definitions:
|
||||
- SensorTypeTemperature
|
||||
- SensorTypeHumidity
|
||||
- SensorTypeWeight
|
||||
models.SeverityLevel:
|
||||
enum:
|
||||
- Debug
|
||||
- Info
|
||||
- Warn
|
||||
- Error
|
||||
- DPanic
|
||||
- Panic
|
||||
- Fatal
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- DebugLevel
|
||||
- InfoLevel
|
||||
- WarnLevel
|
||||
- ErrorLevel
|
||||
- DPanicLevel
|
||||
- PanicLevel
|
||||
- FatalLevel
|
||||
models.StockLogSourceType:
|
||||
enum:
|
||||
- 采购入库
|
||||
@@ -1899,9 +2038,11 @@ definitions:
|
||||
- 等待
|
||||
- 下料
|
||||
- 全量采集
|
||||
- 告警通知
|
||||
type: string
|
||||
x-enum-comments:
|
||||
TaskPlanAnalysis: 解析Plan的Task列表并添加到待执行队列的特殊任务
|
||||
TaskTypeAlarmNotification: 告警通知任务
|
||||
TaskTypeFullCollection: 新增的全量采集任务
|
||||
TaskTypeReleaseFeedWeight: 下料口释放指定重量任务
|
||||
TaskTypeWaiting: 等待任务
|
||||
@@ -1910,11 +2051,13 @@ definitions:
|
||||
- 等待任务
|
||||
- 下料口释放指定重量任务
|
||||
- 新增的全量采集任务
|
||||
- 告警通知任务
|
||||
x-enum-varnames:
|
||||
- TaskPlanAnalysis
|
||||
- TaskTypeWaiting
|
||||
- TaskTypeReleaseFeedWeight
|
||||
- TaskTypeFullCollection
|
||||
- TaskTypeAlarmNotification
|
||||
models.ValueDescriptor:
|
||||
properties:
|
||||
multiplier:
|
||||
@@ -1926,18 +2069,6 @@ definitions:
|
||||
type:
|
||||
$ref: '#/definitions/models.SensorType'
|
||||
type: object
|
||||
notify.NotifierType:
|
||||
enum:
|
||||
- 邮件
|
||||
- 企业微信
|
||||
- 飞书
|
||||
- 日志
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- NotifierTypeSMTP
|
||||
- NotifierTypeWeChat
|
||||
- NotifierTypeLark
|
||||
- NotifierTypeLog
|
||||
repository.PlanTypeFilter:
|
||||
enum:
|
||||
- 所有任务
|
||||
@@ -1987,6 +2118,224 @@ info:
|
||||
title: 猪场管理系统 API
|
||||
version: "1.0"
|
||||
paths:
|
||||
/api/v1/alarm/threshold/{id}/cancel-snooze:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 根据告警ID取消对一个阈值告警的忽略状态
|
||||
parameters:
|
||||
- description: 告警ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 成功取消忽略告警
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 取消忽略阈值告警
|
||||
tags:
|
||||
- 告警管理
|
||||
/api/v1/alarm/threshold/{id}/snooze:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 根据告警ID忽略一个活跃的阈值告警,或更新其忽略时间
|
||||
parameters:
|
||||
- description: 告警ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: 忽略告警请求体
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.SnoozeAlarmRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 成功忽略告警
|
||||
schema:
|
||||
$ref: '#/definitions/controller.Response'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 忽略阈值告警
|
||||
tags:
|
||||
- 告警管理
|
||||
/api/v1/alarm/threshold/active-alarms:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 根据过滤条件和分页参数查询活跃告警列表
|
||||
parameters:
|
||||
- description: 告警触发时间范围 - 结束时间
|
||||
in: query
|
||||
name: end_time
|
||||
type: string
|
||||
- description: 按是否被忽略过滤
|
||||
in: query
|
||||
name: is_ignored
|
||||
type: boolean
|
||||
- description: 按告警严重性等级过滤
|
||||
enum:
|
||||
- Debug
|
||||
- Info
|
||||
- Warn
|
||||
- Error
|
||||
- DPanic
|
||||
- Panic
|
||||
- Fatal
|
||||
in: query
|
||||
name: level
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- DebugLevel
|
||||
- InfoLevel
|
||||
- WarnLevel
|
||||
- ErrorLevel
|
||||
- DPanicLevel
|
||||
- PanicLevel
|
||||
- FatalLevel
|
||||
- description: 排序字段,例如 "trigger_time DESC"
|
||||
in: query
|
||||
name: order_by
|
||||
type: string
|
||||
- in: query
|
||||
name: page
|
||||
type: integer
|
||||
- in: query
|
||||
name: page_size
|
||||
type: integer
|
||||
- description: 按告警来源ID过滤
|
||||
in: query
|
||||
name: source_id
|
||||
type: integer
|
||||
- description: 按告警来源类型过滤
|
||||
enum:
|
||||
- 普通设备
|
||||
- 区域主控
|
||||
- 系统
|
||||
in: query
|
||||
name: source_type
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- AlarmSourceTypeDevice
|
||||
- AlarmSourceTypeAreaController
|
||||
- AlarmSourceTypeSystem
|
||||
- description: 告警触发时间范围 - 开始时间
|
||||
in: query
|
||||
name: trigger_time
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 成功获取活跃告警列表
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/controller.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/dto.ListActiveAlarmResponse'
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 批量查询活跃告警
|
||||
tags:
|
||||
- 告警管理
|
||||
/api/v1/alarm/threshold/historical-alarms:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 根据过滤条件和分页参数查询历史告警列表
|
||||
parameters:
|
||||
- description: 按告警严重性等级过滤
|
||||
enum:
|
||||
- Debug
|
||||
- Info
|
||||
- Warn
|
||||
- Error
|
||||
- DPanic
|
||||
- Panic
|
||||
- Fatal
|
||||
in: query
|
||||
name: level
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- DebugLevel
|
||||
- InfoLevel
|
||||
- WarnLevel
|
||||
- ErrorLevel
|
||||
- DPanicLevel
|
||||
- PanicLevel
|
||||
- FatalLevel
|
||||
- description: 排序字段,例如 "trigger_time DESC"
|
||||
in: query
|
||||
name: order_by
|
||||
type: string
|
||||
- in: query
|
||||
name: page
|
||||
type: integer
|
||||
- in: query
|
||||
name: page_size
|
||||
type: integer
|
||||
- description: 告警解决时间范围 - 结束时间
|
||||
in: query
|
||||
name: resolve_time_end
|
||||
type: string
|
||||
- description: 告警解决时间范围 - 开始时间
|
||||
in: query
|
||||
name: resolve_time_start
|
||||
type: string
|
||||
- description: 按告警来源ID过滤
|
||||
in: query
|
||||
name: source_id
|
||||
type: integer
|
||||
- description: 按告警来源类型过滤
|
||||
enum:
|
||||
- 普通设备
|
||||
- 区域主控
|
||||
- 系统
|
||||
in: query
|
||||
name: source_type
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- AlarmSourceTypeDevice
|
||||
- AlarmSourceTypeAreaController
|
||||
- AlarmSourceTypeSystem
|
||||
- description: 告警触发时间范围 - 结束时间
|
||||
in: query
|
||||
name: trigger_time_end
|
||||
type: string
|
||||
- description: 告警触发时间范围 - 开始时间
|
||||
in: query
|
||||
name: trigger_time_start
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 成功获取历史告警列表
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/controller.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/dto.ListHistoricalAlarmResponse'
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 批量查询历史告警
|
||||
tags:
|
||||
- 告警管理
|
||||
/api/v1/area-controllers:
|
||||
get:
|
||||
description: 获取系统中所有区域主控的列表
|
||||
|
||||
Reference in New Issue
Block a user