From a20f37207a00c24b97b2c5a4fc0fff265885c985 Mon Sep 17 00:00:00 2001 From: zhangbin <460190368@qq.com> Date: Tue, 2 Sep 2025 14:06:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=BE=E7=89=87=E5=9D=90?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/ServiceApp/Algo/DaHuaAiApp.cs | 22 ++++++++++++++----- .../ServiceApp/Algo/Request/AiImgReq.cs | 1 + .../Domain/LasaAiAchievementDetail.cs | 5 +++++ .../AiAchievementController.cs | 2 ++ .../ServiceControllers/DaHuaAiController.cs | 2 +- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/OpenAuth.App/ServiceApp/Algo/DaHuaAiApp.cs b/OpenAuth.App/ServiceApp/Algo/DaHuaAiApp.cs index 0cba342..c566b5c 100644 --- a/OpenAuth.App/ServiceApp/Algo/DaHuaAiApp.cs +++ b/OpenAuth.App/ServiceApp/Algo/DaHuaAiApp.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json.Nodes; using System.Threading.Tasks; namespace OpenAuth.App.ServiceApp.Algo @@ -198,7 +199,7 @@ namespace OpenAuth.App.ServiceApp.Algo }; } } - public async Task> AddImg(string taskid, string path, string aiid, List tag) + public async Task> AddImg(string taskid, string path, string aiid, dynamic drone_info, List tag) { using (var db = UnitWork.CreateContext()) { @@ -206,6 +207,13 @@ namespace OpenAuth.App.ServiceApp.Algo { var info = await db.LasaAiAchievement.GetFirstAsync(r => r.TaskId == taskid && r.Tag == item.class_id.ToString()); var modelinfo = await db.LasaModelLabel.AsQueryable().Where(r => r.PId == aiid).ToListAsync(); + double lat = 0.0, lng = 0.0; + if (drone_info != null) + { + var root = JsonNode.Parse(drone_info)?.AsObject(); + lat = root?["data"]?["latitude"]?.GetValue() ?? 0.0; + lng = root?["data"]?["longitude"]?.GetValue() ?? 0.0; + } if (info == null) { LasaAiAchievement lasaAiAchievement = new LasaAiAchievement(); @@ -250,11 +258,13 @@ namespace OpenAuth.App.ServiceApp.Algo { Id = Guid.NewGuid().ToString(), Image = "http://175.27.168.120:6013/test/" + path, - AiAchievementId = lasaAiAchievement.Id + AiAchievementId = lasaAiAchievement.Id, + Lat = lat, + Lng = lng }; lasaAiAchievement.Cover = "http://175.27.168.120:6013/test/" + path; - lasaAiAchievement.Lat = (float)35.135026; - lasaAiAchievement.Lng = (float)118.296182; + lasaAiAchievement.Lat = (float)lat; + lasaAiAchievement.Lng = (float)lng; await db.LasaAiAchievement.InsertAsync(lasaAiAchievement); await db.LasaAiAchievementDetail.InsertAsync(lasaAiAchievementDetail); } @@ -265,7 +275,9 @@ namespace OpenAuth.App.ServiceApp.Algo { Id = Guid.NewGuid().ToString(), Image = "http://175.27.168.120:6013/test/" + path, - AiAchievementId = info.Id + AiAchievementId = info.Id, + Lat = lat, + Lng = lng }; await db.LasaAiAchievementDetail.InsertAsync(lasaAiAchievementDetail); } diff --git a/OpenAuth.App/ServiceApp/Algo/Request/AiImgReq.cs b/OpenAuth.App/ServiceApp/Algo/Request/AiImgReq.cs index 7abba5a..93bd5ac 100644 --- a/OpenAuth.App/ServiceApp/Algo/Request/AiImgReq.cs +++ b/OpenAuth.App/ServiceApp/Algo/Request/AiImgReq.cs @@ -11,6 +11,7 @@ namespace OpenAuth.App.ServiceApp.Algo.Request public string taskid; public string path; public string aiid; + public dynamic drone_info; public List tag; } public class TagItem diff --git a/OpenAuth.Repository/Domain/LasaAiAchievementDetail.cs b/OpenAuth.Repository/Domain/LasaAiAchievementDetail.cs index b23f7c9..db2b3b3 100644 --- a/OpenAuth.Repository/Domain/LasaAiAchievementDetail.cs +++ b/OpenAuth.Repository/Domain/LasaAiAchievementDetail.cs @@ -12,4 +12,9 @@ public class LasaAiAchievementDetail [SugarColumn(ColumnName = "AiAchievementId")] public string AiAchievementId { get; set; } + [SugarColumn(ColumnName = "Lng")] + public double Lng { get; set; } + + [SugarColumn(ColumnName = "Lat")] + public double Lat { get; set; } } \ No newline at end of file diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/AiAchievementController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/AiAchievementController.cs index 1057812..e7e2543 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/AiAchievementController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/AiAchievementController.cs @@ -41,4 +41,6 @@ public class AiAchievementController : ControllerBase { return await _app.GetAiAchievement(id); } + + // 根据时间查询 } \ No newline at end of file diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/DaHuaAiController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/DaHuaAiController.cs index 98d57c9..14a3118 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/DaHuaAiController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/DaHuaAiController.cs @@ -249,7 +249,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers [AllowAnonymous] public async Task> AddImg([FromBody] AiImgReq request) { - return await _app.AddImg(request.taskid, request.path, request.aiid, request.tag); + return await _app.AddImg(request.taskid, request.path, request.aiid,request.drone_info, request.tag); } #endregion }