|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
using System.Dynamic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Infrastructure.Cache;
|
|
|
|
|
using Infrastructure.CloudSdk.minio;
|
|
|
|
|
using Infrastructure.CloudSdk.wayline;
|
|
|
|
|
using MQTTnet;
|
|
|
|
|
using MQTTnet.Client;
|
|
|
|
@ -19,15 +20,17 @@ public class ConfigSubscribe : IJob
|
|
|
|
|
private readonly ISqlSugarClient _sqlSugarClient;
|
|
|
|
|
private readonly RedisCacheContext _redisCacheContext;
|
|
|
|
|
private readonly ManageApp _manageApp;
|
|
|
|
|
private readonly MinioService _minioService;
|
|
|
|
|
private object _locker = new();
|
|
|
|
|
|
|
|
|
|
public ConfigSubscribe(MqttClientManager mqttClientManager, ISqlSugarClient sqlSugarClient,
|
|
|
|
|
ICacheContext redisCacheContext, ManageApp manageApp)
|
|
|
|
|
ICacheContext redisCacheContext, ManageApp manageApp, MinioService minioService)
|
|
|
|
|
{
|
|
|
|
|
_mqttClientManager = mqttClientManager;
|
|
|
|
|
_sqlSugarClient = sqlSugarClient;
|
|
|
|
|
_redisCacheContext = redisCacheContext as RedisCacheContext;
|
|
|
|
|
_manageApp = manageApp;
|
|
|
|
|
_minioService = minioService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task Subscribe()
|
|
|
|
@ -104,27 +107,29 @@ public class ConfigSubscribe : IJob
|
|
|
|
|
// "need_reply":0,"tid":"50e8102c-da72-42b1-a899-a82a519456d9",
|
|
|
|
|
// "timestamp":1750575776430,
|
|
|
|
|
// "gateway":"8UUXN5400A079H"}
|
|
|
|
|
//todo 配置中读取minio配置
|
|
|
|
|
// 配置中读取minio配置
|
|
|
|
|
var storageConfigRequest = new TopicServicesRequest<object>()
|
|
|
|
|
{
|
|
|
|
|
method = "storage_config_get",
|
|
|
|
|
tid = result.tid,
|
|
|
|
|
bid = result.bid,
|
|
|
|
|
timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
|
|
|
|
|
|
|
|
|
|
data = new
|
|
|
|
|
{
|
|
|
|
|
result = 0,
|
|
|
|
|
output = new
|
|
|
|
|
{
|
|
|
|
|
bucket = "test",
|
|
|
|
|
endpoint = "http://175.27.168.120:6013",
|
|
|
|
|
bucket = _minioService._bucketName,
|
|
|
|
|
// todo 这里待确定
|
|
|
|
|
endpoint = $"http://{_minioService.endPoint}",
|
|
|
|
|
object_key_prefix = Guid.NewGuid().ToString(), // todo 是否设计任务id ?
|
|
|
|
|
provider = "minio",
|
|
|
|
|
region = "linyi",
|
|
|
|
|
credentials = new
|
|
|
|
|
{
|
|
|
|
|
access_key_id = "minioadmin",
|
|
|
|
|
access_key_secret = "minioadmin",
|
|
|
|
|
access_key_id = _minioService.AccessKey,
|
|
|
|
|
access_key_secret = _minioService.SecretKey,
|
|
|
|
|
expire = 7200,
|
|
|
|
|
security_token = ""
|
|
|
|
|
}
|
|
|
|
@ -226,15 +231,14 @@ public class ConfigSubscribe : IJob
|
|
|
|
|
await _sqlSugarClient.Insertable(fileUpload).ExecuteCommandAsync();
|
|
|
|
|
var expectFileCount = data.flight_task.expected_file_count;
|
|
|
|
|
var uploadedFileCount = data.flight_task.uploaded_file_count;
|
|
|
|
|
string taskId = _manageApp.GetTaskAssignByFlightId(data.flight_task.id).TaskId;
|
|
|
|
|
string taskId = _manageApp.GetTaskAssignByFlightId(flightId).TaskId;
|
|
|
|
|
var taskRecord = new LasaTask()
|
|
|
|
|
{
|
|
|
|
|
Id = taskId,
|
|
|
|
|
ExpectedFileCount = expectFileCount,
|
|
|
|
|
UploadedFileCount = uploadedFileCount
|
|
|
|
|
ExpectedFileCount = expectFileCount, // 期望文件数量
|
|
|
|
|
UploadedFileCount = uploadedFileCount // 已上传文件数量
|
|
|
|
|
};
|
|
|
|
|
await _sqlSugarClient.Updateable(taskRecord)
|
|
|
|
|
.Where(t => t.FlightId == fileUpload.FlightId)
|
|
|
|
|
.IgnoreNullColumns().ExecuteCommandAsync();
|
|
|
|
|
break;
|
|
|
|
|
case "release_terminal_control_area":
|
|
|
|
|