Commit b4dadf6c51c22ff1d49825497ce2e8a868f5609d
1 parent
21a96ad2
修复删除的设备无法重新注册的问题
Showing
1 changed file
with
5 additions
and
1 deletions
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| @@ -117,9 +117,10 @@ public class DeviceServiceImpl implements IDeviceService { | @@ -117,9 +117,10 @@ public class DeviceServiceImpl implements IDeviceService { | ||
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | // 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询 | 119 | // 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询 |
| 120 | - if (device.getCreateTime() == null) { | 120 | + if (deviceInDb == null) { |
| 121 | device.setOnLine(true); | 121 | device.setOnLine(true); |
| 122 | device.setCreateTime(now); | 122 | device.setCreateTime(now); |
| 123 | + device.setUpdateTime(now); | ||
| 123 | logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId()); | 124 | logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId()); |
| 124 | deviceMapper.add(device); | 125 | deviceMapper.add(device); |
| 125 | redisCatchStorage.updateDevice(device); | 126 | redisCatchStorage.updateDevice(device); |
| @@ -525,6 +526,9 @@ public class DeviceServiceImpl implements IDeviceService { | @@ -525,6 +526,9 @@ public class DeviceServiceImpl implements IDeviceService { | ||
| 525 | }catch (Exception e) { | 526 | }catch (Exception e) { |
| 526 | dataSourceTransactionManager.rollback(transactionStatus); | 527 | dataSourceTransactionManager.rollback(transactionStatus); |
| 527 | } | 528 | } |
| 529 | + if (result) { | ||
| 530 | + redisCatchStorage.removeDevice(deviceId); | ||
| 531 | + } | ||
| 528 | return result; | 532 | return result; |
| 529 | } | 533 | } |
| 530 | 534 |