计划监控增加计划名
This commit is contained in:
		
							
								
								
									
										102
									
								
								docs/docs.go
									
									
									
									
									
								
							
							
						
						
									
										102
									
								
								docs/docs.go
									
									
									
									
									
								
							| @@ -998,7 +998,6 @@ const docTemplate = `{ | ||||
|                     }, | ||||
|                     { | ||||
|                         "enum": [ | ||||
|                             7, | ||||
|                             -1, | ||||
|                             0, | ||||
|                             1, | ||||
| @@ -1008,12 +1007,12 @@ const docTemplate = `{ | ||||
|                             5, | ||||
|                             -1, | ||||
|                             5, | ||||
|                             6 | ||||
|                             6, | ||||
|                             7 | ||||
|                         ], | ||||
|                         "type": "integer", | ||||
|                         "format": "int32", | ||||
|                         "x-enum-varnames": [ | ||||
|                             "_numLevels", | ||||
|                             "DebugLevel", | ||||
|                             "InfoLevel", | ||||
|                             "WarnLevel", | ||||
| @@ -1023,7 +1022,8 @@ const docTemplate = `{ | ||||
|                             "FatalLevel", | ||||
|                             "_minLevel", | ||||
|                             "_maxLevel", | ||||
|                             "InvalidLevel" | ||||
|                             "InvalidLevel", | ||||
|                             "_numLevels" | ||||
|                         ], | ||||
|                         "name": "level", | ||||
|                         "in": "query" | ||||
| @@ -3600,7 +3600,7 @@ const docTemplate = `{ | ||||
|                         "BearerAuth": [] | ||||
|                     } | ||||
|                 ], | ||||
|                 "description": "获取所有计划的列表", | ||||
|                 "description": "获取所有计划的列表,支持按类型过滤和分页", | ||||
|                 "produces": [ | ||||
|                     "application/json" | ||||
|                 ], | ||||
| @@ -3608,6 +3608,26 @@ const docTemplate = `{ | ||||
|                     "计划管理" | ||||
|                 ], | ||||
|                 "summary": "获取计划列表", | ||||
|                 "parameters": [ | ||||
|                     { | ||||
|                         "type": "integer", | ||||
|                         "description": "页码", | ||||
|                         "name": "page", | ||||
|                         "in": "query" | ||||
|                     }, | ||||
|                     { | ||||
|                         "type": "integer", | ||||
|                         "description": "每页大小", | ||||
|                         "name": "pageSize", | ||||
|                         "in": "query" | ||||
|                     }, | ||||
|                     { | ||||
|                         "type": "string", | ||||
|                         "description": "计划类型 (all, custom, system),默认为 custom", | ||||
|                         "name": "planType", | ||||
|                         "in": "query" | ||||
|                     } | ||||
|                 ], | ||||
|                 "responses": { | ||||
|                     "200": { | ||||
|                         "description": "业务码为200代表成功获取列表", | ||||
| @@ -3620,10 +3640,7 @@ const docTemplate = `{ | ||||
|                                     "type": "object", | ||||
|                                     "properties": { | ||||
|                                         "data": { | ||||
|                                             "type": "array", | ||||
|                                             "items": { | ||||
|                                                 "$ref": "#/definitions/dto.PlanResponse" | ||||
|                                             } | ||||
|                                             "$ref": "#/definitions/dto.ListPlansResponse" | ||||
|                                         } | ||||
|                                     } | ||||
|                                 } | ||||
| @@ -3733,7 +3750,7 @@ const docTemplate = `{ | ||||
|                         "BearerAuth": [] | ||||
|                     } | ||||
|                 ], | ||||
|                 "description": "根据计划ID更新计划的详细信息。", | ||||
|                 "description": "根据计划ID更新计划的详细信息。系统计划不允许修改。", | ||||
|                 "consumes": [ | ||||
|                     "application/json" | ||||
|                 ], | ||||
| @@ -3789,7 +3806,7 @@ const docTemplate = `{ | ||||
|                         "BearerAuth": [] | ||||
|                     } | ||||
|                 ], | ||||
|                 "description": "根据计划ID删除计划。(软删除)", | ||||
|                 "description": "根据计划ID删除计划。(软删除)系统计划不允许删除。", | ||||
|                 "produces": [ | ||||
|                     "application/json" | ||||
|                 ], | ||||
| @@ -3823,7 +3840,7 @@ const docTemplate = `{ | ||||
|                         "BearerAuth": [] | ||||
|                     } | ||||
|                 ], | ||||
|                 "description": "根据计划ID启动一个计划的执行。", | ||||
|                 "description": "根据计划ID启动一个计划的执行。系统计划不允许手动启动。", | ||||
|                 "produces": [ | ||||
|                     "application/json" | ||||
|                 ], | ||||
| @@ -3857,7 +3874,7 @@ const docTemplate = `{ | ||||
|                         "BearerAuth": [] | ||||
|                     } | ||||
|                 ], | ||||
|                 "description": "根据计划ID停止一个正在执行的计划。", | ||||
|                 "description": "根据计划ID停止一个正在执行的计划。系统计划不能被停止。", | ||||
|                 "produces": [ | ||||
|                     "application/json" | ||||
|                 ], | ||||
| @@ -4154,6 +4171,7 @@ const docTemplate = `{ | ||||
|                 2001, | ||||
|                 4000, | ||||
|                 4001, | ||||
|                 4003, | ||||
|                 4004, | ||||
|                 4009, | ||||
|                 5000, | ||||
| @@ -4163,6 +4181,7 @@ const docTemplate = `{ | ||||
|                 "CodeBadRequest": "请求参数错误", | ||||
|                 "CodeConflict": "资源冲突", | ||||
|                 "CodeCreated": "创建成功", | ||||
|                 "CodeForbidden": "禁止访问", | ||||
|                 "CodeInternalError": "服务器内部错误", | ||||
|                 "CodeNotFound": "资源未找到", | ||||
|                 "CodeServiceUnavailable": "服务不可用", | ||||
| @@ -4174,6 +4193,7 @@ const docTemplate = `{ | ||||
|                 "创建成功", | ||||
|                 "请求参数错误", | ||||
|                 "未授权", | ||||
|                 "禁止访问", | ||||
|                 "资源未找到", | ||||
|                 "资源冲突", | ||||
|                 "服务器内部错误", | ||||
| @@ -4184,6 +4204,7 @@ const docTemplate = `{ | ||||
|                 "CodeCreated", | ||||
|                 "CodeBadRequest", | ||||
|                 "CodeUnauthorized", | ||||
|                 "CodeForbidden", | ||||
|                 "CodeNotFound", | ||||
|                 "CodeConflict", | ||||
|                 "CodeInternalError", | ||||
| @@ -4744,6 +4765,21 @@ const docTemplate = `{ | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         "dto.ListPlansResponse": { | ||||
|             "type": "object", | ||||
|             "properties": { | ||||
|                 "plans": { | ||||
|                     "type": "array", | ||||
|                     "items": { | ||||
|                         "$ref": "#/definitions/dto.PlanResponse" | ||||
|                     } | ||||
|                 }, | ||||
|                 "total": { | ||||
|                     "type": "integer", | ||||
|                     "example": 100 | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         "dto.ListRawMaterialPurchaseResponse": { | ||||
|             "type": "object", | ||||
|             "properties": { | ||||
| @@ -5439,6 +5475,9 @@ const docTemplate = `{ | ||||
|                 "plan_id": { | ||||
|                     "type": "integer" | ||||
|                 }, | ||||
|                 "plan_name": { | ||||
|                     "type": "string" | ||||
|                 }, | ||||
|                 "started_at": { | ||||
|                     "type": "string" | ||||
|                 }, | ||||
| @@ -5493,6 +5532,14 @@ const docTemplate = `{ | ||||
|                     "type": "string", | ||||
|                     "example": "猪舍温度控制计划" | ||||
|                 }, | ||||
|                 "plan_type": { | ||||
|                     "allOf": [ | ||||
|                         { | ||||
|                             "$ref": "#/definitions/models.PlanType" | ||||
|                         } | ||||
|                     ], | ||||
|                     "example": "自定义任务" | ||||
|                 }, | ||||
|                 "status": { | ||||
|                     "allOf": [ | ||||
|                         { | ||||
| @@ -6737,6 +6784,17 @@ const docTemplate = `{ | ||||
|                 "PlanStatusFailed" | ||||
|             ] | ||||
|         }, | ||||
|         "models.PlanType": { | ||||
|             "type": "string", | ||||
|             "enum": [ | ||||
|                 "自定义任务", | ||||
|                 "系统任务" | ||||
|             ], | ||||
|             "x-enum-varnames": [ | ||||
|                 "PlanTypeCustom", | ||||
|                 "PlanTypeSystem" | ||||
|             ] | ||||
|         }, | ||||
|         "models.SensorType": { | ||||
|             "type": "string", | ||||
|             "enum": [ | ||||
| @@ -6792,22 +6850,26 @@ const docTemplate = `{ | ||||
|             "enum": [ | ||||
|                 "计划分析", | ||||
|                 "等待", | ||||
|                 "下料" | ||||
|                 "下料", | ||||
|                 "全量采集" | ||||
|             ], | ||||
|             "x-enum-comments": { | ||||
|                 "TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务", | ||||
|                 "TaskTypeFullCollection": "新增的全量采集任务", | ||||
|                 "TaskTypeReleaseFeedWeight": "下料口释放指定重量任务", | ||||
|                 "TaskTypeWaiting": "等待任务" | ||||
|             }, | ||||
|             "x-enum-descriptions": [ | ||||
|                 "解析Plan的Task列表并添加到待执行队列的特殊任务", | ||||
|                 "等待任务", | ||||
|                 "下料口释放指定重量任务" | ||||
|                 "下料口释放指定重量任务", | ||||
|                 "新增的全量采集任务" | ||||
|             ], | ||||
|             "x-enum-varnames": [ | ||||
|                 "TaskPlanAnalysis", | ||||
|                 "TaskTypeWaiting", | ||||
|                 "TaskTypeReleaseFeedWeight" | ||||
|                 "TaskTypeReleaseFeedWeight", | ||||
|                 "TaskTypeFullCollection" | ||||
|             ] | ||||
|         }, | ||||
|         "models.ValueDescriptor": { | ||||
| @@ -6845,7 +6907,6 @@ const docTemplate = `{ | ||||
|             "type": "integer", | ||||
|             "format": "int32", | ||||
|             "enum": [ | ||||
|                 7, | ||||
|                 -1, | ||||
|                 0, | ||||
|                 1, | ||||
| @@ -6855,10 +6916,10 @@ const docTemplate = `{ | ||||
|                 5, | ||||
|                 -1, | ||||
|                 5, | ||||
|                 6 | ||||
|                 6, | ||||
|                 7 | ||||
|             ], | ||||
|             "x-enum-varnames": [ | ||||
|                 "_numLevels", | ||||
|                 "DebugLevel", | ||||
|                 "InfoLevel", | ||||
|                 "WarnLevel", | ||||
| @@ -6868,7 +6929,8 @@ const docTemplate = `{ | ||||
|                 "FatalLevel", | ||||
|                 "_minLevel", | ||||
|                 "_maxLevel", | ||||
|                 "InvalidLevel" | ||||
|                 "InvalidLevel", | ||||
|                 "_numLevels" | ||||
|             ] | ||||
|         } | ||||
|     }, | ||||
|   | ||||
| @@ -990,7 +990,6 @@ | ||||
|                     }, | ||||
|                     { | ||||
|                         "enum": [ | ||||
|                             7, | ||||
|                             -1, | ||||
|                             0, | ||||
|                             1, | ||||
| @@ -1000,12 +999,12 @@ | ||||
|                             5, | ||||
|                             -1, | ||||
|                             5, | ||||
|                             6 | ||||
|                             6, | ||||
|                             7 | ||||
|                         ], | ||||
|                         "type": "integer", | ||||
|                         "format": "int32", | ||||
|                         "x-enum-varnames": [ | ||||
|                             "_numLevels", | ||||
|                             "DebugLevel", | ||||
|                             "InfoLevel", | ||||
|                             "WarnLevel", | ||||
| @@ -1015,7 +1014,8 @@ | ||||
|                             "FatalLevel", | ||||
|                             "_minLevel", | ||||
|                             "_maxLevel", | ||||
|                             "InvalidLevel" | ||||
|                             "InvalidLevel", | ||||
|                             "_numLevels" | ||||
|                         ], | ||||
|                         "name": "level", | ||||
|                         "in": "query" | ||||
| @@ -3592,7 +3592,7 @@ | ||||
|                         "BearerAuth": [] | ||||
|                     } | ||||
|                 ], | ||||
|                 "description": "获取所有计划的列表", | ||||
|                 "description": "获取所有计划的列表,支持按类型过滤和分页", | ||||
|                 "produces": [ | ||||
|                     "application/json" | ||||
|                 ], | ||||
| @@ -3600,6 +3600,26 @@ | ||||
|                     "计划管理" | ||||
|                 ], | ||||
|                 "summary": "获取计划列表", | ||||
|                 "parameters": [ | ||||
|                     { | ||||
|                         "type": "integer", | ||||
|                         "description": "页码", | ||||
|                         "name": "page", | ||||
|                         "in": "query" | ||||
|                     }, | ||||
|                     { | ||||
|                         "type": "integer", | ||||
|                         "description": "每页大小", | ||||
|                         "name": "pageSize", | ||||
|                         "in": "query" | ||||
|                     }, | ||||
|                     { | ||||
|                         "type": "string", | ||||
|                         "description": "计划类型 (all, custom, system),默认为 custom", | ||||
|                         "name": "planType", | ||||
|                         "in": "query" | ||||
|                     } | ||||
|                 ], | ||||
|                 "responses": { | ||||
|                     "200": { | ||||
|                         "description": "业务码为200代表成功获取列表", | ||||
| @@ -3612,10 +3632,7 @@ | ||||
|                                     "type": "object", | ||||
|                                     "properties": { | ||||
|                                         "data": { | ||||
|                                             "type": "array", | ||||
|                                             "items": { | ||||
|                                                 "$ref": "#/definitions/dto.PlanResponse" | ||||
|                                             } | ||||
|                                             "$ref": "#/definitions/dto.ListPlansResponse" | ||||
|                                         } | ||||
|                                     } | ||||
|                                 } | ||||
| @@ -3725,7 +3742,7 @@ | ||||
|                         "BearerAuth": [] | ||||
|                     } | ||||
|                 ], | ||||
|                 "description": "根据计划ID更新计划的详细信息。", | ||||
|                 "description": "根据计划ID更新计划的详细信息。系统计划不允许修改。", | ||||
|                 "consumes": [ | ||||
|                     "application/json" | ||||
|                 ], | ||||
| @@ -3781,7 +3798,7 @@ | ||||
|                         "BearerAuth": [] | ||||
|                     } | ||||
|                 ], | ||||
|                 "description": "根据计划ID删除计划。(软删除)", | ||||
|                 "description": "根据计划ID删除计划。(软删除)系统计划不允许删除。", | ||||
|                 "produces": [ | ||||
|                     "application/json" | ||||
|                 ], | ||||
| @@ -3815,7 +3832,7 @@ | ||||
|                         "BearerAuth": [] | ||||
|                     } | ||||
|                 ], | ||||
|                 "description": "根据计划ID启动一个计划的执行。", | ||||
|                 "description": "根据计划ID启动一个计划的执行。系统计划不允许手动启动。", | ||||
|                 "produces": [ | ||||
|                     "application/json" | ||||
|                 ], | ||||
| @@ -3849,7 +3866,7 @@ | ||||
|                         "BearerAuth": [] | ||||
|                     } | ||||
|                 ], | ||||
|                 "description": "根据计划ID停止一个正在执行的计划。", | ||||
|                 "description": "根据计划ID停止一个正在执行的计划。系统计划不能被停止。", | ||||
|                 "produces": [ | ||||
|                     "application/json" | ||||
|                 ], | ||||
| @@ -4146,6 +4163,7 @@ | ||||
|                 2001, | ||||
|                 4000, | ||||
|                 4001, | ||||
|                 4003, | ||||
|                 4004, | ||||
|                 4009, | ||||
|                 5000, | ||||
| @@ -4155,6 +4173,7 @@ | ||||
|                 "CodeBadRequest": "请求参数错误", | ||||
|                 "CodeConflict": "资源冲突", | ||||
|                 "CodeCreated": "创建成功", | ||||
|                 "CodeForbidden": "禁止访问", | ||||
|                 "CodeInternalError": "服务器内部错误", | ||||
|                 "CodeNotFound": "资源未找到", | ||||
|                 "CodeServiceUnavailable": "服务不可用", | ||||
| @@ -4166,6 +4185,7 @@ | ||||
|                 "创建成功", | ||||
|                 "请求参数错误", | ||||
|                 "未授权", | ||||
|                 "禁止访问", | ||||
|                 "资源未找到", | ||||
|                 "资源冲突", | ||||
|                 "服务器内部错误", | ||||
| @@ -4176,6 +4196,7 @@ | ||||
|                 "CodeCreated", | ||||
|                 "CodeBadRequest", | ||||
|                 "CodeUnauthorized", | ||||
|                 "CodeForbidden", | ||||
|                 "CodeNotFound", | ||||
|                 "CodeConflict", | ||||
|                 "CodeInternalError", | ||||
| @@ -4736,6 +4757,21 @@ | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         "dto.ListPlansResponse": { | ||||
|             "type": "object", | ||||
|             "properties": { | ||||
|                 "plans": { | ||||
|                     "type": "array", | ||||
|                     "items": { | ||||
|                         "$ref": "#/definitions/dto.PlanResponse" | ||||
|                     } | ||||
|                 }, | ||||
|                 "total": { | ||||
|                     "type": "integer", | ||||
|                     "example": 100 | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         "dto.ListRawMaterialPurchaseResponse": { | ||||
|             "type": "object", | ||||
|             "properties": { | ||||
| @@ -5431,6 +5467,9 @@ | ||||
|                 "plan_id": { | ||||
|                     "type": "integer" | ||||
|                 }, | ||||
|                 "plan_name": { | ||||
|                     "type": "string" | ||||
|                 }, | ||||
|                 "started_at": { | ||||
|                     "type": "string" | ||||
|                 }, | ||||
| @@ -5485,6 +5524,14 @@ | ||||
|                     "type": "string", | ||||
|                     "example": "猪舍温度控制计划" | ||||
|                 }, | ||||
|                 "plan_type": { | ||||
|                     "allOf": [ | ||||
|                         { | ||||
|                             "$ref": "#/definitions/models.PlanType" | ||||
|                         } | ||||
|                     ], | ||||
|                     "example": "自定义任务" | ||||
|                 }, | ||||
|                 "status": { | ||||
|                     "allOf": [ | ||||
|                         { | ||||
| @@ -6729,6 +6776,17 @@ | ||||
|                 "PlanStatusFailed" | ||||
|             ] | ||||
|         }, | ||||
|         "models.PlanType": { | ||||
|             "type": "string", | ||||
|             "enum": [ | ||||
|                 "自定义任务", | ||||
|                 "系统任务" | ||||
|             ], | ||||
|             "x-enum-varnames": [ | ||||
|                 "PlanTypeCustom", | ||||
|                 "PlanTypeSystem" | ||||
|             ] | ||||
|         }, | ||||
|         "models.SensorType": { | ||||
|             "type": "string", | ||||
|             "enum": [ | ||||
| @@ -6784,22 +6842,26 @@ | ||||
|             "enum": [ | ||||
|                 "计划分析", | ||||
|                 "等待", | ||||
|                 "下料" | ||||
|                 "下料", | ||||
|                 "全量采集" | ||||
|             ], | ||||
|             "x-enum-comments": { | ||||
|                 "TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务", | ||||
|                 "TaskTypeFullCollection": "新增的全量采集任务", | ||||
|                 "TaskTypeReleaseFeedWeight": "下料口释放指定重量任务", | ||||
|                 "TaskTypeWaiting": "等待任务" | ||||
|             }, | ||||
|             "x-enum-descriptions": [ | ||||
|                 "解析Plan的Task列表并添加到待执行队列的特殊任务", | ||||
|                 "等待任务", | ||||
|                 "下料口释放指定重量任务" | ||||
|                 "下料口释放指定重量任务", | ||||
|                 "新增的全量采集任务" | ||||
|             ], | ||||
|             "x-enum-varnames": [ | ||||
|                 "TaskPlanAnalysis", | ||||
|                 "TaskTypeWaiting", | ||||
|                 "TaskTypeReleaseFeedWeight" | ||||
|                 "TaskTypeReleaseFeedWeight", | ||||
|                 "TaskTypeFullCollection" | ||||
|             ] | ||||
|         }, | ||||
|         "models.ValueDescriptor": { | ||||
| @@ -6837,7 +6899,6 @@ | ||||
|             "type": "integer", | ||||
|             "format": "int32", | ||||
|             "enum": [ | ||||
|                 7, | ||||
|                 -1, | ||||
|                 0, | ||||
|                 1, | ||||
| @@ -6847,10 +6908,10 @@ | ||||
|                 5, | ||||
|                 -1, | ||||
|                 5, | ||||
|                 6 | ||||
|                 6, | ||||
|                 7 | ||||
|             ], | ||||
|             "x-enum-varnames": [ | ||||
|                 "_numLevels", | ||||
|                 "DebugLevel", | ||||
|                 "InfoLevel", | ||||
|                 "WarnLevel", | ||||
| @@ -6860,7 +6921,8 @@ | ||||
|                 "FatalLevel", | ||||
|                 "_minLevel", | ||||
|                 "_maxLevel", | ||||
|                 "InvalidLevel" | ||||
|                 "InvalidLevel", | ||||
|                 "_numLevels" | ||||
|             ] | ||||
|         } | ||||
|     }, | ||||
|   | ||||
| @@ -17,6 +17,7 @@ definitions: | ||||
|     - 2001 | ||||
|     - 4000 | ||||
|     - 4001 | ||||
|     - 4003 | ||||
|     - 4004 | ||||
|     - 4009 | ||||
|     - 5000 | ||||
| @@ -26,6 +27,7 @@ definitions: | ||||
|       CodeBadRequest: 请求参数错误 | ||||
|       CodeConflict: 资源冲突 | ||||
|       CodeCreated: 创建成功 | ||||
|       CodeForbidden: 禁止访问 | ||||
|       CodeInternalError: 服务器内部错误 | ||||
|       CodeNotFound: 资源未找到 | ||||
|       CodeServiceUnavailable: 服务不可用 | ||||
| @@ -36,6 +38,7 @@ definitions: | ||||
|     - 创建成功 | ||||
|     - 请求参数错误 | ||||
|     - 未授权 | ||||
|     - 禁止访问 | ||||
|     - 资源未找到 | ||||
|     - 资源冲突 | ||||
|     - 服务器内部错误 | ||||
| @@ -45,6 +48,7 @@ definitions: | ||||
|     - CodeCreated | ||||
|     - CodeBadRequest | ||||
|     - CodeUnauthorized | ||||
|     - CodeForbidden | ||||
|     - CodeNotFound | ||||
|     - CodeConflict | ||||
|     - CodeInternalError | ||||
| @@ -421,6 +425,16 @@ definitions: | ||||
|       pagination: | ||||
|         $ref: '#/definitions/dto.PaginationDTO' | ||||
|     type: object | ||||
|   dto.ListPlansResponse: | ||||
|     properties: | ||||
|       plans: | ||||
|         items: | ||||
|           $ref: '#/definitions/dto.PlanResponse' | ||||
|         type: array | ||||
|       total: | ||||
|         example: 100 | ||||
|         type: integer | ||||
|     type: object | ||||
|   dto.ListRawMaterialPurchaseResponse: | ||||
|     properties: | ||||
|       list: | ||||
| @@ -879,6 +893,8 @@ definitions: | ||||
|         type: integer | ||||
|       plan_id: | ||||
|         type: integer | ||||
|       plan_name: | ||||
|         type: string | ||||
|       started_at: | ||||
|         type: string | ||||
|       status: | ||||
| @@ -914,6 +930,10 @@ definitions: | ||||
|       name: | ||||
|         example: 猪舍温度控制计划 | ||||
|         type: string | ||||
|       plan_type: | ||||
|         allOf: | ||||
|         - $ref: '#/definitions/models.PlanType' | ||||
|         example: 自定义任务 | ||||
|       status: | ||||
|         allOf: | ||||
|         - $ref: '#/definitions/models.PlanStatus' | ||||
| @@ -1808,6 +1828,14 @@ definitions: | ||||
|     - PlanStatusEnabled | ||||
|     - PlanStatusStopped | ||||
|     - PlanStatusFailed | ||||
|   models.PlanType: | ||||
|     enum: | ||||
|     - 自定义任务 | ||||
|     - 系统任务 | ||||
|     type: string | ||||
|     x-enum-varnames: | ||||
|     - PlanTypeCustom | ||||
|     - PlanTypeSystem | ||||
|   models.SensorType: | ||||
|     enum: | ||||
|     - 信号强度 | ||||
| @@ -1855,19 +1883,23 @@ definitions: | ||||
|     - 计划分析 | ||||
|     - 等待 | ||||
|     - 下料 | ||||
|     - 全量采集 | ||||
|     type: string | ||||
|     x-enum-comments: | ||||
|       TaskPlanAnalysis: 解析Plan的Task列表并添加到待执行队列的特殊任务 | ||||
|       TaskTypeFullCollection: 新增的全量采集任务 | ||||
|       TaskTypeReleaseFeedWeight: 下料口释放指定重量任务 | ||||
|       TaskTypeWaiting: 等待任务 | ||||
|     x-enum-descriptions: | ||||
|     - 解析Plan的Task列表并添加到待执行队列的特殊任务 | ||||
|     - 等待任务 | ||||
|     - 下料口释放指定重量任务 | ||||
|     - 新增的全量采集任务 | ||||
|     x-enum-varnames: | ||||
|     - TaskPlanAnalysis | ||||
|     - TaskTypeWaiting | ||||
|     - TaskTypeReleaseFeedWeight | ||||
|     - TaskTypeFullCollection | ||||
|   models.ValueDescriptor: | ||||
|     properties: | ||||
|       multiplier: | ||||
| @@ -1893,7 +1925,6 @@ definitions: | ||||
|     - NotifierTypeLog | ||||
|   zapcore.Level: | ||||
|     enum: | ||||
|     - 7 | ||||
|     - -1 | ||||
|     - 0 | ||||
|     - 1 | ||||
| @@ -1904,10 +1935,10 @@ definitions: | ||||
|     - -1 | ||||
|     - 5 | ||||
|     - 6 | ||||
|     - 7 | ||||
|     format: int32 | ||||
|     type: integer | ||||
|     x-enum-varnames: | ||||
|     - _numLevels | ||||
|     - DebugLevel | ||||
|     - InfoLevel | ||||
|     - WarnLevel | ||||
| @@ -1918,6 +1949,7 @@ definitions: | ||||
|     - _minLevel | ||||
|     - _maxLevel | ||||
|     - InvalidLevel | ||||
|     - _numLevels | ||||
| info: | ||||
|   contact: | ||||
|     email: divano@example.com | ||||
| @@ -2489,7 +2521,6 @@ paths: | ||||
|         name: end_time | ||||
|         type: string | ||||
|       - enum: | ||||
|         - 7 | ||||
|         - -1 | ||||
|         - 0 | ||||
|         - 1 | ||||
| @@ -2500,12 +2531,12 @@ paths: | ||||
|         - -1 | ||||
|         - 5 | ||||
|         - 6 | ||||
|         - 7 | ||||
|         format: int32 | ||||
|         in: query | ||||
|         name: level | ||||
|         type: integer | ||||
|         x-enum-varnames: | ||||
|         - _numLevels | ||||
|         - DebugLevel | ||||
|         - InfoLevel | ||||
|         - WarnLevel | ||||
| @@ -2516,6 +2547,7 @@ paths: | ||||
|         - _minLevel | ||||
|         - _maxLevel | ||||
|         - InvalidLevel | ||||
|         - _numLevels | ||||
|       - enum: | ||||
|         - 邮件 | ||||
|         - 企业微信 | ||||
| @@ -4038,7 +4070,20 @@ paths: | ||||
|       - 猪场管理 | ||||
|   /api/v1/plans: | ||||
|     get: | ||||
|       description: 获取所有计划的列表 | ||||
|       description: 获取所有计划的列表,支持按类型过滤和分页 | ||||
|       parameters: | ||||
|       - description: 页码 | ||||
|         in: query | ||||
|         name: page | ||||
|         type: integer | ||||
|       - description: 每页大小 | ||||
|         in: query | ||||
|         name: pageSize | ||||
|         type: integer | ||||
|       - description: 计划类型 (all, custom, system),默认为 custom | ||||
|         in: query | ||||
|         name: planType | ||||
|         type: string | ||||
|       produces: | ||||
|       - application/json | ||||
|       responses: | ||||
| @@ -4049,9 +4094,7 @@ paths: | ||||
|             - $ref: '#/definitions/controller.Response' | ||||
|             - properties: | ||||
|                 data: | ||||
|                   items: | ||||
|                     $ref: '#/definitions/dto.PlanResponse' | ||||
|                   type: array | ||||
|                   $ref: '#/definitions/dto.ListPlansResponse' | ||||
|               type: object | ||||
|       security: | ||||
|       - BearerAuth: [] | ||||
| @@ -4088,7 +4131,7 @@ paths: | ||||
|       - 计划管理 | ||||
|   /api/v1/plans/{id}: | ||||
|     delete: | ||||
|       description: 根据计划ID删除计划。(软删除) | ||||
|       description: 根据计划ID删除计划。(软删除)系统计划不允许删除。 | ||||
|       parameters: | ||||
|       - description: 计划ID | ||||
|         in: path | ||||
| @@ -4135,7 +4178,7 @@ paths: | ||||
|     put: | ||||
|       consumes: | ||||
|       - application/json | ||||
|       description: 根据计划ID更新计划的详细信息。 | ||||
|       description: 根据计划ID更新计划的详细信息。系统计划不允许修改。 | ||||
|       parameters: | ||||
|       - description: 计划ID | ||||
|         in: path | ||||
| @@ -4167,7 +4210,7 @@ paths: | ||||
|       - 计划管理 | ||||
|   /api/v1/plans/{id}/start: | ||||
|     post: | ||||
|       description: 根据计划ID启动一个计划的执行。 | ||||
|       description: 根据计划ID启动一个计划的执行。系统计划不允许手动启动。 | ||||
|       parameters: | ||||
|       - description: 计划ID | ||||
|         in: path | ||||
| @@ -4188,7 +4231,7 @@ paths: | ||||
|       - 计划管理 | ||||
|   /api/v1/plans/{id}/stop: | ||||
|     post: | ||||
|       description: 根据计划ID停止一个正在执行的计划。 | ||||
|       description: 根据计划ID停止一个正在执行的计划。系统计划不能被停止。 | ||||
|       parameters: | ||||
|       - description: 计划ID | ||||
|         in: path | ||||
|   | ||||
| @@ -149,7 +149,7 @@ func (c *Controller) ListPlanExecutionLogs(ctx *gin.Context) { | ||||
| 		opts.Status = &status | ||||
| 	} | ||||
|  | ||||
| 	data, total, err := c.monitorService.ListPlanExecutionLogs(opts, req.Page, req.PageSize) | ||||
| 	planLogs, plans, total, err := c.monitorService.ListPlanExecutionLogs(opts, req.Page, req.PageSize) | ||||
| 	if err != nil { | ||||
| 		if errors.Is(err, repository.ErrInvalidPagination) { | ||||
| 			c.logger.Warnf("%s: 无效的分页参数: %v", actionType, err) | ||||
| @@ -162,8 +162,8 @@ func (c *Controller) ListPlanExecutionLogs(ctx *gin.Context) { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	resp := dto.NewListPlanExecutionLogResponse(data, total, req.Page, req.PageSize) | ||||
| 	c.logger.Infof("%s: 成功, 获取到 %d 条记录, 总计 %d 条", actionType, len(data), total) | ||||
| 	resp := dto.NewListPlanExecutionLogResponse(planLogs, plans, total, req.Page, req.PageSize) | ||||
| 	c.logger.Infof("%s: 成功, 获取到 %d 条记录, 总计 %d 条", actionType, len(planLogs), total) | ||||
| 	controller.SendSuccessWithAudit(ctx, controller.CodeSuccess, "获取计划执行日志成功", resp, actionType, "获取计划执行日志成功", req) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -53,14 +53,20 @@ func NewListDeviceCommandLogResponse(data []models.DeviceCommandLog, total int64 | ||||
| } | ||||
|  | ||||
| // NewListPlanExecutionLogResponse 从模型数据创建列表响应 DTO | ||||
| func NewListPlanExecutionLogResponse(data []models.PlanExecutionLog, total int64, page, pageSize int) *ListPlanExecutionLogResponse { | ||||
| 	dtos := make([]PlanExecutionLogDTO, len(data)) | ||||
| 	for i, item := range data { | ||||
| func NewListPlanExecutionLogResponse(planLogs []models.PlanExecutionLog, plans []models.Plan, total int64, page, pageSize int) *ListPlanExecutionLogResponse { | ||||
| 	planId2Name := make(map[uint]string) | ||||
| 	for _, plan := range plans { | ||||
| 		planId2Name[plan.ID] = plan.Name | ||||
| 	} | ||||
|  | ||||
| 	dtos := make([]PlanExecutionLogDTO, len(planLogs)) | ||||
| 	for i, item := range planLogs { | ||||
| 		dtos[i] = PlanExecutionLogDTO{ | ||||
| 			ID:        item.ID, | ||||
| 			CreatedAt: item.CreatedAt, | ||||
| 			UpdatedAt: item.UpdatedAt, | ||||
| 			PlanID:    item.PlanID, | ||||
| 			PlanName:  planId2Name[item.PlanID], | ||||
| 			Status:    item.Status, | ||||
| 			StartedAt: item.StartedAt, | ||||
| 			EndedAt:   item.EndedAt, | ||||
|   | ||||
| @@ -91,6 +91,7 @@ type PlanExecutionLogDTO struct { | ||||
| 	CreatedAt time.Time              `json:"created_at"` | ||||
| 	UpdatedAt time.Time              `json:"updated_at"` | ||||
| 	PlanID    uint                   `json:"plan_id"` | ||||
| 	PlanName  string                 `json:"plan_name"` | ||||
| 	Status    models.ExecutionStatus `json:"status"` | ||||
| 	StartedAt time.Time              `json:"started_at"` | ||||
| 	EndedAt   time.Time              `json:"ended_at"` | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import ( | ||||
| type MonitorService interface { | ||||
| 	ListSensorData(opts repository.SensorDataListOptions, page, pageSize int) ([]models.SensorData, int64, error) | ||||
| 	ListDeviceCommandLogs(opts repository.DeviceCommandLogListOptions, page, pageSize int) ([]models.DeviceCommandLog, int64, error) | ||||
| 	ListPlanExecutionLogs(opts repository.PlanExecutionLogListOptions, page, pageSize int) ([]models.PlanExecutionLog, int64, error) | ||||
| 	ListPlanExecutionLogs(opts repository.PlanExecutionLogListOptions, page, pageSize int) ([]models.PlanExecutionLog, []models.Plan, int64, error) | ||||
| 	ListTaskExecutionLogs(opts repository.TaskExecutionLogListOptions, page, pageSize int) ([]models.TaskExecutionLog, int64, error) | ||||
| 	ListPendingCollections(opts repository.PendingCollectionListOptions, page, pageSize int) ([]models.PendingCollection, int64, error) | ||||
| 	ListUserActionLogs(opts repository.UserActionLogListOptions, page, pageSize int) ([]models.UserActionLog, int64, error) | ||||
| @@ -32,6 +32,7 @@ type monitorService struct { | ||||
| 	sensorDataRepo        repository.SensorDataRepository | ||||
| 	deviceCommandLogRepo  repository.DeviceCommandLogRepository | ||||
| 	executionLogRepo      repository.ExecutionLogRepository | ||||
| 	planRepository        repository.PlanRepository | ||||
| 	pendingCollectionRepo repository.PendingCollectionRepository | ||||
| 	userActionLogRepo     repository.UserActionLogRepository | ||||
| 	rawMaterialRepo       repository.RawMaterialRepository | ||||
| @@ -49,6 +50,7 @@ func NewMonitorService( | ||||
| 	sensorDataRepo repository.SensorDataRepository, | ||||
| 	deviceCommandLogRepo repository.DeviceCommandLogRepository, | ||||
| 	executionLogRepo repository.ExecutionLogRepository, | ||||
| 	planRepository repository.PlanRepository, | ||||
| 	pendingCollectionRepo repository.PendingCollectionRepository, | ||||
| 	userActionLogRepo repository.UserActionLogRepository, | ||||
| 	rawMaterialRepo repository.RawMaterialRepository, | ||||
| @@ -64,6 +66,7 @@ func NewMonitorService( | ||||
| 		sensorDataRepo:        sensorDataRepo, | ||||
| 		deviceCommandLogRepo:  deviceCommandLogRepo, | ||||
| 		executionLogRepo:      executionLogRepo, | ||||
| 		planRepository:        planRepository, | ||||
| 		pendingCollectionRepo: pendingCollectionRepo, | ||||
| 		userActionLogRepo:     userActionLogRepo, | ||||
| 		rawMaterialRepo:       rawMaterialRepo, | ||||
| @@ -88,8 +91,25 @@ func (s *monitorService) ListDeviceCommandLogs(opts repository.DeviceCommandLogL | ||||
| } | ||||
|  | ||||
| // ListPlanExecutionLogs 负责处理查询计划执行日志列表的业务逻辑 | ||||
| func (s *monitorService) ListPlanExecutionLogs(opts repository.PlanExecutionLogListOptions, page, pageSize int) ([]models.PlanExecutionLog, int64, error) { | ||||
| 	return s.executionLogRepo.ListPlanExecutionLogs(opts, page, pageSize) | ||||
| func (s *monitorService) ListPlanExecutionLogs(opts repository.PlanExecutionLogListOptions, page, pageSize int) ([]models.PlanExecutionLog, []models.Plan, int64, error) { | ||||
| 	planLogs, total, err := s.executionLogRepo.ListPlanExecutionLogs(opts, page, pageSize) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, 0, err | ||||
| 	} | ||||
| 	planIds := []uint{} | ||||
| 	for _, datum := range planLogs { | ||||
| 		for _, id := range planIds { | ||||
| 			if id == datum.PlanID { | ||||
| 				break | ||||
| 			} | ||||
| 			planIds = append(planIds, datum.PlanID) | ||||
| 		} | ||||
| 	} | ||||
| 	plans, err := s.planRepository.GetPlansByIDs(planIds) | ||||
| 	if err != nil { | ||||
| 		return nil, nil, 0, err | ||||
| 	} | ||||
| 	return planLogs, plans, total, nil | ||||
| } | ||||
|  | ||||
| // ListTaskExecutionLogs 负责处理查询任务执行日志列表的业务逻辑 | ||||
|   | ||||
| @@ -196,6 +196,7 @@ func initAppServices(infra *Infrastructure, domainServices *DomainServices, logg | ||||
| 		infra.Repos.SensorDataRepo, | ||||
| 		infra.Repos.DeviceCommandLogRepo, | ||||
| 		infra.Repos.ExecutionLogRepo, | ||||
| 		infra.Repos.PlanRepo, | ||||
| 		infra.Repos.PendingCollectionRepo, | ||||
| 		infra.Repos.UserActionLogRepo, | ||||
| 		infra.Repos.RawMaterialRepo, | ||||
|   | ||||
| @@ -44,6 +44,8 @@ type PlanRepository interface { | ||||
| 	GetBasicPlanByID(id uint) (*models.Plan, error) | ||||
| 	// GetPlanByID 根据ID获取计划,包含子计划和任务详情 | ||||
| 	GetPlanByID(id uint) (*models.Plan, error) | ||||
| 	// GetPlansByIDs 根据ID列表获取计划,不包含子计划和任务详情 | ||||
| 	GetPlansByIDs(ids []uint) ([]models.Plan, error) | ||||
| 	// CreatePlan 创建一个新的计划 | ||||
| 	CreatePlan(plan *models.Plan) error | ||||
| 	// UpdatePlan 更新计划,包括子计划和任务 | ||||
| @@ -139,6 +141,19 @@ func (r *gormPlanRepository) GetBasicPlanByID(id uint) (*models.Plan, error) { | ||||
| 	return &plan, nil | ||||
| } | ||||
|  | ||||
| // GetPlansByIDs 根据ID列表获取计划,不包含子计划和任务详情 | ||||
| func (r *gormPlanRepository) GetPlansByIDs(ids []uint) ([]models.Plan, error) { | ||||
| 	var plans []models.Plan | ||||
| 	if len(ids) == 0 { | ||||
| 		return plans, nil | ||||
| 	} | ||||
| 	err := r.db.Where("id IN ?", ids).Find(&plans).Error | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return plans, nil | ||||
| } | ||||
|  | ||||
| // GetPlanByID 根据ID获取计划,包含子计划和任务详情 | ||||
| func (r *gormPlanRepository) GetPlanByID(id uint) (*models.Plan, error) { | ||||
| 	var plan models.Plan | ||||
|   | ||||
		Reference in New Issue
	
	Block a user