Commit abc6dd645d2ccc565e9d12a9eee1a4fbf9c771fd

Authored by 芯火源
1 parent 9649fc49

fix: 场景联动兼容服务内容为空的情况。

@@ -17,6 +17,7 @@ package org.thingsboard.server.common.data.id; @@ -17,6 +17,7 @@ package org.thingsboard.server.common.data.id;
17 17
18 import org.thingsboard.server.common.data.EntityType; 18 import org.thingsboard.server.common.data.EntityType;
19 import org.thingsboard.server.common.data.edge.EdgeEventType; 19 import org.thingsboard.server.common.data.edge.EdgeEventType;
  20 +import org.thingsboard.server.common.data.yunteng.id.SceneId;
20 21
21 import java.util.UUID; 22 import java.util.UUID;
22 23
@@ -77,7 +78,9 @@ public class EntityIdFactory { @@ -77,7 +78,9 @@ public class EntityIdFactory {
77 return new EdgeId(uuid); 78 return new EdgeId(uuid);
78 case RPC: 79 case RPC:
79 return new RpcId(uuid); 80 return new RpcId(uuid);
80 - } 81 + case SCENE_ACT:
  82 + return new SceneId(uuid);
  83 + }
81 throw new IllegalArgumentException("EntityType " + type + " is not supported!"); 84 throw new IllegalArgumentException("EntityType " + type + " is not supported!");
82 } 85 }
83 86
@@ -242,7 +242,9 @@ public class TkSceneLinkageServiceImpl extends AbstractBaseService<SceneLinkageM @@ -242,7 +242,9 @@ public class TkSceneLinkageServiceImpl extends AbstractBaseService<SceneLinkageM
242 JsonNode inputContext = doActionDTO.getDoContext().get(FastIotConstants.Rpc.PARAMS_NAME); 242 JsonNode inputContext = doActionDTO.getDoContext().get(FastIotConstants.Rpc.PARAMS_NAME);
243 ObjectNode outputContext = JacksonUtil.newObjectNode(); 243 ObjectNode outputContext = JacksonUtil.newObjectNode();
244 outputContext.put(FastIotConstants.Rpc.METHOD_NAME, "methodThingskit"); 244 outputContext.put(FastIotConstants.Rpc.METHOD_NAME, "methodThingskit");
245 - if(inputContext.isTextual()){ 245 + if(inputContext == null){
  246 + outputContext.put(FastIotConstants.Rpc.PARAMS_NAME,"");
  247 + }else if(inputContext.isTextual()){
246 outputContext.put(FastIotConstants.Rpc.PARAMS_NAME,inputContext.asText()); 248 outputContext.put(FastIotConstants.Rpc.PARAMS_NAME,inputContext.asText());
247 }else{ 249 }else{
248 outputContext.set(FastIotConstants.Rpc.PARAMS_NAME, inputContext); 250 outputContext.set(FastIotConstants.Rpc.PARAMS_NAME, inputContext);