From e35172d69f4c5f620ced3f13f664be44abee0654 Mon Sep 17 00:00:00 2001
From: ChenYi <296215406@outlook.com>
Date: Mon, 12 May 2025 10:14:08 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs | 2 +-
.../JiShe.CollectBus.Protocol.csproj | 2 +-
.../DataChannels/DataChannelManageService.cs | 4 ++--
.../JiShe.CollectBus.Application.csproj | 4 ++--
.../JiShe.CollectBus.Application/Samples/SampleAppService.cs | 4 ++--
.../BasicScheduledMeterReadingService.cs | 4 ++--
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs
index dfe442d..6d77ce3 100644
--- a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs
+++ b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs
@@ -134,7 +134,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
try
{
- var batchSize = 1000;
+ var batchSize = 2000;
var batches = entities.Chunk(batchSize);
foreach (var batch in batches)
diff --git a/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj b/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj
index 6495b24..7fead27 100644
--- a/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj
+++ b/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj
@@ -19,7 +19,7 @@
-
+
diff --git a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs
index c24ad18..21cec8a 100644
--- a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs
+++ b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs
@@ -63,8 +63,8 @@ namespace JiShe.CollectBus.DataChannels
public async Task ScheduledMeterTaskReadingAsync(
ChannelReader>> telemetryPacketInfoReader)
{
- const int BatchSize = 20000;
- const int EmptyWaitMilliseconds = 1000;
+ const int BatchSize = 100000;
+ const int EmptyWaitMilliseconds = 200;
var timeout = TimeSpan.FromSeconds(5);
var timer = Stopwatch.StartNew();
long timeoutMilliseconds = 0;
diff --git a/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj b/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj
index b9d899c..01878c2 100644
--- a/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj
+++ b/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj
@@ -19,8 +19,8 @@
-
-
+
+
diff --git a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs
index 0009e20..ffbfadb 100644
--- a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs
+++ b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs
@@ -250,14 +250,14 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS
{
time = DateTime.Now;
- var meter = new TableModelSingleMeasuringEntity()
+ var meter = new TableModelSingleMeasuringEntity()
{
SystemName = "energy",
DeviceId = "402440506",
DeviceType = "Ammeter",
ProjectId = "10059",
Timestamps = time.GetDateTimeOffset().ToUnixTimeMilliseconds(),
- SingleColumn = (measuring, value)
+ SingleColumn = (measuring, true)
};
_dbContext.UseTableSessionPool = true;
await _iotDBProvider.InsertAsync(meter);
diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs
index 270bb67..7b407b4 100644
--- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs
+++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs
@@ -231,7 +231,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
//检查任务时间节点,由于定时任务10秒钟运行一次,需要判定当前时间是否在任务时间节点内,不在则跳过
var currentTaskTime = tasksToBeIssueModel.LastTaskTime.CalculateNextCollectionTime(timeDensity);//程序启动缓存电表的时候,NextTaskTime需要格式化到下一个采集点时间。
- if (!IsTaskTime(currentTaskTime, timeDensity))
+ if (!IsTaskTime(currentTaskTime, timeDensity))//todo 如果时间超过两个采集频率周期,就一直处理,直到追加到下一个采集频率周期。
{
_logger.LogInformation($"{nameof(CreateToBeIssueTasks)} 构建待处理的下发指令任务处理时Key=>{item}时间节点不在当前时间范围内,103");
continue;
@@ -498,7 +498,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
timer.Stop();
- _logger.LogInformation($"{nameof(InitAmmeterCacheData)} 初始化电表缓存数据完成,耗时{timer.ElapsedMilliseconds}毫秒");
+ _logger.LogWarning($"{nameof(InitAmmeterCacheData)} 初始化电表缓存数据完成,耗时{timer.ElapsedMilliseconds}毫秒");
}
///
From 80b8942d9d28ab066c6bc1e8b2686cb2abe79414 Mon Sep 17 00:00:00 2001
From: ChenYi <296215406@outlook.com>
Date: Mon, 12 May 2025 11:20:50 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DataChannels/DataChannelManageService.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs
index 21cec8a..3cf4dad 100644
--- a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs
+++ b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs
@@ -64,7 +64,7 @@ namespace JiShe.CollectBus.DataChannels
ChannelReader>> telemetryPacketInfoReader)
{
const int BatchSize = 100000;
- const int EmptyWaitMilliseconds = 200;
+ const int EmptyWaitMilliseconds = 50;
var timeout = TimeSpan.FromSeconds(5);
var timer = Stopwatch.StartNew();
long timeoutMilliseconds = 0;
@@ -83,7 +83,7 @@ namespace JiShe.CollectBus.DataChannels
_logger.LogError($"{nameof(ScheduledMeterTaskReadingAsync)} 通道处理数据耗时{timeoutMilliseconds}毫秒");
}
timeoutMilliseconds = 0;
- //无消息时短等待1秒
+ //无消息时短等待50毫秒
await Task.Delay(EmptyWaitMilliseconds);
continue;
}
From eaf6f22bdc8404b317acb3d500d1b47c26c3dcf2 Mon Sep 17 00:00:00 2001
From: ChenYi <296215406@outlook.com>
Date: Mon, 12 May 2025 15:14:19 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8DIoTDB=E6=9F=A5=E8=AF=A2?=
=?UTF-8?q?=E6=98=A0=E5=B0=84=E7=B1=BB=E5=9E=8B=E5=BC=82=E5=B8=B8=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../JiShe.CollectBus.IoTDB/Model/Class1.cs | 12 --
.../Provider/DeviceMetadata.cs | 19 ++-
.../Provider/IoTDBProvider.cs | 143 ++++++++++--------
.../Samples/SampleAppService.cs | 88 ++++++++++-
.../BasicScheduledMeterReadingService.cs | 2 +-
.../IotSystems/Devices/DeviceDataInfo.cs | 22 +++
6 files changed, 200 insertions(+), 86 deletions(-)
delete mode 100644 modules/JiShe.CollectBus.IoTDB/Model/Class1.cs
create mode 100644 services/JiShe.CollectBus.Domain/IotSystems/Devices/DeviceDataInfo.cs
diff --git a/modules/JiShe.CollectBus.IoTDB/Model/Class1.cs b/modules/JiShe.CollectBus.IoTDB/Model/Class1.cs
deleted file mode 100644
index 9bcd5ff..0000000
--- a/modules/JiShe.CollectBus.IoTDB/Model/Class1.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace JiShe.CollectBus.IoTDB.Model
-{
- internal class Class1
- {
- }
-}
diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs b/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs
index 92c33ee..a93ba35 100644
--- a/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs
+++ b/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs
@@ -60,14 +60,29 @@ namespace JiShe.CollectBus.IoTDB.Provider
public string ColumnName;
///
- /// 值获取委托
+ /// 数据类型
+ ///
+ public TSDataType TSDataType { get; set;}
+
+ ///
+ /// 值获取委托(参数:实体对象)
///
public Func