From fa268054c88398084ef75997f324ba7ff6d1819e Mon Sep 17 00:00:00 2001 From: lgd Date: Wed, 20 Aug 2025 09:22:43 +0800 Subject: [PATCH 01/10] =?UTF-8?q?db=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Infrastructure/Infrastructure.csproj | 1 + .../ServiceApp/DroneDocking/DroneDockApp.cs | 180 ++++++++++++++++-- .../DroneDocking/Request/AirPortDbFj.cs | 39 ++++ .../Request/AirPortUploadDbReq.cs | 6 +- OpenAuth.Repository/Domain/DbfileInfo.cs | 2 +- OpenAuth.Repository/Domain/LasaMediaFile.cs | 1 + .../ServiceControllers/DroneDockController.cs | 16 ++ OpenAuth.WebApi/appsettings.json | 3 +- 8 files changed, 226 insertions(+), 22 deletions(-) create mode 100644 OpenAuth.App/ServiceApp/DroneDocking/Request/AirPortDbFj.cs diff --git a/Infrastructure/Infrastructure.csproj b/Infrastructure/Infrastructure.csproj index 0e81524..9240894 100644 --- a/Infrastructure/Infrastructure.csproj +++ b/Infrastructure/Infrastructure.csproj @@ -34,6 +34,7 @@ + diff --git a/OpenAuth.App/ServiceApp/DroneDocking/DroneDockApp.cs b/OpenAuth.App/ServiceApp/DroneDocking/DroneDockApp.cs index b2b0bc1..b1860b5 100644 --- a/OpenAuth.App/ServiceApp/DroneDocking/DroneDockApp.cs +++ b/OpenAuth.App/ServiceApp/DroneDocking/DroneDockApp.cs @@ -19,6 +19,12 @@ using DocumentFormat.OpenXml.Drawing.Charts; using Org.BouncyCastle.Ocsp; using System.Net.Http.Headers; using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing; +using System.Data.SQLite; +using Infrastructure.CloudSdk.minio; +using Infrastructure.Extensions; +using System.Security.Cryptography; +using System.Text.Json.Nodes; +using Newtonsoft.Json.Linq; namespace OpenAuth.App.ServiceApp.DroneDocking @@ -27,10 +33,14 @@ namespace OpenAuth.App.ServiceApp.DroneDocking { private EncryptionHelper _helper; private IConfiguration configuration; - public DroneDockApp(EncryptionHelper helper, IConfiguration configuration, ISugarUnitOfWork unitWork, ISimpleClient repository, IAuth auth) : base(unitWork, repository, auth) + private readonly ISqlSugarClient _client; + private readonly MinioService _minioService; + public DroneDockApp(EncryptionHelper helper, IConfiguration configuration, ISqlSugarClient client, MinioService minioService, ISugarUnitOfWork unitWork, ISimpleClient repository, IAuth auth) : base(unitWork, repository, auth) { _helper = helper; this.configuration = configuration; + _client = client; + _minioService = minioService; } /// @@ -835,7 +845,7 @@ namespace OpenAuth.App.ServiceApp.DroneDocking Response Response = new Response(); var filePath = req.filePath; var uploadUrl = req.fileUrl; - var fileName = Path.GetFileName(filePath); + var fileName = req.filename; byte[] fileBuffer = null; HttpClient client = null; MultipartFormDataContent formData = null; @@ -893,34 +903,170 @@ namespace OpenAuth.App.ServiceApp.DroneDocking //查询数据 检查是否有重复数据 var info = uow.DbfineInfo.AsQueryable().Where(r => r.taskid == taskid).First(); - if (true) - { string json = JsonSerializer.Serialize(info); string x_lc_secret = _helper.getxseret(); // 转换为字节数组 byte[] bytes = Encoding.UTF8.GetBytes(json); var encryptedResData = _helper.Encrypt(bytes); Response.Result = encryptedResData; - Response.Message = "获取无人机机场状态成功!"; + Response.Message = "获取无人机成果成功!"; Response.Code = 200; Response.Secret = x_lc_secret; return Response; + + + } + } + + public async void InsertDb(string taskid) { + + string _sqliteConnection = "DataSource = E:\\Program Files (x86)\\DingDing\\DTalkFIle\\(371325)费县_20250628155400093.db; Version = 3; "; + string sql = "select * from drone_docktaskdetail where taskid='" + taskid + "'"; + var filigtlist = _client.Ado.SqlQuery(sql); + using (var sqliteConn = new SQLiteConnection(_sqliteConnection)) + { + sqliteConn.Open(); + + + + string deleteDbinfo1 = "delete from JMXX"; + using (var cmd2 = new SQLiteCommand(deleteDbinfo1, sqliteConn)) + { + + cmd2.ExecuteNonQuery(); + } + string sqlInsert = "INSERT INTO JMXX (ZSDM, SZZS,ZSBFJGDM,ZSBFJGGY) VALUES (@ZSDM, @SZZS,@ZSBFJGDM,@ZSBFJGGY)"; + using (var cmd1 = new SQLiteCommand(sqlInsert, sqliteConn)) + { + cmd1.Parameters.AddWithValue("@ZSDM", "UAV32_LJY2FPMYDE6UDES3P3ZD7V3IKQ"); + cmd1.Parameters.AddWithValue("@SZZS", "eyJvcmdjb2RlIjoiOTEzNzEzMDAzMjgzOTg1NzdRIiwib3JnbmFtZSI6IuWxseS4nOaFp+WIm+S/oeaBr+enkeaKgOaciemZkOWFrOWPuCIsImNlcnRjb2RlIjoiVUFWMzJfTEpZMkZQTVlERTZVREVTM1AzWkQ3VjNJS1EiLCJjZXJ0b3JnY29kZSI6IjEyMTAwMDAwNDAwMDEwMzk4UCIsImNlcnRvcmduYW1lIjoi5Lit5Zu95Zu95Zyf5YuY5rWL6KeE5YiS6Zmi5omn5rOV5qih5Z2XIiwiZXhwaXJhdGlvbiI6IjIwMjYtMDctMDEgMTU6NDY6MjAiLCJwdWJsaWNrZXkiOiIwNEYxQkYxQkVGRDYzRjE2RTVEQjNCQ0QzMkNBNUQ5QThFOERGN0FERDY3RDZDNEYyOTNGQjIzRjdCREE3NEY1MkQzMUI4RERBRDAzRDk1NUQ1NjY1MDVBMTVEOEI3REJFODNCNDIzNzhCOEU4NzQ5QzBFQjZFMkZCQzg2Nz" + + "U4MzhCIiwic2lnbiI6IjJBQTIyNDkwQzYxNkI0NjEzNUY2MDRBNDczNjFCQjJGRDcxMEJGOTdBQjcyNDdCMzYxQzc2N0NGQTNGNzcyMTQ0MkExQzhDMUVBRTIxRkEwQUZEMzJGRDg1NjdDMDg1MThGRUY4NTg2RUVCNkE4OTE1MDVBQjUxRjZDNDUyRUM2IiwiY2VydHR5cGUiOiLml6DkurrmnLrkuL7or4Hor4HkuaYiLCJyZWdpb25jb2RlIjoiMzcxMzAwIn0="); + cmd1.Parameters.AddWithValue("@ZSBFJGDM", "91371300328398577Q"); + cmd1.Parameters.AddWithValue("@ZSBFJGGY", "04F1BF1BEFD63F16E5DB3BCD32CA5D9A8E8DF7ADD67D6C4F293FB23F7BDA74F52D31B8DDAD03D955D566505A15D8B7DBE83B42378B8E8749C0EB6E2FBC8675838B"); + cmd1.ExecuteNonQuery(); + } + + + + string deleteDbinfo = "delete from DB_INFO"; + using (var cmd = new SQLiteCommand(deleteDbinfo, sqliteConn)) + { + + cmd.ExecuteNonQuery(); } - else + + DateTime dt = DateTime.Now; + string dt24 = dt.ToString("yyyy-MM-dd HH:mm:ss"); + string sqlInsertDbinfo = "INSERT INTO DB_INFO (VERSION, CREATETIME,UPDATETIME,CREATEUSER,DESCRIPTION) VALUES (@VERSION, @CREATETIME,@UPDATETIME,@CREATEUSER,@DESCRIPTION)"; + using (var cmd = new SQLiteCommand(sqlInsertDbinfo, sqliteConn)) + { + cmd.Parameters.AddWithValue("@VERSION", 2.0); + cmd.Parameters.AddWithValue("@CREATETIME", dt24); + cmd.Parameters.AddWithValue("@UPDATETIME", dt24); + cmd.Parameters.AddWithValue("@CREATEUSER", "system"); + cmd.Parameters.AddWithValue("@DESCRIPTION", "DESCRIPTION"); + cmd.ExecuteNonQuery(); + } + string deleteFj = "delete from FJ"; + using (var cmd = new SQLiteCommand(deleteFj, sqliteConn)) { - string x_lc_secret = _helper.getxseret(); - // 转换为字节数组 - byte[] bytes = Encoding.UTF8.GetBytes(" "); - var encryptedResData = _helper.Encrypt(bytes); - Response.Result = encryptedResData; - Response.Message = "获取无人机机场状态失败!"; - Response.Code = 500; - Response.Secret = x_lc_secret; - return Response; + cmd.ExecuteNonQuery(); } - } - } + for (int i = 0; i < filigtlist.Count; i++) + { + var flightid = filigtlist[i]; + string fligthpicsql = "select * from lasa_mediafile where \"FlightId\"='"+ flightid.flighttaskid+"'"; + + var pics = _client.Ado.SqlQuery(fligthpicsql); + for (int j = 0; j < pics.Count; j++) + { + + var pic = pics[j]; + var imageStream = _minioService.GetObjectAsStream("", pic.ObjectKey+""); + if (imageStream.Result==null) + { + continue; + } + byte[] bytes; + using (MemoryStream memoryStream = new MemoryStream()) + { + imageStream.Result.CopyTo(memoryStream); // 将原始流复制到MemoryStream中 + bytes = memoryStream.ToArray(); // 获取MemoryStream的字节数组表示 + } + + string fileHash; + using (var sha256 = SHA256.Create()) { + var hashBytes = sha256.ComputeHash(bytes); + fileHash = BitConverter.ToString(hashBytes).Replace("-", + "").ToLower(); + } + string sqlintoFj = "INSERT INTO FJ (BSM, DKLX,DKBSM,ZDKBH,XZQDM,FJMC,FJLX,PSTZ,FJ,FJHXZ,PSSJ,XDGD,JDGD,Longitude,Latitude,PSFYJ,PSJD,PSHGJ,PSJJ,FJYSKD,FJYSGD,PSDXZXX,PSRY,SPKZXX,ZSDM,JYM) " + + "VALUES (@BSM, @DKLX,@DKBSM,@ZDKBH,@XZQDM,@FJMC,@FJLX,@PSTZ,@FJ,@FJHXZ,@PSSJ,@XDGD,@JDGD,@Longitude,@Latitude,@PSFYJ,@PSJD,@PSHGJ,@PSJJ,@FJYSKD,@FJYSGD,@PSDXZXX,@PSRY,@SPKZXX,@ZSDM,@JYM)"; + using (var cmd = new SQLiteCommand(sqlintoFj, sqliteConn)) + { + cmd.Parameters.AddWithValue("@BSM", pic.Id); + cmd.Parameters.AddWithValue("@DKLX", flightid.dklx); + cmd.Parameters.AddWithValue("@DKBSM", flightid.dkbh); + cmd.Parameters.AddWithValue("@ZDKBH", flightid.zdkbh); + cmd.Parameters.AddWithValue("@XZQDM", flightid.xzqdm); + cmd.Parameters.AddWithValue("@FJMC", pic.Name); + cmd.Parameters.AddWithValue("@FJLX", 1); + cmd.Parameters.AddWithValue("@PSTZ", "Y"); + cmd.Parameters.AddWithValue("@FJ", bytes); + cmd.Parameters.AddWithValue("@FJHXZ", fileHash); + cmd.Parameters.AddWithValue("@PSSJ",pic.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")); + cmd.Parameters.AddWithValue("@XDGD", pic.RelativeAltitude); + cmd.Parameters.AddWithValue("@JDGD", pic.AbsoluteAltitude); + cmd.Parameters.AddWithValue("@Longitude", pic.Lat); + cmd.Parameters.AddWithValue("@Latitude", pic.Lng); + cmd.Parameters.AddWithValue("@PSFYJ", pic.GimbalYawDegree); + cmd.Parameters.AddWithValue("@PSJD", pic.GimbalYawDegree); + cmd.Parameters.AddWithValue("@PSHGJ", pic.GimbalYawDegree); + cmd.Parameters.AddWithValue("@PSJJ", pic.FocalLength); + cmd.Parameters.AddWithValue("@FJYSKD", pic.Width); + cmd.Parameters.AddWithValue("@FJYSGD", pic.Height); + cmd.Parameters.AddWithValue("@PSDXZXX", ""); + cmd.Parameters.AddWithValue("@PSRY", "system"); + cmd.Parameters.AddWithValue("@SPKZXX", "wu"); + cmd.Parameters.AddWithValue("@ZSDM", "UAV32_LJY2FPMYDE6UDES3P3ZD7V3IKQ"); + cmd.Parameters.AddWithValue("@JYM", "DESCRIPTION"); + cmd.ExecuteNonQuery(); + } + } + } + AirPortUploadReq airPortUploadReq = new AirPortUploadReq(); + airPortUploadReq.code = "AirportData"; + airPortUploadReq.regioncode = filigtlist[0].xzqdm; + List strings = new List(); + strings.Add(filigtlist[0].xzqdm + ".db"); + airPortUploadReq.filenames = strings; + var result = await getUploadFilePath(airPortUploadReq); + var jsonstr = result.Result; + JObject jObject = JObject.Parse(jsonstr); + var liststr = jObject["data"].Value>(); + var write = liststr[0]["writeurl"].ToString(); + var read = liststr[0]["readurl"].ToString(); + AirPortUploadDbReq req = new AirPortUploadDbReq(); + req.fileUrl = write; + req.filePath = configuration.GetSection("DroneDocking:DbFile").Value; + req.filename = filigtlist[0].xzqdm + ".db"; + UploadFile(req); + using (var uow = base.UnitWork.CreateContext()) + { + DbfineInfo dbfine = new DbfineInfo(); + dbfine.id = Guid.NewGuid().ToString(); + dbfine.taskid = taskid; + dbfine.regioncode = filigtlist[0].xzqdm; + dbfine.extension = ".db"; + dbfine.attachment_count = 1; + dbfine.hash = "3jekd4k3k5554k3l2l4kj6kl"; + dbfine.size = 1000; + dbfine.count = 50; + var info = uow.DbfineInfo.Insert(dbfine); + } + } + } // 安全获取响应头值的方法 private static string GetHeaderValue(HttpResponseMessage response, string headerName) { diff --git a/OpenAuth.App/ServiceApp/DroneDocking/Request/AirPortDbFj.cs b/OpenAuth.App/ServiceApp/DroneDocking/Request/AirPortDbFj.cs new file mode 100644 index 0000000..f4bf87a --- /dev/null +++ b/OpenAuth.App/ServiceApp/DroneDocking/Request/AirPortDbFj.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenAuth.App.ServiceApp.DroneDocking.Request +{ + public class AirPortDbFj + { + public string BSM { get; set; } + public string DKIX { get; set; } + public string DRBSM { get; set; } + public string ZDKBH { get; set; } + public string XZQDM { get; set; } + public string FJMC { get; set; } + public string FJLX { get; set; } + public byte[] FJ { get; set; } + public string FJHXZ { get; set; } + public string PSSJ { get; set; } + public double XDGD { get; set; } + public double JDGD { get; set; } + public float Longitude { get; set; } + public float Latitude { get; set; } + public int PSF01 { get; set; } + public int PSJD { get; set; } + public int FJYSKD { get; set; } + public int FJYSGD { get; set; } + public string PSRY { get; set; } + public string ZSDM { get; set; } + public string JYM { get; set; } + + + + + + + } +} diff --git a/OpenAuth.App/ServiceApp/DroneDocking/Request/AirPortUploadDbReq.cs b/OpenAuth.App/ServiceApp/DroneDocking/Request/AirPortUploadDbReq.cs index fc6c677..aa44d6c 100644 --- a/OpenAuth.App/ServiceApp/DroneDocking/Request/AirPortUploadDbReq.cs +++ b/OpenAuth.App/ServiceApp/DroneDocking/Request/AirPortUploadDbReq.cs @@ -12,9 +12,9 @@ namespace OpenAuth.App.ServiceApp.DroneDocking.Request public string fileUrl { get; set; } - + public string filename { get; set; } + + - - } } diff --git a/OpenAuth.Repository/Domain/DbfileInfo.cs b/OpenAuth.Repository/Domain/DbfileInfo.cs index 96ea76a..7226b1c 100644 --- a/OpenAuth.Repository/Domain/DbfileInfo.cs +++ b/OpenAuth.Repository/Domain/DbfileInfo.cs @@ -49,7 +49,7 @@ public class DbfineInfo /// /// 云台偏航角 /// - public string hashcode { get; set; } + public string hash { get; set; } /// /// 拍摄相对高度 diff --git a/OpenAuth.Repository/Domain/LasaMediaFile.cs b/OpenAuth.Repository/Domain/LasaMediaFile.cs index 11a6009..5f46c9e 100644 --- a/OpenAuth.Repository/Domain/LasaMediaFile.cs +++ b/OpenAuth.Repository/Domain/LasaMediaFile.cs @@ -126,6 +126,7 @@ public class LasaMediaFile public string PayloadModelName { get; set; } public int? Type { get; set; } + public float? FocalLength { get; set; } [SugarColumn(IsIgnore = true)] public List Children { get; set; } [SugarColumn(IsIgnore = true)] public string CreateUserName { get; set; } diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/DroneDockController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/DroneDockController.cs index 5b7a187..bfacd6d 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/DroneDockController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/DroneDockController.cs @@ -547,5 +547,21 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers } } + + + [HttpGet] + [AllowAnonymous] + + public async Task> dbupload (string taskid) + { + var result = new ReciveData(); + + _app.InsertDb(taskid); + result.code = 200; + result.message = "error"; + + return result; + + } } } diff --git a/OpenAuth.WebApi/appsettings.json b/OpenAuth.WebApi/appsettings.json index 7287275..18dad71 100644 --- a/OpenAuth.WebApi/appsettings.json +++ b/OpenAuth.WebApi/appsettings.json @@ -83,6 +83,7 @@ "limitspeed": 1048576 }, "DroneDocking": { - "Url": "https://wp.tianmu.cloud:5443/zhcfzx" + "Url": "https://wp.tianmu.cloud:5443/zhcfzx", + "DbFile": "D://dbfile//test.db" } } From 1dd79bc2a2ad2ce75f1b79f94582db7e9522add6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E6=88=90=E6=A5=BC?= <799806631@qq.com> Date: Wed, 20 Aug 2025 09:57:35 +0800 Subject: [PATCH 02/10] =?UTF-8?q?.js=20=E6=96=87=E4=BB=B6=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.WebApi/Startup.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenAuth.WebApi/Startup.cs b/OpenAuth.WebApi/Startup.cs index 99bdaba..3225cd7 100644 --- a/OpenAuth.WebApi/Startup.cs +++ b/OpenAuth.WebApi/Startup.cs @@ -399,7 +399,9 @@ namespace OpenAuth.WebApi { ".txt", "application/octet-stream" }, { ".xlsx", "application/octet-stream" }, { ".xls", "application/vnd.ms-excel" }, - { ".pdf", "application/pdf" } + { ".pdf", "application/pdf" }, + { ".js","application/javascript" }, + { ".cjs","application/javascript" } }) }; app.UseStaticFiles(staticfile); From 820e9d54c7947c3f5c55893ca48dd81d6c2cde59 Mon Sep 17 00:00:00 2001 From: lgd Date: Wed, 20 Aug 2025 10:35:42 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceApp/DroneDocking/DroneDockApp.cs | 77 ++++++++++--------- OpenAuth.App/ServiceApp/ManageApp.cs | 4 +- OpenAuth.Repository/Domain/DbfileInfo.cs | 3 +- OpenAuth.Repository/Domain/LasaMediaFile.cs | 2 +- .../ServiceControllers/DroneDockController.cs | 6 +- OpenAuth.WebApi/appsettings.json | 2 +- 6 files changed, 51 insertions(+), 43 deletions(-) diff --git a/OpenAuth.App/ServiceApp/DroneDocking/DroneDockApp.cs b/OpenAuth.App/ServiceApp/DroneDocking/DroneDockApp.cs index b1860b5..92fc982 100644 --- a/OpenAuth.App/ServiceApp/DroneDocking/DroneDockApp.cs +++ b/OpenAuth.App/ServiceApp/DroneDocking/DroneDockApp.cs @@ -840,7 +840,7 @@ namespace OpenAuth.App.ServiceApp.DroneDocking return Response; } - public Response UploadFile(AirPortUploadDbReq req) + public async Task> UploadFile(AirPortUploadDbReq req) { Response Response = new Response(); var filePath = req.filePath; @@ -862,7 +862,7 @@ namespace OpenAuth.App.ServiceApp.DroneDocking fileContent.Headers.ContentDisposition.FileName = fileName; //注意:务必 根据 文件扩展名,这里指定 ContentType fileContent.Headers.ContentType = new - MediaTypeHeaderValue(fileName); + MediaTypeHeaderValue("application/octet-stream"); formData.Add(fileContent); var request = new HttpRequestMessage { @@ -919,8 +919,8 @@ namespace OpenAuth.App.ServiceApp.DroneDocking } public async void InsertDb(string taskid) { - - string _sqliteConnection = "DataSource = E:\\Program Files (x86)\\DingDing\\DTalkFIle\\(371325)费县_20250628155400093.db; Version = 3; "; + var sqliteconnect = configuration.GetSection("DroneDocking:DbFile").Value; + string _sqliteConnection = "DataSource = "+ sqliteconnect + "; Version = 3; "; string sql = "select * from drone_docktaskdetail where taskid='" + taskid + "'"; var filigtlist = _client.Ado.SqlQuery(sql); using (var sqliteConn = new SQLiteConnection(_sqliteConnection)) @@ -1035,38 +1035,45 @@ namespace OpenAuth.App.ServiceApp.DroneDocking } } } - AirPortUploadReq airPortUploadReq = new AirPortUploadReq(); - airPortUploadReq.code = "AirportData"; - airPortUploadReq.regioncode = filigtlist[0].xzqdm; - List strings = new List(); - strings.Add(filigtlist[0].xzqdm + ".db"); - airPortUploadReq.filenames = strings; - var result = await getUploadFilePath(airPortUploadReq); - var jsonstr = result.Result; - JObject jObject = JObject.Parse(jsonstr); - var liststr = jObject["data"].Value>(); - var write = liststr[0]["writeurl"].ToString(); - var read = liststr[0]["readurl"].ToString(); - AirPortUploadDbReq req = new AirPortUploadDbReq(); - req.fileUrl = write; - req.filePath = configuration.GetSection("DroneDocking:DbFile").Value; - req.filename = filigtlist[0].xzqdm + ".db"; - UploadFile(req); - using (var uow = base.UnitWork.CreateContext()) - { - DbfineInfo dbfine = new DbfineInfo(); - dbfine.id = Guid.NewGuid().ToString(); - dbfine.taskid = taskid; - dbfine.regioncode = filigtlist[0].xzqdm; - dbfine.extension = ".db"; - dbfine.attachment_count = 1; - dbfine.hash = "3jekd4k3k5554k3l2l4kj6kl"; - dbfine.size = 1000; - dbfine.count = 50; - var info = uow.DbfineInfo.Insert(dbfine); - } + sqliteConn.Close(); + } - } + AirPortUploadReq airPortUploadReq = new AirPortUploadReq(); + airPortUploadReq.code = "AirportData"; + airPortUploadReq.regioncode = filigtlist[0].xzqdm; + List strings = new List(); + strings.Add(filigtlist[0].xzqdm + ".db"); + airPortUploadReq.filenames = strings; + var result = await getUploadFilePath(airPortUploadReq); + var jsonstr = result.Result; + JArray jObject = JArray.Parse(jsonstr); + var liststr = jObject[0].Value(); + var write = liststr["writeurl"].ToString(); + var read = liststr["readurl"].ToString(); + AirPortUploadDbReq req = new AirPortUploadDbReq(); + req.fileUrl = write; + req.filePath = configuration.GetSection("DroneDocking:DbFile").Value; + req.filename = filigtlist[0].xzqdm + ".db"; + using (var uow = base.UnitWork.CreateContext()) + { + DbfineInfo dbfine = new DbfineInfo(); + dbfine.id = Guid.NewGuid().ToString(); + dbfine.taskid = taskid; + dbfine.regioncode = filigtlist[0].xzqdm; + dbfine.extension = ".db"; + dbfine.attachment_count = 1; + dbfine.size = 1000; + dbfine.count = 50; + dbfine.url = read; + dbfine.hashcode = "adewfdafdaf"; + var info = await uow.DbfineInfo.InsertAsync(dbfine); + + uow.Commit(); + Console.WriteLine(info); + } + await UploadFile(req); + + } // 安全获取响应头值的方法 private static string GetHeaderValue(HttpResponseMessage response, string headerName) { diff --git a/OpenAuth.App/ServiceApp/ManageApp.cs b/OpenAuth.App/ServiceApp/ManageApp.cs index bd5062c..77b1a2d 100644 --- a/OpenAuth.App/ServiceApp/ManageApp.cs +++ b/OpenAuth.App/ServiceApp/ManageApp.cs @@ -1887,9 +1887,9 @@ namespace OpenAuth.App.ServiceApp imgWidth = dimensions.width, imgOriginHeight = dimensions.height, imgOriginWidth = dimensions.width, - psjj = lasaMediaFile.FocalLength, + psjj = (double)lasaMediaFile.FocalLength, time = lasaMediaFile.CreateTime, - height = lasaMediaFile.Height, + height = (double) lasaMediaFile.Height, lon = lasaMediaFile.Lng, lat = lasaMediaFile.Lat, pitch = 0, diff --git a/OpenAuth.Repository/Domain/DbfileInfo.cs b/OpenAuth.Repository/Domain/DbfileInfo.cs index 7226b1c..f8e3b87 100644 --- a/OpenAuth.Repository/Domain/DbfileInfo.cs +++ b/OpenAuth.Repository/Domain/DbfileInfo.cs @@ -49,7 +49,8 @@ public class DbfineInfo /// /// 云台偏航角 /// - public string hash { get; set; } + + public string hashcode { get; set; } /// /// 拍摄相对高度 diff --git a/OpenAuth.Repository/Domain/LasaMediaFile.cs b/OpenAuth.Repository/Domain/LasaMediaFile.cs index 5f46c9e..b6d4d07 100644 --- a/OpenAuth.Repository/Domain/LasaMediaFile.cs +++ b/OpenAuth.Repository/Domain/LasaMediaFile.cs @@ -126,7 +126,7 @@ public class LasaMediaFile public string PayloadModelName { get; set; } public int? Type { get; set; } - public float? FocalLength { get; set; } + [SugarColumn(IsIgnore = true)] public List Children { get; set; } [SugarColumn(IsIgnore = true)] public string CreateUserName { get; set; } diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/DroneDockController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/DroneDockController.cs index bfacd6d..b915ca3 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/DroneDockController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/DroneDockController.cs @@ -492,11 +492,11 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers [HttpPost] [AllowAnonymous] - public Response UploadFile(AirPortUploadDbReq req) { + public async Task> UploadFile(AirPortUploadDbReq req) { var result = new Response(); try { - result = _app.UploadFile(req); + result = await _app.UploadFile(req); } catch (Exception ex) { @@ -558,7 +558,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers _app.InsertDb(taskid); result.code = 200; - result.message = "error"; + result.message = "success"; return result; diff --git a/OpenAuth.WebApi/appsettings.json b/OpenAuth.WebApi/appsettings.json index 18dad71..d628cfb 100644 --- a/OpenAuth.WebApi/appsettings.json +++ b/OpenAuth.WebApi/appsettings.json @@ -84,6 +84,6 @@ }, "DroneDocking": { "Url": "https://wp.tianmu.cloud:5443/zhcfzx", - "DbFile": "D://dbfile//test.db" + "DbFile": "E:\\Program Files (x86)\\DingDing\\DTalkFIle\\(371325)费县_20250628155400093.db" } } From d8dc1bbd5fe79c96bebfe04b4e8e9be1538606fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Thu, 21 Aug 2025 10:09:46 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A8=AA=E6=BB=9A?= =?UTF-8?q?=E8=A7=92=EF=BC=8C=E4=BF=AF=E4=BB=B0=E8=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceApp/Subscribe/ConfigSubscribe.cs | 80 ++++++++++++++----- OpenAuth.Repository/Domain/LasaMediaFile.cs | 8 ++ 2 files changed, 68 insertions(+), 20 deletions(-) diff --git a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs index 127753b..fd64906 100644 --- a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs +++ b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs @@ -9,9 +9,11 @@ using Infrastructure.CloudSdk.wayline; using Infrastructure.Extensions; using MetadataExtractor; using MetadataExtractor.Formats.Exif; +using MetadataExtractor.Formats.Xmp; using Microsoft.Extensions.Logging; using MQTTnet.Client; using Newtonsoft.Json; +using NPOI.SS.Formula.Functions; using OpenAuth.App.ServiceApp; using OpenAuth.Repository.Domain; using OpenAuth.WebApi; @@ -210,11 +212,32 @@ public class ConfigSubscribe : IJob _logger.LogDebug($"文件上传处理:{message}"); int flightType = data.flight_task.flight_type; string flightId = data.file.ext.flight_id; + // 关于flightId 没有值的问题怎么办??? var taskAssign = _manageApp.GetTaskAssignByFlightId(flightId); - var taskId = taskAssign.TaskId; - var executeTask = await _sqlSugarClient - .Queryable() - .SingleAsync(a => a.Id == taskId); + var taskId = ""; + var taskName = ""; + var workspaceId = ""; + if (taskAssign != null) + { + taskId = taskAssign.TaskId; + var executeTask = await _sqlSugarClient + .Queryable() + .SingleAsync(a => a.Id == taskId); + if (!string.IsNullOrEmpty(executeTask.TaskName)) + { + taskName = executeTask.TaskName; + } + + if (!string.IsNullOrEmpty(executeTask.WorkspaceId)) + { + workspaceId = executeTask.WorkspaceId; + } + } + else + { + taskName = "指令"; + } + string objectKey = data.file.object_key; var folderKey = ((string)data.file.object_key).Split("/"); var parentKey = folderKey[2]; @@ -231,10 +254,8 @@ public class ConfigSubscribe : IJob FlightId = flightId, TaskId = taskId, ParentKey = "0", - Name = string.IsNullOrEmpty(executeTask.TaskName) - ? timeStr - : $"{executeTask.TaskName} {timeStr}", - WorkspaceId = executeTask.WorkspaceId, + Name = $"{taskName} {timeStr}", + WorkspaceId = workspaceId, CreateTime = date, }; await _sqlSugarClient.Insertable(parent1).ExecuteCommandAsync(); @@ -276,7 +297,7 @@ public class ConfigSubscribe : IJob int width = 0, height = 0, focalLength = 0; int offset = 0, length = 0; string model = ""; - + float? gimbalRoll= 0, gimbalPitch=0; var fileUrl = "http://" + _minioService.endPoint + "/" + _minioService._bucketName + "/" + objectKey; using (var httpClient = new HttpClient()) @@ -292,24 +313,38 @@ public class ConfigSubscribe : IJob .GetAsync(fileUrl, HttpCompletionOption.ResponseHeadersRead).Result; if (response.StatusCode == HttpStatusCode.PartialContent) { - //Focal Length 35: 24 mm - //Exif Image Width: 4032 pixels : Exif SubIFD - //Exif Image Height: 3024 pixels : Exif SubIFD - // 3.1 解析Content-Range头(格式:bytes start-end/total) var contentRange = response.Content.Headers.ContentRange; if (contentRange != null) { fileSize = contentRange.Length.Value; - _logger.LogDebug( - $"获取范围:{contentRange.From}-{contentRange.To}/{contentRange.Length}"); } if (objectKey.ToLower().EndsWith("jpeg")) { // 成功获取部分内容 var y = response.Content.ReadAsByteArrayAsync().Result; - MemoryStream ms = new MemoryStream(y); + var ms = new MemoryStream(y); var directories = ImageMetadataReader.ReadMetadata(ms); + // 获取 XMP 目录(包含 XMP 原始 XML 数据) + var xmpDirectory = directories.OfType().FirstOrDefault(); + if (xmpDirectory != null) + { + // 获取 XMP 的 XML 字符串(原始数据) + var xmpXml = xmpDirectory.GetXmpProperties(); + foreach (var keyValuePair in xmpXml) + { + switch (keyValuePair.Key) + { + case "GimbalPitchDegree": + gimbalPitch = float.Parse(keyValuePair.Value); + break; + case "GimbalRollDegree": + gimbalRoll = float.Parse(keyValuePair.Value); + break; + } + } + } + foreach (var directory in directories) { if (directory is ExifDirectoryBase) @@ -418,7 +453,7 @@ public class ConfigSubscribe : IJob ObjectKey = data.file.object_key, Path = data.file.path, // 目前这个好像没有值 CreateTime = createTime, - WorkspaceId = executeTask.WorkspaceId, + WorkspaceId = workspaceId, ParentKey = folderKey[2], Tid = result.tid, Bid = result.bid, @@ -431,9 +466,11 @@ public class ConfigSubscribe : IJob display = 1, FocalLength = focalLength, PayloadModelName = model, - Type = type + Type = type, + GimbalPitchDegree = gimbalPitch, + GimbalRollDegree = gimbalRoll }; - // todo 添加事务 + // 添加事务 await _sqlSugarClient.Insertable(fileUpload).ExecuteCommandAsync(); } @@ -538,6 +575,8 @@ public class ConfigSubscribe : IJob //更新任务状态及失败原因? string flightId1 = data.output.ext.flight_id; var taskId1 = _manageApp.GetTaskAssignByFlightId(flightId1).TaskId; + // "773":"低电量返航导致航线中断" + int reasonCode = data.output.ext.break_point.break_reason; // 添加断点信息 var taskRecord1 = new LasaTask() { @@ -546,8 +585,10 @@ public class ConfigSubscribe : IJob Reason = ErrorMap[code], BreakPoint = JsonConvert.SerializeObject(data.output.ext.break_point) }; + // 创建一个条件任务怎么样? await _sqlSugarClient.Updateable(taskRecord1) .IgnoreNullColumns().ExecuteCommandAsync(); + // todo 关于断点原因为773(电量低),处置 } else { @@ -599,7 +640,6 @@ public class ConfigSubscribe : IJob } break; - // todo // 任务资源处理 // 航线进度处理 // 任务取消 thing/product/*/services_reply diff --git a/OpenAuth.Repository/Domain/LasaMediaFile.cs b/OpenAuth.Repository/Domain/LasaMediaFile.cs index 11a6009..33bcf4b 100644 --- a/OpenAuth.Repository/Domain/LasaMediaFile.cs +++ b/OpenAuth.Repository/Domain/LasaMediaFile.cs @@ -50,6 +50,14 @@ public class LasaMediaFile /// 云台偏航角 /// public float? GimbalYawDegree { get; set; } + /// + /// 云台横滚角 + /// + public float? GimbalRollDegree { get; set; } + /// + /// 云台俯仰角 + /// + public float? GimbalPitchDegree { get; set; } /// /// 拍摄相对高度 From d766ae581ff1b62deb87e2e2976d2572a1162f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Thu, 21 Aug 2025 10:10:15 +0800 Subject: [PATCH 05/10] =?UTF-8?q?bugfix:=20=E9=98=BB=E9=A3=9E=E5=A4=A9?= =?UTF-8?q?=E6=B0=94=E8=AF=AF=E5=88=A4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/ServiceApp/ManageApp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenAuth.App/ServiceApp/ManageApp.cs b/OpenAuth.App/ServiceApp/ManageApp.cs index bd5062c..19c75d3 100644 --- a/OpenAuth.App/ServiceApp/ManageApp.cs +++ b/OpenAuth.App/ServiceApp/ManageApp.cs @@ -897,7 +897,7 @@ namespace OpenAuth.App.ServiceApp var rainThreshold = 3; // 大雨 var windSpeedThreshold = 12; double weatherWindSpeed = 0; // 天气预报风速 - double weatherWindSpeedThreshold = 0; + double weatherWindSpeedThreshold = 12; switch (dockTypeId) { case "Dock": From 947a781e1b26c7e795c11d56d1575156058472a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Thu, 21 Aug 2025 13:50:23 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E5=8F=98=E7=84=A6=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceApp/Subscribe/ConfigSubscribe.cs | 18 +++++++++++++++--- OpenAuth.Repository/Domain/LasaMediaFile.cs | 14 ++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs index fd64906..262d842 100644 --- a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs +++ b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs @@ -298,6 +298,7 @@ public class ConfigSubscribe : IJob int offset = 0, length = 0; string model = ""; float? gimbalRoll= 0, gimbalPitch=0; + float? digitalZoomRatio = 1; var fileUrl = "http://" + _minioService.endPoint + "/" + _minioService._bucketName + "/" + objectKey; using (var httpClient = new HttpClient()) @@ -335,10 +336,14 @@ public class ConfigSubscribe : IJob { switch (keyValuePair.Key) { - case "GimbalPitchDegree": + // // drone-dji:GimbalPitchDegree: -90.00 + //drone-dji:GimbalReverse: 0 + //drone-dji:GimbalRollDegree: +180.00 + //drone-dji:GimbalYawDegree: -96.40 + case "drone-dji:GimbalPitchDegree": gimbalPitch = float.Parse(keyValuePair.Value); break; - case "GimbalRollDegree": + case "drone-dji:GimbalRollDegree": gimbalRoll = float.Parse(keyValuePair.Value); break; } @@ -349,6 +354,7 @@ public class ConfigSubscribe : IJob { if (directory is ExifDirectoryBase) { + if (directory.Name.Equals("Exif IFD0")) { foreach (var tag in directory.Tags) @@ -362,8 +368,13 @@ public class ConfigSubscribe : IJob if (directory.Name.Equals("Exif SubIFD")) { + // Digital Zoom Ratio: 1 Exif SubIFD foreach (var tag in directory.Tags) { + if (tag.Name.Equals("Digital Zoom Ratio")) + { + digitalZoomRatio = float.Parse(tag.Description); + } if (tag.Name.Equals("Exif Image Width")) { width = int.Parse(tag.Description.Replace("pixels", "") @@ -468,7 +479,8 @@ public class ConfigSubscribe : IJob PayloadModelName = model, Type = type, GimbalPitchDegree = gimbalPitch, - GimbalRollDegree = gimbalRoll + GimbalRollDegree = gimbalRoll, + DigitalZoomRatio = digitalZoomRatio }; // 添加事务 await _sqlSugarClient.Insertable(fileUpload).ExecuteCommandAsync(); diff --git a/OpenAuth.Repository/Domain/LasaMediaFile.cs b/OpenAuth.Repository/Domain/LasaMediaFile.cs index c58850f..32f67b9 100644 --- a/OpenAuth.Repository/Domain/LasaMediaFile.cs +++ b/OpenAuth.Repository/Domain/LasaMediaFile.cs @@ -50,15 +50,22 @@ public class LasaMediaFile /// 云台偏航角 /// public float? GimbalYawDegree { get; set; } + /// /// 云台横滚角 /// public float? GimbalRollDegree { get; set; } + /// /// 云台俯仰角 /// public float? GimbalPitchDegree { get; set; } + /// + /// 数字变焦比例 + /// + public float? DigitalZoomRatio { get; set; } + /// /// 拍摄相对高度 /// @@ -124,13 +131,12 @@ public class LasaMediaFile public int? FlightType { get; set; } - [SugarColumn(IsIgnore = true)] - public string PicLink { get; set; } + [SugarColumn(IsIgnore = true)] public string PicLink { get; set; } public string minipic { get; set; } - + public double? FocalLength { get; set; } - + public string PayloadModelName { get; set; } public int? Type { get; set; } From aeb12f6ad153c4f219458108f8bf67258849c5b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Thu, 21 Aug 2025 14:41:50 +0800 Subject: [PATCH 07/10] =?UTF-8?q?1.=20=E6=B5=8B=E8=AF=95=E6=96=B9=E6=B3=95?= =?UTF-8?q?=202.=20bugfix:=E6=8C=87=E4=BB=A4=E9=A3=9E=E8=A1=8C=E7=A9=BA?= =?UTF-8?q?=E6=8C=87=E9=92=88=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/ServiceApp/ManageApp.cs | 101 ++++++++++++------ .../ServiceApp/Subscribe/ConfigSubscribe.cs | 5 +- 2 files changed, 74 insertions(+), 32 deletions(-) diff --git a/OpenAuth.App/ServiceApp/ManageApp.cs b/OpenAuth.App/ServiceApp/ManageApp.cs index 8ffe369..8cc8a07 100644 --- a/OpenAuth.App/ServiceApp/ManageApp.cs +++ b/OpenAuth.App/ServiceApp/ManageApp.cs @@ -11,6 +11,7 @@ using Infrastructure.Extensions; using Infrastructure.Helpers; using MetadataExtractor; using MetadataExtractor.Formats.Exif; +using MetadataExtractor.Formats.Xmp; using Microsoft.AspNetCore.Http; using Microsoft.IdentityModel.Tokens; using Microsoft.Net.Http.Headers; @@ -1889,7 +1890,7 @@ namespace OpenAuth.App.ServiceApp imgOriginWidth = dimensions.width, psjj = (double)lasaMediaFile.FocalLength, time = lasaMediaFile.CreateTime, - height = (double) lasaMediaFile.Height, + height = (double)lasaMediaFile.Height, lon = lasaMediaFile.Lng, lat = lasaMediaFile.Lat, pitch = 0, @@ -2016,11 +2017,32 @@ namespace OpenAuth.App.ServiceApp var data = result.data; int flightType = data.flight_task.flight_type; string flightId = data.file.ext.flight_id; + // 关于flightId 没有值的问题怎么办??? var taskAssign = GetTaskAssignByFlightId(flightId); - var taskId = taskAssign.TaskId; - var executeTask = await Repository.AsSugarClient() - .Queryable() - .SingleAsync(a => a.Id == taskId); + var taskId = ""; + var taskName = ""; + var workspaceId = ""; + if (taskAssign != null) + { + taskId = taskAssign.TaskId; + var executeTask = await Repository.AsSugarClient() + .Queryable() + .SingleAsync(a => a.Id == taskId); + if (!string.IsNullOrEmpty(executeTask.TaskName)) + { + taskName = executeTask.TaskName; + } + + if (!string.IsNullOrEmpty(executeTask.WorkspaceId)) + { + workspaceId = executeTask.WorkspaceId; + } + } + else + { + taskName = "指令"; + } + string objectKey = data.file.object_key; var folderKey = ((string)data.file.object_key).Split("/"); var parentKey = folderKey[2]; @@ -2037,10 +2059,8 @@ namespace OpenAuth.App.ServiceApp FlightId = flightId, TaskId = taskId, ParentKey = "0", - Name = string.IsNullOrEmpty(executeTask.TaskName) - ? timeStr - : $"{executeTask.TaskName} {timeStr}", - WorkspaceId = executeTask.WorkspaceId, + Name = $"{taskName} {timeStr}", + WorkspaceId = workspaceId, CreateTime = date, }; await Repository.AsSugarClient().Insertable(parent1).ExecuteCommandAsync(); @@ -2054,8 +2074,8 @@ namespace OpenAuth.App.ServiceApp if (mediaFile == null) { var type = 0; - var preSize = 5; - // todo 判断是不是图片 + var preSize = 1; + // 判断是不是图片 if (objectKey.EndsWith(".jpeg")) // todo 是否有其它类型的图片,待确定 { preSize = 65535; @@ -2082,7 +2102,8 @@ namespace OpenAuth.App.ServiceApp int width = 0, height = 0, focalLength = 0; int offset = 0, length = 0; string model = ""; - + float? gimbalRoll = 0, gimbalPitch = 0; + float? digitalZoomRatio = 1; var fileUrl = "http://" + _minioService.endPoint + "/" + _minioService._bucketName + "/" + objectKey; using (var httpClient = new HttpClient()) @@ -2098,24 +2119,42 @@ namespace OpenAuth.App.ServiceApp .GetAsync(fileUrl, HttpCompletionOption.ResponseHeadersRead).Result; if (response.StatusCode == HttpStatusCode.PartialContent) { - //Focal Length 35: 24 mm - //Exif Image Width: 4032 pixels : Exif SubIFD - //Exif Image Height: 3024 pixels : Exif SubIFD - // 3.1 解析Content-Range头(格式:bytes start-end/total) var contentRange = response.Content.Headers.ContentRange; if (contentRange != null) { fileSize = contentRange.Length.Value; - Console.WriteLine( - $"获取范围:{contentRange.From}-{contentRange.To}/{contentRange.Length}"); } if (objectKey.ToLower().EndsWith("jpeg")) { // 成功获取部分内容 var y = response.Content.ReadAsByteArrayAsync().Result; - MemoryStream ms = new MemoryStream(y); + var ms = new MemoryStream(y); var directories = ImageMetadataReader.ReadMetadata(ms); + // 获取 XMP 目录(包含 XMP 原始 XML 数据) + var xmpDirectory = directories.OfType().FirstOrDefault(); + if (xmpDirectory != null) + { + // 获取 XMP 的 XML 字符串(原始数据) + var xmpXml = xmpDirectory.GetXmpProperties(); + foreach (var keyValuePair in xmpXml) + { + switch (keyValuePair.Key) + { + // // drone-dji:GimbalPitchDegree: -90.00 + //drone-dji:GimbalReverse: 0 + //drone-dji:GimbalRollDegree: +180.00 + //drone-dji:GimbalYawDegree: -96.40 + case "drone-dji:GimbalPitchDegree": + gimbalPitch = float.Parse(keyValuePair.Value); + break; + case "drone-dji:GimbalRollDegree": + gimbalRoll = float.Parse(keyValuePair.Value); + break; + } + } + } + foreach (var directory in directories) { if (directory is ExifDirectoryBase) @@ -2133,8 +2172,14 @@ namespace OpenAuth.App.ServiceApp if (directory.Name.Equals("Exif SubIFD")) { + // Digital Zoom Ratio: 1 Exif SubIFD foreach (var tag in directory.Tags) { + if (tag.Name.Equals("Digital Zoom Ratio")) + { + digitalZoomRatio = float.Parse(tag.Description); + } + if (tag.Name.Equals("Exif Image Width")) { width = int.Parse(tag.Description.Replace("pixels", "") @@ -2205,6 +2250,7 @@ namespace OpenAuth.App.ServiceApp var createTime = string.IsNullOrEmpty(createdTimeStr) ? DateTime.Now : createdTimeStr.ToDateTime(); + // _logger.LogDebug("执行到保存媒体文件之前"); var fileUpload = new LasaMediaFile() { Id = Guid.NewGuid().ToString(), @@ -2223,7 +2269,7 @@ namespace OpenAuth.App.ServiceApp ObjectKey = data.file.object_key, Path = data.file.path, // 目前这个好像没有值 CreateTime = createTime, - WorkspaceId = executeTask.WorkspaceId, + WorkspaceId = workspaceId, ParentKey = folderKey[2], Tid = result.tid, Bid = result.bid, @@ -2236,9 +2282,12 @@ namespace OpenAuth.App.ServiceApp display = 1, FocalLength = focalLength, PayloadModelName = model, - Type = type + Type = type, + GimbalPitchDegree = gimbalPitch, + GimbalRollDegree = gimbalRoll, + DigitalZoomRatio = digitalZoomRatio }; - // todo 添加事务 + // 添加事务 await Repository.AsSugarClient().Insertable(fileUpload).ExecuteCommandAsync(); } @@ -2269,14 +2318,6 @@ namespace OpenAuth.App.ServiceApp ExpectedFileCount = expectFileCount, // 期望文件数量 UploadedFileCount = uploadedFileCount // 已上传文件数量 }; - // 当expectFileCount 等于uploadedFileCount时,则表示航线执行完成 - /* - if (uploadedFileCount.Equals(expectFileCount)) - { - taskRecord.Status = 5; // 成功状态 - } - */ - await Repository.AsSugarClient().Updateable(taskRecord) .IgnoreNullColumns().ExecuteCommandAsync(); diff --git a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs index 262d842..2487740 100644 --- a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs +++ b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs @@ -210,6 +210,7 @@ public class ConfigSubscribe : IJob // 文件上传 _logger.LogDebug("进入文件上传处理"); _logger.LogDebug($"文件上传处理:{message}"); + //飞行任务 0 指令飞行 1 int flightType = data.flight_task.flight_type; string flightId = data.file.ext.flight_id; // 关于flightId 没有值的问题怎么办??? @@ -270,7 +271,7 @@ public class ConfigSubscribe : IJob { var type = 0; var preSize = 1; - // todo 判断是不是图片 + // 判断是不是图片 if (objectKey.EndsWith(".jpeg")) // todo 是否有其它类型的图片,待确定 { preSize = 65535; @@ -450,7 +451,7 @@ public class ConfigSubscribe : IJob { Id = Guid.NewGuid().ToString(), FlightId = flightId, // 计划id - TaskId = taskAssign.TaskId, // 任务id + TaskId = taskId, // 任务id DroneModelKey = data.file.ext.drone_model_key, // 无人机型号 PayloadModelKey = data.file.ext.payload_model_key, //这应该可以标明是什么设置 IsOriginal = data.file.ext.is_original, From 38a1cddc29793611ce9b7f8024b45fac8ecf4a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Thu, 21 Aug 2025 15:12:37 +0800 Subject: [PATCH 08/10] =?UTF-8?q?bugfix:=20=E6=8C=87=E4=BB=A4=E6=8B=8D?= =?UTF-8?q?=E7=85=A7=E5=AA=92=E4=BD=93=E5=9B=BE=E7=89=87=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E6=AD=A3=E7=A1=AE=E7=9A=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs index 2487740..9b28248 100644 --- a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs +++ b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs @@ -242,6 +242,11 @@ public class ConfigSubscribe : IJob string objectKey = data.file.object_key; var folderKey = ((string)data.file.object_key).Split("/"); var parentKey = folderKey[2]; + if (flightType.Equals(1)) + { + parentKey = flightId; + } + var isExist = await _sqlSugarClient .Queryable() .Where(x => x.Id.Equals(parentKey)).CountAsync(); @@ -298,7 +303,7 @@ public class ConfigSubscribe : IJob int width = 0, height = 0, focalLength = 0; int offset = 0, length = 0; string model = ""; - float? gimbalRoll= 0, gimbalPitch=0; + float? gimbalRoll = 0, gimbalPitch = 0; float? digitalZoomRatio = 1; var fileUrl = "http://" + _minioService.endPoint + "/" + _minioService._bucketName + "/" + objectKey; @@ -355,7 +360,6 @@ public class ConfigSubscribe : IJob { if (directory is ExifDirectoryBase) { - if (directory.Name.Equals("Exif IFD0")) { foreach (var tag in directory.Tags) @@ -376,6 +380,7 @@ public class ConfigSubscribe : IJob { digitalZoomRatio = float.Parse(tag.Description); } + if (tag.Name.Equals("Exif Image Width")) { width = int.Parse(tag.Description.Replace("pixels", "") @@ -466,7 +471,7 @@ public class ConfigSubscribe : IJob Path = data.file.path, // 目前这个好像没有值 CreateTime = createTime, WorkspaceId = workspaceId, - ParentKey = folderKey[2], + ParentKey = parentKey, Tid = result.tid, Bid = result.bid, FlightType = flightType, From c68301af5c8d3678ffcb616154a32fa2034e8396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Thu, 21 Aug 2025 15:32:40 +0800 Subject: [PATCH 09/10] =?UTF-8?q?bugfix:=20=E6=8C=87=E4=BB=A4=E6=8B=8D?= =?UTF-8?q?=E7=85=A7=E5=AA=92=E4=BD=93=E5=9B=BE=E7=89=87=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E6=AD=A3=E7=A1=AE=E7=9A=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs index 9b28248..8a9f7f8 100644 --- a/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs +++ b/OpenAuth.App/ServiceApp/Subscribe/ConfigSubscribe.cs @@ -256,7 +256,7 @@ public class ConfigSubscribe : IJob var timeStr = date.ToString("yyyy-MM-dd HH:mm:ss"); var parent1 = new LasaMediaFile() { - Id = folderKey[2], + Id = parentKey, FlightId = flightId, TaskId = taskId, ParentKey = "0", From 75edf5807e0a2d53c891402ff5c7b26492ee274e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BC=9F?= <421281095@qq.com> Date: Thu, 21 Aug 2025 17:02:53 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=98=BB=E9=A3=9E?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/ServiceApp/ManageApp.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenAuth.App/ServiceApp/ManageApp.cs b/OpenAuth.App/ServiceApp/ManageApp.cs index 8cc8a07..fcb270b 100644 --- a/OpenAuth.App/ServiceApp/ManageApp.cs +++ b/OpenAuth.App/ServiceApp/ManageApp.cs @@ -915,6 +915,12 @@ namespace OpenAuth.App.ServiceApp break; } + // 如果未开始云端阻飞,或者未开启天气阻飞,改变天气阻飞默认阀值 + if (!workspace.IsWeatherBlockFlight || !workspace.IsCloudBlockFlight) + { + weatherWindSpeedThreshold = windSpeedThreshold; + } + // 1. 云端阻飞开启天气阻飞未开启 2. 云端阻飞未开启 3. 云端阻飞开启,天气阻飞开启 if (workspace.IsCloudBlockFlight) { @@ -2250,7 +2256,7 @@ namespace OpenAuth.App.ServiceApp var createTime = string.IsNullOrEmpty(createdTimeStr) ? DateTime.Now : createdTimeStr.ToDateTime(); - // _logger.LogDebug("执行到保存媒体文件之前"); + // _logger.LogDebug("执行到保存媒体文件之前"); var fileUpload = new LasaMediaFile() { Id = Guid.NewGuid().ToString(),