优化注释
This commit is contained in:
parent
180b654f26
commit
c1423d549f
@ -302,10 +302,20 @@ namespace JiShe.IoT.DeviceAggregation
|
|||||||
throw new UserFriendlyException($"设备不存在");
|
throw new UserFriendlyException($"设备不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//将指令存储
|
||||||
|
var receiveCommandInfoDto = new ReceiveCommandInfoDto()
|
||||||
|
{
|
||||||
|
DeviceAddress = deviceInfo.DeviceAddress,
|
||||||
|
Commands = input.CommandContent,
|
||||||
|
DeviceType = deviceInfo.DeviceType,
|
||||||
|
SourceType = DeviceTelemetrySourceTypeEnum.AdminSystem,
|
||||||
|
IoTPlatform = deviceInfo.IoTPlatform,
|
||||||
|
};
|
||||||
|
|
||||||
//数据写入遥测任务数据存储通道
|
//数据写入遥测任务数据存储通道
|
||||||
if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.OneNET)
|
if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.OneNET)
|
||||||
{
|
{
|
||||||
return await DeviceCommandInfoToOneNET(deviceInfo, input);
|
return await DeviceCommandInfoToOneNET(deviceInfo, receiveCommandInfoDto);
|
||||||
}
|
}
|
||||||
else if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.CTWing)
|
else if (deviceInfo.IoTPlatform == IoTPlatformTypeEnum.CTWing)
|
||||||
{
|
{
|
||||||
@ -611,25 +621,15 @@ namespace JiShe.IoT.DeviceAggregation
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="UserFriendlyException"></exception>
|
/// <exception cref="UserFriendlyException"></exception>
|
||||||
public async Task<bool> DeviceCommandInfoToOneNET(DeviceManagementInfoDto deviceInfo, DeviceCommandForApiInput input)
|
public async Task<bool> DeviceCommandInfoToOneNET(DeviceManagementInfoDto deviceInfo, ReceiveCommandInfoDto input)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//将指令存储
|
|
||||||
var receiveCommandInfoDto = new ReceiveCommandInfoDto()
|
|
||||||
{
|
|
||||||
DeviceAddress = deviceInfo.DeviceAddress,
|
|
||||||
Commands = input.CommandContent,
|
|
||||||
DeviceType = deviceInfo.DeviceType,
|
|
||||||
SourceType = DeviceTelemetrySourceTypeEnum.AdminSystem,
|
|
||||||
IoTPlatform = deviceInfo.IoTPlatform,
|
|
||||||
};
|
|
||||||
|
|
||||||
//检查设备是否有配置设备端物模型信息
|
//检查设备是否有配置设备端物模型信息
|
||||||
//如果有配置,就检查指令字典中是否有SpecialCommand标识符
|
//如果有配置,就检查指令字典中是否有SpecialCommand标识符
|
||||||
//如果有就需要构建 SpecialCommand 的特别指令
|
//如果有就需要构建 SpecialCommand 的特别指令
|
||||||
|
|
||||||
if (deviceInfo.IsNeedConfigDevicMdoel && deviceInfo.DeviceThingModelDataId.HasValue && receiveCommandInfoDto.Commands.ContainsKey(ThingModelFixedTypeConst.SpecialCommand))
|
if (deviceInfo.IsNeedConfigDevicMdoel && deviceInfo.DeviceThingModelDataId.HasValue && input.Commands.ContainsKey(ThingModelFixedTypeConst.SpecialCommand))
|
||||||
{
|
{
|
||||||
var propertyInfo = await oneNETProductService.GetProductThingModelSpecialCommandDataTypeListAsync(new IdInput<string>() { Id = deviceInfo.IoTPlatformProductId });
|
var propertyInfo = await oneNETProductService.GetProductThingModelSpecialCommandDataTypeListAsync(new IdInput<string>() { Id = deviceInfo.IoTPlatformProductId });
|
||||||
|
|
||||||
@ -640,12 +640,12 @@ namespace JiShe.IoT.DeviceAggregation
|
|||||||
|
|
||||||
Dictionary<string, string> tempSpecialCommand = await deviceThingModelService.BuildThingModelSpecialCommandAsync(propertyInfo, deviceInfo.DeviceThingModelDataId.Value);
|
Dictionary<string, string> tempSpecialCommand = await deviceThingModelService.BuildThingModelSpecialCommandAsync(propertyInfo, deviceInfo.DeviceThingModelDataId.Value);
|
||||||
|
|
||||||
receiveCommandInfoDto.Commands[ThingModelFixedTypeConst.SpecialCommand] = tempSpecialCommand;
|
input.Commands[ThingModelFixedTypeConst.SpecialCommand] = tempSpecialCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
var commandRequest = new OpenApiRequest()
|
var commandRequest = new OpenApiRequest()
|
||||||
{
|
{
|
||||||
Message = receiveCommandInfoDto.Serialize(),
|
Message = input.Serialize(),
|
||||||
};
|
};
|
||||||
var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, commandRequest, deviceInfo.Adapt<DeviceCacheInfos>(), commandRequest.Message);
|
var packetTaskInfo = GetDeviceTelemetryPacketTaskInfo(ioTDBOptions, commandRequest, deviceInfo.Adapt<DeviceCacheInfos>(), commandRequest.Message);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user