指令拍摄照片查询返回数据结构修改

main
陈伟 2 months ago
parent 91961e63de
commit a83596d2d8

@ -0,0 +1,24 @@
namespace OpenAuth.App.ServiceApp.FlyTask.Response;
public class CommandPictureResponse
{
public bool Issuccess { get; set; }
public byte[] imgBlob { get; set; }
public ExtData zpkzxx { get; set; }
}
public class ExtData
{
public float? lon { get; set; }
public float? lat { get; set; }
public float? yaw { get; set; }
public int pitch { get; set; }
public int roll { get; set; }
public DateTime? time { get; set; }
public double height { get; set; }
public long imgWidth { get; set; }
public long imgHeight { get; set; }
public long imgOriginWidth { get; set; }
public long imgOriginHeight { get; set; }
public double psjj { get; set; }
}

@ -1,3 +1,4 @@
using System.Drawing;
using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Wordprocessing;
using Infrastructure;
@ -19,9 +20,12 @@ using OpenAuth.WebApi.CloudSdk;
using SqlSugar;
using System.Dynamic;
using System.Text;
using Hopetry.App.Common;
using NPOI.HSSF.Record;
using OpenAuth.App.Request;
using OpenAuth.App.ServiceApp.AirLine.Request;
using OpenAuth.App.ServiceApp.FlyTask.Response;
using Image = NetModular.DocX.Core.Image;
namespace OpenAuth.App.ServiceApp
{
@ -1519,7 +1523,7 @@ namespace OpenAuth.App.ServiceApp
return rootNodes;
}
public async Task<Response<LasaMediaFile>> GetTaskPicList(string flightId, long timestamp)
public async Task<Response<CommandPictureResponse>> GetTaskPicList(string flightId, long timestamp)
{
var lasaMediaFile = await Repository.ChangeRepository<SugarRepositiry<LasaMediaFile>>()
.AsQueryable()
@ -1529,18 +1533,54 @@ namespace OpenAuth.App.ServiceApp
.SingleAsync();
if (lasaMediaFile == null)
{
return new Response<LasaMediaFile>()
return new Response<CommandPictureResponse>()
{
Result = new LasaMediaFile()
Result = new CommandPictureResponse()
};
}
lasaMediaFile.PicLink = "http://" + _minioService.endPoint + "/" + _minioService._bucketName + "/" +
lasaMediaFile.ObjectKey;
return new Response<LasaMediaFile>()
/*lasaMediaFile.PicLink = "http://" + _minioService.endPoint + "/" + _minioService._bucketName + "/" +
lasaMediaFile.ObjectKey;*/
var tempPath = Path.Combine(Path.GetTempPath(),"lasa");
if (!Directory.Exists(tempPath))
{
Result = lasaMediaFile
Directory.CreateDirectory(tempPath);
}
await _minioService
.DownLoadObject(_minioService._bucketName, lasaMediaFile.ObjectKey, tempPath, "");
var picPath = Path.Combine(tempPath, lasaMediaFile.ObjectKey);
var dimensions = GetImageDimensions(picPath);
return new Response<CommandPictureResponse>()
{
Result = new CommandPictureResponse()
{
Issuccess = true,
// minio 下载图片,并取得图片二进制数据
imgBlob = await File.ReadAllBytesAsync(picPath),
zpkzxx = new ExtData()
{
imgHeight = dimensions.height,
imgWidth = dimensions.width,
imgOriginHeight = dimensions.height,
imgOriginWidth = dimensions.width,
psjj = 0, // 等效焦距
time = lasaMediaFile.CreateTime,
height = lasaMediaFile.Height,
lon = lasaMediaFile.Lng,
lat = lasaMediaFile.Lat,
pitch = 0,
roll = 0,
yaw = lasaMediaFile.GimbalYawDegree
}
}
};
}
public (int width, int height) GetImageDimensions(string imagePath)
{
using (var bmp = new Bitmap(imagePath))
{
return (bmp.Width, bmp.Height);
}
}
}
}

@ -8,6 +8,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using OpenAuth.App.ServiceApp;
using OpenAuth.App.ServiceApp.AirLine.Request;
using OpenAuth.App.ServiceApp.FlyTask.Response;
using OpenAuth.App.ServiceApp.Request;
using OpenAuth.App.ServiceApp.Response;
using OpenAuth.Repository.Domain;
@ -259,7 +260,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<Response<LasaMediaFile>> GetTaskPicList(string flightId, long timestamp)
public async Task<Response<CommandPictureResponse>> GetTaskPicList(string flightId, long timestamp)
{
return await _app.GetTaskPicList(flightId, timestamp);
}

Loading…
Cancel
Save