Quellcode durchsuchen

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

develop
H Vs vor 6 Monaten
Ursprung
Commit
f071b2285a
5 geänderte Dateien mit 62 neuen und 41 gelöschten Zeilen
  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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen

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


Laden…
Abbrechen
Speichern