集成IoTDB模块

This commit is contained in:
ChenYi 2025-06-04 17:09:21 +08:00
parent 1a66b61749
commit 01123703e5
19 changed files with 138 additions and 93 deletions

View File

@ -100,4 +100,5 @@
<PackageReference Update="JiShe.ServicePro.DeviceManagement.HttpApi.Client" Version="$(ServiceProVersion)"/>
</ItemGroup>
</Project>

View File

@ -2,7 +2,7 @@
<!-- 定义项目加载属性 -->
<PropertyGroup>
<!--JiShe.ServicePro版本-->
<ServiceProVersion>1.0.1</ServiceProVersion>
<ServiceProVersion>1.0.5.06</ServiceProVersion>
<!--Volo Abp 版本-->
<VoloAbpVersion>9.1.1</VoloAbpVersion>

View File

@ -31,8 +31,6 @@
<PackageReference Include="Hangfire.Redis.StackExchange" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" />
<PackageReference Include="JiShe.ServicePro.CAP" />
<PackageReference Include="JiShe.ServicePro.CAP.EntityFrameworkCore" />
<PackageReference Include="DotNetCore.CAP.MySql" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" />
<PackageReference Include="DotNetCore.CAP.Dashboard" />
@ -53,6 +51,8 @@
<ItemGroup>
<PackageReference Include="JiShe.ServicePro.Shared.Hosting.Microservices"/>
<PackageReference Include="JiShe.ServicePro.CAP" />
<PackageReference Include="JiShe.ServicePro.CAP.EntityFrameworkCore" />
</ItemGroup>
<ItemGroup>

View File

@ -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

View File

@ -21,6 +21,7 @@
<PackageReference Include="JiShe.ServicePro.TemplateManagement.Application.Contracts"/>
<PackageReference Include="JiShe.ServicePro.DynamicMenuManagement.Application.Contracts"/>
<PackageReference Include="JiShe.ServicePro.FileManagement.Application.Contracts"/>
<PackageReference Include="JiShe.ServicePro.IoTDBManagement.Application.Contracts"/>
</ItemGroup>
</Project>

View File

@ -8,7 +8,7 @@ namespace JiShe.IoT
public abstract class IoTAppService : ApplicationService
{
protected IFreeSqlProvider FreeSqlDbContext => LazyServiceProvider.LazyGetRequiredService<IFreeSqlProvider>();
protected IFreeRedisProviderService FreeRedis => LazyServiceProvider.LazyGetRequiredService<IFreeRedisProviderService>();
protected IFreeRedisProvider RedisProvider => LazyServiceProvider.LazyGetRequiredService<IFreeRedisProvider>();
protected IoTAppService()
{

View File

@ -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
{

View File

@ -18,6 +18,7 @@
<PackageReference Include="JiShe.ServicePro.LanguageManagement.Application" />
<PackageReference Include="JiShe.ServicePro.TemplateManagement.Application" />
<PackageReference Include="JiShe.ServicePro.DynamicMenuManagement.Application" />
<PackageReference Include="JiShe.ServicePro.IoTDBManagement.Application" />
<PackageReference Include="JiShe.ServicePro.FileManagement.Application" />
<PackageReference Include="JiShe.ServicePro.FreeRedisProvider" />
</ItemGroup>

View File

@ -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
}
}

View File

@ -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

View File

@ -20,6 +20,7 @@
<PackageReference Include="JiShe.ServicePro.TemplateManagement.Domain.Shared"/>
<PackageReference Include="JiShe.ServicePro.DynamicMenuManagement.Domain.Shared"/>
<PackageReference Include="JiShe.ServicePro.FileManagement.Domain.Shared"/>
<PackageReference Include="JiShe.ServicePro.IoTDBManagement.Domain.Shared"/>
<PackageReference Include="JiShe.ServicePro.FreeSqlProvider" />
</ItemGroup>

View File

@ -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<IIoTDbSchemaMigrator> _dbSchemaMigrators;
private readonly ITenantRepository _tenantRepository;
private readonly ICurrentTenant _currentTenant;
private readonly IIoTDBSessionPoolProvider _ioTDBSessionPoolProvider;
public IoTDbMigrationService(
IDataSeeder dataSeeder,
IEnumerable<IIoTDbSchemaMigrator> dbSchemaMigrators,
ITenantRepository tenantRepository,
ICurrentTenant currentTenant)
ICurrentTenant currentTenant,
IIoTDBSessionPoolProvider ioTDBSessionPoolProvider)
{
_dataSeeder = dataSeeder;
_dbSchemaMigrators = dbSchemaMigrators;
_tenantRepository = tenantRepository;
_currentTenant = currentTenant;
_ioTDBSessionPoolProvider = ioTDBSessionPoolProvider;
Logger = NullLogger<IoTDbMigrationService>.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
}
}
/// <summary>
/// ³õʼ»¯IoTDB±íÄ£ÐÍ
/// </summary>
/// <returns></returns>
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...");

View File

@ -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

View File

@ -16,6 +16,7 @@
<PackageReference Include="JiShe.ServicePro.TemplateManagement.Domain"/>
<PackageReference Include="JiShe.ServicePro.DynamicMenuManagement.Domain"/>
<PackageReference Include="JiShe.ServicePro.FileManagement.Domain"/>
<PackageReference Include="JiShe.ServicePro.IoTDBManagement.Domain"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" />
</ItemGroup>

View File

@ -17,6 +17,7 @@
<PackageReference Include="JiShe.ServicePro.TemplateManagement.EntityFrameworkCore"/>
<PackageReference Include="JiShe.ServicePro.DynamicMenuManagement.EntityFrameworkCore"/>
<PackageReference Include="JiShe.ServicePro.FileManagement.EntityFrameworkCore"/>
<PackageReference Include="JiShe.ServicePro.IoTDBManagement.EntityFrameworkCore"/>
</ItemGroup>
<ItemGroup>

View File

@ -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

View File

@ -16,6 +16,7 @@
<PackageReference Include="JiShe.ServicePro.TemplateManagement.HttpApi.Client"/>
<PackageReference Include="JiShe.ServicePro.DynamicMenuManagement.HttpApi.Client"/>
<PackageReference Include="JiShe.ServicePro.FileManagement.HttpApi.Client"/>
<PackageReference Include="JiShe.ServicePro.IoTDBManagement.HttpApi.Client"/>
</ItemGroup>

View File

@ -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

View File

@ -6,22 +6,22 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\JiShe.IoT.Application.Contracts\JiShe.IoT.Application.Contracts.csproj"/>
<ProjectReference Include="..\JiShe.IoT.Application.Contracts\JiShe.IoT.Application.Contracts.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore.Annotations"/>
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="JiShe.ServicePro.BasicManagement.HttpApi"/>
<PackageReference Include="JiShe.ServicePro.NotificationManagement.HttpApi"/>
<PackageReference Include="JiShe.ServicePro.DataDictionaryManagement.HttpApi"/>
<PackageReference Include="JiShe.ServicePro.LanguageManagement.HttpApi"/>
<PackageReference Include="JiShe.ServicePro.TemplateManagement.HttpApi"/>
<PackageReference Include="JiShe.ServicePro.DynamicMenuManagement.HttpApi"/>
<PackageReference Include="JiShe.ServicePro.FileManagement.HttpApi"/>
<PackageReference Include="JiShe.ServicePro.BasicManagement.HttpApi" />
<PackageReference Include="JiShe.ServicePro.NotificationManagement.HttpApi" />
<PackageReference Include="JiShe.ServicePro.DataDictionaryManagement.HttpApi" />
<PackageReference Include="JiShe.ServicePro.LanguageManagement.HttpApi" />
<PackageReference Include="JiShe.ServicePro.TemplateManagement.HttpApi" />
<PackageReference Include="JiShe.ServicePro.DynamicMenuManagement.HttpApi" />
<PackageReference Include="JiShe.ServicePro.FileManagement.HttpApi" />
<PackageReference Include="JiShe.ServicePro.IoTDBManagement.HttpApi" />
</ItemGroup>
</Project>