diff --git a/protocols/JiShe.CollectBus.Protocol.T1882018/GlobalUsings.cs b/protocols/JiShe.CollectBus.Protocol.T1882018/GlobalUsings.cs index 61e52b6..d1b32ae 100644 --- a/protocols/JiShe.CollectBus.Protocol.T1882018/GlobalUsings.cs +++ b/protocols/JiShe.CollectBus.Protocol.T1882018/GlobalUsings.cs @@ -5,4 +5,5 @@ global using Volo.Abp.Modularity; global using JiShe.ServicePro.Enums; global using JiShe.ServicePro.FreeRedisProvider; global using JiShe.ServicePro.Consts; -global using JiShe.ServicePro.Core; \ No newline at end of file +global using JiShe.ServicePro.Core; +global using JiShe.ServicePro.ServerOptions; \ No newline at end of file diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/GlobalUsings.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/GlobalUsings.cs index 61e52b6..d1b32ae 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/GlobalUsings.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/GlobalUsings.cs @@ -5,4 +5,5 @@ global using Volo.Abp.Modularity; global using JiShe.ServicePro.Enums; global using JiShe.ServicePro.FreeRedisProvider; global using JiShe.ServicePro.Consts; -global using JiShe.ServicePro.Core; \ No newline at end of file +global using JiShe.ServicePro.Core; +global using JiShe.ServicePro.ServerOptions; \ No newline at end of file diff --git a/protocols/JiShe.CollectBus.Protocol.T6452007/GlobalUsings.cs b/protocols/JiShe.CollectBus.Protocol.T6452007/GlobalUsings.cs index 61e52b6..d1b32ae 100644 --- a/protocols/JiShe.CollectBus.Protocol.T6452007/GlobalUsings.cs +++ b/protocols/JiShe.CollectBus.Protocol.T6452007/GlobalUsings.cs @@ -5,4 +5,5 @@ global using Volo.Abp.Modularity; global using JiShe.ServicePro.Enums; global using JiShe.ServicePro.FreeRedisProvider; global using JiShe.ServicePro.Consts; -global using JiShe.ServicePro.Core; \ No newline at end of file +global using JiShe.ServicePro.Core; +global using JiShe.ServicePro.ServerOptions; \ No newline at end of file diff --git a/protocols/JiShe.CollectBus.Protocol/GlobalUsings.cs b/protocols/JiShe.CollectBus.Protocol/GlobalUsings.cs new file mode 100644 index 0000000..b6f2092 --- /dev/null +++ b/protocols/JiShe.CollectBus.Protocol/GlobalUsings.cs @@ -0,0 +1,9 @@ +// Global using directives + +global using System.Text; +global using Volo.Abp.Modularity; +global using JiShe.ServicePro.Enums; +global using JiShe.ServicePro.FreeRedisProvider; +global using JiShe.ServicePro.Consts; +global using JiShe.ServicePro.Core; +global using JiShe.ServicePro.ServerOptions; diff --git a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs index 2ac6930..c45c242 100644 --- a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs +++ b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs @@ -182,130 +182,6 @@ namespace JiShe.CollectBus.DataChannels await Task.Delay(1000 * (retry + 1)); } } - } - - - - ///// - ///// 日志保存 - ///// - ///// - ///// - //public async Task LogSaveAsync(ChannelReader channelReader) - //{ - // const int BatchSize = 1000; - // const int EmptyWaitMilliseconds = 1000; - // var timeout = TimeSpan.FromSeconds(2); - // var timer = Stopwatch.StartNew(); - // long timeoutMilliseconds = 0; - // try - // { - // while (true) - // { - // var batch = new List(); - // var canRead = channelReader.Count; - // if (canRead <= 0) - // { - // if (timeoutMilliseconds > 0) - // { - // _logger.LogError($"{nameof(LogSaveAsync)} 通道处理数据耗时{timeoutMilliseconds}毫秒"); - // } - // timeoutMilliseconds = 0; - // //无消息时短等待1秒 - // await Task.Delay(EmptyWaitMilliseconds); - // continue; - // } - - // timer.Restart(); - // var startTime = DateTime.Now; - - // try - // { - // // 异步批量读取数据 - // while (batch != null && batch.Count < BatchSize && (DateTime.Now - startTime) < timeout) - // { - // try - // { - // if (channelReader.TryRead(out var dataItem)) - // { - // batch.Add(dataItem); - // } - // } - // catch (Exception) - // { - // throw; - // } - // } - // } - // catch (Exception) - // { - // throw; - // } - - // if (batch == null || batch.Count == 0) - // { - // await Task.Delay(EmptyWaitMilliseconds); - // continue; - // } - // try - // { - - // // 按小时分组 - // var hourGroups = new Dictionary>(); - // DateTime? dateTime = null; - // List batchList = new List(); - // int index = 1; - // foreach (var item in batch) - // { - // var records = item.Adapt(); - - // if (!records.ReceivedTime.HasValue) - // records.ReceivedTime = DateTime.Now; - // var curDateTime = new DateTime(records.ReceivedTime.Value.Year, records.ReceivedTime.Value.Month, records.ReceivedTime.Value.Hour, records.ReceivedTime.Value.Day, records.ReceivedTime.Value.Hour, 0, 0); - // if (!dateTime.HasValue || curDateTime != dateTime) - // { - // dateTime = curDateTime; - // if (batchList.Count > 0) - // { - // var immutableList = ImmutableList.CreateRange(batchList); - // hourGroups.Add(dateTime.Value, immutableList.ToList()); - // batchList.Clear(); - // } - // } - // batchList.Add(records); - // // 最后一批 - // if(index== batch.Count) - // { - // var immutableList = ImmutableList.CreateRange(batchList); - // hourGroups.Add(dateTime.Value, immutableList.ToList()); - // batchList.Clear(); - // } - // index++; - // } - // foreach (var (time, records) in hourGroups) - // { - // // 批量写入数据库 - // await _logRecordRepository.InsertManyAsync(records, time); - // } - // } - // catch (Exception ex) - // { - // _logger.LogError(ex, "数据通道处理日志数据时发生异常"); - // } - // batch.Clear(); - // timer.Stop(); - - // timeoutMilliseconds = timeoutMilliseconds + timer.ElapsedMilliseconds; - - // startTime = DateTime.Now; - // } - // } - // catch (Exception ex) - // { - // _logger.LogCritical(ex, "日志处理发生致命错误"); - // throw; - // } - //} - + } } } diff --git a/services/JiShe.CollectBus.Application/GlobalUsings.cs b/services/JiShe.CollectBus.Application/GlobalUsings.cs index 998ad2c..4c0d3a4 100644 --- a/services/JiShe.CollectBus.Application/GlobalUsings.cs +++ b/services/JiShe.CollectBus.Application/GlobalUsings.cs @@ -14,3 +14,4 @@ global using JiShe.ServicePro.FreeSqlProvider; global using JiShe.ServicePro.Kafka.Producer; global using JiShe.ServicePro.Consts; global using JiShe.ServicePro.Core; +global using JiShe.ServicePro.ServerOptions; diff --git a/services/JiShe.CollectBus.Application/Subscribers/SubscriberAnalysisAppService.cs b/services/JiShe.CollectBus.Application/Subscribers/SubscriberAnalysisAppService.cs index 3a537db..8e99a56 100644 --- a/services/JiShe.CollectBus.Application/Subscribers/SubscriberAnalysisAppService.cs +++ b/services/JiShe.CollectBus.Application/Subscribers/SubscriberAnalysisAppService.cs @@ -19,6 +19,7 @@ namespace JiShe.CollectBus.Subscribers private readonly IoTDBSessionPoolProvider _dbProvider; private readonly IProtocolService _protocolService; + public SubscriberAnalysisAppService(ILogger logger, ITcpService tcpService, IServiceProvider serviceProvider, diff --git a/shared/JiShe.CollectBus.Common/Models/ServerApplicationOptions.cs b/shared/JiShe.CollectBus.Common/Models/ServerApplicationOptions.cs deleted file mode 100644 index 525b5a2..0000000 --- a/shared/JiShe.CollectBus.Common/Models/ServerApplicationOptions.cs +++ /dev/null @@ -1,53 +0,0 @@ -namespace JiShe.CollectBus.Common -{ - /// - /// 服务器应用配置 - /// - public class ServerApplicationOptions - { - /// - /// 服务器标识 - /// - public string ServerTagName { get; set; } - - /// - /// 系统类型 - /// - public string SystemType { get; set; } - - /// - /// 首次采集时间 - /// - public DateTime? FirstCollectionTime { get; set; } - - /// - /// 自动验证时间 - /// - public string AutomaticVerificationTime { get; set; } - - /// - /// 自动获取终端版时间 - /// - public string AutomaticTerminalVersionTime { get; set; } - - /// - /// 自动获取远程通信模块(SIM)版本时间 - /// - public string AutomaticTelematicsModuleTime { get; set; } - - /// - /// 日冻结抄读时间 - /// - public string AutomaticDayFreezeTime { get; set; } - - /// - /// 月冻结抄读时间 - /// - public string AutomaticMonthFreezeTime { get; set; } - - /// - /// 默认协议插件 - /// - public string DefaultProtocolPlugin { get; set; } - } -} diff --git a/web/JiShe.CollectBus.Host/CollectBusHostModule.cs b/web/JiShe.CollectBus.Host/CollectBusHostModule.cs index 1416c55..a43aabe 100644 --- a/web/JiShe.CollectBus.Host/CollectBusHostModule.cs +++ b/web/JiShe.CollectBus.Host/CollectBusHostModule.cs @@ -1,6 +1,7 @@ using JiShe.CollectBus.Common; using JiShe.CollectBus.Host.HealthChecks; using JiShe.CollectBus.Host.Swaggers; +using JiShe.ServicePro.ServerOptions; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Swashbuckle.AspNetCore.SwaggerUI; using Volo.Abp; diff --git a/web/JiShe.CollectBus.Host/appsettings.json b/web/JiShe.CollectBus.Host/appsettings.json index 702861a..3708b77 100644 --- a/web/JiShe.CollectBus.Host/appsettings.json +++ b/web/JiShe.CollectBus.Host/appsettings.json @@ -34,9 +34,10 @@ "IoTDBOptions": { "UserName": "root", "Password": "root", - "ClusterList": [ "121.42.175.177:16667" ], + "TreeModelClusterList": [ "121.42.175.177:16667" ], + "TableModelClusterList": [ "121.42.175.177:16667" ], "PoolSize": 32, - "DataBaseName": "energy", + "TableModelDataBaseName": "energy", "OpenDebugMode": true, "UseTableSessionPoolByDefault": false },