From 01123703e5489dec80db1f5f02df60c11afb21e2 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Wed, 4 Jun 2025 17:09:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E6=88=90IoTDB=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Directory.Build.JiShe.targets | 125 +++++++++--------- Directory.Build.props | 4 +- .../JiShe.IoT.HttpApi.Host.csproj | 8 +- .../IoTApplicationContractsModule.cs | 2 + .../JiShe.IoT.Application.Contracts.csproj | 1 + src/JiShe.IoT.Application/IoTAppService.cs | 2 +- .../IoTApplicationModule.cs | 4 +- .../JiShe.IoT.Application.csproj | 1 + src/JiShe.IoT.DbMigrator/appsettings.json | 10 ++ .../IoTDomainSharedModule.cs | 4 +- .../JiShe.IoT.Domain.Shared.csproj | 1 + .../Data/IoTDbMigrationService.cs | 18 ++- src/JiShe.IoT.Domain/IoTDomainModule.cs | 2 + src/JiShe.IoT.Domain/JiShe.IoT.Domain.csproj | 1 + .../JiShe.IoT.EntityFrameworkCore.csproj | 1 + .../IoTHttpApiClientModule.cs | 2 + .../JiShe.IoT.HttpApi.Client.csproj | 1 + src/JiShe.IoT.HttpApi/IoTHttpApiModule.cs | 2 + .../JiShe.IoT.HttpApi.csproj | 42 +++--- 19 files changed, 138 insertions(+), 93 deletions(-) diff --git a/Directory.Build.JiShe.targets b/Directory.Build.JiShe.targets index 5db0bce..931de5c 100644 --- a/Directory.Build.JiShe.targets +++ b/Directory.Build.JiShe.targets @@ -1,72 +1,72 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + @@ -98,6 +98,7 @@ - - + + + \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 95cc910..07d38b1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,11 +2,11 @@ - 1.0.1 + 1.0.5.06 9.1.1 - 9.0.0 + 9.0.0 \ No newline at end of file diff --git a/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj b/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj index d461817..5449737 100644 --- a/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj +++ b/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj @@ -30,9 +30,7 @@ - - - + @@ -53,8 +51,10 @@ + + - + diff --git a/src/JiShe.IoT.Application.Contracts/IoTApplicationContractsModule.cs b/src/JiShe.IoT.Application.Contracts/IoTApplicationContractsModule.cs index 6f34544..61f7478 100644 --- a/src/JiShe.IoT.Application.Contracts/IoTApplicationContractsModule.cs +++ b/src/JiShe.IoT.Application.Contracts/IoTApplicationContractsModule.cs @@ -1,5 +1,6 @@ using JiShe.ServicePro.DynamicMenuManagement; using JiShe.ServicePro.FileManagement; +using JiShe.ServicePro.IoTDBManagement; using JiShe.ServicePro.TemplateManagement; namespace JiShe.IoT @@ -13,6 +14,7 @@ namespace JiShe.IoT typeof(LanguageManagementApplicationContractsModule), typeof(TemplateManagementApplicationContractsModule), typeof(FileManagementApplicationContractsModule), + typeof(IoTDBManagementApplicationContractsModule), typeof(DynamicMenuManagementApplicationContractsModule) )] public class IoTApplicationContractsModule : AbpModule diff --git a/src/JiShe.IoT.Application.Contracts/JiShe.IoT.Application.Contracts.csproj b/src/JiShe.IoT.Application.Contracts/JiShe.IoT.Application.Contracts.csproj index 9456405..54eb1d3 100644 --- a/src/JiShe.IoT.Application.Contracts/JiShe.IoT.Application.Contracts.csproj +++ b/src/JiShe.IoT.Application.Contracts/JiShe.IoT.Application.Contracts.csproj @@ -21,6 +21,7 @@ + \ No newline at end of file diff --git a/src/JiShe.IoT.Application/IoTAppService.cs b/src/JiShe.IoT.Application/IoTAppService.cs index ec9ed93..65df7dd 100644 --- a/src/JiShe.IoT.Application/IoTAppService.cs +++ b/src/JiShe.IoT.Application/IoTAppService.cs @@ -8,7 +8,7 @@ namespace JiShe.IoT public abstract class IoTAppService : ApplicationService { protected IFreeSqlProvider FreeSqlDbContext => LazyServiceProvider.LazyGetRequiredService(); - protected IFreeRedisProviderService FreeRedis => LazyServiceProvider.LazyGetRequiredService(); + protected IFreeRedisProvider RedisProvider => LazyServiceProvider.LazyGetRequiredService(); protected IoTAppService() { diff --git a/src/JiShe.IoT.Application/IoTApplicationModule.cs b/src/JiShe.IoT.Application/IoTApplicationModule.cs index dd7b35f..aab3f2b 100644 --- a/src/JiShe.IoT.Application/IoTApplicationModule.cs +++ b/src/JiShe.IoT.Application/IoTApplicationModule.cs @@ -2,6 +2,7 @@ using JiShe.ServicePro.DynamicMenuManagement; using JiShe.ServicePro.FileManagement; using JiShe.ServicePro.FreeRedisProvider; using JiShe.ServicePro.FreeSqlProvider; +using JiShe.ServicePro.IoTDBManagement; using JiShe.ServicePro.TemplateManagement; namespace JiShe.IoT @@ -16,7 +17,8 @@ namespace JiShe.IoT typeof(TemplateManagementApplicationModule), typeof(DynamicMenuManagementApplicationModule), typeof(FileManagementApplicationModule), - typeof(FreeRedisProviderModule) + typeof(IoTDBManagementApplicationModule), + typeof(ServiceProFreeRedisProviderModule) )] public class IoTApplicationModule : AbpModule { diff --git a/src/JiShe.IoT.Application/JiShe.IoT.Application.csproj b/src/JiShe.IoT.Application/JiShe.IoT.Application.csproj index 0181f96..276b177 100644 --- a/src/JiShe.IoT.Application/JiShe.IoT.Application.csproj +++ b/src/JiShe.IoT.Application/JiShe.IoT.Application.csproj @@ -18,6 +18,7 @@ + diff --git a/src/JiShe.IoT.DbMigrator/appsettings.json b/src/JiShe.IoT.DbMigrator/appsettings.json index bdb58bc..2cf7122 100644 --- a/src/JiShe.IoT.DbMigrator/appsettings.json +++ b/src/JiShe.IoT.DbMigrator/appsettings.json @@ -1,5 +1,15 @@ { "ConnectionStrings": { "Default": "Data Source=47.110.60.222;Port=13306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;" + }, + "IoTDBOptions": { + "UserName": "root", + "Password": "root", + "TreeModelClusterList": [ "121.42.175.177:16667" ], + "TableModelClusterList": [ "121.42.175.177:16667" ], + "PoolSize": 32, + "TableModelDataBaseName": "energy", + "OpenDebugMode": true, + "UseTableSessionPoolByDefault": false } } \ No newline at end of file diff --git a/src/JiShe.IoT.Domain.Shared/IoTDomainSharedModule.cs b/src/JiShe.IoT.Domain.Shared/IoTDomainSharedModule.cs index 478bad6..a661b02 100644 --- a/src/JiShe.IoT.Domain.Shared/IoTDomainSharedModule.cs +++ b/src/JiShe.IoT.Domain.Shared/IoTDomainSharedModule.cs @@ -1,6 +1,7 @@ using JiShe.ServicePro.DynamicMenuManagement; using JiShe.ServicePro.FileManagement; using JiShe.ServicePro.FreeSqlProvider; +using JiShe.ServicePro.IoTDBManagement; using JiShe.ServicePro.TemplateManagement; namespace JiShe.IoT @@ -13,7 +14,8 @@ namespace JiShe.IoT typeof(TemplateManagementDomainSharedModule), typeof(DynamicMenuManagementDomainSharedModule), typeof(FileManagementDomainSharedModule), - typeof(AbpFreeSqlProviderModule), + typeof(IoTDBManagementDomainSharedModule), + typeof(ServiceProFreeSqlProviderModule), typeof(ServiceProCoreModule) )] public class IoTDomainSharedModule : AbpModule diff --git a/src/JiShe.IoT.Domain.Shared/JiShe.IoT.Domain.Shared.csproj b/src/JiShe.IoT.Domain.Shared/JiShe.IoT.Domain.Shared.csproj index 04a0d59..09c91f4 100644 --- a/src/JiShe.IoT.Domain.Shared/JiShe.IoT.Domain.Shared.csproj +++ b/src/JiShe.IoT.Domain.Shared/JiShe.IoT.Domain.Shared.csproj @@ -20,6 +20,7 @@ + diff --git a/src/JiShe.IoT.Domain/Data/IoTDbMigrationService.cs b/src/JiShe.IoT.Domain/Data/IoTDbMigrationService.cs index acf03c6..b861bf2 100644 --- a/src/JiShe.IoT.Domain/Data/IoTDbMigrationService.cs +++ b/src/JiShe.IoT.Domain/Data/IoTDbMigrationService.cs @@ -1,3 +1,5 @@ +using JiShe.ServicePro.IoTDBManagement.SessionPools; + namespace JiShe.IoT.Data { public class IoTDbMigrationService : ITransientDependency @@ -8,17 +10,20 @@ namespace JiShe.IoT.Data private readonly IEnumerable _dbSchemaMigrators; private readonly ITenantRepository _tenantRepository; private readonly ICurrentTenant _currentTenant; + private readonly IIoTDBSessionPoolProvider _ioTDBSessionPoolProvider; public IoTDbMigrationService( IDataSeeder dataSeeder, IEnumerable dbSchemaMigrators, ITenantRepository tenantRepository, - ICurrentTenant currentTenant) + ICurrentTenant currentTenant, + IIoTDBSessionPoolProvider ioTDBSessionPoolProvider) { _dataSeeder = dataSeeder; _dbSchemaMigrators = dbSchemaMigrators; _tenantRepository = tenantRepository; _currentTenant = currentTenant; + _ioTDBSessionPoolProvider = ioTDBSessionPoolProvider; Logger = NullLogger.Instance; } @@ -36,6 +41,7 @@ namespace JiShe.IoT.Data await MigrateDatabaseSchemaAsync(); await SeedDataAsync(); + await InitIoTDBTable(); Logger.LogInformation($"Successfully completed host database migrations."); @@ -81,6 +87,16 @@ namespace JiShe.IoT.Data } } + /// + /// ³õʼ»¯IoTDB±íÄ£ÐÍ + /// + /// + private async Task InitIoTDBTable() + { + //³õʼ»¯IoTDB±íÄ£ÐÍ + await _ioTDBSessionPoolProvider.GetSessionPool(true).InitTableSessionModelAsync(); + } + private async Task SeedDataAsync(Tenant tenant = null) { Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed..."); diff --git a/src/JiShe.IoT.Domain/IoTDomainModule.cs b/src/JiShe.IoT.Domain/IoTDomainModule.cs index 9cea670..57f22ac 100644 --- a/src/JiShe.IoT.Domain/IoTDomainModule.cs +++ b/src/JiShe.IoT.Domain/IoTDomainModule.cs @@ -1,5 +1,6 @@ using JiShe.ServicePro.DynamicMenuManagement; using JiShe.ServicePro.FileManagement; +using JiShe.ServicePro.IoTDBManagement; using JiShe.ServicePro.TemplateManagement; namespace JiShe.IoT @@ -12,6 +13,7 @@ namespace JiShe.IoT typeof(LanguageManagementDomainModule), typeof(TemplateManagementDomainModule), typeof(FileManagementDomainModule), + typeof(IoTDBManagementDomainModule), typeof(DynamicMenuManagementDomainModule) )] public class IoTDomainModule : AbpModule diff --git a/src/JiShe.IoT.Domain/JiShe.IoT.Domain.csproj b/src/JiShe.IoT.Domain/JiShe.IoT.Domain.csproj index b0d1af7..1a7aaf3 100644 --- a/src/JiShe.IoT.Domain/JiShe.IoT.Domain.csproj +++ b/src/JiShe.IoT.Domain/JiShe.IoT.Domain.csproj @@ -16,6 +16,7 @@ + diff --git a/src/JiShe.IoT.EntityFrameworkCore/JiShe.IoT.EntityFrameworkCore.csproj b/src/JiShe.IoT.EntityFrameworkCore/JiShe.IoT.EntityFrameworkCore.csproj index f93378f..467b4a8 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/JiShe.IoT.EntityFrameworkCore.csproj +++ b/src/JiShe.IoT.EntityFrameworkCore/JiShe.IoT.EntityFrameworkCore.csproj @@ -17,6 +17,7 @@ + diff --git a/src/JiShe.IoT.HttpApi.Client/IoTHttpApiClientModule.cs b/src/JiShe.IoT.HttpApi.Client/IoTHttpApiClientModule.cs index 1104d95..9a4a50a 100644 --- a/src/JiShe.IoT.HttpApi.Client/IoTHttpApiClientModule.cs +++ b/src/JiShe.IoT.HttpApi.Client/IoTHttpApiClientModule.cs @@ -2,6 +2,7 @@ using JiShe.ServicePro.BasicManagement; using JiShe.ServicePro.DataDictionaryManagement; using JiShe.ServicePro.DynamicMenuManagement; using JiShe.ServicePro.FileManagement; +using JiShe.ServicePro.IoTDBManagement; using JiShe.ServicePro.LanguageManagement; using JiShe.ServicePro.NotificationManagement; using JiShe.ServicePro.TemplateManagement; @@ -16,6 +17,7 @@ namespace JiShe.IoT typeof(LanguageManagementHttpApiClientModule), typeof(TemplateManagementHttpApiClientModule), typeof(FileManagementHttpApiClientModule), + typeof(IoTDBManagementHttpApiClientModule), typeof(DynamicMenuManagementHttpApiClientModule) )] public class IoTHttpApiClientModule : AbpModule diff --git a/src/JiShe.IoT.HttpApi.Client/JiShe.IoT.HttpApi.Client.csproj b/src/JiShe.IoT.HttpApi.Client/JiShe.IoT.HttpApi.Client.csproj index 9ed4b82..e3582d8 100644 --- a/src/JiShe.IoT.HttpApi.Client/JiShe.IoT.HttpApi.Client.csproj +++ b/src/JiShe.IoT.HttpApi.Client/JiShe.IoT.HttpApi.Client.csproj @@ -16,6 +16,7 @@ + diff --git a/src/JiShe.IoT.HttpApi/IoTHttpApiModule.cs b/src/JiShe.IoT.HttpApi/IoTHttpApiModule.cs index 8eb8996..7ccd8fa 100644 --- a/src/JiShe.IoT.HttpApi/IoTHttpApiModule.cs +++ b/src/JiShe.IoT.HttpApi/IoTHttpApiModule.cs @@ -1,6 +1,7 @@ using JiShe.ServicePro.DataDictionaryManagement; using JiShe.ServicePro.DynamicMenuManagement; using JiShe.ServicePro.FileManagement; +using JiShe.ServicePro.IoTDBManagement; using JiShe.ServicePro.LanguageManagement; using JiShe.ServicePro.TemplateManagement; @@ -14,6 +15,7 @@ namespace JiShe.IoT typeof(LanguageManagementHttpApiModule), typeof(TemplateManagementHttpApiModule), typeof(FileManagementHttpApiModule), + typeof(IoTDBManagementHttpApiModule), typeof(DynamicMenuManagementHttpApiModule) )] public class IoTHttpApiModule : AbpModule diff --git a/src/JiShe.IoT.HttpApi/JiShe.IoT.HttpApi.csproj b/src/JiShe.IoT.HttpApi/JiShe.IoT.HttpApi.csproj index d0c084d..524e069 100644 --- a/src/JiShe.IoT.HttpApi/JiShe.IoT.HttpApi.csproj +++ b/src/JiShe.IoT.HttpApi/JiShe.IoT.HttpApi.csproj @@ -1,27 +1,27 @@  - - net9.0 - JiShe.IoT - + + net9.0 + JiShe.IoT + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +