Commit 84c60381cc77a1f7fba206900ebcfed4918859d3
1 parent
f9ae4cfd
增加设备通道数为0时自动发起更新通道
Showing
1 changed file
with
5 additions
and
0 deletions
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| @@ -118,6 +118,7 @@ public class DeviceServiceImpl implements IDeviceService { | @@ -118,6 +118,7 @@ public class DeviceServiceImpl implements IDeviceService { | ||
| 118 | } | 118 | } |
| 119 | sync(device); | 119 | sync(device); |
| 120 | }else { | 120 | }else { |
| 121 | + | ||
| 121 | if(device.getOnline() == 0){ | 122 | if(device.getOnline() == 0){ |
| 122 | device.setOnline(1); | 123 | device.setOnline(1); |
| 123 | device.setCreateTime(now); | 124 | device.setCreateTime(now); |
| @@ -132,6 +133,10 @@ public class DeviceServiceImpl implements IDeviceService { | @@ -132,6 +133,10 @@ public class DeviceServiceImpl implements IDeviceService { | ||
| 132 | sync(device); | 133 | sync(device); |
| 133 | // TODO 如果设备下的通道级联到了其他平台,那么需要发送事件或者notify给上级平台 | 134 | // TODO 如果设备下的通道级联到了其他平台,那么需要发送事件或者notify给上级平台 |
| 134 | }else { | 135 | }else { |
| 136 | + if (deviceChannelMapper.queryAllChannels(device.getDeviceId()).size() == 0) { | ||
| 137 | + sync(device); | ||
| 138 | + } | ||
| 139 | + | ||
| 135 | deviceMapper.update(device); | 140 | deviceMapper.update(device); |
| 136 | redisCatchStorage.updateDevice(device); | 141 | redisCatchStorage.updateDevice(device); |
| 137 | } | 142 | } |