This commit is contained in:
parent
fa3773c8dc
commit
e72164545e
|
|
@ -51,20 +51,24 @@ namespace LY.App.Service
|
||||||
await _redisService.SetAsync(key, deviceinfo, TimeSpan.FromDays(1));
|
await _redisService.SetAsync(key, deviceinfo, TimeSpan.FromDays(1));
|
||||||
}
|
}
|
||||||
var entity = input.data.Adapt<List<Alarm>>();
|
var entity = input.data.Adapt<List<Alarm>>();
|
||||||
foreach (var item in entity)
|
if (entity.Any())
|
||||||
{
|
{
|
||||||
item.BatchId = await GetBatId(item.serial_number);
|
foreach (var item in entity)
|
||||||
item.DeviceId = deviceinfo.Id;
|
{
|
||||||
item.DeviceName = deviceinfo.Name;
|
item.BatchId = await GetBatId(item.serial_number);
|
||||||
item.positionId = deviceinfo.PositionId;
|
item.DeviceId = deviceinfo.Id;
|
||||||
item.PostionName = deviceinfo.PositionName;
|
item.DeviceName = deviceinfo.Name;
|
||||||
item.Time = input.time;
|
item.positionId = deviceinfo.PositionId;
|
||||||
item.distance = GisHelper.HaversineDistance(item.drone_lat, item.drone_lon, item.app_lat, item.app_lon);
|
item.PostionName = deviceinfo.PositionName;
|
||||||
item.alarmLevel = await GetAlarmLevel(deviceinfo.PositionId, item.drone_lon, item.drone_lat);
|
item.Time = input.time;
|
||||||
|
item.distance = GisHelper.HaversineDistance(item.drone_lat, item.drone_lon, item.app_lat, item.app_lon);
|
||||||
|
item.alarmLevel = await GetAlarmLevel(deviceinfo.PositionId, item.drone_lon, item.drone_lat);
|
||||||
|
}
|
||||||
|
await _db.CopyNew().Insertable(entity).SplitTable().ExecuteReturnSnowflakeIdListAsync();
|
||||||
|
//推送报警信息
|
||||||
|
await _pushService.SendMessageToAll(new { msgType = "event", data = entity });
|
||||||
}
|
}
|
||||||
await _db.CopyNew().Insertable(entity).SplitTable().ExecuteReturnSnowflakeIdListAsync();
|
|
||||||
//推送报警信息
|
|
||||||
await _pushService.SendMessageToAll(new { msgType = "event", data = entity });
|
|
||||||
return new ApiResult();
|
return new ApiResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +132,7 @@ namespace LY.App.Service
|
||||||
await _redisService.SetAsync(key, deviceinfo);
|
await _redisService.SetAsync(key, deviceinfo);
|
||||||
//更新位置
|
//更新位置
|
||||||
// await _db.Updateable(deviceinfo).ExecuteCommandAsync();
|
// await _db.Updateable(deviceinfo).ExecuteCommandAsync();
|
||||||
await _db.Updateable<DeviceEntity>(deviceinfo).ExecuteCommandAsync();
|
await _db.CopyNew().Updateable<DeviceEntity>(deviceinfo).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private async Task<long> GetBatId(string droneId)
|
private async Task<long> GetBatId(string droneId)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue