diff --git a/Infrastructure/CloudSdk/minio/MinioService.cs b/Infrastructure/CloudSdk/minio/MinioService.cs index 24c63e0..c41e6be 100644 --- a/Infrastructure/CloudSdk/minio/MinioService.cs +++ b/Infrastructure/CloudSdk/minio/MinioService.cs @@ -158,6 +158,7 @@ public class MinioService { objectName = objectName.Replace($"http://{endPoint}/{_bucketName}/", ""); } + var deleteargs = new RemoveObjectArgs().WithBucket(_bucketName).WithObject(objectName); await _minioClient.RemoveObjectAsync(deleteargs); Console.WriteLine($"File {objectName} deleted."); @@ -169,6 +170,11 @@ public class MinioService } public async Task UploadFile(IFormFile file, string bucketName) + { + return await UploadFile(file, bucketName, ""); + } + + public async Task UploadFile(IFormFile file, string bucketName, string prifix) { try { @@ -188,7 +194,16 @@ public class MinioService } var suffix = Path.GetExtension(file.FileName); - var objectName = $"{GenerateId.GenerateOrderNumber()}{suffix}"; + string objectName; + if (string.IsNullOrEmpty(prifix)) + { + objectName = $"{GenerateId.GenerateOrderNumber()}{suffix}"; + } + else + { + objectName = $"{prifix}/{GenerateId.GenerateOrderNumber()}{suffix}"; + } + // 使用内存流上传 using var stream = new MemoryStream(); await file.CopyToAsync(stream); @@ -207,8 +222,9 @@ public class MinioService }) .WithContentType("application/octet-stream"); //.WithContentType(file.ContentType); - await _minioClient.PutObjectAsync(putArgs); - return "http://" + endPoint + "/" + bucketName + "/" + objectName; + var result = await _minioClient.PutObjectAsync(putArgs); + Console.WriteLine("code :" + result.ResponseStatusCode); + return "http://" + endPoint + "/" + bucketName + "/" + objectName; } catch (Exception ex) { diff --git a/OpenAuth.App/ServiceApp/AirLine/Request/AirLineListRequestPage.cs b/OpenAuth.App/ServiceApp/AirLine/Request/AirLineListRequestPage.cs index fa6ab29..b4dab30 100644 --- a/OpenAuth.App/ServiceApp/AirLine/Request/AirLineListRequestPage.cs +++ b/OpenAuth.App/ServiceApp/AirLine/Request/AirLineListRequestPage.cs @@ -20,4 +20,6 @@ public class AirLineListRequestPage : PageReq /// 航线名称 /// public string AirLineName { get; set; } + + public string Folder { get; set; } } \ No newline at end of file diff --git a/OpenAuth.App/ServiceApp/ManageApp.cs b/OpenAuth.App/ServiceApp/ManageApp.cs index 89c5012..9bf5a17 100644 --- a/OpenAuth.App/ServiceApp/ManageApp.cs +++ b/OpenAuth.App/ServiceApp/ManageApp.cs @@ -504,6 +504,7 @@ namespace OpenAuth.App.ServiceApp .WhereIF(!string.IsNullOrEmpty(req.key), a => a.AirLineName.Contains(req.key)) .WhereIF(!string.IsNullOrEmpty(req.AirLineName), a => a.AirLineName.Contains(req.AirLineName)) .WhereIF(!string.IsNullOrEmpty(req.AirLineType), a => a.AirLineType.Equals(req.AirLineType)) + .WhereIF(!string.IsNullOrEmpty(req.Folder), (a) => a.Folder.Equals(req.Folder)) .OrderByIF(true, a => a.CreateTime, req.Ascending ? OrderByType.Asc : OrderByType.Desc) .ToPageListAsync(req.page, req.limit, totalCount); return new Response>> @@ -948,9 +949,9 @@ namespace OpenAuth.App.ServiceApp throw new NotImplementedException(); } - public Task UploadFile(IFormFile xmlFile) + public Task UploadFile(IFormFile xmlFile, string folder) { - return _minioService.UploadFile(xmlFile, ""); + return _minioService.UploadFile(xmlFile, "", folder); } #region 添加地图作业区域 @@ -1403,7 +1404,7 @@ namespace OpenAuth.App.ServiceApp #endregion - public async Task> CreateAirLoneFolder(string folderName, string parentId) + public async Task> CreateAirLineFolder(string folderName, string parentId) { LasaLineFolder folder = new LasaLineFolder() { diff --git a/OpenAuth.Repository/Domain/LasaAirLine.cs b/OpenAuth.Repository/Domain/LasaAirLine.cs index 72d1d52..52da2c5 100644 --- a/OpenAuth.Repository/Domain/LasaAirLine.cs +++ b/OpenAuth.Repository/Domain/LasaAirLine.cs @@ -11,25 +11,28 @@ namespace OpenAuth.Repository.Domain public class LasaAirLine { [SugarColumn(IsPrimaryKey = true, ColumnName = "Id")] - public string Id { get; set; } // 主键 - public string AirLineName { get; set; } // 航线名称 - public string AirLineType { get; set; } // 航线类型 - public string UavId { get; set; } // 无人机 ID - public string FlyToFirstPointMode { get; set; } // 飞向首航点模式 - public int SafeTakeoffAltitude { get; set; } // 安全起飞高度 - public int SafeTakeoffSpeed { get; set; } // 飞向首航点速度 - public double GlobalRouteSpeed { get; set; } // 全局航线速度 - public string TaskCompletionAction { get; set; } // 任务完成动作 - public string OutOfControlOption { get; set; } // 失控选项 - public string TypeOfOutOfControlAction { get; set; } // 失控动作类型 - public string GlobalWayPointType { get; set; } // 全局航点类型 - public string PTZControlMode { get; set; } // 云台控制模式 - public string AircraftYawAngleMode { get; set; } // 飞行器偏航角模式 - public DateTime? CreateTime { get; set; } // 创建时间 - public long CreateId { get; set; } // 创建人 + public string Id { get; set; } // 主键 + + public string AirLineName { get; set; } // 航线名称 + public string AirLineType { get; set; } // 航线类型 + public string UavId { get; set; } // 无人机 ID + public string FlyToFirstPointMode { get; set; } // 飞向首航点模式 + public int SafeTakeoffAltitude { get; set; } // 安全起飞高度 + public int SafeTakeoffSpeed { get; set; } // 飞向首航点速度 + public double GlobalRouteSpeed { get; set; } // 全局航线速度 + public string TaskCompletionAction { get; set; } // 任务完成动作 + public string OutOfControlOption { get; set; } // 失控选项 + public string TypeOfOutOfControlAction { get; set; } // 失控动作类型 + public string GlobalWayPointType { get; set; } // 全局航点类型 + public string PTZControlMode { get; set; } // 云台控制模式 + public string AircraftYawAngleMode { get; set; } // 飞行器偏航角模式 + public DateTime? CreateTime { get; set; } // 创建时间 + public long CreateId { get; set; } // 创建人 public string WPML { get; set; } // WPML 航线文件地址 - + public float? TaskOffLng { get; set; } public float? TaskOffLat { get; set; } + + public string Folder { get; set; } } -} +} \ No newline at end of file diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs index 1897655..fe7b226 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs @@ -258,9 +258,9 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers // todo 删除文件夹 // todo 文件夹列表 [HttpPost] - public async Task> CreateAirLoneFolder(string folderName, string parentId) + public async Task> CreateAirLineFolder(string folderName, string parentId) { - return await _app.CreateAirLoneFolder(folderName, parentId); + return await _app.CreateAirLineFolder(folderName, parentId); } /// @@ -344,20 +344,19 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers { return await _app.DeleteAirLine(id); } - - // todo 已有的文件如何处理? /// /// 上传航线文件 /// - /// + /// kmz文件 + /// 文件夹 /// [HttpPost("upload")] [AllowAnonymous] - public async Task UploadXmlFile(IFormFile xmlFile) + public async Task UploadXmlFile(IFormFile xmlFile,string folder) { if (xmlFile == null || xmlFile.Length == 0) return BadRequest("文件为空"); - var path = await _app.UploadFile(xmlFile); + var path = await _app.UploadFile(xmlFile,folder); return Ok(new { message = "上传成功", path }); } /*///