设置父级设备ID

This commit is contained in:
zhouhao 2020-02-21 12:06:28 +08:00
parent f7775c9fce
commit 6eb98971bd
1 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package org.jetlinks.community.standalone.configuration;
import lombok.Getter;
import lombok.Setter;
import org.jetlinks.core.device.DeviceConfigKey;
import org.jetlinks.core.device.DeviceRegistry;
import org.jetlinks.core.message.codec.Transport;
import org.jetlinks.core.server.monitor.GatewayServerMonitor;
@ -231,6 +232,7 @@ public class DefaultDeviceSessionManager implements DeviceSessionManager {
.switchIfEmpty(Mono.fromRunnable(() -> log.warn("children device [{}] not fond in registry", childrenDeviceId)))
.flatMap(deviceOperator -> deviceOperator
.online(session.getServerId().orElse(serverId), session.getId())
.then(deviceOperator.setConfig(DeviceConfigKey.parentMeshDeviceId, deviceId))
.thenReturn(new ChildrenDeviceSession(childrenDeviceId, session, deviceOperator)))
.doOnSuccess(s -> children.computeIfAbsent(deviceId, __ -> new ConcurrentHashMap<>()).put(childrenDeviceId, s));
});