媒体图片查询修改
parent
3db8084de7
commit
0386d45ac4
|
|
@ -25,12 +25,16 @@ namespace OpenAuth.App.ServiceApp
|
|||
private readonly IConfiguration _configuration;
|
||||
private readonly ISqlSugarClient _client;
|
||||
private readonly MinioService _minioService;
|
||||
public AirportMaintenanceApp(MinioService minioService, ISqlSugarClient client, ISugarUnitOfWork<SugarDbContext> unitWork, IConfiguration configuration, ISimpleClient<LasaDronePort> repository, IAuth auth) : base(unitWork, repository, auth)
|
||||
|
||||
public AirportMaintenanceApp(MinioService minioService, ISqlSugarClient client,
|
||||
ISugarUnitOfWork<SugarDbContext> unitWork, IConfiguration configuration,
|
||||
ISimpleClient<LasaDronePort> repository, IAuth auth) : base(unitWork, repository, auth)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_client = client;
|
||||
_minioService = minioService;
|
||||
}
|
||||
|
||||
//获取设备绑定码
|
||||
public async Task<Response<LasaDeviceBindingCode>> GetDeviceBindingCode()
|
||||
{
|
||||
|
|
@ -75,13 +79,12 @@ namespace OpenAuth.App.ServiceApp
|
|||
{
|
||||
Code = 500,
|
||||
Message = "获取设备绑定码失败",
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改注册码状态
|
||||
/// </summary>
|
||||
|
|
@ -100,7 +103,6 @@ namespace OpenAuth.App.ServiceApp
|
|||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//使用网关
|
||||
|
|
@ -157,9 +159,9 @@ namespace OpenAuth.App.ServiceApp
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateGateway(string gateway, string did)
|
||||
{
|
||||
using (var db = UnitWork.CreateContext())
|
||||
|
|
@ -175,8 +177,8 @@ namespace OpenAuth.App.ServiceApp
|
|||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//获取网关
|
||||
public async Task<List<string>> GetGatewaysnList()
|
||||
{
|
||||
|
|
@ -193,12 +195,15 @@ namespace OpenAuth.App.ServiceApp
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetUavSn()
|
||||
{
|
||||
using (var db = UnitWork.CreateContext())
|
||||
{
|
||||
var uavinfo = await db.LasaUav.AsQueryable().Where(r => r.IsDelete == false).Select(r => r.Sn).ToListAsync();
|
||||
var dockinfo = await db.LasaDronePort.AsQueryable().Where(r => r.IsDelete == false).Select(r => r.Sn).ToListAsync();
|
||||
var uavinfo = await db.LasaUav.AsQueryable().Where(r => r.IsDelete == false).Select(r => r.Sn)
|
||||
.ToListAsync();
|
||||
var dockinfo = await db.LasaDronePort.AsQueryable().Where(r => r.IsDelete == false).Select(r => r.Sn)
|
||||
.ToListAsync();
|
||||
|
||||
if (dockinfo != null)
|
||||
{
|
||||
|
|
@ -212,6 +217,7 @@ namespace OpenAuth.App.ServiceApp
|
|||
}
|
||||
|
||||
#region 固件版本管理
|
||||
|
||||
public async Task<Response<bool>> AddFirmware(LasaFirmware info)
|
||||
{
|
||||
using (var db = UnitWork.CreateContext())
|
||||
|
|
@ -232,6 +238,7 @@ namespace OpenAuth.App.ServiceApp
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
//修改无人机或机场版本
|
||||
public async Task<Response<bool>> UpdateFirmware(string id, string version, int type)
|
||||
{
|
||||
|
|
@ -259,17 +266,18 @@ namespace OpenAuth.App.ServiceApp
|
|||
else
|
||||
return new Response<bool> { Result = false, Message = "编辑失败" };
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Task<string> UploadFile(IFormFile xmlFile)
|
||||
{
|
||||
return _minioService.UploadFile(xmlFile, "firmware");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 健康报警
|
||||
|
||||
/// <summary>
|
||||
/// 添加健康报警
|
||||
/// </summary>
|
||||
|
|
@ -282,7 +290,7 @@ namespace OpenAuth.App.ServiceApp
|
|||
var now = DateTime.Now;
|
||||
//获取当前所有未处理的告警信息
|
||||
var existing = db.LasaManageDeviceHms.AsQueryable()
|
||||
.Where(x => x.IsResolved == 0).ToList();
|
||||
.Where(x => x.IsResolved == 0).ToList();
|
||||
var currentKeys = newAlarms.Select(x => x.Code).ToHashSet();
|
||||
var existingKeys = existing.Select(x => x.Code).ToHashSet();
|
||||
// 需要解除的(老有,新没有) 起的隆冬强
|
||||
|
|
@ -293,6 +301,7 @@ namespace OpenAuth.App.ServiceApp
|
|||
resolved.IsResolved = 1;
|
||||
resolved.UpdateTime = now;
|
||||
}
|
||||
|
||||
db.LasaManageDeviceHms.UpdateRange(toResolve);
|
||||
// 需要新增的(新有,老没有)
|
||||
var toInsert = newAlarms
|
||||
|
|
@ -307,8 +316,10 @@ namespace OpenAuth.App.ServiceApp
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//根据时间获取告警信息列表
|
||||
public async Task<Response<PageInfo<List<LasaManageDeviceHms>>>> GetManageDeviceHmsList(int level, int model, DateTime startTime, DateTime endTime, int page, int limit, string message, string getway)
|
||||
public async Task<Response<PageInfo<List<LasaManageDeviceHms>>>> GetManageDeviceHmsList(int level, int model,
|
||||
DateTime startTime, DateTime endTime, int page, int limit, string message, string getway)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
using (var db = UnitWork.CreateContext())
|
||||
|
|
@ -327,9 +338,11 @@ namespace OpenAuth.App.ServiceApp
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 日志
|
||||
|
||||
/// <summary>
|
||||
/// 添加日志
|
||||
/// </summary>
|
||||
|
|
@ -346,6 +359,7 @@ namespace OpenAuth.App.ServiceApp
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取日志
|
||||
/// </summary>
|
||||
|
|
@ -355,7 +369,8 @@ namespace OpenAuth.App.ServiceApp
|
|||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Response<PageInfo<List<LasaLog>>>> GetLogList(string sn, DateTime startTime, DateTime endTime, int page, int limit)
|
||||
public async Task<Response<PageInfo<List<LasaLog>>>> GetLogList(string sn, DateTime startTime, DateTime endTime,
|
||||
int page, int limit)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
using (var db = UnitWork.CreateContext())
|
||||
|
|
@ -372,22 +387,52 @@ namespace OpenAuth.App.ServiceApp
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
public async Task<Response<PageInfo<List<LasaMediaFile>>>> GetMediaFile(string taskId,string device, string picname, DateTime? startTime, DateTime? endTime, int page, int limit, string parentKey)
|
||||
|
||||
public async Task<Response<PageInfo<List<LasaMediaFile>>>> GetMediaFile(string taskId, string device,
|
||||
string picname, DateTime? startTime, DateTime? endTime, int page, int limit, string parentKey)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
using (var db = UnitWork.CreateContext())
|
||||
{
|
||||
Console.WriteLine(startTime.ToString());
|
||||
var list = await db.LasaMediaFile.AsQueryable()
|
||||
|
||||
.WhereIF(!string.IsNullOrEmpty(device), x => x.DroneModelKey == device)
|
||||
.WhereIF(!string.IsNullOrEmpty(picname), x => x.Name.Contains(picname))
|
||||
.WhereIF(!"0001/1/1 0:00:00".Equal(startTime.ToString()), x => x.CreateTime >= startTime)
|
||||
.WhereIF(!"0001/1/1 0:00:00".Equal(endTime.ToString()), x => x.CreateTime <= endTime)
|
||||
.WhereIF(!string.IsNullOrEmpty(parentKey), x => x.ParentKey == parentKey)
|
||||
.WhereIF(!string.IsNullOrEmpty(taskId), x => x.TaskId == taskId)
|
||||
.OrderBy(x => x.CreateTime, OrderByType.Desc)
|
||||
.LeftJoin<LasaTask>((x, b) => x.FlightId == b.FlightId)
|
||||
.WhereIF(!string.IsNullOrEmpty(device), x => x.DroneModelKey == device)
|
||||
.WhereIF(!string.IsNullOrEmpty(picname), x => x.Name.Contains(picname))
|
||||
.WhereIF(!"0001/1/1 0:00:00".Equal(startTime.ToString()), x => x.CreateTime >= startTime)
|
||||
.WhereIF(!"0001/1/1 0:00:00".Equal(endTime.ToString()), x => x.CreateTime <= endTime)
|
||||
.WhereIF(!string.IsNullOrEmpty(parentKey), x => x.ParentKey == parentKey)
|
||||
.WhereIF(!string.IsNullOrEmpty(taskId), x => x.TaskId == taskId)
|
||||
.OrderBy(x => x.CreateTime, OrderByType.Desc)
|
||||
.Select((x,b) => new LasaMediaFile
|
||||
{
|
||||
Id = x.Id,
|
||||
Name = x.Name,
|
||||
ObjectKey = x.ObjectKey,
|
||||
Path = x.Path,
|
||||
CreateTime = x.CreateTime,
|
||||
TaskId = x.TaskId,
|
||||
Level = x.Level,
|
||||
ParentKey = x.ParentKey,
|
||||
WorkspaceId = x.WorkspaceId,
|
||||
display = x.display,
|
||||
ShowOnMap = x.ShowOnMap,
|
||||
GraffitiJson = x.GraffitiJson,
|
||||
FileTags = x.FileTags,
|
||||
Size = x.Size,
|
||||
Width = x.Width,
|
||||
Height = x.Height,
|
||||
Tid = x.Tid,
|
||||
Bid = x.Bid,
|
||||
FlightType = x.FlightType,
|
||||
PicLink = x.PicLink,
|
||||
minipic = x.minipic,
|
||||
CreateUserName = b.CreateUserName,
|
||||
TaskName = b.TaskName,
|
||||
AirLineName = b.TaskAirLineName,
|
||||
})
|
||||
.ToPageListAsync(page, limit, totalCount);
|
||||
return new Response<PageInfo<List<LasaMediaFile>>>
|
||||
{
|
||||
|
|
@ -397,9 +442,12 @@ namespace OpenAuth.App.ServiceApp
|
|||
}
|
||||
|
||||
|
||||
public async Task<Response<string>> UpdatePicStatus(string id, int showOnMap, int display, string fileTags, string graffitiJson)
|
||||
public async Task<Response<string>> UpdatePicStatus(string id, int showOnMap, int display, string fileTags,
|
||||
string graffitiJson)
|
||||
{
|
||||
string sql = "update lasa_mediafile set \"ShowOnMap\"=" + showOnMap + ",display=" + display + ",\"FileTags\"='" + fileTags + "',\"GraffitiJson\"='" + graffitiJson + "' where \"Id\"='" + id + "'";
|
||||
string sql = "update lasa_mediafile set \"ShowOnMap\"=" + showOnMap + ",display=" + display +
|
||||
",\"FileTags\"='" + fileTags + "',\"GraffitiJson\"='" + graffitiJson + "' where \"Id\"='" +
|
||||
id + "'";
|
||||
await _client.Ado.ExecuteCommandAsync(sql);
|
||||
return new Response<string> { Result = "修改成功!" };
|
||||
}
|
||||
|
|
@ -415,9 +463,8 @@ namespace OpenAuth.App.ServiceApp
|
|||
string sql = "delete from lasa_mediafile where \"Id\"='" + idarray[i] + "'";
|
||||
await _client.Ado.ExecuteCommandAsync(sql);
|
||||
await _minioService.DeleteFile(objectkey);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return new Response<string> { Result = "删除成功!" };
|
||||
}
|
||||
|
||||
|
|
@ -436,6 +483,4 @@ namespace OpenAuth.App.ServiceApp
|
|||
return new Response<string> { Result = "修改成功!" };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -85,17 +85,19 @@ public class LasaMediaFile
|
|||
/// 文件创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
|
||||
public string TaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件夹所属层级
|
||||
/// </summary>
|
||||
public int Level { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 父文件key
|
||||
/// </summary>
|
||||
public string ParentKey { get; set; }
|
||||
|
||||
public string WorkspaceId { get; set; }
|
||||
|
||||
public int? ShowOnMap { get; set; }
|
||||
|
|
@ -111,14 +113,16 @@ public class LasaMediaFile
|
|||
public int Height { get; set; }
|
||||
public string Tid { get; set; }
|
||||
public string Bid { get; set; }
|
||||
|
||||
|
||||
public int? FlightType { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string PicLink { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public string PicLink { get; set; }
|
||||
|
||||
public string minipic { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<LasaMediaFile> Children { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public List<LasaMediaFile> Children { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public string CreateUserName { get; set; }
|
||||
[SugarColumn(IsIgnore = true)] public string TaskName { get; set; }
|
||||
[SugarColumn(IsIgnore = true)] public string AirLineName { get; set; }
|
||||
}
|
||||
Loading…
Reference in New Issue