修复删除的设备无法重新注册的问题

This commit is contained in:
648540858 2023-06-20 13:02:18 +08:00
parent 21a96ad20f
commit b4dadf6c51

View File

@ -117,9 +117,10 @@ public class DeviceServiceImpl implements IDeviceService {
}
// 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询
if (device.getCreateTime() == null) {
if (deviceInDb == null) {
device.setOnLine(true);
device.setCreateTime(now);
device.setUpdateTime(now);
logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId());
deviceMapper.add(device);
redisCatchStorage.updateDevice(device);
@ -525,6 +526,9 @@ public class DeviceServiceImpl implements IDeviceService {
}catch (Exception e) {
dataSourceTransactionManager.rollback(transactionStatus);
}
if (result) {
redisCatchStorage.removeDevice(deviceId);
}
return result;
}