修复状态类型错误

This commit is contained in:
zhouhao 2023-01-04 15:56:20 +08:00
parent 29bc67e3a4
commit b81f0b176d
2 changed files with 5 additions and 4 deletions

View File

@ -21,7 +21,7 @@ import static org.jetlinks.community.network.manager.service.DeviceGatewayEventH
@Service
public class DeviceGatewayService extends GenericReactiveCrudService<DeviceGatewayEntity, String> {
public Mono<Integer> updateState(String id, NetworkConfigState state) {
public Mono<Integer> updateState(String id, DeviceGatewayState state) {
return createUpdate()
.where()
.and(DeviceGatewayEntity::getId, id)

View File

@ -13,6 +13,7 @@ import org.hswebframework.web.authorization.annotation.Resource;
import org.hswebframework.web.authorization.annotation.SaveAction;
import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
import org.hswebframework.web.i18n.LocaleUtils;
import org.jetlinks.community.network.manager.enums.DeviceGatewayState;
import org.jetlinks.core.ProtocolSupports;
import org.jetlinks.core.device.session.DeviceSessionInfo;
import org.jetlinks.core.device.session.DeviceSessionManager;
@ -59,7 +60,7 @@ public class DeviceGatewayController implements ReactiveServiceCrudController<De
@Parameter(description = "网关ID") String id) {
return gatewayManager
.start(id)
.then(deviceGatewayService.updateState(id, NetworkConfigState.enabled))
.then(deviceGatewayService.updateState(id, DeviceGatewayState.enabled))
.then();
}
@ -71,7 +72,7 @@ public class DeviceGatewayController implements ReactiveServiceCrudController<De
return gatewayManager
.getGateway(id)
.flatMap(DeviceGateway::pause)
.then(deviceGatewayService.updateState(id, NetworkConfigState.paused))
.then(deviceGatewayService.updateState(id, DeviceGatewayState.paused))
.then();
}
@ -82,7 +83,7 @@ public class DeviceGatewayController implements ReactiveServiceCrudController<De
@Parameter(description = "网关ID") String id) {
return gatewayManager
.shutdown(id)
.then(deviceGatewayService.updateState(id, NetworkConfigState.disabled).then());
.then(deviceGatewayService.updateState(id, DeviceGatewayState.disabled).then());
}
@GetMapping("/{id}/detail")