diff --git a/Directory.Build.props b/Directory.Build.props index 6b19ba6..33a65a2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ - 1.0.5.16 + 1.0.5.23 9.1.1 diff --git a/protocols/JiShe.CollectBus.Protocol.T1882018/GlobalUsings.cs b/protocols/JiShe.CollectBus.Protocol.T1882018/GlobalUsings.cs index d1b32ae..d2a1c52 100644 --- a/protocols/JiShe.CollectBus.Protocol.T1882018/GlobalUsings.cs +++ b/protocols/JiShe.CollectBus.Protocol.T1882018/GlobalUsings.cs @@ -6,4 +6,7 @@ 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; \ No newline at end of file +global using JiShe.ServicePro.ServerOptions; +global using JiShe.ServicePro.ApacheIoTDB.Provider.SessionPools; +global using JiShe.ServicePro.ApacheIoTDB.Provider.Options; +global using JiShe.ServicePro.ApacheIoTDB.Provider.TreeModels.SingleMeasuring; \ No newline at end of file diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs index aa80d1f..2721c07 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs @@ -5,10 +5,7 @@ using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.ServicePro.Consts; using JiShe.ServicePro.Core; -using JiShe.ServicePro.Encrypt; -using JiShe.ServicePro.IoTDBManagement.Model; -using JiShe.ServicePro.IoTDBManagement.Options; -using JiShe.ServicePro.IoTDBManagement.SessionPools; +using JiShe.ServicePro.Encrypt; using JiShe.ServicePro.IoTDBManagement.TableModels; using JiShe.ServicePro.IoTDBManagement.TreeModels; using Microsoft.Extensions.Caching.Memory; diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/GlobalUsings.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/GlobalUsings.cs index d1b32ae..01ea7d4 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/GlobalUsings.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/GlobalUsings.cs @@ -6,4 +6,8 @@ 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; \ No newline at end of file +global using JiShe.ServicePro.ServerOptions; +global using JiShe.ServicePro.ApacheIoTDB.Provider.SessionPools; +global using JiShe.ServicePro.ApacheIoTDB.Provider.Options; +global using JiShe.ServicePro.ApacheIoTDB.Provider.TreeModels.SingleMeasuring; +global using JiShe.ServicePro.ApacheIoTDB.Provider.Model; \ 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 d1b32ae..946e0e8 100644 --- a/protocols/JiShe.CollectBus.Protocol.T6452007/GlobalUsings.cs +++ b/protocols/JiShe.CollectBus.Protocol.T6452007/GlobalUsings.cs @@ -6,4 +6,7 @@ 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; \ No newline at end of file +global using JiShe.ServicePro.ServerOptions; +global using JiShe.ServicePro.ApacheIoTDB.Provider.SessionPools; +global using JiShe.ServicePro.ApacheIoTDB.Provider.Options; +global using JiShe.ServicePro.ApacheIoTDB.Provider.TreeModels.SingleMeasuring; \ No newline at end of file diff --git a/protocols/JiShe.CollectBus.Protocol/GlobalUsings.cs b/protocols/JiShe.CollectBus.Protocol/GlobalUsings.cs index b6f2092..72eb45c 100644 --- a/protocols/JiShe.CollectBus.Protocol/GlobalUsings.cs +++ b/protocols/JiShe.CollectBus.Protocol/GlobalUsings.cs @@ -7,3 +7,7 @@ global using JiShe.ServicePro.FreeRedisProvider; global using JiShe.ServicePro.Consts; global using JiShe.ServicePro.Core; global using JiShe.ServicePro.ServerOptions; +global using JiShe.ServicePro.ApacheIoTDB.Provider.SessionPools; +global using JiShe.ServicePro.ApacheIoTDB.Provider.Options; +global using JiShe.ServicePro.ApacheIoTDB.Provider.TreeModels.SingleMeasuring; +global using JiShe.ServicePro.ApacheIoTDB.Provider.Model; diff --git a/protocols/JiShe.CollectBus.Protocol/Services/ProtocolService.cs b/protocols/JiShe.CollectBus.Protocol/Services/ProtocolService.cs index 99bb314..79c4dc1 100644 --- a/protocols/JiShe.CollectBus.Protocol/Services/ProtocolService.cs +++ b/protocols/JiShe.CollectBus.Protocol/Services/ProtocolService.cs @@ -38,10 +38,22 @@ namespace JiShe.CollectBus.Protocol.Services { var protocols = await _freeRedisProvider.Instance.HGetAllAsync(RedisConst.ProtocolKey); var keyValuePair = protocols.FirstOrDefault(a => ContainsExactPartRegex(deviceCode, a.Value.RegularExpression)); - 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 (!keyValuePair.Key.IsNullOrWhiteSpace() || keyValuePair.Value != null) + { + return keyValuePair.Value; + } + + if (isSpecial) + { + throw new UserFriendlyException("The device protocol plugin does not exist!", ExceptionCode.NotFound); + } + //todo 默认协议插件应该根据表类型获取 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; } diff --git a/services/JiShe.CollectBus.Application.Contracts/GlobalUsings.cs b/services/JiShe.CollectBus.Application.Contracts/GlobalUsings.cs index 6b81fc0..2282faa 100644 --- a/services/JiShe.CollectBus.Application.Contracts/GlobalUsings.cs +++ b/services/JiShe.CollectBus.Application.Contracts/GlobalUsings.cs @@ -4,8 +4,10 @@ global using System.Text; global using Volo.Abp.Modularity; global using JiShe.ServicePro.Enums; global using JiShe.ServicePro.FreeRedisProvider; -global using JiShe.ServicePro.IoTDBManagement.Options; -global using JiShe.ServicePro.IoTDBManagement.SessionPools; +global using JiShe.ServicePro.ApacheIoTDB.Provider.SessionPools; +global using JiShe.ServicePro.ApacheIoTDB.Provider.Options; +global using JiShe.ServicePro.ApacheIoTDB.Provider.TreeModels.SingleMeasuring; +global using JiShe.ServicePro.ApacheIoTDB.Provider.Model; global using JiShe.ServicePro.IoTDBManagement.TableModels; global using JiShe.ServicePro.Kafka.Consts; global using JiShe.ServicePro.Kafka.Internal; diff --git a/services/JiShe.CollectBus.Application/GlobalUsings.cs b/services/JiShe.CollectBus.Application/GlobalUsings.cs index 4c0d3a4..d282177 100644 --- a/services/JiShe.CollectBus.Application/GlobalUsings.cs +++ b/services/JiShe.CollectBus.Application/GlobalUsings.cs @@ -4,9 +4,9 @@ global using System.Text; global using Volo.Abp.Modularity; global using JiShe.ServicePro.Enums; global using JiShe.ServicePro.FreeRedisProvider; -global using JiShe.ServicePro.IoTDBManagement.Options; -global using JiShe.ServicePro.IoTDBManagement.SessionPools; global using JiShe.ServicePro.IoTDBManagement.TableModels; +global using JiShe.ServicePro.ApacheIoTDB.Provider.SessionPools; +global using JiShe.ServicePro.ApacheIoTDB.Provider.Options; global using JiShe.ServicePro.Kafka.Consts; global using JiShe.ServicePro.Kafka.Internal; global using JiShe.ServicePro.Kafka.Attributes; diff --git a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs index ca4e541..6a89b38 100644 --- a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs +++ b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs @@ -5,9 +5,7 @@ using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Devices; using JiShe.CollectBus.IotSystems.PrepayModel; using JiShe.CollectBus.Protocol.Interfaces; -using JiShe.ServicePro.FreeSqlProvider; -using JiShe.ServicePro.IoTDBManagement.Options; -using JiShe.ServicePro.IoTDBManagement.SessionPools; +using JiShe.ServicePro.FreeSqlProvider; using JiShe.ServicePro.Kafka.Internal; using JiShe.ServicePro.Kafka.Producer; using Microsoft.AspNetCore.Authorization; diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs index dad113b..b004603 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs @@ -494,159 +494,167 @@ namespace JiShe.CollectBus.ScheduledMeterReading /// private async Task> AmmerterCreatePublishTaskAction(int timeDensity, DeviceCacheInfo ammeterInfo, int groupIndex, DateTime timestamps) { - var currentTime = DateTime.Now; + try + { + var currentTime = DateTime.Now; - //根据电表型号获取协议插件 - var protocolPlugin = await _protocolService.GetProtocolServiceAsync(ammeterInfo.BrandType); - if (protocolPlugin == null) - { - //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 创建电表待发送的任务数据{currentTime}没有找到对应的协议组件,-105"); - return null; - } - - if (ammeterInfo.ItemCodes == null || ammeterInfo.ItemCodes.Count <=0) - { - //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}数据采集指令生成失败,采集项为空,-101"); - return null; - } - - //载波的不处理 - if (ammeterInfo.MeteringPort == (int)MeterLinkProtocolEnum.Carrierwave) - { - //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}数据采集指令生成失败,载波不处理,-102"); - return null; - } - - if (ammeterInfo.State.Equals(2)) - { - //_logger.LogWarning($"{nameof(AmmerterCreatePublishTaskAction)} {ammeterInfo.Name} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}状态为禁用,不处理"); - return null; - } - - ////排除1天未在线的集中器生成指令 或 排除集中器配置为自动上报的集中器 - //if (!IsGennerateCmd(ammeter.LastTime, -1)) - //{ - // _logger.LogInformation($"{nameof(CreatePublishTask)} 集中器{ammeter.FocusAddress}的电表{ammeter.Name},采集时间:{ammeter.LastTime},已超过1天未在线,不生成指令"); - // continue; - //} - - if (string.IsNullOrWhiteSpace(ammeterInfo.AreaCode)) - { - //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 表ID:{ammeterInfo.MeterId},集中器通信区号为空"); - return null; - } - if (string.IsNullOrWhiteSpace(ammeterInfo.Address)) - { - //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 表ID:{ammeterInfo.MeterId},集中器通信地址为空"); - return null; - } - if (Convert.ToInt32(ammeterInfo.Address) > 65535) - { - //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 表ID:{ammeterInfo.MeterId},集中器通信地址无效,确保大于65535"); - return null; - } - if (ammeterInfo.MeteringCode <= 0 || ammeterInfo.MeteringCode > 33) - { - //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 表ID:{ammeterInfo.MeterId},非有效测量点号({ammeterInfo.MeteringCode})"); - return null; - } - - List tempCodes = ammeterInfo.ItemCodes!; - - //TODO:自动上报数据只主动采集1类数据。 - if (ammeterInfo.AutomaticReport.Equals(1)) - { - var tempSubCodes = new List(); - if (tempCodes.Contains("0C_49")) + //根据电表型号获取协议插件 + var protocolPlugin = await _protocolService.GetProtocolServiceAsync(ammeterInfo.BrandType); + if (protocolPlugin == null) { - tempSubCodes.Add("0C_49"); - } - - if (tempSubCodes.Contains("0C_149")) - { - tempSubCodes.Add("0C_149"); - } - - if (ammeterInfo.ItemCodes.Contains("10_97")) - { - tempSubCodes.Add("10_97"); - } - - if (tempSubCodes == null || tempSubCodes.Count <= 0) - { - //_logger.LogInformation($"{nameof(AmmerterCreatePublishTask)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}自动上报数据主动采集1类数据时数据类型为空"); + //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 创建电表待发送的任务数据{currentTime}没有找到对应的协议组件,-105"); return null; } - else - { - tempCodes = tempSubCodes; - } - } - List taskList = new List(); - - foreach (var tempItem in tempCodes) - { - //排除已发送日冻结和月冻结采集项配置 - if (DayFreezeCodes.Contains(tempItem)) + if (ammeterInfo.ItemCodes == null || ammeterInfo.ItemCodes.Count <= 0) { - continue; + //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}数据采集指令生成失败,采集项为空,-101"); + return null; } - if (MonthFreezeCodes.Contains(tempItem)) + //载波的不处理 + if (ammeterInfo.MeteringPort == (int)MeterLinkProtocolEnum.Carrierwave) { - continue; + //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}数据采集指令生成失败,载波不处理,-102"); + return null; } - //var itemCodeArr = tempItem.Split('_'); - //var aFNStr = itemCodeArr[0]; - //var aFN = (AFN)aFNStr.HexToDec(); - //var fn = int.Parse(itemCodeArr[1]); - - //特殊编码映射 - var itemCodeInfo = T37612012PacketItemCodeConst.MappingItemCodeTo645SubCodeRelationship(tempItem); - - //TODO:特殊表 - ProtocolBuildResponse builderResponse = await protocolPlugin.BuildAsync(new ProtocolBuildRequest() + if (ammeterInfo.State.Equals(2)) { - FocusAddress = ammeterInfo.FocusAddress, - Pn = itemCodeInfo.Item1 == T37612012PacketItemCodeConst.AFN10HFN01H ? 0 : ammeterInfo.MeteringCode, - ItemCode = itemCodeInfo.Item1, - DataTimeMark = new Protocol.DataTimeMark() + //_logger.LogWarning($"{nameof(AmmerterCreatePublishTaskAction)} {ammeterInfo.Name} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}状态为禁用,不处理"); + return null; + } + + ////排除1天未在线的集中器生成指令 或 排除集中器配置为自动上报的集中器 + //if (!IsGennerateCmd(ammeter.LastTime, -1)) + //{ + // _logger.LogInformation($"{nameof(CreatePublishTask)} 集中器{ammeter.FocusAddress}的电表{ammeter.Name},采集时间:{ammeter.LastTime},已超过1天未在线,不生成指令"); + // continue; + //} + + if (string.IsNullOrWhiteSpace(ammeterInfo.AreaCode)) + { + //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 表ID:{ammeterInfo.MeterId},集中器通信区号为空"); + return null; + } + if (string.IsNullOrWhiteSpace(ammeterInfo.Address)) + { + //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 表ID:{ammeterInfo.MeterId},集中器通信地址为空"); + return null; + } + if (Convert.ToInt32(ammeterInfo.Address) > 65535) + { + //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 表ID:{ammeterInfo.MeterId},集中器通信地址无效,确保大于65535"); + return null; + } + if (ammeterInfo.MeteringCode <= 0 || ammeterInfo.MeteringCode > 33) + { + //_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 表ID:{ammeterInfo.MeterId},非有效测量点号({ammeterInfo.MeteringCode})"); + return null; + } + + List tempCodes = ammeterInfo.ItemCodes!; + + //TODO:自动上报数据只主动采集1类数据。 + if (ammeterInfo.AutomaticReport.Equals(1)) + { + var tempSubCodes = new List(); + if (tempCodes.Contains("0C_49")) { - Density = ammeterInfo.TimeDensity.GetFocusDensity(),//转换成协议的值 - Point = 1, - DataTime = timestamps, - }, - SubProtocolRequest = new SubProtocolBuildRequest() - { - MeterAddress = ammeterInfo.MeterAddress, - Password = ammeterInfo.Password, - MeteringPort = ammeterInfo.MeteringPort, - Baudrate = ammeterInfo.Baudrate, - ItemCode = itemCodeInfo.Item2, //10_97 => 11_02_80_00_02 + tempSubCodes.Add("0C_49"); + } + + if (tempSubCodes.Contains("0C_149")) + { + tempSubCodes.Add("0C_149"); + } + + if (ammeterInfo.ItemCodes.Contains("10_97")) + { + tempSubCodes.Add("10_97"); + } + + if (tempSubCodes == null || tempSubCodes.Count <= 0) + { + //_logger.LogInformation($"{nameof(AmmerterCreatePublishTask)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}自动上报数据主动采集1类数据时数据类型为空"); + return null; + } + else + { + tempCodes = tempSubCodes; } - }); - if (builderResponse == null || builderResponse.Data.Length <= 0) - { - //_logger.LogWarning($"{nameof(AmmerterCreatePublishTask)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}采集项{tempItem}未能正确获取报文。"); - continue; } - var meterReadingRecords = CreateAmmeterPacketInfo( - ammeterInfo: ammeterInfo, - timestamps: DateTimeOffset.Now.ToUnixTimeNanoseconds(), - builderResponse: builderResponse, - itemCode: itemCodeInfo.Item1, - subItemCode: itemCodeInfo.Item2, - pendingCopyReadTime: timestamps, - creationTime: currentTime, - packetType: (TelemetryPacketTypeEnum)timeDensity, - _guidGenerator); - taskList.Add(meterReadingRecords); - } + List taskList = new List(); - return taskList; + foreach (var tempItem in tempCodes) + { + //排除已发送日冻结和月冻结采集项配置 + if (DayFreezeCodes.Contains(tempItem)) + { + continue; + } + + if (MonthFreezeCodes.Contains(tempItem)) + { + continue; + } + + //var itemCodeArr = tempItem.Split('_'); + //var aFNStr = itemCodeArr[0]; + //var aFN = (AFN)aFNStr.HexToDec(); + //var fn = int.Parse(itemCodeArr[1]); + + //特殊编码映射 + var itemCodeInfo = T37612012PacketItemCodeConst.MappingItemCodeTo645SubCodeRelationship(tempItem); + + //TODO:特殊表 + ProtocolBuildResponse builderResponse = await protocolPlugin.BuildAsync(new ProtocolBuildRequest() + { + FocusAddress = ammeterInfo.FocusAddress, + Pn = itemCodeInfo.Item1 == T37612012PacketItemCodeConst.AFN10HFN01H ? 0 : ammeterInfo.MeteringCode, + ItemCode = itemCodeInfo.Item1, + DataTimeMark = new Protocol.DataTimeMark() + { + Density = ammeterInfo.TimeDensity.GetFocusDensity(),//转换成协议的值 + Point = 1, + DataTime = timestamps, + }, + SubProtocolRequest = new SubProtocolBuildRequest() + { + MeterAddress = ammeterInfo.MeterAddress, + Password = ammeterInfo.Password, + MeteringPort = ammeterInfo.MeteringPort, + Baudrate = ammeterInfo.Baudrate, + ItemCode = itemCodeInfo.Item2, //10_97 => 11_02_80_00_02 + } + }); + if (builderResponse == null || builderResponse.Data.Length <= 0) + { + //_logger.LogWarning($"{nameof(AmmerterCreatePublishTask)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}采集项{tempItem}未能正确获取报文。"); + continue; + } + + var meterReadingRecords = CreateAmmeterPacketInfo( + ammeterInfo: ammeterInfo, + timestamps: DateTimeOffset.Now.ToUnixTimeNanoseconds(), + builderResponse: builderResponse, + itemCode: itemCodeInfo.Item1, + subItemCode: itemCodeInfo.Item2, + pendingCopyReadTime: timestamps, + creationTime: currentTime, + packetType: (TelemetryPacketTypeEnum)timeDensity, + _guidGenerator); + taskList.Add(meterReadingRecords); + } + + return taskList; + } + catch (Exception ex) + { + + throw; + } } /// diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs index a76c551..223199b 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs @@ -87,149 +87,149 @@ namespace JiShe.CollectBus.ScheduledMeterReading //[Route($"ammeter/list")] public override async Task> GetAmmeterInfoList(string gatherCode = "V4-Gather-8890") { -#if DEBUG - var redisCacheDeviceCacheInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceCacheInfo"; +//#if DEBUG +// var redisCacheDeviceCacheInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceCacheInfo"; - List ammeterInfos = FreeRedisProvider.Instance.Get>(redisCacheDeviceCacheInfoHashKeyTemp);//542400504 +// List ammeterInfos = FreeRedisProvider.Instance.Get>(redisCacheDeviceCacheInfoHashKeyTemp);//542400504 - if (ammeterInfos == null || ammeterInfos.Count <= 0) - { - ammeterInfos = new List(); - //ammeterInfos.Add(new DeviceCacheInfo() - //{ - // Baudrate = 2400, - // FocusAddress = "442400040", - // Name = "保利单箱电表1", - // FocusId = 95780, - // DatabaseBusiID = 1, - // MeteringCode = 0, - // MeterAddress = "442405000040", - // MeterId = 127035, - // TypeName = 1, - // DataTypes = "581,589,592,597,601", - // TimeDensity = 15, - // BrandType = "DTS1980", - // MeterType = MeterTypeEnum.Ammeter, - // ProjectID = 1, - // MeteringPort = MeteringPortConst.MeteringPortTwo, - // Password = "000000", - //}); +// if (ammeterInfos == null || ammeterInfos.Count <= 0) +// { +// ammeterInfos = new List(); +// //ammeterInfos.Add(new DeviceCacheInfo() +// //{ +// // Baudrate = 2400, +// // FocusAddress = "442400040", +// // Name = "保利单箱电表1", +// // FocusId = 95780, +// // DatabaseBusiID = 1, +// // MeteringCode = 0, +// // MeterAddress = "442405000040", +// // MeterId = 127035, +// // TypeName = 1, +// // DataTypes = "581,589,592,597,601", +// // TimeDensity = 15, +// // BrandType = "DTS1980", +// // MeterType = MeterTypeEnum.Ammeter, +// // ProjectID = 1, +// // MeteringPort = MeteringPortConst.MeteringPortTwo, +// // Password = "000000", +// //}); - //ammeterInfos.Add(new DeviceCacheInfo() - //{ - // Baudrate = 2400, - // FocusAddress = "442400039", - // Name = "保利单箱电表2", - // FocusId = 69280, - // DatabaseBusiID = 1, - // MeteringCode = 0, - // MeterAddress = "442405000039", - // MeterId = 95594, - // TypeName = 1, - // DataTypes = "581,589,592,597,601", - // TimeDensity = 15, - // BrandType = "DTS1980", - // MeterType = MeterTypeEnum.Ammeter, - // ProjectID = 1, - // MeteringPort = MeteringPortConst.MeteringPortTwo, - // Password = "000000", - //}); +// //ammeterInfos.Add(new DeviceCacheInfo() +// //{ +// // Baudrate = 2400, +// // FocusAddress = "442400039", +// // Name = "保利单箱电表2", +// // FocusId = 69280, +// // DatabaseBusiID = 1, +// // MeteringCode = 0, +// // MeterAddress = "442405000039", +// // MeterId = 95594, +// // TypeName = 1, +// // DataTypes = "581,589,592,597,601", +// // TimeDensity = 15, +// // BrandType = "DTS1980", +// // MeterType = MeterTypeEnum.Ammeter, +// // ProjectID = 1, +// // MeteringPort = MeteringPortConst.MeteringPortTwo, +// // Password = "000000", +// //}); - //ammeterInfos.Add(new DeviceCacheInfo() - //{ - // Baudrate = 2400, - // FocusAddress = "402440506", - // Name = "中环半导体9#冷却泵-220KW(三相电表)", - // FocusId = 106857, - // DatabaseBusiID = 1, - // MeteringCode = 0, - // MeterAddress = "402410040506", - // MeterId = 139059, - // TypeName = 3, - // DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679", - // TimeDensity = 15, - // BrandType = "DTS1980", - // Password = "000000", - // ProjectID = 1, - // MeterType = MeterTypeEnum.Ammeter, - // MeteringPort = MeteringPortConst.MeteringPortTwo, - //}); +// //ammeterInfos.Add(new DeviceCacheInfo() +// //{ +// // Baudrate = 2400, +// // FocusAddress = "402440506", +// // Name = "中环半导体9#冷却泵-220KW(三相电表)", +// // FocusId = 106857, +// // DatabaseBusiID = 1, +// // MeteringCode = 0, +// // MeterAddress = "402410040506", +// // MeterId = 139059, +// // TypeName = 3, +// // DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679", +// // TimeDensity = 15, +// // BrandType = "DTS1980", +// // Password = "000000", +// // ProjectID = 1, +// // MeterType = MeterTypeEnum.Ammeter, +// // MeteringPort = MeteringPortConst.MeteringPortTwo, +// //}); - //ammeterInfos.Add(new DeviceCacheInfo() - //{ - // Baudrate = 2400, - // FocusAddress = "942411321", - // Name = "DDS1980-T4(5-60) ML307A 长稳 942408011321", - // FocusId = 57682, - // DatabaseBusiID = 1, - // MeteringCode = 0, - // MeterAddress = "942408011321", - // MeterId = 78970, - // TypeName = 3, - // DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679", - // TimeDensity = 15, - // BrandType = "DTS1980", - // Password = "000000", - // ProjectID = 1, - // MeterType = MeterTypeEnum.Ammeter, - // MeteringPort = MeteringPortConst.MeteringPortTwo, - //}); +// //ammeterInfos.Add(new DeviceCacheInfo() +// //{ +// // Baudrate = 2400, +// // FocusAddress = "942411321", +// // Name = "DDS1980-T4(5-60) ML307A 长稳 942408011321", +// // FocusId = 57682, +// // DatabaseBusiID = 1, +// // MeteringCode = 0, +// // MeterAddress = "942408011321", +// // MeterId = 78970, +// // TypeName = 3, +// // DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679", +// // TimeDensity = 15, +// // BrandType = "DTS1980", +// // Password = "000000", +// // ProjectID = 1, +// // MeterType = MeterTypeEnum.Ammeter, +// // MeteringPort = MeteringPortConst.MeteringPortTwo, +// //}); - //ammeterInfos.Add(new DeviceCacheInfo() - //{ - // Baudrate = 2400, - // FocusAddress = "942411319", - // Name = "DDS1980-T4(5-60) ML307A 长稳 942408011319", - // FocusId = 57685, - // DatabaseBusiID = 1, - // MeteringCode = 0, - // MeterAddress = "942408011319", - // MeterId = 78973, - // TypeName = 3, - // DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679", - // TimeDensity = 15, - // BrandType = "DTS1980", - // Password = "000000", - // ProjectID = 1, - // MeterType = MeterTypeEnum.Ammeter, - // MeteringPort = MeteringPortConst.MeteringPortTwo, - //}); +// //ammeterInfos.Add(new DeviceCacheInfo() +// //{ +// // Baudrate = 2400, +// // FocusAddress = "942411319", +// // Name = "DDS1980-T4(5-60) ML307A 长稳 942408011319", +// // FocusId = 57685, +// // DatabaseBusiID = 1, +// // MeteringCode = 0, +// // MeterAddress = "942408011319", +// // MeterId = 78973, +// // TypeName = 3, +// // DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679", +// // TimeDensity = 15, +// // BrandType = "DTS1980", +// // Password = "000000", +// // ProjectID = 1, +// // MeterType = MeterTypeEnum.Ammeter, +// // MeteringPort = MeteringPortConst.MeteringPortTwo, +// //}); - ammeterInfos.Add(new DeviceCacheInfo() - { - Baudrate = 2400, - FocusAddress = "322011149", - Name = "DDS1980-T4(5-60) ML307A 长稳 322011149", - FocusId = 57685, - DatabaseBusiID = 1, - MeteringCode = 0, - MeterAddress = "31240010270", - MeterId = 78973, - TypeName = 3, - DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679", - TimeDensity = 15, - BrandType = "DTS1980", - Password = "000000", - MeterType = MeterTypeEnum.Ammeter, - MeteringPort = MeteringPortConst.MeteringPortTwo, - SystemName = SystemType, - IoTDataType = IOTDBDataTypeConst.Data, - ProjectId = "1", - DeviceType = JiShe.ServicePro.Enums.MeterTypeEnum.Ammeter.ToString(), - DeviceId = "78973", +// ammeterInfos.Add(new DeviceCacheInfo() +// { +// Baudrate = 2400, +// FocusAddress = "322011149", +// Name = "DDS1980-T4(5-60) ML307A 长稳 322011149", +// FocusId = 57685, +// DatabaseBusiID = 1, +// MeteringCode = 0, +// MeterAddress = "31240010270", +// MeterId = 78973, +// TypeName = 3, +// DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679", +// TimeDensity = 15, +// BrandType = "DTS1980", +// Password = "000000", +// MeterType = MeterTypeEnum.Ammeter, +// MeteringPort = MeteringPortConst.MeteringPortTwo, +// SystemName = SystemType, +// IoTDataType = IOTDBDataTypeConst.Data, +// ProjectId = "1", +// DeviceType = JiShe.ServicePro.Enums.MeterTypeEnum.Ammeter.ToString(), +// DeviceId = "78973", - }); +// }); - FreeRedisProvider.Instance.Set(redisCacheDeviceCacheInfoHashKeyTemp, ammeterInfos); - } +// FreeRedisProvider.Instance.Set(redisCacheDeviceCacheInfoHashKeyTemp, ammeterInfos); +// } - return ammeterInfos; -#else +// return ammeterInfos; +//#else -#endif +//#endif try @@ -272,7 +272,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading #if DEBUG // sql = $@"{sql} and c.Address in('542410000504','442405000040','442405000039','402410040506')"; - sql = $@"{sql} and c.Address in('402410040506')"; + //sql = $@"{sql} and c.Address in('402410040506')"; #endif if (!string.IsNullOrWhiteSpace(gatherCode)) diff --git a/services/JiShe.CollectBus.DbMigrator/DbMigratorHostedService.cs b/services/JiShe.CollectBus.DbMigrator/DbMigratorHostedService.cs index b41831c..c330696 100644 --- a/services/JiShe.CollectBus.DbMigrator/DbMigratorHostedService.cs +++ b/services/JiShe.CollectBus.DbMigrator/DbMigratorHostedService.cs @@ -7,7 +7,7 @@ using JiShe.CollectBus.Data; using Serilog; using Volo.Abp; using Volo.Abp.Data; -using JiShe.ServicePro.IoTDBManagement.SessionPools; +using JiShe.ServicePro.ApacheIoTDB.Provider.SessionPools; namespace JiShe.CollectBus.DbMigrator; diff --git a/web/JiShe.CollectBus.Host/appsettings.Development.json b/web/JiShe.CollectBus.Host/appsettings.Development.json index bcdd3fc..eedf16c 100644 --- a/web/JiShe.CollectBus.Host/appsettings.Development.json +++ b/web/JiShe.CollectBus.Host/appsettings.Development.json @@ -4,5 +4,10 @@ "Default": "Warning", "Microsoft.AspNetCore": "Warning" } + }, + "ConnectionStrings": { + "Default": "", + "PrepayDB": "server=rm-m5el3d1u1k0wzk70n2o.sqlserver.rds.aliyuncs.com,3433;database=jishe.sysdb;uid=v3sa;pwd=JiShe123;Encrypt=False;Trust Server Certificate=False", + "EnergyDB": "server=rm-wz9hw529i3j1e3b5fbo.sqlserver.rds.aliyuncs.com,3433;database=db_energy;uid=yjdb;pwd=Kdjdhf+9*7ad222LL;Encrypt=False;Trust Server Certificate=False" } } diff --git a/web/JiShe.CollectBus.Host/appsettings.json b/web/JiShe.CollectBus.Host/appsettings.json index bcb6128..1e70ef3 100644 --- a/web/JiShe.CollectBus.Host/appsettings.json +++ b/web/JiShe.CollectBus.Host/appsettings.json @@ -1,9 +1,9 @@ { - "ConnectionStrings": { - "Default": "", - "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" - }, + //"ConnectionStrings": { + // "Default": "", + // "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" + //}, "FreeRedisOptions": { "ConnectionString": "47.110.53.196:6379,password=1q3J@BGf!yhTaD46nS#,syncTimeout=30000,abortConnect=false,connectTimeout=30000,allowAdmin=true,maxPoolSize=50,defaultdatabase=14", "UseDistributedCache": false