完成设备属性标识符特殊结构体参数下发

This commit is contained in:
ChenYi 2025-12-10 17:08:24 +08:00
parent c1423d549f
commit 7dcc470018
7 changed files with 15 additions and 11 deletions

1
.gitignore vendored
View File

@ -60,3 +60,4 @@
/gateways/JiShe.IoT.WebGateway/bin/Debug/net10.0 /gateways/JiShe.IoT.WebGateway/bin/Debug/net10.0
/host/JiShe.IoT.HttpApi.Host/bin/Debug/net10.0 /host/JiShe.IoT.HttpApi.Host/bin/Debug/net10.0
/src/JiShe.IoT.Application/bin/Debug/net10.0 /src/JiShe.IoT.Application/bin/Debug/net10.0
/host/JiShe.IoT.HttpApi.Host/UploadFile/20251210/host/abp-file-management

View File

@ -44,7 +44,7 @@
"DefaultPartitions": 16, "DefaultPartitions": 16,
"DefaultBundles": 16, "DefaultBundles": 16,
"EnableAutoCreation": true, //Topic "EnableAutoCreation": true, //Topic
"TopicMode": "Static", //Dynamic "TopicMode": "Static", //DynamicStatic
"EnableTopicTypeFilter": true, //Topic "EnableTopicTypeFilter": true, //Topic
"AllowedTopicTypes": [ "Static" ], //Topic "AllowedTopicTypes": [ "Static" ], //Topic
"AllowedClusters": [ "pulsar-cluster-1" ], // "AllowedClusters": [ "pulsar-cluster-1" ], //

View File

@ -44,7 +44,7 @@
"DefaultPartitions": 16, "DefaultPartitions": 16,
"DefaultBundles": 16, "DefaultBundles": 16,
"EnableAutoCreation": false, //Topic "EnableAutoCreation": false, //Topic
"TopicMode": "Dynamic", //Dynamic "TopicMode": "Dynamic", //DynamicStatic
"EnableTopicTypeFilter": true, //Topic "EnableTopicTypeFilter": true, //Topic
"AllowedTopicTypes": [ "Dynamic" ], //Topic "AllowedTopicTypes": [ "Dynamic" ], //Topic
"AllowedClusters": [ "pulsar-cluster-1" ], // "AllowedClusters": [ "pulsar-cluster-1" ], //

View File

@ -26,7 +26,7 @@
"TaskThreadCount": -1 "TaskThreadCount": -1
}, },
"Pulsar": { "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", "WebUrl": "http://192.168.111.174:9094",
"UserName": "admin", "UserName": "admin",
"TenantName": "1YMVZZkAkRArjxSD8457", "TenantName": "1YMVZZkAkRArjxSD8457",
@ -39,14 +39,14 @@
"ConnectionTimeout": 30, "ConnectionTimeout": 30,
"OperationTimeout": 30, "OperationTimeout": 30,
"KeepAliveInterval": 30, "KeepAliveInterval": 30,
"TaskThreadCount": 8, "TaskThreadCount": 1,
"IsSubscriber": true, "IsSubscriber": true,
"DefaultPartitions": 16, "DefaultPartitions": 16,
"DefaultBundles": 16, "DefaultBundles": 16,
"EnableAutoCreation": false, //Topic "EnableAutoCreation": true, //Topic
"TopicMode": "Dynamic", //Dynamic "TopicMode": "Static", //DynamicStatic
"EnableTopicTypeFilter": true, //Topic "EnableTopicTypeFilter": true, //Topic
"AllowedTopicTypes": [ "Dynamic" ], //Topic "AllowedTopicTypes": [ "Static" ], //Topic
"AllowedClusters": [ "pulsar-cluster-1" ], // "AllowedClusters": [ "pulsar-cluster-1" ], //
"AdminRoles": [ "admin" ], "AdminRoles": [ "admin" ],
"EnableConsumerIdleCleanup": true, "EnableConsumerIdleCleanup": true,

View File

@ -45,7 +45,10 @@ namespace JiShe.IoT.BusinessSystemAggregation
return handleResult; return handleResult;
} }
var messageBody = handleResult.Data; 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) if (messageBody.SourceType != DeviceTelemetrySourceTypeEnum.BusinessSystem)
@ -60,7 +63,7 @@ namespace JiShe.IoT.BusinessSystemAggregation
return HttpDataResultExtensions.Failed("设备不存在", -1041, ResponeResultEnum.Fail); return HttpDataResultExtensions.Failed("设备不存在", -1041, ResponeResultEnum.Fail);
} }
var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, input, deviceInfo.Adapt<DeviceCacheInfos>(), tempMessageBody); var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, input, deviceInfo.Adapt<DeviceCacheInfos>(), messageBody.Commands.Serialize());
//将指令存储IoTDB数据库和Redis发布通道 //将指令存储IoTDB数据库和Redis发布通道
if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.OneNET) if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.OneNET)

View File

@ -647,7 +647,7 @@ namespace JiShe.IoT.DeviceAggregation
{ {
Message = input.Serialize(), Message = input.Serialize(),
}; };
var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, commandRequest, deviceInfo.Adapt<DeviceCacheInfos>(), commandRequest.Message); var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, commandRequest, deviceInfo.Adapt<DeviceCacheInfos>(), input.Commands.Serialize());
await ioTDBDataChannelManageService.DeviceTelemetryTaskWriterAsync(DataChannelManage.DeviceTelemetryTaskDataChannel.Writer, (DistributedMessageCenterConst.OneNETCommandIssuedEventName, packetTaskInfo)); await ioTDBDataChannelManageService.DeviceTelemetryTaskWriterAsync(DataChannelManage.DeviceTelemetryTaskDataChannel.Writer, (DistributedMessageCenterConst.OneNETCommandIssuedEventName, packetTaskInfo));

View File

@ -52,6 +52,7 @@ namespace JiShe.IoT
DeviceType = $"{commandIssueInfo.DeviceType}", DeviceType = $"{commandIssueInfo.DeviceType}",
DeviceAddress = commandIssueInfo.DeviceAddress, DeviceAddress = commandIssueInfo.DeviceAddress,
IssueRawMessage = input.Serialize(), IssueRawMessage = input.Serialize(),
IssuePayload = messageBody,
IoTDataType = IoTDBDataTypeConst.Command, IoTDataType = IoTDBDataTypeConst.Command,
TelemetrySource = (int)commandIssueInfo.SourceType, TelemetrySource = (int)commandIssueInfo.SourceType,
IoTPlatform = (int)commandIssueInfo.IoTPlatform, IoTPlatform = (int)commandIssueInfo.IoTPlatform,
@ -60,7 +61,6 @@ namespace JiShe.IoT
IoTPlatformAccountId = deviceInfo.IoTPlatformAccountId, IoTPlatformAccountId = deviceInfo.IoTPlatformAccountId,
AccountPhoneNumber = deviceInfo.AccountPhoneNumber, AccountPhoneNumber = deviceInfo.AccountPhoneNumber,
IoTPlatformProductName = deviceInfo.IoTPlatformProductName, IoTPlatformProductName = deviceInfo.IoTPlatformProductName,
IssuePayload = messageBody,
RetryCount = 0, RetryCount = 0,
IssueStatus = (int)DeviceCommandIssueStatusEnum.Unprocessed, IssueStatus = (int)DeviceCommandIssueStatusEnum.Unprocessed,
LastIssueTime = DateTime.Now LastIssueTime = DateTime.Now