Просмотр исходного кода

第三方定位推送改为推送到topic.push.position

develop
H Vs 6 месяцев назад
Родитель
Сommit
f071b2285a
5 измененных файлов: 62 добавлений и 41 удалений
  1. +5
    -0
      GpsCardGatewayPosition.Model/Config/ServiceAccessConfig.cs
  2. +1
    -0
      GpsCardGatewayPosition.Postion/appsettings.debug.json
  3. +1
    -0
      GpsCardGatewayPosition.Postion/appsettings.test.json
  4. +2
    -0
      GpsCardGatewayPosition.Service/MqProducer/Model/MqTopic.cs
  5. +53
    -41
      GpsCardGatewayPosition.Service/MqProducer/MqProcessLogic.cs

+ 5
- 0
GpsCardGatewayPosition.Model/Config/ServiceAccessConfig.cs Просмотреть файл

@@ -32,6 +32,11 @@ namespace GpsCardGatewayPosition.Model.Config
/// </summary>
public bool EnablePushThird { get; set; }

/// <summary>
/// 第三方定位推送
/// </summary>
public bool EnablePushPosition { get; set; }

public bool EnablePushHealthy { get; set; }
/// <summary>
/// 快速通道


+ 1
- 0
GpsCardGatewayPosition.Postion/appsettings.debug.json Просмотреть файл

@@ -16,6 +16,7 @@
"EnableServiceGuard": true,
"EnablePushWx": true,
"EnablePushThird": true,
"EnablePushPosition": true,
"EnablePushHealthy": true,
"EnablePushFast": true, // 快速通道
"EnablePushFence": true,


+ 1
- 0
GpsCardGatewayPosition.Postion/appsettings.test.json Просмотреть файл

@@ -16,6 +16,7 @@
"EnableServiceGuard": true,
"EnablePushWx": true,
"EnablePushThird": true,
"EnablePushPosition": true,
"EnablePushHealthy": true,
"EnablePushFast": true, // 快速通道
"EnablePushFence": true,


+ 2
- 0
GpsCardGatewayPosition.Service/MqProducer/Model/MqTopic.cs Просмотреть файл

@@ -43,5 +43,7 @@ namespace GpsCardGatewayPosition.Service.MqProducer.Model
/// 定位gps监测(非法区域检测)
/// </summary>
public const string LocationMonitor = "topic.location.monitor";

public const string PushPosition = "topic.push.position";
}
}

+ 53
- 41
GpsCardGatewayPosition.Service/MqProducer/MqProcessLogic.cs Просмотреть файл

@@ -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 },


Загрузка…
Отмена
Сохранить