diff --git a/JiShe.CollectBus.sln b/JiShe.CollectBus.sln
index f02dd6e..272514c 100644
--- a/JiShe.CollectBus.sln
+++ b/JiShe.CollectBus.sln
@@ -66,6 +66,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Analyzers.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Analyzers", "modules\JiShe.CollectBus.Analyzers\JiShe.CollectBus.Analyzers.csproj", "{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Migration.Application.Contracts", "services\JiShe.CollectBus.Migration.Application.Contracts\JiShe.CollectBus.Migration.Application.Contracts.csproj", "{E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Migration.Application", "services\JiShe.CollectBus.Migration.Application\JiShe.CollectBus.Migration.Application.csproj", "{B955C5DA-3C20-35D2-0770-8FE473C41C44}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Migration.Host", "web\JiShe.CollectBus.Migration.Host\JiShe.CollectBus.Migration.Host.csproj", "{995D3D91-7221-D4A3-A7B2-FEC202328A18}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Migration.HttpApi", "web\JiShe.CollectBus.Migration.HttpApi\JiShe.CollectBus.Migration.HttpApi.csproj", "{8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -160,6 +168,22 @@ Global
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B955C5DA-3C20-35D2-0770-8FE473C41C44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B955C5DA-3C20-35D2-0770-8FE473C41C44}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B955C5DA-3C20-35D2-0770-8FE473C41C44}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B955C5DA-3C20-35D2-0770-8FE473C41C44}.Release|Any CPU.Build.0 = Release|Any CPU
+ {995D3D91-7221-D4A3-A7B2-FEC202328A18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {995D3D91-7221-D4A3-A7B2-FEC202328A18}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {995D3D91-7221-D4A3-A7B2-FEC202328A18}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {995D3D91-7221-D4A3-A7B2-FEC202328A18}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -187,6 +211,10 @@ Global
{75B7D419-C261-577D-58D6-AA3ACED9129F} = {3C3F9DB2-EC97-4464-B49F-BF1A0C2B46DC}
{DD68F314-BC66-5601-B094-B1A7BE93F4E0} = {EBF7C01F-9B4F-48E6-8418-2CBFDA51EB0B}
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A} = {2E0FE301-34C3-4561-9CAE-C7A9E65AEE59}
+ {E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A} = {BA4DA3E7-9AD0-47AD-A0E6-A0BB6700DA23}
+ {B955C5DA-3C20-35D2-0770-8FE473C41C44} = {BA4DA3E7-9AD0-47AD-A0E6-A0BB6700DA23}
+ {995D3D91-7221-D4A3-A7B2-FEC202328A18} = {A02F7D8A-04DC-44D6-94D4-3F65712D6B94}
+ {8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4} = {A02F7D8A-04DC-44D6-94D4-3F65712D6B94}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD}
diff --git a/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs b/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs
index 925212e..00a7129 100644
--- a/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs
+++ b/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs
@@ -580,7 +580,7 @@ namespace JiShe.CollectBus.IncrementalGenerator
$"new EntityMemberInfo(" +
$"\"{prop.Name}.{elementName}\", " +
$"typeof({elementType}), " +
- $"GetValueTupleElementName(typeof({elementType})), " +//$"\"{elementDeclaredName}\", " +
+ $"GetValueTupleElementDeclaredTypeName(typeof({elementType})), " +//$"\"{elementDeclaredName}\", " +
$"(e) => Get{prop.Name}_{elementName}(({entityType})e), " +
$"(e, v) => Set{prop.Name}_{elementName}(({entityType})e, ({elementType})v))");
}
@@ -596,7 +596,7 @@ namespace JiShe.CollectBus.IncrementalGenerator
private static string GetValueTupleElementName()
{
return """
- public static string GetValueTupleElementName(Type declaredType)
+ public static string GetValueTupleElementDeclaredTypeName(Type declaredType)
{
string typeName;
// 处理可空类型
diff --git a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs
index c52df0c..ad1dc02 100644
--- a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs
+++ b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs
@@ -545,7 +545,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS
///
///
///
- [KafkaSubscribe(ProtocolConst.TESTSENDTOPIC), ApiExplorerSettings(IgnoreApi = true)]
+ [KafkaSubscribe(ProtocolConst.TESTSENDTOPIC)/*, ApiExplorerSettings(IgnoreApi = true)*/]
public async Task KafkaSubscribeTestSendAsync(KafkaSendDto dto)
{
diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs
index 9795624..f434cdd 100644
--- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs
+++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs
@@ -8,7 +8,6 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Models;
using JiShe.CollectBus.DataChannels;
-using JiShe.CollectBus.DataMigration.Options;
using JiShe.CollectBus.GatherItem;
using JiShe.CollectBus.IoTDB.Interface;
using JiShe.CollectBus.IoTDB.Model;
@@ -42,7 +41,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
private readonly IDataChannelManageService _dataChannelManage;
private readonly IRedisDataCacheService _redisDataCacheService;
private readonly IProtocolService _protocolService;
- private readonly DataMigrationOptions _dataMigrationOptions;
private readonly KafkaOptionConfig _kafkaOptions;
private readonly ServerApplicationOptions _applicationOptions;
private readonly IGuidGenerator _guidGenerator;
@@ -56,7 +54,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
IIoTDbProvider dbProvider,
IProtocolService protocolService,
IGuidGenerator guidGenerator,
- IOptions dataMigrationOptions,
IOptions kafkaOptions,
IOptions applicationOptions)
{
@@ -66,7 +63,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
_redisDataCacheService = redisDataCacheService;
_protocolService = protocolService;
- _dataMigrationOptions = dataMigrationOptions.Value;
_kafkaOptions = kafkaOptions.Value;
_applicationOptions = applicationOptions.Value;
diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs
index e41f7af..bc28d2b 100644
--- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs
+++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs
@@ -1,28 +1,22 @@
using JiShe.CollectBus.Application.Contracts;
using JiShe.CollectBus.Common;
using JiShe.CollectBus.Common.Consts;
-using JiShe.CollectBus.Common.DeviceBalanceControl;
using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.DataChannels;
-using JiShe.CollectBus.DataMigration.Options;
using JiShe.CollectBus.FreeSql;
using JiShe.CollectBus.GatherItem;
-using JiShe.CollectBus.IoTDB.Context;
using JiShe.CollectBus.IoTDB.Interface;
using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.IotSystems.MeterReadingRecords;
-using JiShe.CollectBus.IotSystems.Watermeter;
using JiShe.CollectBus.Kafka.Internal;
-using JiShe.CollectBus.Kafka.Producer;
using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-using MongoDB.Bson.Serialization.IdGenerators;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -52,7 +46,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
IIoTDbProvider dbProvider,
IProtocolService protocolService,
IGuidGenerator guidGenerator,
- IOptions dataMigrationOptions,
IOptions kafkaOptions,
IOptions applicationOptions)
: base(logger,
@@ -61,7 +54,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
dbProvider,
protocolService,
guidGenerator,
- dataMigrationOptions,
kafkaOptions,
applicationOptions)
{
@@ -112,56 +104,77 @@ namespace JiShe.CollectBus.ScheduledMeterReading
// if (ammeterInfos == null || ammeterInfos.Count <= 0)
// {
// ammeterInfos = new List();
- // ammeterInfos.Add(new DeviceInfo()
- // {
- // 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 DeviceInfo()
+ // //{
+ // // 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 DeviceInfo()
+ // //{
+ // // 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 DeviceInfo()
+ // //{
+ // // 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 DeviceInfo()
// {
// Baudrate = 2400,
- // FocusAddress = "442400039",
- // Name = "保利单箱电表2",
- // FocusId = 69280,
+ // FocusAddress = "942411321",
+ // Name = "DDS1980-T4(5-60) ML307A 长稳 942408011321",
+ // FocusId = 57682,
// 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 DeviceInfo()
- // {
- // Baudrate = 2400,
- // FocusAddress = "402440506",
- // Name = "中环半导体9#冷却泵-220KW(三相电表)",
- // FocusId = 106857,
- // DatabaseBusiID = 1,
- // MeteringCode = 0,
- // MeterAddress = "402410040506",
- // MeterId = 139059,
+ // 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,
@@ -173,7 +186,28 @@ namespace JiShe.CollectBus.ScheduledMeterReading
// });
- // FreeRedisProvider.Instance.Set(redisCacheDeviceInfoHashKeyTemp,ammeterInfos);
+ // ammeterInfos.Add(new DeviceInfo()
+ // {
+ // 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,
+ // });
+
+
+ // FreeRedisProvider.Instance.Set(redisCacheDeviceInfoHashKeyTemp, ammeterInfos);
// }
// return ammeterInfos;
@@ -186,43 +220,43 @@ namespace JiShe.CollectBus.ScheduledMeterReading
try
{
string sql = $@"SELECT
- C.ID as MeterId,
- C.Name,
- C.FocusID as FocusId,
- C.SingleRate,
- C.MeteringCode,
- C.Code AS BrandType,
- C.Baudrate,
- C.Password,
- C.MeteringPort,
- C.[Address] AS MeterAddress,
- C.TypeName,
- C.Protocol,
- C.TripState,
- C.[State],
- B.[Address],
- B.AreaCode,
- B.AutomaticReport,
- D.DataTypes,
- B.TimeDensity,
- A.GatherCode,
- C.Special,
- C.[ProjectID],
- B.AbnormalState,
- B.LastTime,
- 1 as MeterType,
- CONCAT(B.AreaCode, B.[Address]) AS FocusAddress,
- (select top 1 DatabaseBusiID from TB_Project where ID = B.ProjectID) AS DatabaseBusiID
- FROM TB_GatherInfo(NOLOCK) AS A
- INNER JOIN TB_FocusInfo(NOLOCK) AS B ON A.ID = B.GatherInfoID AND B.RemoveState >= 0 AND B.State>=0
- INNER JOIN TB_AmmeterInfo(NOLOCK) AS C ON B.ID = C.FocusID AND C.State>= 0 AND C.State<100
- INNER JOIN TB_AmmeterGatherItem(NOLOCK) AS D ON C.ID = D.AmmeterID AND D.State>=0
- WHERE 1=1 and C.Special = 0 ";
+ C.ID as MeterId,
+ C.Name,
+ C.FocusID as FocusId,
+ C.SingleRate,
+ C.MeteringCode,
+ C.Code AS BrandType,
+ C.Baudrate,
+ C.Password,
+ C.MeteringPort,
+ C.[Address] AS MeterAddress,
+ C.TypeName,
+ C.Protocol,
+ C.TripState,
+ C.[State],
+ B.[Address],
+ B.AreaCode,
+ B.AutomaticReport,
+ D.DataTypes,
+ B.TimeDensity,
+ A.GatherCode,
+ C.Special,
+ C.[ProjectID],
+ B.AbnormalState,
+ B.LastTime,
+ 1 as MeterType,
+ CONCAT(B.AreaCode, B.[Address]) AS FocusAddress,
+ (select top 1 DatabaseBusiID from TB_Project where ID = B.ProjectID) AS DatabaseBusiID
+ FROM TB_GatherInfo(NOLOCK) AS A
+ INNER JOIN TB_FocusInfo(NOLOCK) AS B ON A.ID = B.GatherInfoID AND B.RemoveState >= 0 AND B.State>=0
+ INNER JOIN TB_AmmeterInfo(NOLOCK) AS C ON B.ID = C.FocusID AND C.State>= 0 AND C.State<100
+ INNER JOIN TB_AmmeterGatherItem(NOLOCK) AS D ON C.ID = D.AmmeterID AND D.State>=0
+ WHERE 1=1 and C.Special = 0 ";
//TODO 记得移除特殊表过滤
-#if DEBUG
- // sql = $@"{sql} and c.Address in('542410000504','442405000040','442405000039','402410040506')";
+ #if DEBUG
+ //// sql = $@"{sql} and c.Address in('542410000504','442405000040','442405000039','402410040506')";
sql = $@"{sql} and c.Address in('402410040506')";
#endif
@@ -291,7 +325,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
//电表自动阀控缓存
string redisCacheDeviceSettingInfoHashKey = $"redisCacheDeviceSettingInfoHashKey_{SystemType}_{ServerTagName}";
- var settingInfos = FreeRedisProvider.Instance.Get< List> (redisCacheDeviceSettingInfoHashKey);
+ var settingInfos = FreeRedisProvider.Instance.Get>(redisCacheDeviceSettingInfoHashKey);
if (settingInfos == null || settingInfos.Count <= 0)
{
settingInfos = new List();
@@ -323,7 +357,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
// EachDayWithout = "周六,周日",
// TimeDensity = 15,
//});
-
+
//settingInfos.Add(new AmmeterAutoValveControlSetting()
//{
// MeterType = MeterTypeEnum.Ammeter,
@@ -339,6 +373,21 @@ namespace JiShe.CollectBus.ScheduledMeterReading
// TimeDensity = 15,
//});
+ //settingInfos.Add(new AmmeterAutoValveControlSetting()
+ //{
+ // MeterType = MeterTypeEnum.Ammeter,
+ // AmmerterAddress = "402410040506",
+ // FocusAddress = "402440506",
+ // FocusId = 57685,
+ // ProjectID = 1,
+ // TripType = "on",
+ // TripTime = $"{DateTime.Now:HH:mm}",
+ // MeterId = 78973,
+ // LoopType = "EachDay",
+ // EachDayWithout = "周六,周日",
+ // TimeDensity = 15,
+ //});
+
settingInfos.Add(new AmmeterAutoValveControlSetting()
{
MeterType = MeterTypeEnum.Ammeter,
@@ -357,7 +406,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
FreeRedisProvider.Instance.Set(redisCacheDeviceSettingInfoHashKey, settingInfos);
}
- List meterInfos =await GetAmmeterInfoList();
+ List meterInfos = await GetAmmeterInfoList();
#else
//获取电表阀控配置
var settingInfos = await GetAmmeterAutoValveControlSetting(currentTimeStr);
@@ -415,12 +464,12 @@ namespace JiShe.CollectBus.ScheduledMeterReading
}
//获取对应的缓存电表信息
- var ammeterInfo = meterInfos.Where(d=>d.MeterId == settingInfo.MeterId).FirstOrDefault();
+ var ammeterInfo = meterInfos.Where(d => d.MeterId == settingInfo.MeterId).FirstOrDefault();
if (ammeterInfo == null)
{
_logger.LogError($"{nameof(AmmeterScheduledAutoValveControl)} 电表自动阀控时,未找到对应电表信息,电表Id={settingInfo.MeterId}, -102");
continue;
- }
+ }
bool tripStateResult = false;
string itemCode = T37612012PacketItemCodeConst.AFN10HFN01H;
diff --git a/services/JiShe.CollectBus.Application/Subscribers/WorkerSubscriberAppService.cs b/services/JiShe.CollectBus.Application/Subscribers/WorkerSubscriberAppService.cs
index 214caf7..bd754bb 100644
--- a/services/JiShe.CollectBus.Application/Subscribers/WorkerSubscriberAppService.cs
+++ b/services/JiShe.CollectBus.Application/Subscribers/WorkerSubscriberAppService.cs
@@ -76,7 +76,7 @@ namespace JiShe.CollectBus.Subscribers
foreach (var item in receivedMessage)
{
- _logger.LogError($"15分钟采集电表数据下行消息消费队列开始处理:{item.Serialize()}");
+ _logger.LogError($"15分钟采集电表数据下行消息消费队列开始处理_ItemCode_{item.ItemCode}_{item.Serialize()}");
await SendMessagesAsync(item);
}
return SubscribeAck.Success();
diff --git a/services/JiShe.CollectBus.Migration.Application.Contracts/CollectBusMigrationApplicationContractsModule.cs b/services/JiShe.CollectBus.Migration.Application.Contracts/CollectBusMigrationApplicationContractsModule.cs
new file mode 100644
index 0000000..756ba99
--- /dev/null
+++ b/services/JiShe.CollectBus.Migration.Application.Contracts/CollectBusMigrationApplicationContractsModule.cs
@@ -0,0 +1,15 @@
+using Volo.Abp.Application;
+using Volo.Abp.Modularity;
+using Volo.Abp.Authorization;
+
+namespace JiShe.CollectBus.Migration;
+
+[DependsOn(
+ typeof(CollectBusDomainSharedModule),
+ typeof(AbpDddApplicationContractsModule),
+ typeof(AbpAuthorizationModule)
+ )]
+public class CollectBusMigrationApplicationContractsModule : AbpModule
+{
+
+}
diff --git a/services/JiShe.CollectBus.Migration.Application.Contracts/CollectBusMigrationRemoteServiceConsts.cs b/services/JiShe.CollectBus.Migration.Application.Contracts/CollectBusMigrationRemoteServiceConsts.cs
new file mode 100644
index 0000000..cc0c233
--- /dev/null
+++ b/services/JiShe.CollectBus.Migration.Application.Contracts/CollectBusMigrationRemoteServiceConsts.cs
@@ -0,0 +1,8 @@
+namespace JiShe.CollectBus.Migration;
+
+public class CollectBusMigrationRemoteServiceConsts
+{
+ public const string RemoteServiceName = "CollectBus";
+
+ public const string ModuleName = "collectBus";
+}
diff --git a/services/JiShe.CollectBus.Application.Contracts/DataMigration/IDataMigrationService.cs b/services/JiShe.CollectBus.Migration.Application.Contracts/DataMigration/IDataMigrationService.cs
similarity index 90%
rename from services/JiShe.CollectBus.Application.Contracts/DataMigration/IDataMigrationService.cs
rename to services/JiShe.CollectBus.Migration.Application.Contracts/DataMigration/IDataMigrationService.cs
index bbfa581..c6fbb96 100644
--- a/services/JiShe.CollectBus.Application.Contracts/DataMigration/IDataMigrationService.cs
+++ b/services/JiShe.CollectBus.Migration.Application.Contracts/DataMigration/IDataMigrationService.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace JiShe.CollectBus.DataMigration
+namespace JiShe.CollectBus.Migration
{
///
/// 数据迁移服务
diff --git a/services/JiShe.CollectBus.Application.Contracts/DataMigration/Options/DataMigrationOptions.cs b/services/JiShe.CollectBus.Migration.Application.Contracts/DataMigration/Options/DataMigrationOptions.cs
similarity index 95%
rename from services/JiShe.CollectBus.Application.Contracts/DataMigration/Options/DataMigrationOptions.cs
rename to services/JiShe.CollectBus.Migration.Application.Contracts/DataMigration/Options/DataMigrationOptions.cs
index db6cfcc..6e70531 100644
--- a/services/JiShe.CollectBus.Application.Contracts/DataMigration/Options/DataMigrationOptions.cs
+++ b/services/JiShe.CollectBus.Migration.Application.Contracts/DataMigration/Options/DataMigrationOptions.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace JiShe.CollectBus.DataMigration.Options
+namespace JiShe.CollectBus.Migration
{
///
/// 数据迁移配置
diff --git a/services/JiShe.CollectBus.Migration.Application.Contracts/FodyWeavers.xml b/services/JiShe.CollectBus.Migration.Application.Contracts/FodyWeavers.xml
new file mode 100644
index 0000000..1715698
--- /dev/null
+++ b/services/JiShe.CollectBus.Migration.Application.Contracts/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/services/JiShe.CollectBus.Migration.Application.Contracts/ICollectWorker.cs b/services/JiShe.CollectBus.Migration.Application.Contracts/ICollectWorker.cs
new file mode 100644
index 0000000..e2c4fa8
--- /dev/null
+++ b/services/JiShe.CollectBus.Migration.Application.Contracts/ICollectWorker.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace JiShe.CollectBus.Migration
+{
+ public interface ICollectWorker
+ {
+ }
+}
diff --git a/services/JiShe.CollectBus.Migration.Application.Contracts/JiShe.CollectBus.Migration.Application.Contracts.csproj b/services/JiShe.CollectBus.Migration.Application.Contracts/JiShe.CollectBus.Migration.Application.Contracts.csproj
new file mode 100644
index 0000000..f3ef574
--- /dev/null
+++ b/services/JiShe.CollectBus.Migration.Application.Contracts/JiShe.CollectBus.Migration.Application.Contracts.csproj
@@ -0,0 +1,34 @@
+
+
+
+
+
+ net8.0
+ enable
+ JiShe.CollectBus.Migration
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/services/JiShe.CollectBus.Migration.Application/CollectBusMigrationAppService.cs b/services/JiShe.CollectBus.Migration.Application/CollectBusMigrationAppService.cs
new file mode 100644
index 0000000..5ec9a4c
--- /dev/null
+++ b/services/JiShe.CollectBus.Migration.Application/CollectBusMigrationAppService.cs
@@ -0,0 +1,20 @@
+using JiShe.CollectBus.FreeRedis;
+using JiShe.CollectBus.FreeSql;
+using JiShe.CollectBus.Localization;
+using Microsoft.AspNetCore.Mvc;
+using Volo.Abp.Application.Services;
+
+namespace JiShe.CollectBus.Migration;
+
+[ApiExplorerSettings(GroupName = CollectBusDomainSharedConsts.Business)]
+public abstract class CollectBusMigrationAppService : ApplicationService
+{
+ public IFreeSqlProvider SqlProvider => LazyServiceProvider.LazyGetRequiredService();
+ protected IFreeRedisProvider FreeRedisProvider => LazyServiceProvider.LazyGetService()!;
+
+ protected CollectBusMigrationAppService()
+ {
+ LocalizationResource = typeof(CollectBusResource);
+ ObjectMapperContext = typeof(CollectBusMigrationApplicationModule);
+ }
+}
diff --git a/services/JiShe.CollectBus.Migration.Application/CollectBusMigrationApplicationModule.cs b/services/JiShe.CollectBus.Migration.Application/CollectBusMigrationApplicationModule.cs
new file mode 100644
index 0000000..62df6ba
--- /dev/null
+++ b/services/JiShe.CollectBus.Migration.Application/CollectBusMigrationApplicationModule.cs
@@ -0,0 +1,72 @@
+using JiShe.CollectBus.FreeRedis;
+using JiShe.CollectBus.FreeSql;
+using JiShe.CollectBus.IoTDB;
+using Microsoft.Extensions.DependencyInjection;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using Volo.Abp;
+using Volo.Abp.Application;
+using Volo.Abp.AutoMapper;
+using Volo.Abp.BackgroundWorkers;
+using Volo.Abp.BackgroundWorkers.Hangfire;
+using Volo.Abp.Modularity;
+
+namespace JiShe.CollectBus.Migration;
+
+[DependsOn(
+ typeof(CollectBusDomainModule),
+ typeof(CollectBusMigrationApplicationContractsModule),
+ typeof(AbpDddApplicationModule),
+ typeof(AbpAutoMapperModule),
+ typeof(AbpBackgroundWorkersHangfireModule),
+ typeof(CollectBusFreeRedisModule),
+ typeof(CollectBusFreeSqlModule),
+ typeof(CollectBusIoTDbModule)
+)]
+public class CollectBusMigrationApplicationModule : AbpModule
+{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ var configuration = context.Services.GetConfiguration();
+
+ context.Services.AddAutoMapperObjectMapper();
+ Configure(options => { options.AddMaps(true); });
+
+ }
+
+ public override async Task OnApplicationInitializationAsync(
+ ApplicationInitializationContext context)
+ {
+ var assembly = Assembly.GetExecutingAssembly();
+ var types = assembly.GetTypes().Where(t => typeof(ICollectWorker).IsAssignableFrom(t) && !t.IsInterface)
+ .ToList();
+ foreach (var type in types) await context.AddBackgroundWorkerAsync(type);
+
+ //Task.Run(() =>
+ //{
+ // //默认初始化表计信息
+ // var dbContext = context.ServiceProvider.GetRequiredService();
+ // dbContext.InitAmmeterCacheData();
+ // //await dbContext.InitWatermeterCacheData();
+ //}).ConfigureAwait(false);
+
+ ////下发任务通道构建
+ //DataChannelManage.TaskDataChannel = Channel.CreateUnbounded>>();
+
+
+ //// 日志存储通道构建
+ //DataChannelManage.LogSaveChannel = Channel.CreateUnbounded