From b094961e2cd11b4f3037b8cb0016165a4fbc4d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Sat, 29 Nov 2025 15:29:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(manage):=20=E4=BC=98=E5=8C=96=E6=97=A0?= =?UTF-8?q?=E4=BA=BA=E6=9C=BA=E8=AE=BE=E5=A4=87=E7=B1=BB=E5=9E=8B=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E4=B8=8E=E6=99=BA=E8=83=BD=E5=B7=A1=E6=A3=80=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 改进设备类型ID解析逻辑,增强代码可读性 - 根据设备字典查询结果动态设置设备名称 - 新增智能巡检任务标识及状态更新机制 - 实现人工飞行任务结束前的智能巡检状态检查 - 整理Redis数据获取相关代码结构 - 添加必要的注释说明待办事项 --- OpenAuth.App/ServiceApp/ManageApp.cs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/OpenAuth.App/ServiceApp/ManageApp.cs b/OpenAuth.App/ServiceApp/ManageApp.cs index fc79a85..9a16e93 100644 --- a/OpenAuth.App/ServiceApp/ManageApp.cs +++ b/OpenAuth.App/ServiceApp/ManageApp.cs @@ -367,15 +367,18 @@ namespace OpenAuth.App.ServiceApp { using (var db = UnitWork.CreateContext()) { - int[] uavtype = info.TypeId.Split('-', StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray(); + int[] uavtype = info.TypeId.Split('-', StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)) + .ToArray(); if (uavtype.Length == 3) { - var devicename = db.LasaDeviceDictionary.AsQueryable().Where(r => r.Domain == uavtype[0] && r.DeviceType == uavtype[1] && r.SubType == uavtype[2]).First(); + var devicename = db.LasaDeviceDictionary.AsQueryable().Where(r => + r.Domain == uavtype[0] && r.DeviceType == uavtype[1] && r.SubType == uavtype[2]).First(); if (devicename != null) { info.TypeId = devicename.DeviceName; } } + var flag = db.LasaUav.Insert(info); if (db.Commit()) return true; @@ -2538,11 +2541,14 @@ namespace OpenAuth.App.ServiceApp aiInspection.WarningContent = req.WarningContent; } - // 更新 - // todo 关于多次调用问题 + // 关于多次调用问题 var count = await db.Queryable().Where(x => x.TaskId == req.TaskId).CountAsync(); if (count == 0) { + // 设置任务智能巡检标识 + task.AIInspection = "true"; + task.Status = 3; // 表示智能巡检中 + await db.Updateable(task).ExecuteCommandAsync(); await db.Insertable(aiInspection).ExecuteCommandAsync(); } } @@ -2655,6 +2661,15 @@ namespace OpenAuth.App.ServiceApp public async Task> EndHandFlyTask(string taskid) { + // todo + var savedTask = await Repository.ChangeRepository>().AsQueryable() + .Where(x => x.Id == taskid) + .FirstAsync(); + if (savedTask.Status == 3) + { + throw new Exception("智能巡检未关闭"); + } + var task = new LasaTask() { Id = taskid, @@ -3018,6 +3033,7 @@ WHERE #region redis获取数据 + public async Task> GetDronePortInfoFromRedis(string key) { var info = _redisCacheContext.Get(key); @@ -3028,12 +3044,14 @@ WHERE Result = info }; } + return new Response { Message = "暂无数据", Code = 500 }; } + #endregion } } \ No newline at end of file From fbec9b215be43ce083473fe3e90643837fb109b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Sat, 29 Nov 2025 15:33:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(manage):=20=E4=BF=AE=E6=94=B9=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E4=BB=BB=E5=8A=A1=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=BAdynamic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将EndHandFlyTask方法的返回类型从Response改为Response - 当任务状态为3时,直接返回包含错误信息的Response对象而非抛出异常 - 成功结束任务后,返回包含完整任务信息的Response对象 --- OpenAuth.App/ServiceApp/ManageApp.cs | 15 ++++++++++----- .../ServiceControllers/ManageController.cs | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/OpenAuth.App/ServiceApp/ManageApp.cs b/OpenAuth.App/ServiceApp/ManageApp.cs index 9a16e93..8f0469a 100644 --- a/OpenAuth.App/ServiceApp/ManageApp.cs +++ b/OpenAuth.App/ServiceApp/ManageApp.cs @@ -2659,15 +2659,18 @@ namespace OpenAuth.App.ServiceApp }; } - public async Task> EndHandFlyTask(string taskid) + public async Task> EndHandFlyTask(string taskid) { - // todo var savedTask = await Repository.ChangeRepository>().AsQueryable() .Where(x => x.Id == taskid) .FirstAsync(); if (savedTask.Status == 3) { - throw new Exception("智能巡检未关闭"); + return new Response() + { + Result = false, + Message = "智能巡检未关闭" + }; } var task = new LasaTask() @@ -2695,9 +2698,11 @@ namespace OpenAuth.App.ServiceApp throw new Exception("结束任务失败"); } - return new Response() + return new Response() { - Result = true + Result = await Repository.ChangeRepository>().AsQueryable() + .Where(x => x.Id == taskid) + .FirstAsync() }; } diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs index 52bfcb5..8acd3d6 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs @@ -927,7 +927,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers /// /// [HttpPost] - public async Task> EndHandFlyTask(string taskid) + public async Task> EndHandFlyTask(string taskid) { return await _app.EndHandFlyTask(taskid); }