细节修正
This commit is contained in:
parent
947edb0409
commit
25b3fc8321
|
|
@ -42,6 +42,16 @@ namespace LY.App.Controllers
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 协议列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("protocollist")]
|
||||||
|
public async Task<IActionResult> ProtocolTypeList()
|
||||||
|
{
|
||||||
|
var result = await _deviceService.ProtocolTypeList();
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
///更新
|
///更新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
|
|
|
||||||
|
|
@ -333,7 +333,7 @@ namespace LY.App.Device
|
||||||
{
|
{
|
||||||
int retryDelay = 1000; // 初始重连间隔(1秒)
|
int retryDelay = 1000; // 初始重连间隔(1秒)
|
||||||
int maxDelay = 30000; // 最大重连间隔(30秒)
|
int maxDelay = 30000; // 最大重连间隔(30秒)
|
||||||
await _log.AddLog(new AddLog { Message = $"设备 {device.Id} 掉线,重新连接中...", Parameters = "", StackTrace = "", url = "" });
|
await _log?.AddLog(new AddLog { Message = $"设备 {device.Id} 掉线,重新连接中...", Parameters = "", StackTrace = "", url = "" });
|
||||||
while (!device.IsConnected)
|
while (!device.IsConnected)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -57,11 +57,6 @@ namespace LY.App.Model
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "rssi", ColumnDescription = "信号增益")]
|
[SugarColumn(ColumnName = "rssi", ColumnDescription = "信号增益")]
|
||||||
public double RSSI { get; set; }
|
public double RSSI { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 无人机型号
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 位置id
|
/// 位置id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ string redisConnection = builder.Configuration.GetValue<string>("Redis:Connectio
|
||||||
|
|
||||||
// 注册 RedisService
|
// 注册 RedisService
|
||||||
builder.Services.AddSingleton(new RedisService(redisConnection));
|
builder.Services.AddSingleton(new RedisService(redisConnection));
|
||||||
//builder.Services.AddTransient<TokenValidationMiddleware>();
|
builder.Services.AddTransient<TokenValidationMiddleware>();
|
||||||
////注册SignalR
|
////注册SignalR
|
||||||
builder.Services.AddSignalR();
|
builder.Services.AddSignalR();
|
||||||
builder.Services.AddHttpClient();
|
builder.Services.AddHttpClient();
|
||||||
|
|
@ -117,7 +117,7 @@ app.UseCors("CorsPolicy");
|
||||||
//异常中间件
|
//异常中间件
|
||||||
app.UseMiddleware<CustomErrorMiddleware>();
|
app.UseMiddleware<CustomErrorMiddleware>();
|
||||||
//token验证中间件
|
//token验证中间件
|
||||||
app.UseMiddleware<TokenValidationMiddleware>();
|
//app.UseMiddleware<TokenValidationMiddleware>();
|
||||||
//执行匹配的端点
|
//执行匹配的端点
|
||||||
app.UseEndpoints(endpoints =>
|
app.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ namespace LY.App.Service
|
||||||
.WhereIF(input.strartDate.HasValue, st => st.CreateTime >= input.strartDate.Value)
|
.WhereIF(input.strartDate.HasValue, st => st.CreateTime >= input.strartDate.Value)
|
||||||
.WhereIF(input.endDate.HasValue, st => st.CreateTime <= input.endDate.Value.AddDays(1))
|
.WhereIF(input.endDate.HasValue, st => st.CreateTime <= input.endDate.Value.AddDays(1))
|
||||||
.OrderBy(s => s.BatchId, OrderByType.Desc)
|
.OrderBy(s => s.BatchId, OrderByType.Desc)
|
||||||
.GroupBy(s => new { s.BatchId, s.serial_number, s.device_type, s.positionId, s.PostionName })
|
.GroupBy(s => new { s.BatchId, s.serial_number, s.device_type, s.positionId, s.PostionName ,s.freq})
|
||||||
.Select(st => new AlarmRepDto
|
.Select(st => new AlarmRepDto
|
||||||
{
|
{
|
||||||
batchId = st.BatchId.ToString(),
|
batchId = st.BatchId.ToString(),
|
||||||
|
|
@ -285,6 +285,7 @@ namespace LY.App.Service
|
||||||
start = start.HasValue ? start.Value : DateTime.Now.AddMonths(-1);
|
start = start.HasValue ? start.Value : DateTime.Now.AddMonths(-1);
|
||||||
end = end.HasValue ? end.Value.AddDays(1) : DateTime.Now.Date.AddDays(1);
|
end = end.HasValue ? end.Value.AddDays(1) : DateTime.Now.Date.AddDays(1);
|
||||||
var query = await _db.Queryable<Alarm>().SplitTable()
|
var query = await _db.Queryable<Alarm>().SplitTable()
|
||||||
|
.Where(s => s.alarmLevel > 0)
|
||||||
.WhereIF(start.HasValue, st => st.CreateTime >= start.Value)
|
.WhereIF(start.HasValue, st => st.CreateTime >= start.Value)
|
||||||
.WhereIF(end.HasValue, st => st.CreateTime <= end.Value.AddDays(1))
|
.WhereIF(end.HasValue, st => st.CreateTime <= end.Value.AddDays(1))
|
||||||
.GroupBy(s => new { s.BatchId, s.serial_number, s.device_type, s.positionId, s.PostionName, s.DeviceId, s.DeviceName })
|
.GroupBy(s => new { s.BatchId, s.serial_number, s.device_type, s.positionId, s.PostionName, s.DeviceId, s.DeviceName })
|
||||||
|
|
@ -324,15 +325,24 @@ namespace LY.App.Service
|
||||||
s.Key.positionName,
|
s.Key.positionName,
|
||||||
count = s.Count()
|
count = s.Count()
|
||||||
}),
|
}),
|
||||||
hotmap = await GenerateHotMap(query.Select(s => s.batchId).ToList()),
|
time = query.GroupBy(s => s.startTime.ToString("HH"))
|
||||||
device = query.GroupBy(s => new { s.deviceName })
|
.Select(it => new
|
||||||
.Select(s => new
|
|
||||||
{
|
{
|
||||||
s.Key.deviceName,
|
it.Key,
|
||||||
count = s.Count()
|
count = it.Count()
|
||||||
}),
|
}),
|
||||||
date = query.GroupBy(s => s.startTime.ToString("yyyy-MM-dd"))
|
date = query.GroupBy(s => s.startTime.ToString("yyyy-MM-dd"))
|
||||||
.Select(it => new { it.Key, count = it.Count() })
|
.Select(it => new
|
||||||
|
{
|
||||||
|
it.Key,
|
||||||
|
count = it.Count()
|
||||||
|
}),
|
||||||
|
device = query.GroupBy(s => new { s.deviceName })
|
||||||
|
.Select(b => new
|
||||||
|
{
|
||||||
|
b.Key.deviceName,
|
||||||
|
count = b.Count()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,22 @@ namespace LY.App.Service
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 获取协议列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<ApiResult> ProtocolTypeList()
|
||||||
|
{
|
||||||
|
var dict = new Dictionary<int, string>();
|
||||||
|
foreach (ProtocolType protocol in Enum.GetValues(typeof(ProtocolType)))
|
||||||
|
{
|
||||||
|
dict.Add((int)protocol, protocol.ToString());
|
||||||
|
}
|
||||||
|
return Task.FromResult(new ApiResult()
|
||||||
|
{
|
||||||
|
data = dict
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// 更新设备信息
|
/// 更新设备信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entity"></param>
|
/// <param name="entity"></param>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace LY.App.Service
|
||||||
public async Task AddLog(AddLog input)
|
public async Task AddLog(AddLog input)
|
||||||
{
|
{
|
||||||
var entity = input.Adapt<LogEntity>();
|
var entity = input.Adapt<LogEntity>();
|
||||||
await _db.Insertable(entity).ExecuteReturnSnowflakeIdAsync();
|
await _db?.Insertable(entity).ExecuteReturnSnowflakeIdAsync();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页查询
|
/// 分页查询
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue