细节调整
This commit is contained in:
parent
d71f65de45
commit
40ef054eff
|
|
@ -49,24 +49,22 @@ namespace LY.App.Service
|
||||||
return new ApiResult() { code = 1, msg = "设备不存在" };
|
return new ApiResult() { code = 1, msg = "设备不存在" };
|
||||||
}
|
}
|
||||||
await _redisService.SetAsync(key, deviceinfo, TimeSpan.FromDays(1));
|
await _redisService.SetAsync(key, deviceinfo, TimeSpan.FromDays(1));
|
||||||
|
|
||||||
var entity = input.data.Adapt<List<Alarm>>();
|
|
||||||
foreach (var item in entity)
|
|
||||||
{
|
|
||||||
item.BatchId = await GetBatId(item.serial_number);
|
|
||||||
item.DeviceId = deviceinfo.Id;
|
|
||||||
item.DeviceName = deviceinfo.Name;
|
|
||||||
item.positionId = deviceinfo.PositionId;
|
|
||||||
item.PostionName = deviceinfo.PositionName;
|
|
||||||
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 });
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
var entity = input.data.Adapt<List<Alarm>>();
|
||||||
|
foreach (var item in entity)
|
||||||
|
{
|
||||||
|
item.BatchId = await GetBatId(item.serial_number);
|
||||||
|
item.DeviceId = deviceinfo.Id;
|
||||||
|
item.DeviceName = deviceinfo.Name;
|
||||||
|
item.positionId = deviceinfo.PositionId;
|
||||||
|
item.PostionName = deviceinfo.PositionName;
|
||||||
|
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 });
|
||||||
return new ApiResult();
|
return new ApiResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue