diff --git a/modules/JiShe.CollectBus.IoTDB/Exceptions/IoTException.cs b/modules/JiShe.CollectBus.IoTDB/Exceptions/IoTException.cs
new file mode 100644
index 0000000..93bed4f
--- /dev/null
+++ b/modules/JiShe.CollectBus.IoTDB/Exceptions/IoTException.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace JiShe.CollectBus.IoTDB.Exceptions
+{
+ ///
+ /// IoTDB异常
+ ///
+ public class IoTException : Exception
+ {
+ public int ErrorCode { get; }
+
+ public IoTException(string message, int errorCode)
+ : base($"{message} (Code: {errorCode})")
+ {
+ ErrorCode = errorCode;
+ }
+ }
+}
diff --git a/modules/JiShe.CollectBus.IoTDB/JiShe.CollectBus.IoTDB.csproj b/modules/JiShe.CollectBus.IoTDB/JiShe.CollectBus.IoTDB.csproj
index 3911399..78b81e3 100644
--- a/modules/JiShe.CollectBus.IoTDB/JiShe.CollectBus.IoTDB.csproj
+++ b/modules/JiShe.CollectBus.IoTDB/JiShe.CollectBus.IoTDB.csproj
@@ -14,7 +14,6 @@
-
+
diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs
index bacbf61..db86791 100644
--- a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs
+++ b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs
@@ -21,6 +21,7 @@ using Microsoft.Extensions.Logging;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities;
using JiShe.CollectBus.Analyzers.Shared;
+using JiShe.CollectBus.IoTDB.Exceptions;
namespace JiShe.CollectBus.IoTDB.Provider
{
@@ -250,128 +251,337 @@ namespace JiShe.CollectBus.IoTDB.Provider
}
}
+ /////
+ ///// 构建Tablet
+ /////
+ /////
+ ///// 表实体
+ ///// 设备元数据
+ /////
+ //private Tablet BuildTablet(IEnumerable entities, DeviceMetadata metadata) where T : IoTEntity
+ //{
+ // var timestamps = new List();
+ // var values = new List>();
+ // var devicePaths = new HashSet();
+ // List tempColumnNames = new List();
+ // tempColumnNames.AddRange(metadata.ColumnNames);
+
+ // var accessor = SourceEntityAccessorFactory.GetAccessor();
+
+ // var memberCache = new Dictionary(); // 缓存优化查询
+ // // 预构建成员缓存(Key: NameOrPath)
+ // foreach (var member in accessor.MemberList)
+ // {
+ // memberCache[member.NameOrPath] = member;
+ // }
+
+ // if (accessor.EntityType == null || metadata.EntityType == null)
+ // {
+ // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 {nameof(T)}的EntityType 没有指定,属于异常情况,-101");
+ // }
+
+ // if (metadata.EntityType != accessor.EntityType)
+ // {
+ // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 {nameof(T)}的EntityType 和{nameof(DeviceMetadata)}的 EntityType 不一致,属于异常情况,-102");
+ // }
+
+ // if (metadata.EntityType == EntityTypeEnum.TreeModel && _runtimeContext.UseTableSessionPool == true)
+ // {
+ // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 tree模型不能使用table模型Session连接,属于异常情况,-103");
+ // }
+ // else if (metadata.EntityType == EntityTypeEnum.TableModel && _runtimeContext.UseTableSessionPool == false)
+ // {
+ // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 table模型不能使用tree模型Session连接,属于异常情况,-104");
+ // }
+
+ // string tableNameOrTreePath = string.Empty;
+ // var tableNameOrTreePathAttribute = typeof(T).GetCustomAttribute();
+ // if (tableNameOrTreePathAttribute != null)
+ // {
+ // tableNameOrTreePath = tableNameOrTreePathAttribute.TableNameOrTreePath;
+ // }
+
+ // foreach (var entity in entities)
+ // {
+ // timestamps.Add(entity.Timestamps);
+ // var rowValues = new List