Merge branch 'dev' of https://310.jisheyun.com/daizan/JiShe.CollectBus into dev
This commit is contained in:
commit
31edca94fb
@ -91,7 +91,7 @@ namespace JiShe.CollectBus.Protocol.T1882018
|
|||||||
|
|
||||||
List<string> dataUnit = new List<string>();
|
List<string> dataUnit = new List<string>();
|
||||||
//数据转发场景 10H_F1
|
//数据转发场景 10H_F1
|
||||||
if (aFNStr == "10" && request.SubProtocolRequest != null && string.IsNullOrWhiteSpace(request.SubProtocolRequest.ItemCode) == false)
|
if (request.ItemCode == T37612012PacketItemCodeConst.AFN10HFN01H && request.SubProtocolRequest != null && string.IsNullOrWhiteSpace(request.SubProtocolRequest.ItemCode) == false)
|
||||||
{
|
{
|
||||||
var t188PacketHandlerName = $"{T1882018PacketItemCodeConst.BasicT1882018}_{request.SubProtocolRequest.ItemCode}_Send";
|
var t188PacketHandlerName = $"{T1882018PacketItemCodeConst.BasicT1882018}_{request.SubProtocolRequest.ItemCode}_Send";
|
||||||
Telemetry1882018PacketResponse t645PacketResponse = null;
|
Telemetry1882018PacketResponse t645PacketResponse = null;
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using JiShe.CollectBus.Common;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
using JiShe.CollectBus.FreeRedis;
|
using JiShe.CollectBus.FreeRedis;
|
||||||
using JiShe.CollectBus.IotSystems.Protocols;
|
using JiShe.CollectBus.IotSystems.Protocols;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
|
|
||||||
@ -15,12 +17,14 @@ namespace JiShe.CollectBus.Protocol.Services
|
|||||||
private readonly IFreeRedisProvider _freeRedisProvider;
|
private readonly IFreeRedisProvider _freeRedisProvider;
|
||||||
private readonly IServiceProvider _serviceProvider;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
private readonly ILogger<ProtocolService> _logger;
|
private readonly ILogger<ProtocolService> _logger;
|
||||||
|
private readonly ServerApplicationOptions _serverApplicationOptions;
|
||||||
|
|
||||||
public ProtocolService(IFreeRedisProvider freeRedisProvider, IServiceProvider serviceProvider, ILogger<ProtocolService> logger)
|
public ProtocolService(IFreeRedisProvider freeRedisProvider, IServiceProvider serviceProvider, ILogger<ProtocolService> logger,IOptions<ServerApplicationOptions> serverApplicationOptions)
|
||||||
{
|
{
|
||||||
_freeRedisProvider = freeRedisProvider;
|
_freeRedisProvider = freeRedisProvider;
|
||||||
_serviceProvider = serviceProvider;
|
_serviceProvider = serviceProvider;
|
||||||
_logger= logger;
|
_logger= logger;
|
||||||
|
_serverApplicationOptions = serverApplicationOptions.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -36,7 +40,7 @@ namespace JiShe.CollectBus.Protocol.Services
|
|||||||
var keyValuePair = protocols.FirstOrDefault(a => ContainsExactPartRegex(deviceCode, a.Value.RegularExpression));
|
var keyValuePair = protocols.FirstOrDefault(a => ContainsExactPartRegex(deviceCode, a.Value.RegularExpression));
|
||||||
if (!keyValuePair.Key.IsNullOrWhiteSpace() || keyValuePair.Value != null) return keyValuePair.Value;
|
if (!keyValuePair.Key.IsNullOrWhiteSpace() || keyValuePair.Value != null) return keyValuePair.Value;
|
||||||
if (isSpecial) throw new UserFriendlyException("The device protocol plugin does not exist!", ExceptionCode.NotFound);
|
if (isSpecial) throw new UserFriendlyException("The device protocol plugin does not exist!", ExceptionCode.NotFound);
|
||||||
var hasStandardProtocolPlugin = protocols.TryGetValue("T37612012ProtocolPlugin", out var protocolInfo);
|
var hasStandardProtocolPlugin = protocols.TryGetValue(_serverApplicationOptions.DefaultProtocolPlugin, out var protocolInfo);
|
||||||
if (!hasStandardProtocolPlugin) throw new UserFriendlyException("Standard protocol plugin does not exist!", ExceptionCode.NotFound);
|
if (!hasStandardProtocolPlugin) throw new UserFriendlyException("Standard protocol plugin does not exist!", ExceptionCode.NotFound);
|
||||||
return protocolInfo;
|
return protocolInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.Common;
|
||||||
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.IotSystems.Devices;
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Kafka.Producer;
|
using JiShe.CollectBus.Kafka.Producer;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TouchSocket.Core;
|
using TouchSocket.Core;
|
||||||
@ -22,6 +24,7 @@ namespace JiShe.CollectBus.Plugins
|
|||||||
private readonly IDistributedCache<AmmeterInfo> _ammeterInfoCache;
|
private readonly IDistributedCache<AmmeterInfo> _ammeterInfoCache;
|
||||||
private readonly IServiceProvider _serviceProvider;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
private readonly IProtocolService _protocolService;
|
private readonly IProtocolService _protocolService;
|
||||||
|
private readonly ServerApplicationOptions _serverApplicationOptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@ -31,10 +34,15 @@ namespace JiShe.CollectBus.Plugins
|
|||||||
/// <param name="deviceRepository"></param>
|
/// <param name="deviceRepository"></param>
|
||||||
/// <param name="ammeterInfoCache"></param>
|
/// <param name="ammeterInfoCache"></param>
|
||||||
/// <param name="serviceProvider"></param>
|
/// <param name="serviceProvider"></param>
|
||||||
|
/// <param name="serverApplicationOptions"></param>
|
||||||
|
/// <param name="protocolService"></param>
|
||||||
public TcpMonitor(IProducerService producerService,
|
public TcpMonitor(IProducerService producerService,
|
||||||
ILogger<TcpMonitor> logger,
|
ILogger<TcpMonitor> logger,
|
||||||
IRepository<Device, Guid> deviceRepository,
|
IRepository<Device, Guid> deviceRepository,
|
||||||
IDistributedCache<AmmeterInfo> ammeterInfoCache, IServiceProvider serviceProvider, IProtocolService protocolService)
|
IDistributedCache<AmmeterInfo> ammeterInfoCache,
|
||||||
|
IServiceProvider serviceProvider,
|
||||||
|
IOptions<ServerApplicationOptions> serverApplicationOptions,
|
||||||
|
IProtocolService protocolService)
|
||||||
{
|
{
|
||||||
_producerService = producerService;
|
_producerService = producerService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@ -42,17 +50,20 @@ namespace JiShe.CollectBus.Plugins
|
|||||||
_ammeterInfoCache = ammeterInfoCache;
|
_ammeterInfoCache = ammeterInfoCache;
|
||||||
_serviceProvider= serviceProvider;
|
_serviceProvider= serviceProvider;
|
||||||
_protocolService = protocolService;
|
_protocolService = protocolService;
|
||||||
|
_serverApplicationOptions = serverApplicationOptions.Value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnTcpReceived(ITcpSession client, ReceivedDataEventArgs e)
|
public async Task OnTcpReceived(ITcpSession client, ReceivedDataEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(_serverApplicationOptions.DefaultProtocolPlugin))
|
||||||
|
{
|
||||||
|
_logger.LogError($"请配置默认的端到云协议插件!");
|
||||||
|
}
|
||||||
var messageHexString = Convert.ToHexString(e.ByteBlock.Span);
|
var messageHexString = Convert.ToHexString(e.ByteBlock.Span);
|
||||||
var protocolPlugin = await _protocolService.GetProtocolServiceAsync("376.1");
|
var protocolPlugin = await _protocolService.GetProtocolServiceAsync(_serverApplicationOptions.DefaultProtocolPlugin);
|
||||||
if (protocolPlugin == null)
|
if (protocolPlugin == null)
|
||||||
{
|
{
|
||||||
_logger.LogError("协议不存在!");
|
_logger.LogError($"默认的端到云协议插件{_serverApplicationOptions.DefaultProtocolPlugin}不存在!");
|
||||||
}
|
}
|
||||||
var tcpSessionClient = (ITcpSessionClient)client;
|
var tcpSessionClient = (ITcpSessionClient)client;
|
||||||
|
|
||||||
|
|||||||
@ -18,12 +18,12 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 首次采集时间
|
/// 首次采集时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? FirstCollectionTime { get; set; }
|
public DateTime? FirstCollectionTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自动验证时间
|
/// 自动验证时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public required string AutomaticVerificationTime { get; set;}
|
public required string AutomaticVerificationTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自动获取终端版时间
|
/// 自动获取终端版时间
|
||||||
@ -34,5 +34,10 @@
|
|||||||
/// 自动获取远程通信模块(SIM)版本时间
|
/// 自动获取远程通信模块(SIM)版本时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public required string AutomaticGetTelematicsModuleTime { get; set; }
|
public required string AutomaticGetTelematicsModuleTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 默认协议插件
|
||||||
|
/// </summary>
|
||||||
|
public required string DefaultProtocolPlugin { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"Default": "mongodb://mongo_PmEeF3:lixiao1980@192.168.1.9:27017/JiSheCollectBus?authSource=admin&maxPoolSize=400&minPoolSize=10&waitQueueTimeoutMS=5000",
|
"Default": "mongodb://mongo_PmEeF3:lixiao1980@121.42.175.177:17270/JiSheCollectBus?authSource=admin&maxPoolSize=400&minPoolSize=10&waitQueueTimeoutMS=5000",
|
||||||
"Kafka": "121.42.175.177:16392,121.42.175.177:16393,121.42.175.177:16394",
|
"Kafka": "121.42.175.177:16392,121.42.175.177:16393,121.42.175.177:16394",
|
||||||
"PrepayDB": "server=118.190.144.92;database=jishe.sysdb;uid=sa;pwd=admin@2023;Encrypt=False;Trust Server Certificate=False",
|
"PrepayDB": "server=118.190.144.92;database=jishe.sysdb;uid=sa;pwd=admin@2023;Encrypt=False;Trust Server Certificate=False",
|
||||||
"EnergyDB": "server=118.190.144.92;database=db_energy;uid=sa;pwd=admin@2023;Encrypt=False;Trust Server Certificate=False"
|
"EnergyDB": "server=118.190.144.92;database=db_energy;uid=sa;pwd=admin@2023;Encrypt=False;Trust Server Certificate=False"
|
||||||
@ -12,7 +12,7 @@
|
|||||||
"HangfireDB": "13"
|
"HangfireDB": "13"
|
||||||
},
|
},
|
||||||
"Kafka": {
|
"Kafka": {
|
||||||
"BootstrapServers": "192.168.1.9:29092,192.168.1.9:39092,192.168.1.9:49092",
|
"BootstrapServers": "121.42.175.177:16392,121.42.175.177:16393,121.42.175.177:16394",
|
||||||
"EnableFilter": true,
|
"EnableFilter": true,
|
||||||
"EnableAuthorization": false,
|
"EnableAuthorization": false,
|
||||||
"SecurityProtocol": "SaslPlaintext",
|
"SecurityProtocol": "SaslPlaintext",
|
||||||
@ -27,7 +27,7 @@
|
|||||||
"IoTDBOptions": {
|
"IoTDBOptions": {
|
||||||
"UserName": "root",
|
"UserName": "root",
|
||||||
"Password": "root",
|
"Password": "root",
|
||||||
"ClusterList": [ "192.168.1.9:6667" ],
|
"ClusterList": [ "121.42.175.177:16667" ],
|
||||||
"PoolSize": 2,
|
"PoolSize": 2,
|
||||||
"DataBaseName": "energy",
|
"DataBaseName": "energy",
|
||||||
"OpenDebugMode": true,
|
"OpenDebugMode": true,
|
||||||
@ -45,20 +45,20 @@
|
|||||||
},
|
},
|
||||||
"Nodes": [
|
"Nodes": [
|
||||||
{
|
{
|
||||||
"Host": "192.168.1.9",
|
"Host": "121.42.175.177",
|
||||||
"Port": 9042,
|
"Port": 19042,
|
||||||
"DataCenter": "dc1",
|
"DataCenter": "dc1",
|
||||||
"Rack": "RAC1"
|
"Rack": "RAC1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Host": "192.168.1.9",
|
"Host": "121.42.175.177",
|
||||||
"Port": 9043,
|
"Port": 19043,
|
||||||
"DataCenter": "dc1",
|
"DataCenter": "dc1",
|
||||||
"Rack": "RAC2"
|
"Rack": "RAC2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Host": "192.168.1.9",
|
"Host": "121.42.175.177",
|
||||||
"Port": 9044,
|
"Port": 19044,
|
||||||
"DataCenter": "dc1",
|
"DataCenter": "dc1",
|
||||||
"Rack": "RAC2"
|
"Rack": "RAC2"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
"Serilog.Sinks.File"
|
"Serilog.Sinks.File"
|
||||||
],
|
],
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Warning",
|
||||||
"Override": {
|
"Override": {
|
||||||
"Microsoft": "Warning",
|
"Microsoft": "Warning",
|
||||||
"Volo.Abp": "Warning",
|
"Volo.Abp": "Warning",
|
||||||
@ -147,7 +147,8 @@
|
|||||||
"FirstCollectionTime": "2025-04-22 16:07:00",
|
"FirstCollectionTime": "2025-04-22 16:07:00",
|
||||||
"AutomaticVerificationTime": "16:07:00",
|
"AutomaticVerificationTime": "16:07:00",
|
||||||
"AutomaticGetTerminalVersionTime": "17:07:00",
|
"AutomaticGetTerminalVersionTime": "17:07:00",
|
||||||
"AutomaticGetTelematicsModuleTime": "17:30:00"
|
"AutomaticGetTelematicsModuleTime": "17:30:00",
|
||||||
|
"DefaultProtocolPlugin": "T37612012ProtocolPlugin"
|
||||||
},
|
},
|
||||||
"PlugInFolder": ""
|
"PlugInFolder": ""
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user