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