Commit 83a01a24fd95a3535f0ff7423dd555d0edc2fbcd

Authored by 云中非
1 parent e0d969d3

fix: 场景联动启用禁用,同时更新场景联动表状态

... ... @@ -184,7 +184,10 @@ public class YtConvertDataToController extends BaseController {
184 184 throws ThingsboardException {
185 185 //TODO 通过接口获取JsonNode
186 186 int status = -1;
187   - JsonNode configuration = sceneLinkageService.getRuleNodeConfig(convertReqDTO.getId(),getCurrentUser().getCurrentTenantId(),convertReqDTO.getStatus());
  187 + String sceneId = convertReqDTO.getId();
  188 + String currentTenant = getCurrentUser().getCurrentTenantId();
  189 + Integer sceneStatus = convertReqDTO.getStatus();
  190 + JsonNode configuration = sceneLinkageService.getRuleNodeConfig(sceneId,currentTenant,sceneStatus);
188 191 boolean noValue = configuration == null;
189 192 if (noValue && convertReqDTO.getStatus() == FastIotConstants.StateValue.DISABLE) {
190 193 status = FastIotConstants.StateValue.DISABLE;
... ... @@ -198,7 +201,9 @@ public class YtConvertDataToController extends BaseController {
198 201 scene.setType("org.thingsboard.rule.engine.yunteng.scene.TbSceneReactNode");
199 202 scene.setConfiguration(configuration);
200 203 ruleNodes.add(scene);
201   - return saveRuleChain(ruleNodes, status, FastIotConstants.SCENE_REACT);
  204 + RuleChainMetaData result = saveRuleChain(ruleNodes, status, FastIotConstants.SCENE_REACT);
  205 + sceneLinkageService.updateSceneStatus(sceneId,sceneStatus,currentTenant);
  206 + return result;
202 207 }
203 208
204 209 /**
... ...