编辑无人机,添加状态查询
parent
872b71253a
commit
b3f3c79f70
|
|
@ -29,5 +29,6 @@ namespace OpenAuth.Repository.Domain
|
|||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "false")]
|
||||
public bool IsDelete { get; set; }
|
||||
public string WorkSpaceId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ namespace OpenAuth.WebApi.Model.mqtt
|
|||
$"thing/product/{gateway}/osd",
|
||||
$"thing/product/{gateway}/events",
|
||||
$"thing/product/{gateway}/requests",
|
||||
$"thing/product/{gateway}/services_reply"
|
||||
$"thing/product/{gateway}/services_reply",
|
||||
$"thing/product/{gateway}/state"
|
||||
});
|
||||
}
|
||||
await _mqttCenter.ConnectAndSubscribeAsync(topics.ToArray());
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ namespace OpenAuth.WebApi.Model.mqtt
|
|||
{
|
||||
device_callsign = "山东慧创",
|
||||
is_device_bind_organization = true,
|
||||
organization_id = "379",
|
||||
organization_id = "371300",
|
||||
organization_name = "山东慧创",
|
||||
sn = sn
|
||||
}).ToArray();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
using Infrastructure.CloudSdk.mqttmessagecenter;
|
||||
using OpenAuth.App.ServiceApp;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace OpenAuth.WebApi.Model.mqtt
|
||||
{
|
||||
public class ThingStateHandler : IMqttMessageHandler
|
||||
{
|
||||
private readonly ILogger<ThingStateHandler> _logger;
|
||||
AirportMaintenanceApp _app;
|
||||
public ThingStateHandler(ILogger<ThingStateHandler> logger, AirportMaintenanceApp app)
|
||||
{
|
||||
_logger = logger;
|
||||
_app = app;
|
||||
}
|
||||
|
||||
public bool CanHandle(string topic)
|
||||
{
|
||||
return topic.Contains("/state");
|
||||
}
|
||||
|
||||
public Task HandleAsync(string topic, string payload)
|
||||
{
|
||||
_logger.LogError($"[Service] Topic={topic}, Payload={payload}");
|
||||
Console.WriteLine($"[Service] Topic={topic}, Payload={payload}");
|
||||
var root = JsonNode.Parse(payload)?.AsObject();
|
||||
_app.AddLog(new LasaLog
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
Topic = topic,
|
||||
Method = root["method"]?.ToString() ?? "",
|
||||
CreateTime = DateTime.Now,
|
||||
Data = root
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -254,16 +254,16 @@ namespace OpenAuth.WebApi
|
|||
StaticConfig.CustomSnowFlakeFunc = () => { return YitIdHelper.NextId(); };
|
||||
|
||||
var sqlSugar = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
DbType = DbType.PostgreSQL,
|
||||
ConnectionString = Configuration.GetConnectionString("OpenAuthDBContext"),
|
||||
IsAutoCloseConnection = true,
|
||||
MoreSettings = new ConnMoreSettings()
|
||||
{
|
||||
DbType = DbType.PostgreSQL,
|
||||
ConnectionString = Configuration.GetConnectionString("OpenAuthDBContext"),
|
||||
IsAutoCloseConnection = true,
|
||||
MoreSettings = new ConnMoreSettings()
|
||||
{
|
||||
PgSqlIsAutoToLower = false,
|
||||
PgSqlIsAutoToLowerCodeFirst = false
|
||||
}
|
||||
},
|
||||
PgSqlIsAutoToLower = false,
|
||||
PgSqlIsAutoToLowerCodeFirst = false
|
||||
}
|
||||
},
|
||||
|
||||
//var sqlSugar = new SqlSugarClient(new ConnectionConfig()
|
||||
//{
|
||||
|
|
@ -327,11 +327,10 @@ namespace OpenAuth.WebApi
|
|||
|
||||
#region mqtt
|
||||
services.AddSingleton<MqttMessageCenter>();
|
||||
//services.AddSingleton<IMqttMessageHandler, ThingRequestHandler>();
|
||||
services.AddSingleton<IMqttMessageHandler, ThingRequestHandler>();
|
||||
services.AddSingleton<IMqttMessageHandler, ThingServiceHandler>();
|
||||
//services.AddSingleton<IMqttMessageHandler, ThingOsdHandler>();
|
||||
//services.AddSingleton<IMqttMessageHandler, ThingEventHandler>();
|
||||
|
||||
services.AddSingleton<IMqttMessageHandler, ThingOsdHandler>();
|
||||
services.AddSingleton<IMqttMessageHandler, ThingEventHandler>();
|
||||
services.AddHostedService<MqttHostedService>();
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue