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