Commit da7889bf67ec400c96c4a68e61f8b6b4fbeef585

Authored by lishuyuan
1 parent 26ca854d

bugfix:编辑国标设备时,若目录订阅周期本来不为0时不生效

src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/CatalogSubscribeTask.java
... ... @@ -89,17 +89,17 @@ public class CatalogSubscribeTask implements ISubscribeTask {
89 89 ResponseEvent event = (ResponseEvent) eventResult.event;
90 90 if (event.getResponse().getRawContent() != null) {
91 91 // 成功
92   - logger.info("[取消目录订阅订阅]成功: {}", device.getDeviceId());
  92 + logger.info("[取消目录订阅]成功: {}", device.getDeviceId());
93 93 }else {
94 94 // 成功
95   - logger.info("[取消目录订阅订阅]成功: {}", device.getDeviceId());
  95 + logger.info("[取消目录订阅]成功: {}", device.getDeviceId());
96 96 }
97 97 },eventResult -> {
98 98 // 失败
99   - logger.warn("[取消目录订阅订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
  99 + logger.warn("[取消目录订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
100 100 });
101 101 } catch (InvalidArgumentException | SipException | ParseException e) {
102   - logger.error("[命令发送失败] 取消目录订阅订阅: {}", e.getMessage());
  102 + logger.error("[命令发送失败] 取消目录订阅: {}", e.getMessage());
103 103 }
104 104 }
105 105 }
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
... ... @@ -520,16 +520,18 @@ public class DeviceServiceImpl implements IDeviceService {
520 520  
521 521  
522 522 // 目录订阅相关的信息
523   - if (device.getSubscribeCycleForCatalog() > 0) {
524   - if (deviceInStore.getSubscribeCycleForCatalog() == 0 || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
525   - deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
  523 + if (deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
  524 + if (device.getSubscribeCycleForCatalog() > 0) {
  525 + // 若已开启订阅,但订阅周期不同,则先取消
  526 + if (deviceInStore.getSubscribeCycleForCatalog() != 0) {
  527 + removeCatalogSubscribe(deviceInStore);
  528 + }
526 529 // 开启订阅
527   - addCatalogSubscribe(deviceInStore);
528   - }
529   - }else if (device.getSubscribeCycleForCatalog() == 0) {
530   - if (deviceInStore.getSubscribeCycleForCatalog() != 0) {
531 530 deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
  531 + addCatalogSubscribe(deviceInStore);
  532 + }else if (device.getSubscribeCycleForCatalog() == 0) {
532 533 // 取消订阅
  534 + deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
533 535 removeCatalogSubscribe(deviceInStore);
534 536 }
535 537 }
... ...