Commit 91dc4566a26862abef9aa2352d2ddf2279e5e8e8

Authored by 648540858
1 parent 8ee7211b

修复级联无通道时更新停止在等待更新的问题

src/main/java/com/genersoft/iot/vmp/gb28181/bean/CatalogData.java
... ... @@ -3,8 +3,14 @@ package com.genersoft.iot.vmp.gb28181.bean;
3 3 import java.time.Instant;
4 4 import java.util.List;
5 5  
  6 +/**
  7 + * @author lin
  8 + */
6 9 public class CatalogData {
7   - private int sn; // 命令序列号
  10 + /**
  11 + * 命令序列号
  12 + */
  13 + private int sn;
8 14 private int total;
9 15 private List<DeviceChannel> channelList;
10 16 private Instant lastTime;
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java
... ... @@ -2,12 +2,15 @@ package com.genersoft.iot.vmp.gb28181.bean;
2 2  
3 3 /**
4 4 * 摄像机同步状态
  5 + * @author lin
5 6 */
6 7 public class SyncStatus {
7 8 private int total;
8 9 private int current;
9 10 private String errorMsg;
10 11  
  12 + private boolean syncIng;
  13 +
11 14 public int getTotal() {
12 15 return total;
13 16 }
... ... @@ -31,4 +34,12 @@ public class SyncStatus {
31 34 public void setErrorMsg(String errorMsg) {
32 35 this.errorMsg = errorMsg;
33 36 }
  37 +
  38 + public boolean isSyncIng() {
  39 + return syncIng;
  40 + }
  41 +
  42 + public void setSyncIng(boolean syncIng) {
  43 + this.syncIng = syncIng;
  44 + }
34 45 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java
... ... @@ -84,6 +84,11 @@ public class CatalogDataCatch {
84 84 syncStatus.setCurrent(catalogData.getChannelList().size());
85 85 syncStatus.setTotal(catalogData.getTotal());
86 86 syncStatus.setErrorMsg(catalogData.getErrorMsg());
  87 + if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end)) {
  88 + syncStatus.setSyncIng(false);
  89 + }else {
  90 + syncStatus.setSyncIng(true);
  91 + }
87 92 return syncStatus;
88 93 }
89 94  
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
... ... @@ -111,6 +111,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
111 111 int sumNum = Integer.parseInt(sumNumElement.getText());
112 112  
113 113 if (sumNum == 0) {
  114 + logger.info("收到来自设备【{}】的通道: 0个", take.getDevice().getDeviceId());
114 115 // 数据已经完整接收
115 116 storager.cleanChannelsForDevice(take.getDevice().getDeviceId());
116 117 catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), null);
... ...
web_src/src/components/dialog/SyncChannelProgress.vue
... ... @@ -63,34 +63,39 @@ export default {
63 63 }
64 64  
65 65 if (res.data.data != null) {
66   - if (res.data.data.total == 0) {
67   - if (res.data.data.errorMsg !== null ){
68   - this.msg = res.data.data.errorMsg;
69   - this.syncStatus = "exception"
70   - }else {
71   - this.msg = `等待同步中`;
72   - this.timmer = setTimeout(this.getProgress, 300)
73   - }
74   - }else {
75   - if (res.data.data.total == res.data.data.current) {
76   - this.syncStatus = "success"
77   - this.percentage = 100;
78   - this.msg = '同步成功';
79   - }else {
  66 + if (res.data.syncIng) {
  67 + if (res.data.data.total == 0) {
80 68 if (res.data.data.errorMsg !== null ){
81 69 this.msg = res.data.data.errorMsg;
82 70 this.syncStatus = "exception"
83 71 }else {
84   - this.total = res.data.data.total;
85   - this.current = res.data.data.current;
86   - this.percentage = Math.floor(Number(res.data.data.current)/Number(res.data.data.total)* 10000)/100;
87   - this.msg = `同步中...[${res.data.data.current}/${res.data.data.total}]`;
  72 + this.msg = `等待同步中`;
88 73 this.timmer = setTimeout(this.getProgress, 300)
89 74 }
  75 + }else {
  76 + if (res.data.data.total == res.data.data.current) {
  77 + this.syncStatus = "success"
  78 + this.percentage = 100;
  79 + this.msg = '同步成功';
  80 + }else {
  81 + if (res.data.data.errorMsg !== null ){
  82 + this.msg = res.data.data.errorMsg;
  83 + this.syncStatus = "exception"
  84 + }else {
  85 + this.total = res.data.data.total;
  86 + this.current = res.data.data.current;
  87 + this.percentage = Math.floor(Number(res.data.data.current)/Number(res.data.data.total)* 10000)/100;
  88 + this.msg = `同步中...[${res.data.data.current}/${res.data.data.total}]`;
  89 + this.timmer = setTimeout(this.getProgress, 300)
  90 + }
  91 + }
90 92 }
  93 + }else {
  94 + this.syncStatus = "success"
  95 + this.percentage = 100;
  96 + this.msg = '同步成功';
91 97 }
92 98 }
93   -
94 99 }else {
95 100 if (this.syncFlag) {
96 101 this.syncStatus = "success"
... ...