|
@@ -5,6 +5,7 @@ import org.hswebframework.web.crud.service.GenericReactiveCrudService;
|
|
|
import org.jetlinks.community.rule.engine.entity.DeviceAlarmEntity;
|
|
import org.jetlinks.community.rule.engine.entity.DeviceAlarmEntity;
|
|
|
import org.jetlinks.community.rule.engine.entity.RuleSceneEntity;
|
|
import org.jetlinks.community.rule.engine.entity.RuleSceneEntity;
|
|
|
import org.jetlinks.community.rule.engine.enums.AlarmState;
|
|
import org.jetlinks.community.rule.engine.enums.AlarmState;
|
|
|
|
|
+import org.jetlinks.community.rule.engine.enums.RuleSceneState;
|
|
|
import org.reactivestreams.Publisher;
|
|
import org.reactivestreams.Publisher;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import reactor.core.publisher.Flux;
|
|
import reactor.core.publisher.Flux;
|
|
@@ -33,7 +34,7 @@ public class RuleSceneService extends GenericReactiveCrudService<RuleSceneEntity
|
|
|
.save(Mono.just(entity.toRuleInstance()))
|
|
.save(Mono.just(entity.toRuleInstance()))
|
|
|
.then(instanceService.start(entity.getId()))
|
|
.then(instanceService.start(entity.getId()))
|
|
|
.then(createUpdate()
|
|
.then(createUpdate()
|
|
|
- .set(RuleSceneEntity::getState, AlarmState.running)
|
|
|
|
|
|
|
+ .set(RuleSceneEntity::getState, RuleSceneState.running)
|
|
|
.where(entity::getId).execute())
|
|
.where(entity::getId).execute())
|
|
|
.then();
|
|
.then();
|
|
|
}
|
|
}
|
|
@@ -42,7 +43,7 @@ public class RuleSceneService extends GenericReactiveCrudService<RuleSceneEntity
|
|
|
public Mono<Void> stop(String id) {
|
|
public Mono<Void> stop(String id) {
|
|
|
return instanceService.stop(id)
|
|
return instanceService.stop(id)
|
|
|
.then(createUpdate()
|
|
.then(createUpdate()
|
|
|
- .set(RuleSceneEntity::getState,AlarmState.stopped)
|
|
|
|
|
|
|
+ .set(RuleSceneEntity::getState,RuleSceneState.stopped)
|
|
|
.where(DeviceAlarmEntity::getId,id)
|
|
.where(DeviceAlarmEntity::getId,id)
|
|
|
.execute())
|
|
.execute())
|
|
|
.then();
|
|
.then();
|
|
@@ -56,4 +57,9 @@ public class RuleSceneService extends GenericReactiveCrudService<RuleSceneEntity
|
|
|
.then(RuleSceneService.super.deleteById(Mono.just(id)))
|
|
.then(RuleSceneService.super.deleteById(Mono.just(id)))
|
|
|
).reduce(Math::addExact);
|
|
).reduce(Math::addExact);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public Mono<Void> execute(String id) {
|
|
|
|
|
+
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|