zhangbin 2025-07-08 11:08:35 +08:00
commit 49c0f3aa5e
5 changed files with 108 additions and 9 deletions

View File

@ -209,7 +209,7 @@ public class MinioService
.WithContentType("application/octet-stream"); .WithContentType("application/octet-stream");
//.WithContentType(file.ContentType); //.WithContentType(file.ContentType);
await _minioClient.PutObjectAsync(putArgs); await _minioClient.PutObjectAsync(putArgs);
return UseSSL ? "https://" : "http://" + endPoint + "/" + bucketName + "/" + objectName; return "http://" + endPoint + "/" + bucketName + "/" + objectName;
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -41,7 +41,9 @@ public class ConfigSubscribe : IJob
{ {
"thing/product/+/services_reply", "thing/product/+/services_reply",
"thing/product/+/events", "thing/product/+/events",
"thing/product/+/requests" "thing/product/+/requests",
"thing/product/+/osd",
"thing/product/+/status"
}; };
await _mqttClientManager await _mqttClientManager
@ -121,8 +123,7 @@ public class ConfigSubscribe : IJob
output = new output = new
{ {
bucket = _minioService._bucketName, bucket = _minioService._bucketName,
// todo 这里待确定 endpoint = $"{_minioService.endPoint}",
endpoint = $"http://{_minioService.endPoint}",
object_key_prefix = Guid.NewGuid().ToString(), // todo 是否设计任务id object_key_prefix = Guid.NewGuid().ToString(), // todo 是否设计任务id
provider = "minio", provider = "minio",
region = "linyi", region = "linyi",
@ -240,6 +241,11 @@ public class ConfigSubscribe : IJob
ExpectedFileCount = expectFileCount, // 期望文件数量 ExpectedFileCount = expectFileCount, // 期望文件数量
UploadedFileCount = uploadedFileCount // 已上传文件数量 UploadedFileCount = uploadedFileCount // 已上传文件数量
}; };
// 当expectFileCount 等于uploadedFileCount时则表示航线执行完成
if (uploadedFileCount.Equals(expectFileCount))
{
taskRecord.Status = 5; // 成功状态
}
await _sqlSugarClient.Updateable(taskRecord) await _sqlSugarClient.Updateable(taskRecord)
.IgnoreNullColumns().ExecuteCommandAsync(); .IgnoreNullColumns().ExecuteCommandAsync();
break; break;
@ -303,7 +309,7 @@ public class ConfigSubscribe : IJob
switch (method) switch (method)
{ {
case "flighttask_prepare": // 下发任务响应 case "flighttask_prepare": // 下发任务响应
// todo 同一prepare消息只能处理一次 // 顺序处理,多余的不再处理
lock (_locker) lock (_locker)
{ {
// 报错处理 // 报错处理
@ -396,7 +402,9 @@ public class ConfigSubscribe : IJob
await _sqlSugarClient.Updateable(taskRecordExecute).IgnoreNullColumns().ExecuteCommandAsync(); await _sqlSugarClient.Updateable(taskRecordExecute).IgnoreNullColumns().ExecuteCommandAsync();
break; break;
} }
break;
case "thing/product/*/osd":
Console.WriteLine($"osd消息: {message}");
break; break;
default: default:
Console.WriteLine($"未进入主题处理"); Console.WriteLine($"未进入主题处理");

View File

@ -275,8 +275,6 @@ namespace OpenAuth.App.ServiceApp
{ {
using (var db = UnitWork.CreateContext()) using (var db = UnitWork.CreateContext())
{ {
if (db.LasaUav.GetFirst(r => r.Sn == info.Sn) != null)
return false;
var flag = db.LasaUav.Insert(info); var flag = db.LasaUav.Insert(info);
if (db.Commit()) if (db.Commit())
return true; return true;
@ -1023,6 +1021,64 @@ namespace OpenAuth.App.ServiceApp
}; };
} }
public async Task<Response<List<LasaMediaFile>>> GetTAskImageList(string taskId)
{
var list = await Repository
.ChangeRepository<SugarRepositiry<LasaMediaFile>>()
.AsQueryable()
.Where(r => r.TaskId == taskId)
.ToListAsync();
return new Response<List<LasaMediaFile>>()
{
Result = list
};
}
public async Task<Response<bool>> 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<bool>()
{
Result = true
};
}
public async Task<Response<bool>> 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<bool>()
{
Result = true
};
}
#region 基本信息统计 #region 基本信息统计
public async Task<Response<JObject>> GetBasicInfo() public async Task<Response<JObject>> GetBasicInfo()
{ {

View File

@ -65,7 +65,7 @@ namespace OpenAuth.Repository.Domain
public string AIInspection { get; set; } public string AIInspection { get; set; }
/// <summary> /// <summary>
/// 状态 0-待执行任务 1-任务执行中 2-任务执行失败 3. 任务挂起(挂起的任务超时后,怎么处理?) /// 状态 0-待执行任务 1-任务执行中 2-任务执行失败 3. 任务挂起(挂起的任务超时后,怎么处理?) 5. 成功
/// </summary> /// </summary>
public int Status { get; set; } public int Status { get; set; }

View File

@ -256,6 +256,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
return result; return result;
} }
/// <summary> /// <summary>
/// 航线详情 /// 航线详情
/// </summary> /// </summary>
@ -480,6 +481,40 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
await _app.PendingFlyTask(taskId); await _app.PendingFlyTask(taskId);
} }
/// <summary>
/// 任务图片列表查询
/// </summary>
/// <param name="taskId"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<Response<List<LasaMediaFile>>> GetTAskImageList(string taskId)
{
return await _app.GetTAskImageList(taskId);
}
/// <summary>
/// 开启机场直播(测试使用)
/// </summary>
/// <param name="streamUrl"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<Response<bool>> StartDronePortLive(string streamUrl)
{
return await _app.StartDronePortLive(streamUrl);
}
/// <summary>
/// 测试使用
/// </summary>
/// <param name="streamUrl"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<Response<bool>> StopDronePortLive(string streamUrl)
{
return await _app.StopDronePortLive(streamUrl);
}
[HttpPost] [HttpPost]
[AllowAnonymous] [AllowAnonymous]
public async Task<string> TestExecuteFlyTask(string flightid) public async Task<string> TestExecuteFlyTask(string flightid)