实现任务11应的八个web接口

This commit is contained in:
2025-11-10 19:18:49 +08:00
parent cb075c907d
commit 2cc4135b28
6 changed files with 1784 additions and 7 deletions

View File

@@ -102,6 +102,21 @@ definitions:
updated_at:
type: string
type: object
dto.AreaThresholdAlarmDTO:
properties:
area_controller_id:
type: integer
id:
type: integer
level:
$ref: '#/definitions/models.SeverityLevel'
operator:
$ref: '#/definitions/models.Operator'
sensor_type:
$ref: '#/definitions/models.SensorType'
thresholds:
type: number
type: object
dto.AssignEmptyPensToBatchRequest:
properties:
pen_ids:
@@ -166,6 +181,32 @@ definitions:
- name
- network_id
type: object
dto.CreateAreaThresholdAlarmDTO:
properties:
area_controller_id:
description: 区域主控ID
type: integer
level:
allOf:
- $ref: '#/definitions/models.SeverityLevel'
description: 告警等级,可选
operator:
allOf:
- $ref: '#/definitions/models.Operator'
description: 操作符
sensor_type:
allOf:
- $ref: '#/definitions/models.SensorType'
description: 传感器类型
thresholds:
description: 阈值
type: number
required:
- area_controller_id
- operator
- sensor_type
- thresholds
type: object
dto.CreateDeviceRequest:
properties:
area_controller_id:
@@ -206,6 +247,32 @@ definitions:
- commands
- name
type: object
dto.CreateDeviceThresholdAlarmDTO:
properties:
device_id:
description: 设备ID
type: integer
level:
allOf:
- $ref: '#/definitions/models.SeverityLevel'
description: 告警等级,可选,如果未提供则使用默认值
operator:
allOf:
- $ref: '#/definitions/models.Operator'
description: 操作符 (使用string类型与前端交互更通用)
sensor_type:
allOf:
- $ref: '#/definitions/models.SensorType'
description: 传感器类型
thresholds:
description: 阈值
type: number
required:
- device_id
- operator
- sensor_type
- thresholds
type: object
dto.CreatePenRequest:
properties:
capacity:
@@ -280,6 +347,15 @@ definitions:
example: newuser
type: string
type: object
dto.DeleteDeviceThresholdAlarmDTO:
properties:
sensor_type:
allOf:
- $ref: '#/definitions/models.SensorType'
description: 传感器类型
required:
- sensor_type
type: object
dto.DeviceCommandLogDTO:
properties:
acknowledged_at:
@@ -341,6 +417,21 @@ definitions:
$ref: '#/definitions/models.ValueDescriptor'
type: array
type: object
dto.DeviceThresholdAlarmDTO:
properties:
device_id:
type: integer
id:
type: integer
level:
$ref: '#/definitions/models.SeverityLevel'
operator:
$ref: '#/definitions/models.Operator'
sensor_type:
$ref: '#/definitions/models.SensorType'
thresholds:
type: number
type: object
dto.FeedFormulaDTO:
properties:
id:
@@ -1454,6 +1545,23 @@ definitions:
- name
- network_id
type: object
dto.UpdateAreaThresholdAlarmDTO:
properties:
level:
allOf:
- $ref: '#/definitions/models.SeverityLevel'
description: 新的告警等级,可选
operator:
allOf:
- $ref: '#/definitions/models.Operator'
description: 新的操作符
thresholds:
description: 新的阈值
type: number
required:
- operator
- thresholds
type: object
dto.UpdateDeviceRequest:
properties:
area_controller_id:
@@ -1494,6 +1602,23 @@ definitions:
- commands
- name
type: object
dto.UpdateDeviceThresholdAlarmDTO:
properties:
level:
allOf:
- $ref: '#/definitions/models.SeverityLevel'
description: 新的告警等级,可选
operator:
allOf:
- $ref: '#/definitions/models.Operator'
description: 新的操作符
thresholds:
description: 新的阈值
type: number
required:
- operator
- thresholds
type: object
dto.UpdatePenRequest:
properties:
capacity:
@@ -1767,6 +1892,22 @@ definitions:
- NotifierTypeWeChat
- NotifierTypeLark
- NotifierTypeLog
models.Operator:
enum:
- <
- <=
- '>'
- '>='
- =
- '!='
type: string
x-enum-varnames:
- OperatorLessThan
- OperatorLessThanOrEqualTo
- OperatorGreaterThan
- OperatorGreaterThanOrEqualTo
- OperatorEqualTo
- OperatorNotEqualTo
models.PenStatus:
enum:
- 空闲
@@ -2039,10 +2180,14 @@ definitions:
- 下料
- 全量采集
- 告警通知
- 设备阈值检查
- 区域阈值检查
type: string
x-enum-comments:
TaskPlanAnalysis: 解析Plan的Task列表并添加到待执行队列的特殊任务
TaskTypeAlarmNotification: 告警通知任务
TaskTypeAreaCollectorThresholdCheck: 区域阈值检查任务
TaskTypeDeviceThresholdCheck: 设备阈值检查任务
TaskTypeFullCollection: 新增的全量采集任务
TaskTypeReleaseFeedWeight: 下料口释放指定重量任务
TaskTypeWaiting: 等待任务
@@ -2052,12 +2197,16 @@ definitions:
- 下料口释放指定重量任务
- 新增的全量采集任务
- 告警通知任务
- 设备阈值检查任务
- 区域阈值检查任务
x-enum-varnames:
- TaskPlanAnalysis
- TaskTypeWaiting
- TaskTypeReleaseFeedWeight
- TaskTypeFullCollection
- TaskTypeAlarmNotification
- TaskTypeDeviceThresholdCheck
- TaskTypeAreaCollectorThresholdCheck
models.ValueDescriptor:
properties:
multiplier:
@@ -2251,6 +2400,210 @@ paths:
summary: 批量查询活跃告警
tags:
- 告警管理
/api/v1/alarm/threshold/area:
post:
consumes:
- application/json
description: 为指定的区域主控创建一个新的阈值告警规则
parameters:
- description: 创建区域阈值告警请求体
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.CreateAreaThresholdAlarmDTO'
produces:
- application/json
responses:
"200":
description: 成功创建区域阈值告警
schema:
$ref: '#/definitions/controller.Response'
security:
- BearerAuth: []
summary: 创建区域阈值告警
tags:
- 告警管理
/api/v1/alarm/threshold/area/{task_id}:
delete:
description: 根据任务ID删除区域阈值告警规则
parameters:
- description: 任务ID
in: path
name: task_id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 成功删除区域阈值告警
schema:
$ref: '#/definitions/controller.Response'
security:
- BearerAuth: []
summary: 删除区域阈值告警
tags:
- 告警管理
get:
description: 根据任务ID获取单个区域阈值告警规则的详细信息
parameters:
- description: 任务ID
in: path
name: task_id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 成功获取区域阈值告警
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/dto.AreaThresholdAlarmDTO'
type: object
security:
- BearerAuth: []
summary: 获取区域阈值告警
tags:
- 告警管理
put:
consumes:
- application/json
description: 根据任务ID更新已存在的区域阈值告警规则
parameters:
- description: 任务ID
in: path
name: task_id
required: true
type: integer
- description: 更新区域阈值告警请求体
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.UpdateAreaThresholdAlarmDTO'
produces:
- application/json
responses:
"200":
description: 成功更新区域阈值告警
schema:
$ref: '#/definitions/controller.Response'
security:
- BearerAuth: []
summary: 更新区域阈值告警
tags:
- 告警管理
/api/v1/alarm/threshold/device:
post:
consumes:
- application/json
description: 为单个设备创建一条新的阈值告警规则
parameters:
- description: 创建设备阈值告警请求体
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.CreateDeviceThresholdAlarmDTO'
produces:
- application/json
responses:
"200":
description: 成功创建设备阈值告警
schema:
$ref: '#/definitions/controller.Response'
security:
- BearerAuth: []
summary: 创建设备阈值告警
tags:
- 告警管理
/api/v1/alarm/threshold/device/{task_id}:
delete:
consumes:
- application/json
description: 根据任务ID删除设备阈值告警规则
parameters:
- description: 任务ID
in: path
name: task_id
required: true
type: integer
- description: 删除设备阈值告警请求体
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.DeleteDeviceThresholdAlarmDTO'
produces:
- application/json
responses:
"200":
description: 成功删除设备阈值告警
schema:
$ref: '#/definitions/controller.Response'
security:
- BearerAuth: []
summary: 删除设备阈值告警
tags:
- 告警管理
get:
description: 根据任务ID获取单个设备阈值告警规则的详细信息
parameters:
- description: 任务ID
in: path
name: task_id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 成功获取设备阈值告警
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/dto.DeviceThresholdAlarmDTO'
type: object
security:
- BearerAuth: []
summary: 获取设备阈值告警
tags:
- 告警管理
put:
consumes:
- application/json
description: 根据任务ID更新已存在的设备阈值告警规则
parameters:
- description: 任务ID
in: path
name: task_id
required: true
type: integer
- description: 更新设备阈值告警请求体
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.UpdateDeviceThresholdAlarmDTO'
produces:
- application/json
responses:
"200":
description: 成功更新设备阈值告警
schema:
$ref: '#/definitions/controller.Response'
security:
- BearerAuth: []
summary: 更新设备阈值告警
tags:
- 告警管理
/api/v1/alarm/threshold/historical-alarms:
get:
consumes: