diff --git a/Infrastructure/CloudSdk/minio/MinioService.cs b/Infrastructure/CloudSdk/minio/MinioService.cs index afb4b3c..644971b 100644 --- a/Infrastructure/CloudSdk/minio/MinioService.cs +++ b/Infrastructure/CloudSdk/minio/MinioService.cs @@ -209,7 +209,7 @@ public class MinioService .WithContentType("application/octet-stream"); //.WithContentType(file.ContentType); await _minioClient.PutObjectAsync(putArgs); - return UseSSL ? "https://" : "http://" + endPoint + "/" + bucketName + "/" + objectName; + return "http://" + endPoint + "/" + bucketName + "/" + objectName; } catch (Exception ex) { diff --git a/OpenAuth.App/BaseApp/Subscribe/ConfigSubscribe.cs b/OpenAuth.App/BaseApp/Subscribe/ConfigSubscribe.cs index 85a0f04..53202fd 100644 --- a/OpenAuth.App/BaseApp/Subscribe/ConfigSubscribe.cs +++ b/OpenAuth.App/BaseApp/Subscribe/ConfigSubscribe.cs @@ -41,7 +41,9 @@ public class ConfigSubscribe : IJob { "thing/product/+/services_reply", "thing/product/+/events", - "thing/product/+/requests" + "thing/product/+/requests", + "thing/product/+/osd", + "thing/product/+/status" }; await _mqttClientManager @@ -121,8 +123,7 @@ public class ConfigSubscribe : IJob output = new { bucket = _minioService._bucketName, - // todo 这里待确定 - endpoint = $"http://{_minioService.endPoint}", + endpoint = $"{_minioService.endPoint}", object_key_prefix = Guid.NewGuid().ToString(), // todo 是否设计任务id ? provider = "minio", region = "linyi", @@ -240,6 +241,11 @@ public class ConfigSubscribe : IJob ExpectedFileCount = expectFileCount, // 期望文件数量 UploadedFileCount = uploadedFileCount // 已上传文件数量 }; + // 当expectFileCount 等于uploadedFileCount时,则表示航线执行完成 + if (uploadedFileCount.Equals(expectFileCount)) + { + taskRecord.Status = 5; // 成功状态 + } await _sqlSugarClient.Updateable(taskRecord) .IgnoreNullColumns().ExecuteCommandAsync(); break; @@ -303,7 +309,7 @@ public class ConfigSubscribe : IJob switch (method) { case "flighttask_prepare": // 下发任务响应 - // todo 同一prepare消息只能处理一次 + // 顺序处理,多余的不再处理 lock (_locker) { // 报错处理 @@ -396,7 +402,9 @@ public class ConfigSubscribe : IJob await _sqlSugarClient.Updateable(taskRecordExecute).IgnoreNullColumns().ExecuteCommandAsync(); break; } - + break; + case "thing/product/*/osd": + Console.WriteLine($"osd消息: {message}"); break; default: Console.WriteLine($"未进入主题处理"); diff --git a/OpenAuth.App/ServiceApp/ManageApp.cs b/OpenAuth.App/ServiceApp/ManageApp.cs index 237d4b6..0cfc44a 100644 --- a/OpenAuth.App/ServiceApp/ManageApp.cs +++ b/OpenAuth.App/ServiceApp/ManageApp.cs @@ -275,8 +275,6 @@ namespace OpenAuth.App.ServiceApp { using (var db = UnitWork.CreateContext()) { - if (db.LasaUav.GetFirst(r => r.Sn == info.Sn) != null) - return false; var flag = db.LasaUav.Insert(info); if (db.Commit()) return true; @@ -1023,6 +1021,64 @@ namespace OpenAuth.App.ServiceApp }; } + public async Task>> GetTAskImageList(string taskId) + { + var list = await Repository + .ChangeRepository>() + .AsQueryable() + .Where(r => r.TaskId == taskId) + .ToListAsync(); + return new Response>() + { + Result = list + }; + } + + public async Task> StartDronePortLive(string streamUrl) + { + var request = new + { + tid = Guid.NewGuid().ToString(), + bid = Guid.NewGuid().ToString(), + timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + method = "live_start_push", + data = new + { + url = streamUrl, + url_type = 1, + // 8UUXN5400A079H/165-0-7/normal-0 + video_id = "8UUXN5400A079H/165-0-7/normal-0", + video_quality = 1, + } + }; + //thing/product/{gateway_sn}/services + await _mqttClientManager.PublishAsync("thing/product/8UUXN5400A079H/services", JsonConvert.SerializeObject(request)); + return new Response() + { + Result = true + }; + } + + public async Task> StopDronePortLive(string streamUrl) + { + var request = new + { + tid = Guid.NewGuid().ToString(), + bid = Guid.NewGuid().ToString(), + timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + method = "live_stop_push", + data = new + { + video_id = "8UUXN5400A079H/165-0-7/normal-0" + } + }; + await _mqttClientManager.PublishAsync("thing/product/8UUXN5400A079H/services", JsonConvert.SerializeObject(request)); + return new Response() + { + Result = true + }; + } + #region 基本信息统计 public async Task> GetBasicInfo() { diff --git a/OpenAuth.Repository/Domain/LasaTask.cs b/OpenAuth.Repository/Domain/LasaTask.cs index fe7afea..50c3d83 100644 --- a/OpenAuth.Repository/Domain/LasaTask.cs +++ b/OpenAuth.Repository/Domain/LasaTask.cs @@ -65,7 +65,7 @@ namespace OpenAuth.Repository.Domain public string AIInspection { get; set; } /// - /// 状态 0-待执行任务 1-任务执行中 2-任务执行失败 3. 任务挂起(挂起的任务超时后,怎么处理?) + /// 状态 0-待执行任务 1-任务执行中 2-任务执行失败 3. 任务挂起(挂起的任务超时后,怎么处理?) 5. 成功 /// public int Status { get; set; } diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs index 0fbdd6d..43dde0e 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs @@ -256,6 +256,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers return result; } + /// /// 航线详情 /// @@ -480,6 +481,40 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers await _app.PendingFlyTask(taskId); } + /// + /// 任务图片列表查询 + /// + /// + /// + [HttpGet] + [AllowAnonymous] + public async Task>> GetTAskImageList(string taskId) + { + return await _app.GetTAskImageList(taskId); + } + /// + /// 开启机场直播(测试使用) + /// + /// + /// + [HttpPost] + [AllowAnonymous] + public async Task> StartDronePortLive(string streamUrl) + { + return await _app.StartDronePortLive(streamUrl); + } + /// + /// 测试使用 + /// + /// + /// + [HttpPost] + [AllowAnonymous] + public async Task> StopDronePortLive(string streamUrl) + { + return await _app.StopDronePortLive(streamUrl); + } + [HttpPost] [AllowAnonymous] public async Task TestExecuteFlyTask(string flightid)