|
|
@@ -520,16 +520,18 @@ public class DeviceServiceImpl implements IDeviceService {
|
|
|
|
|
|
|
|
|
// 目录订阅相关的信息
|
|
|
- if (device.getSubscribeCycleForCatalog() > 0) {
|
|
|
- if (deviceInStore.getSubscribeCycleForCatalog() == 0 || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
|
|
|
- deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
|
|
+ if (deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
|
|
|
+ if (device.getSubscribeCycleForCatalog() > 0) {
|
|
|
+ // 若已开启订阅,但订阅周期不同,则先取消
|
|
|
+ if (deviceInStore.getSubscribeCycleForCatalog() != 0) {
|
|
|
+ removeCatalogSubscribe(deviceInStore);
|
|
|
+ }
|
|
|
// 开启订阅
|
|
|
- addCatalogSubscribe(deviceInStore);
|
|
|
- }
|
|
|
- }else if (device.getSubscribeCycleForCatalog() == 0) {
|
|
|
- if (deviceInStore.getSubscribeCycleForCatalog() != 0) {
|
|
|
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
|
|
+ addCatalogSubscribe(deviceInStore);
|
|
|
+ }else if (device.getSubscribeCycleForCatalog() == 0) {
|
|
|
// 取消订阅
|
|
|
+ deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
|
|
removeCatalogSubscribe(deviceInStore);
|
|
|
}
|
|
|
}
|