From b5944c6d3a213c17e283a9be3e6364533521d9db Mon Sep 17 00:00:00 2001 From: zhouhao Date: Tue, 29 Oct 2024 15:02:06 +0800 Subject: [PATCH] fix: #580 --- .../device/service/DeviceMessageBusinessHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/service/DeviceMessageBusinessHandler.java b/jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/service/DeviceMessageBusinessHandler.java index 2acb924f2..b3368f7ee 100644 --- a/jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/service/DeviceMessageBusinessHandler.java +++ b/jetlinks-manager/device-manager/src/main/java/org/jetlinks/community/device/service/DeviceMessageBusinessHandler.java @@ -103,7 +103,10 @@ private Mono doAutoRegister(DeviceRegisterMessage message) { instance.setCreateTimeNow(); instance.setCreatorId(tps.getT4().getCreatorId()); instance.setOrgId(tps.getT4().getOrgId()); - + //网关ID + message.getHeader(DeviceConfigKey.parentGatewayId.getKey()) + .map(String::valueOf) + .ifPresent(instance::setParentId); //设备自状态管理 //网关注册设备子设备时,设置自状态管理。 //在检查子设备状态时,将会发送ChildDeviceMessage到网关