Compare commits
4 Commits
650f53df60
...
bd0d14ba6f
| Author | SHA1 | Date |
|---|---|---|
|
|
bd0d14ba6f | |
|
|
9398410000 | |
|
|
5214dac6a9 | |
|
|
50ce0633a6 |
|
|
@ -1,17 +1,23 @@
|
||||||
|
using System.Dynamic;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using OpenAuth.App.BaseApp.Base;
|
using OpenAuth.App.BaseApp.Base;
|
||||||
using OpenAuth.App.Interface;
|
using OpenAuth.App.Interface;
|
||||||
using OpenAuth.Repository;
|
using OpenAuth.Repository;
|
||||||
using OpenAuth.Repository.Domain;
|
using OpenAuth.Repository.Domain;
|
||||||
|
using OpenAuth.WebApi;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
||||||
namespace OpenAuth.App.ServiceApp;
|
namespace OpenAuth.App.ServiceApp;
|
||||||
|
|
||||||
public class LasaAircraftServiceApp : SqlSugarBaseApp<LasaAircraft, SugarDbContext>
|
public class LasaAircraftServiceApp : SqlSugarBaseApp<LasaAircraft, SugarDbContext>
|
||||||
{
|
{
|
||||||
public LasaAircraftServiceApp(ISugarUnitOfWork<SugarDbContext> unitWork,
|
private readonly MqttClientManager _mqttClientManager;
|
||||||
|
|
||||||
|
public LasaAircraftServiceApp(MqttClientManager mqttClientManager, ISugarUnitOfWork<SugarDbContext> unitWork,
|
||||||
ISimpleClient<LasaAircraft> repository, IAuth auth) : base(unitWork, repository, auth)
|
ISimpleClient<LasaAircraft> repository, IAuth auth) : base(unitWork, repository, auth)
|
||||||
{
|
{
|
||||||
|
_mqttClientManager = mqttClientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Response<bool>> AddLasaAircraft(LasaAircraft info)
|
public async Task<Response<bool>> AddLasaAircraft(LasaAircraft info)
|
||||||
|
|
@ -102,4 +108,39 @@ public class LasaAircraftServiceApp : SqlSugarBaseApp<LasaAircraft, SugarDbConte
|
||||||
Result = await Repository.GetByIdAsync(id)
|
Result = await Repository.GetByIdAsync(id)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<Response<bool>> StartLiveStreaming(string id)
|
||||||
|
{
|
||||||
|
var lasaAircraft = await Repository.GetByIdAsync(id);
|
||||||
|
// 主题参考thing/product/1581F8HGX254V00A0BUY/osd
|
||||||
|
dynamic data = new ExpandoObject();
|
||||||
|
data.method = "live_start_push";
|
||||||
|
data.data.url = ""; // todo
|
||||||
|
data.video_quality = 3; // "0":"自适应","1":"流畅","2":"标清","3":"高清","4":"超清"
|
||||||
|
// todo 发送消息
|
||||||
|
// todo 关于监听反馈消息
|
||||||
|
String sn = lasaAircraft.Sn;
|
||||||
|
await _mqttClientManager.PublishAsync("thing/aircraft/{sn}/service",
|
||||||
|
JsonConvert.SerializeObject(data));
|
||||||
|
return new Response<bool>
|
||||||
|
{
|
||||||
|
Result = true,
|
||||||
|
Message = "推流命令已发送"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Response<bool>> StopLiveStreaming(string id)
|
||||||
|
{
|
||||||
|
var lasaAircraft = await Repository.GetByIdAsync(id);
|
||||||
|
dynamic data = new ExpandoObject();
|
||||||
|
data.method = "live_start_push";
|
||||||
|
String sn = lasaAircraft.Sn;
|
||||||
|
await _mqttClientManager.PublishAsync("thing/aircraft/{sn}/service",
|
||||||
|
JsonConvert.SerializeObject(data));
|
||||||
|
return new Response<bool>
|
||||||
|
{
|
||||||
|
Result = true,
|
||||||
|
Message = "停止推流命令已发送"
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1232,7 +1232,7 @@ namespace OpenAuth.App.ServiceApp
|
||||||
.AsUpdateable(taskUpdate1)
|
.AsUpdateable(taskUpdate1)
|
||||||
.IgnoreNullColumns()
|
.IgnoreNullColumns()
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
return new Response<bool>(){Result = true};
|
return new Response<bool>() { Result = true };
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task PendingFlyTask(string taskId)
|
public async Task PendingFlyTask(string taskId)
|
||||||
|
|
@ -2884,7 +2884,8 @@ namespace OpenAuth.App.ServiceApp
|
||||||
int year = int.Parse(array[0]);
|
int year = int.Parse(array[0]);
|
||||||
int month = int.Parse(array[1]);
|
int month = int.Parse(array[1]);
|
||||||
start = new DateTime(year, month, 1);
|
start = new DateTime(year, month, 1);
|
||||||
end = start.AddMonths(1).AddMilliseconds(-1);;
|
end = start.AddMonths(1).AddMilliseconds(-1);
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
var taskHistoryList = await Repository.ChangeRepository<SugarRepositiry<LasaTaskHistory>>()
|
var taskHistoryList = await Repository.ChangeRepository<SugarRepositiry<LasaTaskHistory>>()
|
||||||
|
|
@ -2899,5 +2900,30 @@ namespace OpenAuth.App.ServiceApp
|
||||||
Result = taskHistoryList
|
Result = taskHistoryList
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<Response<dynamic>> ListDronePort(string lng, string lat)
|
||||||
|
{
|
||||||
|
var sql =
|
||||||
|
@$"WITH target_point AS ( SELECT ST_SetSRID ( ST_MakePoint ( '{lng}', '{lat}' ), 4326 ) AS geom )
|
||||||
|
SELECT
|
||||||
|
b.""Id"" AS DronePortId,
|
||||||
|
b.""Name"" AS DronePortName,
|
||||||
|
u.""Sn"",b.""GateWay"",
|
||||||
|
ST_AsText ( b.""WorkArea"" ) AS coverage_wkt,
|
||||||
|
ST_AsText ( tp.geom ) AS point_location
|
||||||
|
FROM
|
||||||
|
lasa_droneport b left join lasa_uav u on u.""PId"" = b.""Id"",
|
||||||
|
target_point tp
|
||||||
|
WHERE
|
||||||
|
ST_Covers ( b.""WorkArea"", tp.geom )
|
||||||
|
AND b.""IsDelete"" = 'false' and u.""IsDelete"" = 'false'
|
||||||
|
|
||||||
|
";
|
||||||
|
var x = await Repository.AsSugarClient().SqlQueryable<dynamic>(sql).ToListAsync();
|
||||||
|
return new Response<dynamic>
|
||||||
|
{
|
||||||
|
Result = x
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -64,6 +64,7 @@ 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/aircraft/+/service_reply" //大飞机推流消息
|
||||||
//"thing/product/+/osd",
|
//"thing/product/+/osd",
|
||||||
//"thing/product/+/status"
|
//"thing/product/+/status"
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ namespace OpenAuth.Repository.Domain
|
||||||
[SugarTable("lasa_droneport")]
|
[SugarTable("lasa_droneport")]
|
||||||
public class LasaDronePort
|
public class LasaDronePort
|
||||||
{
|
{
|
||||||
[SugarColumn(IsPrimaryKey = true)]
|
[SugarColumn(IsPrimaryKey = true)] public string Id { get; set; }
|
||||||
public string Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string TypeId { get; set; }
|
public string TypeId { get; set; }
|
||||||
public string SerialNumber { get; set; }
|
public string SerialNumber { get; set; }
|
||||||
|
|
@ -18,6 +17,7 @@ namespace OpenAuth.Repository.Domain
|
||||||
public string Sn { get; set; }
|
public string Sn { get; set; }
|
||||||
public string DevicePicUrl { get; set; }
|
public string DevicePicUrl { get; set; }
|
||||||
public string Did { get; set; }
|
public string Did { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Desc:是否删除
|
/// Desc:是否删除
|
||||||
/// Default:false
|
/// Default:false
|
||||||
|
|
@ -25,8 +25,13 @@ namespace OpenAuth.Repository.Domain
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(DefaultValue = "false")]
|
[SugarColumn(DefaultValue = "false")]
|
||||||
public bool IsDelete { get; set; }
|
public bool IsDelete { get; set; }
|
||||||
|
|
||||||
public string WorkSpaceId { get; set; }
|
public string WorkSpaceId { get; set; }
|
||||||
public string GateWay { get; set; }
|
public string GateWay { get; set; }
|
||||||
|
//
|
||||||
|
public string WorkArea { get; set; }
|
||||||
|
public int? Status { get; set; }
|
||||||
|
|
||||||
[Navigate(NavigateType.OneToMany, nameof(LasaUav.PId))]
|
[Navigate(NavigateType.OneToMany, nameof(LasaUav.PId))]
|
||||||
public List<LasaUav> UavList { get; set; }
|
public List<LasaUav> UavList { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,4 +76,14 @@ public class LasaAircraftController : ControllerBase
|
||||||
{
|
{
|
||||||
return await _app.GetLasaAircraft(id);
|
return await _app.GetLasaAircraft(id);
|
||||||
}
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<Response<bool>> StartLiveStreaming(string id)
|
||||||
|
{
|
||||||
|
return await _app.StartLiveStreaming(id);
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<Response<bool>> StopLiveStreaming(string id)
|
||||||
|
{
|
||||||
|
return await _app.StopLiveStreaming(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -966,7 +966,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
||||||
/// <param name="taskId"></param>
|
/// <param name="taskId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<Response<dynamic>> GetTaskHistoryList(string taskId,string date)
|
public async Task<Response<dynamic>> GetTaskHistoryList(string taskId, string date)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(taskId))
|
if (string.IsNullOrEmpty(taskId))
|
||||||
{
|
{
|
||||||
|
|
@ -976,7 +976,15 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
||||||
Message = "参数缺失"
|
Message = "参数缺失"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return await _app.GetTaskHistoryList(taskId,date);
|
|
||||||
|
return await _app.GetTaskHistoryList(taskId, date);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<Response<dynamic>> ListDronePort(string lng, string lat)
|
||||||
|
{
|
||||||
|
return await _app.ListDronePort(lng, lat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue