修改代码
This commit is contained in:
parent
040359177e
commit
aa333a1271
|
|
@ -333,6 +333,9 @@ public class SynService {
|
||||||
String deviceName = deviceInfo.getName();
|
String deviceName = deviceInfo.getName();
|
||||||
String deviceSn = deviceName; // 使用设备名称作为SN号,网关其实是没有SN号的
|
String deviceSn = deviceName; // 使用设备名称作为SN号,网关其实是没有SN号的
|
||||||
|
|
||||||
|
log.info("开始同步设备: iotDeviceId={}, deviceName={}, deviceType={}, gatewayId={}",
|
||||||
|
iotDeviceId, deviceName, deviceType, gatewayId);
|
||||||
|
|
||||||
// 查询设备是否已存在
|
// 查询设备是否已存在
|
||||||
Device existingDevice = deviceDomain.selectDeviceByIotDeviceId(iotDeviceId);
|
Device existingDevice = deviceDomain.selectDeviceByIotDeviceId(iotDeviceId);
|
||||||
|
|
||||||
|
|
@ -346,9 +349,14 @@ public class SynService {
|
||||||
newDevice.setGateway(gatewayId);
|
newDevice.setGateway(gatewayId);
|
||||||
newDevice.setCreateBy("system");
|
newDevice.setCreateBy("system");
|
||||||
|
|
||||||
|
log.info("准备插入新设备: deviceName={}, deviceType={}, deviceSn={}",
|
||||||
|
deviceName, deviceType, deviceSn);
|
||||||
deviceDomain.insertDevice(newDevice);
|
deviceDomain.insertDevice(newDevice);
|
||||||
log.info("插入新设备: iotDeviceId={}, deviceName={}, deviceType={}", iotDeviceId, deviceName, deviceType);
|
|
||||||
return newDevice.getDeviceId();
|
Long deviceId = newDevice.getDeviceId();
|
||||||
|
log.info("插入新设备成功: iotDeviceId={}, deviceName={}, deviceType={}, 返回deviceId={}",
|
||||||
|
iotDeviceId, deviceName, deviceType, deviceId);
|
||||||
|
return deviceId;
|
||||||
} else {
|
} else {
|
||||||
// 设备已存在,检查是否需要更新
|
// 设备已存在,检查是否需要更新
|
||||||
boolean needUpdate = false;
|
boolean needUpdate = false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue