|
|
@@ -301,44 +301,44 @@ namespace GpsCardGatewayPosition.Service.MqProducer |
|
|
|
|
|
|
|
_logger.LogInformation($"设备{model.imei},推送到" + string.Join(", ", ls.Select(e => e.Topic))); |
|
|
|
} |
|
|
|
public async Task ProcessPositionAsync(string messageId, LocationDatas model, string date) |
|
|
|
{ |
|
|
|
List<TopicModel> ls = new List<TopicModel>(); |
|
|
|
if (_configServiceAccess.EnablePushThird) |
|
|
|
{ |
|
|
|
ls.Add(new TopicModel() |
|
|
|
{ |
|
|
|
Topic = MqTopic.Third, |
|
|
|
Headers = _producer.CreateHeader(new Dictionary<string, int> |
|
|
|
{ |
|
|
|
{MqHeader.DataType,(int)MqDataType.PositionInfo }, |
|
|
|
}) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
if (_configServiceAccess.EnableLocationMonitor) |
|
|
|
{ |
|
|
|
ls.Add(new TopicModel() |
|
|
|
{ |
|
|
|
Topic = MqTopic.LocationMonitor, |
|
|
|
Headers = _producer.CreateHeader(new Dictionary<string, int> |
|
|
|
{ |
|
|
|
{ MqHeader.DataType,(int)MqDataType.PositionInfo}, |
|
|
|
}) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
if (ls.Count == 0) return; |
|
|
|
await _producer.ProduceAsync(ls, new |
|
|
|
{ |
|
|
|
messageId = messageId, //string.Format("{0:yyyyMMddHHmmssffff}", DateTime.Now), |
|
|
|
topic = string.Join(",", ls.Select(e => e.Topic)), //MqTopic.Storage + "," + MqTopic.Third, |
|
|
|
time = date, |
|
|
|
data = model |
|
|
|
}); |
|
|
|
|
|
|
|
_logger.LogInformation($"设备{model.imei},推送到" + string.Join(", ", ls.Select(e => e.Topic))); |
|
|
|
} |
|
|
|
//public async Task ProcessPositionAsync(string messageId, LocationDatas model, string date) |
|
|
|
//{ |
|
|
|
// List<TopicModel> ls = new List<TopicModel>(); |
|
|
|
// if (_configServiceAccess.EnablePushThird) |
|
|
|
// { |
|
|
|
// ls.Add(new TopicModel() |
|
|
|
// { |
|
|
|
// Topic = MqTopic.Third, |
|
|
|
// Headers = _producer.CreateHeader(new Dictionary<string, int> |
|
|
|
// { |
|
|
|
// {MqHeader.DataType,(int)MqDataType.PositionInfo }, |
|
|
|
// }) |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
// if (_configServiceAccess.EnableLocationMonitor) |
|
|
|
// { |
|
|
|
// ls.Add(new TopicModel() |
|
|
|
// { |
|
|
|
// Topic = MqTopic.LocationMonitor, |
|
|
|
// Headers = _producer.CreateHeader(new Dictionary<string, int> |
|
|
|
// { |
|
|
|
// { MqHeader.DataType,(int)MqDataType.PositionInfo}, |
|
|
|
// }) |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
// if (ls.Count == 0) return; |
|
|
|
// await _producer.ProduceAsync(ls, new |
|
|
|
// { |
|
|
|
// messageId = messageId, //string.Format("{0:yyyyMMddHHmmssffff}", DateTime.Now), |
|
|
|
// topic = string.Join(",", ls.Select(e => e.Topic)), //MqTopic.Storage + "," + MqTopic.Third, |
|
|
|
// time = date, |
|
|
|
// data = model |
|
|
|
// }); |
|
|
|
|
|
|
|
// _logger.LogInformation($"设备{model.imei},推送到" + string.Join(", ", ls.Select(e => e.Topic))); |
|
|
|
//} |
|
|
|
/// <summary> |
|
|
|
/// 含有wifi列表 |
|
|
|
/// </summary> |
|
|
@@ -347,14 +347,26 @@ namespace GpsCardGatewayPosition.Service.MqProducer |
|
|
|
/// <param name="date"></param> |
|
|
|
/// <param name="wifiMacs"></param> |
|
|
|
/// <returns></returns> |
|
|
|
public async Task ProcessPositionAsync(string messageId, LocationDatas model, string date, string wifiMacs) |
|
|
|
public async Task ProcessPositionAsync(string messageId, LocationDatas model, string date, string wifiMacs = "") |
|
|
|
{ |
|
|
|
List<TopicModel> ls = new(); |
|
|
|
if (_configServiceAccess.EnablePushThird) |
|
|
|
//if (_configServiceAccess.EnablePushThird) |
|
|
|
//{ |
|
|
|
// ls.Add(new TopicModel() |
|
|
|
// { |
|
|
|
// Topic = MqTopic.Third, |
|
|
|
// Headers = _producer.CreateHeader(new Dictionary<string, int> |
|
|
|
// { |
|
|
|
// {MqHeader.DataType,(int)MqDataType.PositionInfo }, |
|
|
|
// }) |
|
|
|
// }); |
|
|
|
//} |
|
|
|
|
|
|
|
if (_configServiceAccess.EnablePushPosition) |
|
|
|
{ |
|
|
|
ls.Add(new TopicModel() |
|
|
|
{ |
|
|
|
Topic = MqTopic.Third, |
|
|
|
Topic = MqTopic.PushPosition, |
|
|
|
Headers = _producer.CreateHeader(new Dictionary<string, int> |
|
|
|
{ |
|
|
|
{MqHeader.DataType,(int)MqDataType.PositionInfo }, |
|
|
|