实现任务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

@@ -145,6 +145,340 @@ const docTemplate = `{
}
}
},
"/api/v1/alarm/threshold/area": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "为指定的区域主控创建一个新的阈值告警规则",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "创建区域阈值告警",
"parameters": [
{
"description": "创建区域阈值告警请求体",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CreateAreaThresholdAlarmDTO"
}
}
],
"responses": {
"200": {
"description": "成功创建区域阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/alarm/threshold/area/{task_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID获取单个区域阈值告警规则的详细信息",
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "获取区域阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "成功获取区域阈值告警",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.AreaThresholdAlarmDTO"
}
}
}
]
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID更新已存在的区域阈值告警规则",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "更新区域阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
},
{
"description": "更新区域阈值告警请求体",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UpdateAreaThresholdAlarmDTO"
}
}
],
"responses": {
"200": {
"description": "成功更新区域阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID删除区域阈值告警规则",
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "删除区域阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "成功删除区域阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/alarm/threshold/device": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "为单个设备创建一条新的阈值告警规则",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "创建设备阈值告警",
"parameters": [
{
"description": "创建设备阈值告警请求体",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CreateDeviceThresholdAlarmDTO"
}
}
],
"responses": {
"200": {
"description": "成功创建设备阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/alarm/threshold/device/{task_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID获取单个设备阈值告警规则的详细信息",
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "获取设备阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "成功获取设备阈值告警",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.DeviceThresholdAlarmDTO"
}
}
}
]
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID更新已存在的设备阈值告警规则",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "更新设备阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
},
{
"description": "更新设备阈值告警请求体",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UpdateDeviceThresholdAlarmDTO"
}
}
],
"responses": {
"200": {
"description": "成功更新设备阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID删除设备阈值告警规则",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "删除设备阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
},
{
"description": "删除设备阈值告警请求体",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.DeleteDeviceThresholdAlarmDTO"
}
}
],
"responses": {
"200": {
"description": "成功删除设备阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/alarm/threshold/historical-alarms": {
"get": {
"security": [
@@ -4577,6 +4911,29 @@ const docTemplate = `{
}
}
},
"dto.AreaThresholdAlarmDTO": {
"type": "object",
"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"
}
}
},
"dto.AssignEmptyPensToBatchRequest": {
"type": "object",
"required": [
@@ -4664,6 +5021,49 @@ const docTemplate = `{
}
}
},
"dto.CreateAreaThresholdAlarmDTO": {
"type": "object",
"required": [
"area_controller_id",
"operator",
"sensor_type",
"thresholds"
],
"properties": {
"area_controller_id": {
"description": "区域主控ID",
"type": "integer"
},
"level": {
"description": "告警等级,可选",
"allOf": [
{
"$ref": "#/definitions/models.SeverityLevel"
}
]
},
"operator": {
"description": "操作符",
"allOf": [
{
"$ref": "#/definitions/models.Operator"
}
]
},
"sensor_type": {
"description": "传感器类型",
"allOf": [
{
"$ref": "#/definitions/models.SensorType"
}
]
},
"thresholds": {
"description": "阈值",
"type": "number"
}
}
},
"dto.CreateDeviceRequest": {
"type": "object",
"required": [
@@ -4722,6 +5122,49 @@ const docTemplate = `{
}
}
},
"dto.CreateDeviceThresholdAlarmDTO": {
"type": "object",
"required": [
"device_id",
"operator",
"sensor_type",
"thresholds"
],
"properties": {
"device_id": {
"description": "设备ID",
"type": "integer"
},
"level": {
"description": "告警等级,可选,如果未提供则使用默认值",
"allOf": [
{
"$ref": "#/definitions/models.SeverityLevel"
}
]
},
"operator": {
"description": "操作符 (使用string类型与前端交互更通用)",
"allOf": [
{
"$ref": "#/definitions/models.Operator"
}
]
},
"sensor_type": {
"description": "传感器类型",
"allOf": [
{
"$ref": "#/definitions/models.SensorType"
}
]
},
"thresholds": {
"description": "阈值",
"type": "number"
}
}
},
"dto.CreatePenRequest": {
"type": "object",
"required": [
@@ -4831,6 +5274,22 @@ const docTemplate = `{
}
}
},
"dto.DeleteDeviceThresholdAlarmDTO": {
"type": "object",
"required": [
"sensor_type"
],
"properties": {
"sensor_type": {
"description": "传感器类型",
"allOf": [
{
"$ref": "#/definitions/models.SensorType"
}
]
}
}
},
"dto.DeviceCommandLogDTO": {
"type": "object",
"properties": {
@@ -4923,6 +5382,29 @@ const docTemplate = `{
}
}
},
"dto.DeviceThresholdAlarmDTO": {
"type": "object",
"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"
}
}
},
"dto.FeedFormulaDTO": {
"type": "object",
"properties": {
@@ -6592,6 +7074,35 @@ const docTemplate = `{
}
}
},
"dto.UpdateAreaThresholdAlarmDTO": {
"type": "object",
"required": [
"operator",
"thresholds"
],
"properties": {
"level": {
"description": "新的告警等级,可选",
"allOf": [
{
"$ref": "#/definitions/models.SeverityLevel"
}
]
},
"operator": {
"description": "新的操作符",
"allOf": [
{
"$ref": "#/definitions/models.Operator"
}
]
},
"thresholds": {
"description": "新的阈值",
"type": "number"
}
}
},
"dto.UpdateDeviceRequest": {
"type": "object",
"required": [
@@ -6650,6 +7161,35 @@ const docTemplate = `{
}
}
},
"dto.UpdateDeviceThresholdAlarmDTO": {
"type": "object",
"required": [
"operator",
"thresholds"
],
"properties": {
"level": {
"description": "新的告警等级,可选",
"allOf": [
{
"$ref": "#/definitions/models.SeverityLevel"
}
]
},
"operator": {
"description": "新的操作符",
"allOf": [
{
"$ref": "#/definitions/models.Operator"
}
]
},
"thresholds": {
"description": "新的阈值",
"type": "number"
}
}
},
"dto.UpdatePenRequest": {
"type": "object",
"required": [
@@ -7027,6 +7567,25 @@ const docTemplate = `{
"NotifierTypeLog"
]
},
"models.Operator": {
"type": "string",
"enum": [
"\u003c",
"\u003c=",
"\u003e",
"\u003e=",
"=",
"!="
],
"x-enum-varnames": [
"OperatorLessThan",
"OperatorLessThanOrEqualTo",
"OperatorGreaterThan",
"OperatorGreaterThanOrEqualTo",
"OperatorEqualTo",
"OperatorNotEqualTo"
]
},
"models.PenStatus": {
"type": "string",
"enum": [
@@ -7357,11 +7916,15 @@ const docTemplate = `{
"等待",
"下料",
"全量采集",
"告警通知"
"告警通知",
"设备阈值检查",
"区域阈值检查"
],
"x-enum-comments": {
"TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务",
"TaskTypeAlarmNotification": "告警通知任务",
"TaskTypeAreaCollectorThresholdCheck": "区域阈值检查任务",
"TaskTypeDeviceThresholdCheck": "设备阈值检查任务",
"TaskTypeFullCollection": "新增的全量采集任务",
"TaskTypeReleaseFeedWeight": "下料口释放指定重量任务",
"TaskTypeWaiting": "等待任务"
@@ -7371,14 +7934,18 @@ const docTemplate = `{
"等待任务",
"下料口释放指定重量任务",
"新增的全量采集任务",
"告警通知任务"
"告警通知任务",
"设备阈值检查任务",
"区域阈值检查任务"
],
"x-enum-varnames": [
"TaskPlanAnalysis",
"TaskTypeWaiting",
"TaskTypeReleaseFeedWeight",
"TaskTypeFullCollection",
"TaskTypeAlarmNotification"
"TaskTypeAlarmNotification",
"TaskTypeDeviceThresholdCheck",
"TaskTypeAreaCollectorThresholdCheck"
]
},
"models.ValueDescriptor": {

View File

@@ -137,6 +137,340 @@
}
}
},
"/api/v1/alarm/threshold/area": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "为指定的区域主控创建一个新的阈值告警规则",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "创建区域阈值告警",
"parameters": [
{
"description": "创建区域阈值告警请求体",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CreateAreaThresholdAlarmDTO"
}
}
],
"responses": {
"200": {
"description": "成功创建区域阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/alarm/threshold/area/{task_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID获取单个区域阈值告警规则的详细信息",
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "获取区域阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "成功获取区域阈值告警",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.AreaThresholdAlarmDTO"
}
}
}
]
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID更新已存在的区域阈值告警规则",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "更新区域阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
},
{
"description": "更新区域阈值告警请求体",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UpdateAreaThresholdAlarmDTO"
}
}
],
"responses": {
"200": {
"description": "成功更新区域阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID删除区域阈值告警规则",
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "删除区域阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "成功删除区域阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/alarm/threshold/device": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "为单个设备创建一条新的阈值告警规则",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "创建设备阈值告警",
"parameters": [
{
"description": "创建设备阈值告警请求体",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CreateDeviceThresholdAlarmDTO"
}
}
],
"responses": {
"200": {
"description": "成功创建设备阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/alarm/threshold/device/{task_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID获取单个设备阈值告警规则的详细信息",
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "获取设备阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "成功获取设备阈值告警",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.DeviceThresholdAlarmDTO"
}
}
}
]
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID更新已存在的设备阈值告警规则",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "更新设备阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
},
{
"description": "更新设备阈值告警请求体",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.UpdateDeviceThresholdAlarmDTO"
}
}
],
"responses": {
"200": {
"description": "成功更新设备阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据任务ID删除设备阈值告警规则",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "删除设备阈值告警",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "task_id",
"in": "path",
"required": true
},
{
"description": "删除设备阈值告警请求体",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.DeleteDeviceThresholdAlarmDTO"
}
}
],
"responses": {
"200": {
"description": "成功删除设备阈值告警",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/alarm/threshold/historical-alarms": {
"get": {
"security": [
@@ -4569,6 +4903,29 @@
}
}
},
"dto.AreaThresholdAlarmDTO": {
"type": "object",
"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"
}
}
},
"dto.AssignEmptyPensToBatchRequest": {
"type": "object",
"required": [
@@ -4656,6 +5013,49 @@
}
}
},
"dto.CreateAreaThresholdAlarmDTO": {
"type": "object",
"required": [
"area_controller_id",
"operator",
"sensor_type",
"thresholds"
],
"properties": {
"area_controller_id": {
"description": "区域主控ID",
"type": "integer"
},
"level": {
"description": "告警等级,可选",
"allOf": [
{
"$ref": "#/definitions/models.SeverityLevel"
}
]
},
"operator": {
"description": "操作符",
"allOf": [
{
"$ref": "#/definitions/models.Operator"
}
]
},
"sensor_type": {
"description": "传感器类型",
"allOf": [
{
"$ref": "#/definitions/models.SensorType"
}
]
},
"thresholds": {
"description": "阈值",
"type": "number"
}
}
},
"dto.CreateDeviceRequest": {
"type": "object",
"required": [
@@ -4714,6 +5114,49 @@
}
}
},
"dto.CreateDeviceThresholdAlarmDTO": {
"type": "object",
"required": [
"device_id",
"operator",
"sensor_type",
"thresholds"
],
"properties": {
"device_id": {
"description": "设备ID",
"type": "integer"
},
"level": {
"description": "告警等级,可选,如果未提供则使用默认值",
"allOf": [
{
"$ref": "#/definitions/models.SeverityLevel"
}
]
},
"operator": {
"description": "操作符 (使用string类型与前端交互更通用)",
"allOf": [
{
"$ref": "#/definitions/models.Operator"
}
]
},
"sensor_type": {
"description": "传感器类型",
"allOf": [
{
"$ref": "#/definitions/models.SensorType"
}
]
},
"thresholds": {
"description": "阈值",
"type": "number"
}
}
},
"dto.CreatePenRequest": {
"type": "object",
"required": [
@@ -4823,6 +5266,22 @@
}
}
},
"dto.DeleteDeviceThresholdAlarmDTO": {
"type": "object",
"required": [
"sensor_type"
],
"properties": {
"sensor_type": {
"description": "传感器类型",
"allOf": [
{
"$ref": "#/definitions/models.SensorType"
}
]
}
}
},
"dto.DeviceCommandLogDTO": {
"type": "object",
"properties": {
@@ -4915,6 +5374,29 @@
}
}
},
"dto.DeviceThresholdAlarmDTO": {
"type": "object",
"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"
}
}
},
"dto.FeedFormulaDTO": {
"type": "object",
"properties": {
@@ -6584,6 +7066,35 @@
}
}
},
"dto.UpdateAreaThresholdAlarmDTO": {
"type": "object",
"required": [
"operator",
"thresholds"
],
"properties": {
"level": {
"description": "新的告警等级,可选",
"allOf": [
{
"$ref": "#/definitions/models.SeverityLevel"
}
]
},
"operator": {
"description": "新的操作符",
"allOf": [
{
"$ref": "#/definitions/models.Operator"
}
]
},
"thresholds": {
"description": "新的阈值",
"type": "number"
}
}
},
"dto.UpdateDeviceRequest": {
"type": "object",
"required": [
@@ -6642,6 +7153,35 @@
}
}
},
"dto.UpdateDeviceThresholdAlarmDTO": {
"type": "object",
"required": [
"operator",
"thresholds"
],
"properties": {
"level": {
"description": "新的告警等级,可选",
"allOf": [
{
"$ref": "#/definitions/models.SeverityLevel"
}
]
},
"operator": {
"description": "新的操作符",
"allOf": [
{
"$ref": "#/definitions/models.Operator"
}
]
},
"thresholds": {
"description": "新的阈值",
"type": "number"
}
}
},
"dto.UpdatePenRequest": {
"type": "object",
"required": [
@@ -7019,6 +7559,25 @@
"NotifierTypeLog"
]
},
"models.Operator": {
"type": "string",
"enum": [
"\u003c",
"\u003c=",
"\u003e",
"\u003e=",
"=",
"!="
],
"x-enum-varnames": [
"OperatorLessThan",
"OperatorLessThanOrEqualTo",
"OperatorGreaterThan",
"OperatorGreaterThanOrEqualTo",
"OperatorEqualTo",
"OperatorNotEqualTo"
]
},
"models.PenStatus": {
"type": "string",
"enum": [
@@ -7349,11 +7908,15 @@
"等待",
"下料",
"全量采集",
"告警通知"
"告警通知",
"设备阈值检查",
"区域阈值检查"
],
"x-enum-comments": {
"TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务",
"TaskTypeAlarmNotification": "告警通知任务",
"TaskTypeAreaCollectorThresholdCheck": "区域阈值检查任务",
"TaskTypeDeviceThresholdCheck": "设备阈值检查任务",
"TaskTypeFullCollection": "新增的全量采集任务",
"TaskTypeReleaseFeedWeight": "下料口释放指定重量任务",
"TaskTypeWaiting": "等待任务"
@@ -7363,14 +7926,18 @@
"等待任务",
"下料口释放指定重量任务",
"新增的全量采集任务",
"告警通知任务"
"告警通知任务",
"设备阈值检查任务",
"区域阈值检查任务"
],
"x-enum-varnames": [
"TaskPlanAnalysis",
"TaskTypeWaiting",
"TaskTypeReleaseFeedWeight",
"TaskTypeFullCollection",
"TaskTypeAlarmNotification"
"TaskTypeAlarmNotification",
"TaskTypeDeviceThresholdCheck",
"TaskTypeAreaCollectorThresholdCheck"
]
},
"models.ValueDescriptor": {

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: