定义控制器和注册路由(服务层和领域层没实现)

This commit is contained in:
2025-12-05 16:08:06 +08:00
parent 7017ffa128
commit 2bb187071f
9 changed files with 805 additions and 38 deletions

View File

@@ -994,6 +994,31 @@ definitions:
$ref: '#/definitions/dto.NutrientRawMaterialDTO'
type: array
type: object
dto.OtaUpgradeProgressResponse:
properties:
current_stage:
allOf:
- $ref: '#/definitions/models.OTATaskStatus'
description: 当前阶段
executed_num:
description: 已执行步骤数
type: integer
message:
description: 状态消息
type: string
task_id:
description: OTA 升级任务ID
type: integer
total_num:
description: 总步骤数
type: integer
type: object
dto.OtaUpgradeResponse:
properties:
task_id:
description: OTA 升级任务ID
type: integer
type: object
dto.PaginationDTO:
properties:
page:
@@ -2288,9 +2313,11 @@ definitions:
type: object
models.AIModel:
enum:
- None
- Gemini
type: string
x-enum-varnames:
- AI_MODEL_NONE
- AI_MODEL_GEMINI
models.AlarmCode:
enum:
@@ -2420,6 +2447,48 @@ definitions:
- NotifierTypeWeChat
- NotifierTypeLark
- NotifierTypeLog
models.OTATaskStatus:
enum:
- 待开始
- 进行中
- 成功
- 版本已是最新
- 预检失败
- 下载或校验失败
- 固件回滚
- 超时
- 平台内部错误
type: string
x-enum-comments:
OTATaskStatusAlreadyUpToDate: 设备报告版本已是最新,未执行升级
OTATaskStatusFailedDownload: 设备报告文件下载或校验失败 (包括清单文件和固件文件)
OTATaskStatusFailedPreCheck: 设备报告升级前检查失败 (如拒绝降级、准备分区失败)
OTATaskStatusFailedRollback: 新固件启动失败,设备自动回滚
OTATaskStatusInProgress: 任务已下发,设备正在处理
OTATaskStatusPending: 任务已创建,等待下发
OTATaskStatusPlatformError: 平台处理过程中发生的非设备报告错误
OTATaskStatusSuccess: 设备报告升级成功,新固件已运行
OTATaskStatusTimedOut: 平台在超时后仍未收到最终报告
x-enum-descriptions:
- 任务已创建,等待下发
- 任务已下发,设备正在处理
- 设备报告升级成功,新固件已运行
- 设备报告版本已是最新,未执行升级
- 设备报告升级前检查失败 (如拒绝降级、准备分区失败)
- 设备报告文件下载或校验失败 (包括清单文件和固件文件)
- 新固件启动失败,设备自动回滚
- 平台在超时后仍未收到最终报告
- 平台处理过程中发生的非设备报告错误
x-enum-varnames:
- OTATaskStatusPending
- OTATaskStatusInProgress
- OTATaskStatusSuccess
- OTATaskStatusAlreadyUpToDate
- OTATaskStatusFailedPreCheck
- OTATaskStatusFailedDownload
- OTATaskStatusFailedRollback
- OTATaskStatusTimedOut
- OTATaskStatusPlatformError
models.Operator:
enum:
- <
@@ -2724,6 +2793,7 @@ definitions:
- 通知刷新
- 设备阈值检查
- 区域阈值检查
- OTA升级检查任务
type: string
x-enum-comments:
TaskPlanAnalysis: 解析Plan的Task列表并添加到待执行队列的特殊任务
@@ -2733,6 +2803,7 @@ definitions:
TaskTypeFullCollection: 新增的全量采集任务
TaskTypeHeartbeat: 区域主控心跳检测任务
TaskTypeNotificationRefresh: 通知刷新任务
TaskTypeOTACheck: OTA升级超时检查任务
TaskTypeReleaseFeedWeight: 下料口释放指定重量任务
TaskTypeWaiting: 等待任务
x-enum-descriptions:
@@ -2745,6 +2816,7 @@ definitions:
- 通知刷新任务
- 设备阈值检查任务
- 区域阈值检查任务
- OTA升级超时检查任务
x-enum-varnames:
- TaskPlanAnalysis
- TaskTypeWaiting
@@ -2755,6 +2827,7 @@ definitions:
- TaskTypeNotificationRefresh
- TaskTypeDeviceThresholdCheck
- TaskTypeAreaCollectorThresholdCheck
- TaskTypeOTACheck
models.ValueDescriptor:
properties:
multiplier:
@@ -2778,6 +2851,7 @@ definitions:
- PlanTypeFilterSystem
zapcore.Level:
enum:
- 7
- -1
- 0
- 1
@@ -2788,10 +2862,10 @@ definitions:
- -1
- 5
- 6
- 7
format: int32
type: integer
x-enum-varnames:
- _numLevels
- DebugLevel
- InfoLevel
- WarnLevel
@@ -2802,7 +2876,6 @@ definitions:
- _minLevel
- _maxLevel
- InvalidLevel
- _numLevels
info:
contact:
email: divano@example.com
@@ -3542,6 +3615,86 @@ paths:
summary: 更新区域主控信息
tags:
- 区域主控管理
/api/v1/area-controllers/{id}/ota/start:
post:
consumes:
- multipart/form-data
description: 为指定的区域主控上传固件并启动一个OTA升级任务
parameters:
- description: 区域主控ID
in: path
name: id
required: true
type: string
- description: 固件压缩包文件
in: formData
name: firmware_file
required: true
type: file
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/dto.OtaUpgradeResponse'
type: object
security:
- BearerAuth: []
summary: 启动区域主控OTA升级
tags:
- 区域主控管理
/api/v1/area-controllers/ota/progress/{taskId}:
get:
description: 根据任务ID查询指定OTA升级任务的当前进度
parameters:
- description: OTA任务ID
in: path
name: taskId
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/dto.OtaUpgradeProgressResponse'
type: object
security:
- BearerAuth: []
summary: 查询OTA升级进度
tags:
- 区域主控管理
/api/v1/area-controllers/ota/tasks/{taskId}/stop:
post:
description: 根据任务ID请求停止一个正在进行的OTA升级任务
parameters:
- description: OTA任务ID
in: path
name: taskId
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controller.Response'
security:
- BearerAuth: []
summary: 停止OTA升级任务
tags:
- 区域主控管理
/api/v1/device-templates:
get:
description: 获取系统中所有设备模板的列表
@@ -5101,6 +5254,7 @@ paths:
name: end_time
type: string
- enum:
- 7
- -1
- 0
- 1
@@ -5111,12 +5265,12 @@ paths:
- -1
- 5
- 6
- 7
format: int32
in: query
name: level
type: integer
x-enum-varnames:
- _numLevels
- DebugLevel
- InfoLevel
- WarnLevel
@@ -5127,7 +5281,6 @@ paths:
- _minLevel
- _maxLevel
- InvalidLevel
- _numLevels
- enum:
- 邮件
- 企业微信