|
|
@@ -7,6 +7,7 @@ import org.hswebframework.web.authorization.annotation.SaveAction;
|
|
|
import org.hswebframework.web.crud.service.ReactiveCrudService;
|
|
|
import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
|
|
|
import org.jetlinks.community.rule.engine.entity.RuleSceneEntity;
|
|
|
+import org.jetlinks.community.rule.engine.enums.RuleSceneState;
|
|
|
import org.jetlinks.community.rule.engine.service.RuleSceneService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import reactor.core.publisher.Mono;
|
|
|
@@ -27,6 +28,15 @@ public class RuleSceneController implements ReactiveServiceCrudController<RuleSc
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @PatchMapping("/update")
|
|
|
+ @SaveAction
|
|
|
+ @Operation(summary = "启动场景互联配置更新")
|
|
|
+ public Mono<Void> update(@RequestBody RuleSceneEntity entity) {
|
|
|
+ return sceneService.save(entity)
|
|
|
+ .filter(result->result.getUpdated()!=0)
|
|
|
+ .flatMap(ignore->RuleSceneState.started.eq(entity.getState())?Mono.empty():sceneService.start(entity.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("/{id}/_start")
|
|
|
@SaveAction
|
|
|
@Operation(summary = "启动场景互联配置")
|