fix 任务根据设备心跳状态获取

This commit is contained in:
2024-06-09 02:40:08 +08:00
parent 0a7898cd73
commit 82a3994d4d
9 changed files with 90 additions and 67 deletions

View File

@@ -274,25 +274,7 @@ public class DeviceService : IDeviceService
_dbContext.Client.QueryFilter.Restore();
}
}
/// <summary>
/// 获取设备
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public async Task<DeviceResponse> GetDeviceByNoAsync(DeviceByNoRequest request)
{
var device = await _dbContext.Queryable<DeviceEntity>()
.Where(x => x.UniqueNo == request.UniqueNo)
.Select(device => new DeviceResponse
{
FuncsStr = device.Funcs.ToString(),
ConnectionInfoStr = device.ConnectionInfo
}, true)
.SingleAsync();
return device;
}
public async Task<List<DeviceResponse>> GetAttendanceDevicesAsync()
{
@@ -347,7 +329,7 @@ public class DeviceService : IDeviceService
var onlineDevices = deviceRegistries.Where(x =>
{
if (x.HeartbeatInterval <= 0) return true;
return x.LastHeartbeatTime.AddSeconds(x.HeartbeatInterval * 3) >= now;
return x.LastHeartbeatTime.AddSeconds(x.HeartbeatInterval) >= now;
})
.Select(x => new
{