diff --git a/.gitignore b/.gitignore index 6005e40..b93acbe 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ /gateways/JiShe.IoT.WebGateway/bin/Debug/net10.0 /host/JiShe.IoT.HttpApi.Host/bin/Debug/net10.0 /src/JiShe.IoT.Application/bin/Debug/net10.0 +/host/JiShe.IoT.HttpApi.Host/UploadFile/20251210/host/abp-file-management diff --git a/DockerComposeShells/adminapi/conf/appsettings.Development.json b/DockerComposeShells/adminapi/conf/appsettings.Development.json index b9a3516..7dd36a6 100644 --- a/DockerComposeShells/adminapi/conf/appsettings.Development.json +++ b/DockerComposeShells/adminapi/conf/appsettings.Development.json @@ -44,7 +44,7 @@ "DefaultPartitions": 16, "DefaultBundles": 16, "EnableAutoCreation": true, //开启自动创建Topic - "TopicMode": "Static", //Dynamic 主题模式 + "TopicMode": "Static", //Dynamic、Static 主题模式 "EnableTopicTypeFilter": true, //允许Topic类型过滤 "AllowedTopicTypes": [ "Static" ], //允许的Topic类型 "AllowedClusters": [ "pulsar-cluster-1" ], //允许的集群 diff --git a/DockerComposeShells/adminapi/conf/appsettings.Development_服务订阅模式.json b/DockerComposeShells/adminapi/conf/appsettings.Development_服务订阅模式.json index 3cbc749..1a9ed09 100644 --- a/DockerComposeShells/adminapi/conf/appsettings.Development_服务订阅模式.json +++ b/DockerComposeShells/adminapi/conf/appsettings.Development_服务订阅模式.json @@ -44,7 +44,7 @@ "DefaultPartitions": 16, "DefaultBundles": 16, "EnableAutoCreation": false, //开启自动创建Topic - "TopicMode": "Dynamic", //Dynamic 主题模式 + "TopicMode": "Dynamic", //Dynamic、Static 主题模式 "EnableTopicTypeFilter": true, //允许Topic类型过滤 "AllowedTopicTypes": [ "Dynamic" ], //允许的Topic类型 "AllowedClusters": [ "pulsar-cluster-1" ], //允许的集群 diff --git a/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json index 6ff0927..6a6035c 100644 --- a/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json +++ b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json @@ -26,7 +26,7 @@ "TaskThreadCount": -1 }, "Pulsar": { - "ServiceUrl": "pulsar+ssl://iot-north-mq.heclouds.com:6651", //pulsar+ssl://iot-north-mq.heclouds.com:6651 ,pulsar://192.168.111.174:26974 + "ServiceUrl": "pulsar://192.168.111.174:26974", //pulsar+ssl://iot-north-mq.heclouds.com:6651 ,pulsar://192.168.111.174:26974 "WebUrl": "http://192.168.111.174:9094", "UserName": "admin", "TenantName": "1YMVZZkAkRArjxSD8457", @@ -39,14 +39,14 @@ "ConnectionTimeout": 30, "OperationTimeout": 30, "KeepAliveInterval": 30, - "TaskThreadCount": 8, + "TaskThreadCount": 1, "IsSubscriber": true, "DefaultPartitions": 16, "DefaultBundles": 16, - "EnableAutoCreation": false, //开启自动创建Topic - "TopicMode": "Dynamic", //Dynamic 主题模式 + "EnableAutoCreation": true, //开启自动创建Topic + "TopicMode": "Static", //Dynamic、Static 主题模式 "EnableTopicTypeFilter": true, //允许Topic类型过滤 - "AllowedTopicTypes": [ "Dynamic" ], //允许的Topic类型 + "AllowedTopicTypes": [ "Static" ], //允许的Topic类型 "AllowedClusters": [ "pulsar-cluster-1" ], //允许的集群 "AdminRoles": [ "admin" ], "EnableConsumerIdleCleanup": true, diff --git a/src/JiShe.IoT.Application/BusinessSystemAggregation/BusinessSystemAggregationService.cs b/src/JiShe.IoT.Application/BusinessSystemAggregation/BusinessSystemAggregationService.cs index 4dfd994..6fa8863 100644 --- a/src/JiShe.IoT.Application/BusinessSystemAggregation/BusinessSystemAggregationService.cs +++ b/src/JiShe.IoT.Application/BusinessSystemAggregation/BusinessSystemAggregationService.cs @@ -45,7 +45,10 @@ namespace JiShe.IoT.BusinessSystemAggregation return handleResult; } var messageBody = handleResult.Data; - string tempMessageBody = null; + if(messageBody== null || messageBody.Commands == null || messageBody.Commands.Count <= 0) + { + return HttpDataResultExtensions.Failed("设备指令不能为空", -103, ResponeResultEnum.Fail); + } //限定来源类型必须为业务系统 if (messageBody.SourceType != DeviceTelemetrySourceTypeEnum.BusinessSystem) @@ -60,7 +63,7 @@ namespace JiShe.IoT.BusinessSystemAggregation return HttpDataResultExtensions.Failed("设备不存在", -1041, ResponeResultEnum.Fail); } - var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, input, deviceInfo.Adapt(), tempMessageBody); + var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, input, deviceInfo.Adapt(), messageBody.Commands.Serialize()); //将指令存储IoTDB数据库和Redis发布通道 if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.OneNET) diff --git a/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs b/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs index 9970fb4..4135306 100644 --- a/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs +++ b/src/JiShe.IoT.Application/DeviceAggregation/DeviceAggregationService.cs @@ -647,7 +647,7 @@ namespace JiShe.IoT.DeviceAggregation { Message = input.Serialize(), }; - var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, commandRequest, deviceInfo.Adapt(), commandRequest.Message); + var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, commandRequest, deviceInfo.Adapt(), input.Commands.Serialize()); await ioTDBDataChannelManageService.DeviceTelemetryTaskWriterAsync(DataChannelManage.DeviceTelemetryTaskDataChannel.Writer, (DistributedMessageCenterConst.OneNETCommandIssuedEventName, packetTaskInfo)); diff --git a/src/JiShe.IoT.Application/IoTAppService.cs b/src/JiShe.IoT.Application/IoTAppService.cs index ab444a7..91fc03c 100644 --- a/src/JiShe.IoT.Application/IoTAppService.cs +++ b/src/JiShe.IoT.Application/IoTAppService.cs @@ -52,6 +52,7 @@ namespace JiShe.IoT DeviceType = $"{commandIssueInfo.DeviceType}", DeviceAddress = commandIssueInfo.DeviceAddress, IssueRawMessage = input.Serialize(), + IssuePayload = messageBody, IoTDataType = IoTDBDataTypeConst.Command, TelemetrySource = (int)commandIssueInfo.SourceType, IoTPlatform = (int)commandIssueInfo.IoTPlatform, @@ -60,7 +61,6 @@ namespace JiShe.IoT IoTPlatformAccountId = deviceInfo.IoTPlatformAccountId, AccountPhoneNumber = deviceInfo.AccountPhoneNumber, IoTPlatformProductName = deviceInfo.IoTPlatformProductName, - IssuePayload = messageBody, RetryCount = 0, IssueStatus = (int)DeviceCommandIssueStatusEnum.Unprocessed, LastIssueTime = DateTime.Now