From 8fdd10d1c2723ead1d2c3b232f64f292ba3ce1cc Mon Sep 17 00:00:00 2001 From: che_shuai <che_shuai@massclouds> Date: 星期一, 24 七月 2023 14:10:46 +0800 Subject: [PATCH] 修复在国标级联选择通道时,如果添加通道到跟平台根目录(即平台本身),无法触发目录变更事件问题.详见 https://github.com/648540858/wvp-GB28181-pro/issues/958 --- src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java index 7ed3c11..38cdf7c 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java @@ -42,7 +42,7 @@ catalogData.setSn(sn); catalogData.setTotal(total); catalogData.setDevice(device); - catalogData.setChannelList(Collections.synchronizedList(new ArrayList<>())); + catalogData.setChannelList(deviceChannelList); catalogData.setStatus(CatalogData.CatalogDataStatus.runIng); catalogData.setLastTime(Instant.now()); data.put(deviceId, catalogData); @@ -84,6 +84,11 @@ syncStatus.setCurrent(catalogData.getChannelList().size()); syncStatus.setTotal(catalogData.getTotal()); syncStatus.setErrorMsg(catalogData.getErrorMsg()); + if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end)) { + syncStatus.setSyncIng(false); + }else { + syncStatus.setSyncIng(true); + } return syncStatus; } @@ -104,12 +109,18 @@ for (String deviceId : keys) { CatalogData catalogData = data.get(deviceId); - if ( catalogData.getLastTime().isBefore(instantBefore5S)) { // 瓒呰繃浜旂鏀朵笉鍒版秷鎭换鍔¤秴鏃讹紝 鍙洿鏂拌繖涓�閮ㄥ垎鏁版嵁 + if ( catalogData.getLastTime().isBefore(instantBefore5S)) { + // 瓒呰繃浜旂鏀朵笉鍒版秷鎭换鍔¤秴鏃讹紝 鍙洿鏂拌繖涓�閮ㄥ垎鏁版嵁, 鏀跺埌鏁版嵁涓庡0鏄庣殑鎬绘暟涓�鑷达紝鍒欓噸缃�氶亾鏁版嵁锛屾暟鎹笉鍏ㄥ垯鍙鏀跺埌鐨勬暟鎹仛鏇存柊鎿嶄綔 if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.runIng)) { - storager.resetChannels(catalogData.getDevice().getDeviceId(), catalogData.getChannelList()); + if (catalogData.getTotal() == catalogData.getChannelList().size()) { + storager.resetChannels(catalogData.getDevice().getDeviceId(), catalogData.getChannelList()); + }else { + storager.updateChannels(catalogData.getDevice().getDeviceId(), catalogData.getChannelList()); + } + String errorMsg = "鏇存柊鎴愬姛锛屽叡" + catalogData.getTotal() + "鏉★紝宸叉洿鏂�" + catalogData.getChannelList().size() + "鏉�"; + catalogData.setErrorMsg(errorMsg); if (catalogData.getTotal() != catalogData.getChannelList().size()) { - String errorMsg = "鏇存柊鎴愬姛锛屽叡" + catalogData.getTotal() + "鏉★紝宸叉洿鏂�" + catalogData.getChannelList().size() + "鏉�"; - catalogData.setErrorMsg(errorMsg); + } }else if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.ready)) { String errorMsg = "鍚屾澶辫触锛岀瓑寰呭洖澶嶈秴鏃�"; -- Gitblit v1.8.0