From ea48f30d4f40ee91ecbeca90bba959a69e341955 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Wed, 14 Jan 2026 16:51:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=90=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E4=BB=A5=E5=8F=8A=E5=AE=8C=E5=96=84=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=E7=B3=BB=E7=BB=9F=E6=96=B0=E5=A2=9E=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configs/appsettings.Development.json | 5 +- .../configs/appsettings.json | 26 ++++++- .../BatchCreateDeviceBusinessSystemInput.cs | 40 ++++++++++ .../Dto/BatchCreateDeviceInfoInput.cs | 55 -------------- .../IBusinessSystemAggregationService.cs | 2 +- .../Dto/BatchCreateDeviceAggregationInput.cs | 15 +++- .../Dto/CreateDeviceAggregationInput.cs | 14 +++- .../IDeviceAggregationService.cs | 5 +- .../BusinessSystemAggregationService.cs | 15 ++-- .../DeviceAggregationService.cs | 73 +++++++++++++++---- src/JiShe.IoT.DbMigrator/appsettings.json | 2 +- .../EntityFrameworkCore/IoTDbContext.cs | 1 + 12 files changed, 160 insertions(+), 93 deletions(-) create mode 100644 src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/Dto/BatchCreateDeviceBusinessSystemInput.cs delete mode 100644 src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/Dto/BatchCreateDeviceInfoInput.cs diff --git a/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json index 6a6035c..f91c8cd 100644 --- a/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json +++ b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json @@ -4,7 +4,7 @@ "CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://10.10.90.3:4200" }, "ConnectionStrings": { - "Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;" + "Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB386;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;" }, "Hangfire": { "Redis": { @@ -80,7 +80,8 @@ "AesSecurityKey": "RPTEIGCA1KvDEXS1", "IsAesEncrypted": false, "DistributedMessage": 2, - "SnowflakeWorkerId": 1 + "SnowflakeWorkerId": 1, + "DownloadDeviceFirmwareBasicUrl": "http://121.42.175.177:32580/Aggregation/Device/DownloadFirmware?Id=" }, "Jwt": { "Audience": "JiShe.IoT", diff --git a/host/JiShe.IoT.HttpApi.Host/configs/appsettings.json b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.json index c14cdf4..a62f0af 100644 --- a/host/JiShe.IoT.HttpApi.Host/configs/appsettings.json +++ b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.json @@ -2,7 +2,8 @@ "Serilog": { "Using": [ "Serilog.Sinks.Console", - "Serilog.Sinks.File" + "Serilog.Sinks.File", + "Serilog.Sinks.Grafana.Loki" ], "MinimumLevel": { "Default": "Warning", @@ -21,10 +22,27 @@ "Name": "Console" }, { - "Name": "File", + "Name": "GrafanaLoki", "Args": { - "path": "logs/logs-.txt", - "rollingInterval": "Hour" + "uri": "http://192.168.111.164:3100", + "labels": [ + { + "key": "app", + "value": "OneNETAdmin" // 应用名称 + }, + { + "key": "environment", + "value": "dev" // 环境(dev/staging/prod) + }, + { + "key": "version", + "value": "1.2.3" // 应用版本(可选) + } + ], + "propertiesAsLabels": [ + "Level", + "SourceContext" + ] } } ] diff --git a/src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/Dto/BatchCreateDeviceBusinessSystemInput.cs b/src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/Dto/BatchCreateDeviceBusinessSystemInput.cs new file mode 100644 index 0000000..d4f0a0e --- /dev/null +++ b/src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/Dto/BatchCreateDeviceBusinessSystemInput.cs @@ -0,0 +1,40 @@ +using JiShe.ServicePro.Enums; +using JiShe.ServicePro.OpenAPIModels; +using System.ComponentModel.DataAnnotations; + +namespace JiShe.IoT.BusinessSystemAggregation.Dto +{ + /// + /// 业务系统批量创建设备信息 + /// + public class BatchCreateDeviceBusinessSystemInput + { + /// + /// 设备信息集合 + /// + [Required(ErrorMessage = "设备信息不能为空")] + public List DeviceInfos { get; set; } + + /// + /// 物联网平台类型 + /// + [Required(ErrorMessage = "物联网平台类型不能为空")] + public IoTPlatformTypeEnum IoTPlatform { get; set; } + + /// + /// 集中器在物联网平台中对应的产品Id + /// + [Required(ErrorMessage = "产品Id不能为空")] + public string IoTPlatformProductId { get; set; } + + /// + /// 设备类型,用来区分主设备是网关设备还是直连设备 + /// + public DeviceTypeEnum? DeviceType { get; set; } + + /// + /// 设备来源类型 + /// + public DeviceSourceTypeEnum? DeviceSourceType { get; set; } + } +} \ No newline at end of file diff --git a/src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/Dto/BatchCreateDeviceInfoInput.cs b/src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/Dto/BatchCreateDeviceInfoInput.cs deleted file mode 100644 index 1311b62..0000000 --- a/src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/Dto/BatchCreateDeviceInfoInput.cs +++ /dev/null @@ -1,55 +0,0 @@ -using JiShe.ServicePro.Enums; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JiShe.IoT.BusinessSystemAggregation.Dto -{ - /// - /// 批量创建设备信息输入 - /// - public class BatchCreateDeviceInfoInput - { - /// - /// 设备来源类型,只接收 预付费业务系统推送、能耗业务系统推送 - /// - public DeviceSourceTypeEnum DeviceSourceType { get; set; } - - /// - /// 物联网平台类型 - /// - public IoTPlatformTypeEnum IoTPlatform { get; set; } - - /// - /// 集中器在物联网平台中对应的产品Id - /// - public string IoTPlatformProductId { get; set; } - - /// - /// 设备地址集合 - /// - public List DeviceAddresses { get; set; } - } - - public class SubDeviceInfoInput - { - /// - /// 设备地址 - /// - public string DeviceAddresses { get; set; } - - /// - /// 子设备地址 - /// - public string SubDeviceAddress { get; set; } - - /// - /// 子设备索引 - /// - public int SubDeviceIndex { get; set; } - - } -} diff --git a/src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/IBusinessSystemAggregationService.cs b/src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/IBusinessSystemAggregationService.cs index e03f1f6..27662c5 100644 --- a/src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/IBusinessSystemAggregationService.cs +++ b/src/JiShe.IoT.Application.Contracts/BusinessSystemAggregation/IBusinessSystemAggregationService.cs @@ -35,7 +35,7 @@ namespace JiShe.IoT.BusinessSystemAggregation Task>> QueryDeviceDataInfoAsync(OpenApiRequest input); /// - /// 业务系统批量新增设备数据,Msg 字段为 BatchCreateDeviceInfoInput 实体 + /// 业务系统批量新增设备数据,Msg 字段为 BatchCreateDeviceBusinessSystemInput 实体 /// /// /// diff --git a/src/JiShe.IoT.Application.Contracts/DeviceAggregation/Dto/BatchCreateDeviceAggregationInput.cs b/src/JiShe.IoT.Application.Contracts/DeviceAggregation/Dto/BatchCreateDeviceAggregationInput.cs index 177b8df..8f31309 100644 --- a/src/JiShe.IoT.Application.Contracts/DeviceAggregation/Dto/BatchCreateDeviceAggregationInput.cs +++ b/src/JiShe.IoT.Application.Contracts/DeviceAggregation/Dto/BatchCreateDeviceAggregationInput.cs @@ -1,4 +1,5 @@ using JiShe.ServicePro.Enums; +using JiShe.ServicePro.OpenAPIModels; using System.ComponentModel.DataAnnotations; namespace JiShe.IoT.DeviceAggregation @@ -9,11 +10,16 @@ namespace JiShe.IoT.DeviceAggregation public class BatchCreateDeviceAggregationInput { /// - /// 表通信地址集合 + /// 设备地址不能为空 /// [Required(ErrorMessage = "设备地址不能为空")] public List AddressList { get; set; } + /// + /// 设备信息 + /// + public List DeviceInfos { get; set; } + /// /// 物联网平台类型 /// @@ -30,6 +36,11 @@ namespace JiShe.IoT.DeviceAggregation /// 设备来源类型 /// - public DeviceSourceTypeEnum? DeviceSourceTypeEnum { get; set; } + public DeviceSourceTypeEnum? DeviceSourceType { get; set; } + + /// + /// 设备类型 + /// + public DeviceTypeEnum? DeviceType { get; set; } } } \ No newline at end of file diff --git a/src/JiShe.IoT.Application.Contracts/DeviceAggregation/Dto/CreateDeviceAggregationInput.cs b/src/JiShe.IoT.Application.Contracts/DeviceAggregation/Dto/CreateDeviceAggregationInput.cs index 6097e0a..cd3d6f1 100644 --- a/src/JiShe.IoT.Application.Contracts/DeviceAggregation/Dto/CreateDeviceAggregationInput.cs +++ b/src/JiShe.IoT.Application.Contracts/DeviceAggregation/Dto/CreateDeviceAggregationInput.cs @@ -1,4 +1,5 @@ using JiShe.ServicePro.Enums; +using JiShe.ServicePro.OpenAPIModels; using System.ComponentModel.DataAnnotations; namespace JiShe.IoT.DeviceAggregation.Dto @@ -14,6 +15,11 @@ namespace JiShe.IoT.DeviceAggregation.Dto [Required(ErrorMessage = "设备地址不能为空")] public string DeviceAddress { get; set; } + /// + /// 设备信息 + /// + public OpenApiDeviceInfoInput DeviceInfos { get; set; } + /// /// 物联网平台类型 /// @@ -30,7 +36,13 @@ namespace JiShe.IoT.DeviceAggregation.Dto /// 设备来源类型 /// - public DeviceSourceTypeEnum? DeviceSourceTypeEnum { get; set; } + public DeviceSourceTypeEnum? DeviceSourceType { get; set; } + + + /// + /// 设备类型,与业务系统无关 + /// + public DeviceTypeEnum? DeviceType { get; set; } } } \ No newline at end of file diff --git a/src/JiShe.IoT.Application.Contracts/DeviceAggregation/IDeviceAggregationService.cs b/src/JiShe.IoT.Application.Contracts/DeviceAggregation/IDeviceAggregationService.cs index 8413f49..f3b5820 100644 --- a/src/JiShe.IoT.Application.Contracts/DeviceAggregation/IDeviceAggregationService.cs +++ b/src/JiShe.IoT.Application.Contracts/DeviceAggregation/IDeviceAggregationService.cs @@ -1,4 +1,5 @@ -using JiShe.IoT.DeviceAggregation.Dto; +using JiShe.IoT.BusinessSystemAggregation.Dto; +using JiShe.IoT.DeviceAggregation.Dto; using JiShe.ServicePro; using JiShe.ServicePro.Core; using JiShe.ServicePro.DeviceManagement.DeviceInfos; @@ -103,6 +104,6 @@ namespace JiShe.IoT.DeviceAggregation /// /// /// - Task BatchCreateDeviceBusinessSystemAsync(BatchCreateDeviceAggregationInput input); + Task BatchCreateDeviceBusinessSystemAsync(BatchCreateDeviceBusinessSystemInput input); } } diff --git a/src/JiShe.IoT.Application/BusinessSystemAggregation/BusinessSystemAggregationService.cs b/src/JiShe.IoT.Application/BusinessSystemAggregation/BusinessSystemAggregationService.cs index 0aebf36..dfcf45f 100644 --- a/src/JiShe.IoT.Application/BusinessSystemAggregation/BusinessSystemAggregationService.cs +++ b/src/JiShe.IoT.Application/BusinessSystemAggregation/BusinessSystemAggregationService.cs @@ -300,7 +300,7 @@ namespace JiShe.IoT.BusinessSystemAggregation /// - /// 业务系统批量新增设备数据,Msg 字段为 BatchCreateDeviceInfoInput 实体 + /// 业务系统批量新增设备数据,Msg 字段为 BatchCreateDeviceBusinessSystemInput 实体 /// /// /// @@ -309,25 +309,20 @@ namespace JiShe.IoT.BusinessSystemAggregation { try { - var handleResult = HandleOpenApiRequest(input, serverOptions); + var handleResult = HandleOpenApiRequest(input, serverOptions); if (handleResult.Success == false) { return HttpDataResultExtensions.Failed(handleResult.Message, handleResult.LocationCode); } var messageBody = handleResult.Data; - if (messageBody.DeviceAddresses == null || messageBody.DeviceAddresses.Count <= 0) + if (messageBody.DeviceInfos == null || messageBody.DeviceInfos.Count <= 0) { return HttpDataResultExtensions.Failed("设备地址不能为空", -101); } - var createResult = await deviceAggregationService.BatchCreateDeviceBusinessSystemAsync(new BatchCreateDeviceAggregationInput() - { - DeviceSourceTypeEnum = messageBody.DeviceSourceType, - IoTPlatform = messageBody.IoTPlatform, - IoTPlatformProductId = messageBody.IoTPlatformProductId, - AddressList = messageBody.DeviceAddresses - }); + // 批量新增设备 + var createResult = await deviceAggregationService.BatchCreateDeviceBusinessSystemAsync(messageBody); if (createResult == false) { diff --git a/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs b/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs index 5aeb726..f07b78c 100644 --- a/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs +++ b/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs @@ -1,4 +1,5 @@ -using JiShe.IoT.DeviceAggregation.Dto; +using JiShe.IoT.BusinessSystemAggregation.Dto; +using JiShe.IoT.DeviceAggregation.Dto; using JiShe.ServicePro; using JiShe.ServicePro.ApacheIoTDB.Provider.Options; using JiShe.ServicePro.Core; @@ -58,7 +59,7 @@ namespace JiShe.IoT.DeviceAggregation { try { - input.DeviceSourceTypeEnum = ServicePro.Enums.DeviceSourceTypeEnum.AdminSystem; + input.DeviceSourceType = ServicePro.Enums.DeviceSourceTypeEnum.AdminSystem; if (input.IoTPlatform == ServicePro.Enums.IoTPlatformTypeEnum.CTWing) { return await CTWingDeviceCreateAsync(input); @@ -99,7 +100,7 @@ namespace JiShe.IoT.DeviceAggregation throw new UserFriendlyException($"批量创建设备失败,设备信息不能超过100个。"); } - input.DeviceSourceTypeEnum = ServicePro.Enums.DeviceSourceTypeEnum.AdminSystem; + input.DeviceSourceType = ServicePro.Enums.DeviceSourceTypeEnum.AdminSystem; if (input.IoTPlatform == ServicePro.Enums.IoTPlatformTypeEnum.CTWing) { @@ -128,7 +129,7 @@ namespace JiShe.IoT.DeviceAggregation { try { - input.DeviceSourceTypeEnum = DeviceSourceTypeEnum.Workshop; + input.DeviceSourceType = DeviceSourceTypeEnum.Workshop; if (input.IoTPlatform == ServicePro.Enums.IoTPlatformTypeEnum.CTWing) { @@ -168,7 +169,7 @@ namespace JiShe.IoT.DeviceAggregation throw new UserFriendlyException($"批量创建设备失败,设备信息不能超过100个。"); } - input.DeviceSourceTypeEnum = DeviceSourceTypeEnum.Workshop; + input.DeviceSourceType = DeviceSourceTypeEnum.Workshop; if (input.IoTPlatform == ServicePro.Enums.IoTPlatformTypeEnum.CTWing) { @@ -651,32 +652,38 @@ namespace JiShe.IoT.DeviceAggregation /// /// /// - public async Task BatchCreateDeviceBusinessSystemAsync(BatchCreateDeviceAggregationInput input) + public async Task BatchCreateDeviceBusinessSystemAsync(BatchCreateDeviceBusinessSystemInput input) { try { - if (input.AddressList == null || input.AddressList.Count <= 0) + if (input.DeviceInfos == null || input.DeviceInfos.Count <= 0) { throw new UserFriendlyException($"业务系统批量创建设备信息,设备信息不能为空。"); } - if (input.AddressList.Count > 100) + if (input.DeviceInfos.Count > 100) { throw new UserFriendlyException($"业务系统批量创建设备信息,设备信息不能超过100个。"); } - if (input.DeviceSourceTypeEnum != DeviceSourceTypeEnum.Prepay && input.DeviceSourceTypeEnum != DeviceSourceTypeEnum.Energy) + if (input.DeviceSourceType != DeviceSourceTypeEnum.Prepay && input.DeviceSourceType != DeviceSourceTypeEnum.Energy) { throw new UserFriendlyException($"业务系统批量创建设备信息,设备来源异常。"); } if (input.IoTPlatform == ServicePro.Enums.IoTPlatformTypeEnum.CTWing) - { - return await CTWingDeviceBatchCreateAsync(input); + { + var batchCreateDeviceInput = input.Adapt(); + batchCreateDeviceInput.AddressList = input.DeviceInfos.Select(f => f.DeviceAddress.Trim()).ToList(); + + return await CTWingDeviceBatchCreateAsync(batchCreateDeviceInput); } else if (input.IoTPlatform == ServicePro.Enums.IoTPlatformTypeEnum.OneNET) { - return await OneNETDeviceBatchCreateAsync(input); + var batchCreateDeviceInput = input.Adapt(); + batchCreateDeviceInput.AddressList = input.DeviceInfos.Select(f => f.DeviceAddress.Trim()).ToList(); + + return await OneNETDeviceBatchCreateAsync(batchCreateDeviceInput); } throw new UserFriendlyException($"不支持的物联网平台"); @@ -708,7 +715,7 @@ namespace JiShe.IoT.DeviceAggregation throw new UserFriendlyException($"OneNET创建设备失败,未找到对应的产品配置信息。"); } - if (input.DeviceSourceTypeEnum == DeviceSourceTypeEnum.Workshop && !productInfo.IsEnabled) //车间生产推送,必须是已经启用的产品才可以 + if (input.DeviceSourceType == DeviceSourceTypeEnum.Workshop && !productInfo.IsEnabled) //车间生产推送,必须是已经启用的产品才可以 { throw new UserFriendlyException($"车间生产推送OneNET创建设备失败,产品未启用。"); } @@ -719,6 +726,10 @@ namespace JiShe.IoT.DeviceAggregation createDeviceInput.PlatformPassword = productInfo.ProductAccesskey; createDeviceInput.IoTPlatformProductName = productInfo.ProductName; createDeviceInput.AccountPhoneNumber = productInfo.AccountPhoneNumber; + if (input.DeviceType.HasValue) + { + createDeviceInput.DeviceType = input.DeviceType.Value; + } var insertResult = await deviceAppService.CreateAsync(createDeviceInput); if (insertResult == null) @@ -742,6 +753,7 @@ namespace JiShe.IoT.DeviceAggregation return false; } + //更新OneNET平台推送结果 await DeviceUpdateHandler(insertResult, pushResult, pushResult.Data.SecurityKey); return true; @@ -764,7 +776,7 @@ namespace JiShe.IoT.DeviceAggregation { var productInfo = await FreeSqlDbContext.Instance.Select() .Where(e => e.IoTPlatformProductId == input.IoTPlatformProductId)//此处不需要过滤产品状态,方便测试产品配置信息是否准确,避免跟车间生产搞混 - .WhereIf(input.DeviceSourceTypeEnum == DeviceSourceTypeEnum.Workshop, e => e.IsEnabled == true) + .WhereIf(input.DeviceSourceType == DeviceSourceTypeEnum.Workshop, e => e.IsEnabled == true) .FirstAsync(); if (productInfo == null) @@ -778,8 +790,27 @@ namespace JiShe.IoT.DeviceAggregation AddressList = input.AddressList, DeviceInputs = new List() }; + + //检查网关或者直连设备信息是否已经存在 + var checkDevicesInfos = await deviceAppService.FindByDeviceAddressAsync(new FindByDeviceAddressInput() + { + AddressList = input.AddressList, + IoTPlatform = input.IoTPlatform, + IoTPlatformProductId = input.IoTPlatformProductId, + }); + foreach (var item in input.AddressList) { + if (checkDevicesInfos != null) + { + if (checkDevicesInfos.Any(e => e.DeviceAddress == item)) + { + logger.LogError($"{nameof(OneNETDeviceBatchCreateAsync)} 平台{input.IoTPlatform} 产品 {input.IoTPlatformProductId} 下设备信息已存在:{item}"); + continue; + } + } + + CreateDeviceInput createDeviceInput = input.Adapt(); createDeviceInput.DeviceName = item; createDeviceInput.DeviceAddress = item; @@ -788,7 +819,18 @@ namespace JiShe.IoT.DeviceAggregation createDeviceInput.PlatformPassword = productInfo.ProductAccesskey; createDeviceInput.IoTPlatformProductName = productInfo.ProductName; createDeviceInput.AccountPhoneNumber = productInfo.AccountPhoneNumber; - createDeviceInput.DeviceSourceTypeEnum = input.DeviceSourceTypeEnum.Value; + createDeviceInput.DeviceSourceType = input.DeviceSourceType.Value; + createDeviceInput.DeviceType = input.DeviceType.Value; + + if (input.DeviceSourceType.HasValue) + { + createDeviceInput.DeviceSourceType = input.DeviceSourceType.Value; + } + + if (input.DeviceType.HasValue) + { + createDeviceInput.DeviceType = input.DeviceType.Value; + } batchCreateDeviceInput.DeviceInputs.Add(createDeviceInput); } @@ -819,6 +861,7 @@ namespace JiShe.IoT.DeviceAggregation return false; } + //更新OneNET平台推送结果 foreach (var item in insertResult) { var successEntity = pushResult.Data.Successlist.Where(d => d.DeviceName == item.IoTPlatformDeviceOpenInfo).FirstOrDefault(); diff --git a/src/JiShe.IoT.DbMigrator/appsettings.json b/src/JiShe.IoT.DbMigrator/appsettings.json index cf67406..557c7c1 100644 --- a/src/JiShe.IoT.DbMigrator/appsettings.json +++ b/src/JiShe.IoT.DbMigrator/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;" + "Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB386;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;" }, "IoTDBOptions": { "UserName": "root", diff --git a/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTDbContext.cs b/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTDbContext.cs index 90bb508..1c08b3d 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTDbContext.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/EntityFrameworkCore/IoTDbContext.cs @@ -69,6 +69,7 @@ namespace JiShe.IoT.EntityFrameworkCore // 设备管理 public DbSet DeviceManagementInfo { get; set; } + public DbSet SubDeviceManagementInfo { get; set; } public DbSet DeviceThingModelManagement { get; set; } public DbSet DeviceThingModelDetailInfo { get; set; } public DbSet DeviceThingModelCommandInfo { get; set; }