diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CatalogData.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CatalogData.java index 2c37a1de..25407ed4 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CatalogData.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CatalogData.java @@ -1,14 +1,10 @@ package com.genersoft.iot.vmp.gb28181.bean; import lombok.Data; -import org.jetbrains.annotations.NotNull; import java.time.Instant; import java.util.HashSet; -import java.util.List; import java.util.Set; -import java.util.concurrent.Delayed; -import java.util.concurrent.TimeUnit; /** * @author lin @@ -19,7 +15,7 @@ public class CatalogData { * 命令序列号 */ private int sn; - private int total; + private Integer total; private Instant time; private Device device; private String errorMsg; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java index 373b971c..33e66c2f 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java @@ -1,51 +1,26 @@ package com.genersoft.iot.vmp.gb28181.bean; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; /** * 摄像机同步状态 * @author lin */ +@Data @Schema(description = "摄像机同步状态") public class SyncStatus { + @Schema(description = "总数") - private int total; + private Integer total; + @Schema(description = "当前更新多少") - private int current; + private Integer current; + @Schema(description = "错误描述") private String errorMsg; + @Schema(description = "是否同步中") - private boolean syncIng; + private Boolean syncIng; - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public int getCurrent() { - return current; - } - - public void setCurrent(int current) { - this.current = current; - } - - public String getErrorMsg() { - return errorMsg; - } - - public void setErrorMsg(String errorMsg) { - this.errorMsg = errorMsg; - } - - public boolean isSyncIng() { - return syncIng; - } - - public void setSyncIng(boolean syncIng) { - this.syncIng = syncIng; - } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java index f6febd83..71f8b327 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java @@ -413,14 +413,16 @@ public class DeviceQuery { public WVPResult getSyncStatus(@PathVariable String deviceId) { SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId); WVPResult wvpResult = new WVPResult<>(); - if (channelSyncStatus == null) { - wvpResult.setCode(-1); + if (channelSyncStatus == null || channelSyncStatus.getTotal() == null) { + wvpResult.setCode(0); wvpResult.setMsg("同步尚未开始"); }else { - wvpResult.setCode(ErrorCode.SUCCESS.getCode()); - wvpResult.setMsg(ErrorCode.SUCCESS.getMsg()); - wvpResult.setData(channelSyncStatus); - if (channelSyncStatus.getErrorMsg() != null) { + if (channelSyncStatus.getErrorMsg() == null) { + wvpResult.setCode(ErrorCode.SUCCESS.getCode()); + wvpResult.setMsg(ErrorCode.SUCCESS.getMsg()); + wvpResult.setData(channelSyncStatus); + }else { + wvpResult.setCode(ErrorCode.ERROR100.getCode()); wvpResult.setMsg(channelSyncStatus.getErrorMsg()); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java index e5279a92..3e67594a 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java @@ -330,6 +330,7 @@ public class DeviceServiceImpl implements IDeviceService { try { sipCommander.catalogQuery(device, sn, event -> { String errorMsg = String.format("同步通道失败,错误码: %s, %s", event.statusCode, event.msg); + log.info("[同步通道]失败,编号: {}, 错误码: {}, {}", device.getDeviceId(), event.statusCode, event.msg); catalogResponseMessageHandler.setChannelSyncEnd(device.getDeviceId(), sn, errorMsg); }); } catch (SipException | InvalidArgumentException | ParseException e) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataManager.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataManager.java index d53ffaee..34d8acaf 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataManager.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataManager.java @@ -170,7 +170,7 @@ public class CatalogDataManager implements CommandLineRunner { syncStatus.setCurrent(catalogData.getRedisKeysForChannel().size()); syncStatus.setTotal(catalogData.getTotal()); syncStatus.setErrorMsg(catalogData.getErrorMsg()); - if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end)) { + if (catalogData.getStatus().equals(CatalogData.CatalogDataStatus.ready) || catalogData.getStatus().equals(CatalogData.CatalogDataStatus.end)) { syncStatus.setSyncIng(false); }else { syncStatus.setSyncIng(true); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index c2e44ba1..9e5fb182 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -981,8 +981,6 @@ public class SIPCommander implements ISIPCommander { catalogXml.append(" " + device.getDeviceId() + "\r\n"); catalogXml.append("\r\n"); - - Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), null,sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport())); sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, errorEvent); diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java index 88f9454a..cf1818d9 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java @@ -230,16 +230,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService { gbChannelService.add(streamProxy.buildCommonGBChannel()); } } - // 判断是否需要重启代理 - if (!streamProxyInDb.getApp().equals(streamProxy.getApp()) - || !streamProxyInDb.getStream().equals(streamProxy.getStream()) - || (streamProxyInDb.getMediaServerId() != null && streamProxyInDb.getMediaServerId().equals(streamProxy.getMediaServerId())) - || (streamProxyInDb.getMediaServerId() == null && streamProxy.getMediaServerId() != null) - ) { - // 变化则重启代理 - playService.stopProxy(streamProxyInDb); - playService.startProxy(streamProxy); - } return true; } diff --git a/web_src/src/components/DeviceList.vue b/web_src/src/components/DeviceList.vue index c34c1e7b..7525def5 100755 --- a/web_src/src/components/DeviceList.vue +++ b/web_src/src/components/DeviceList.vue @@ -246,6 +246,15 @@ export default { type: 'error' }); } else { + if (res.data.data && res.data.data.errorMsg) { + that.$message({ + showClose: true, + message: res.data.data.errorMsg, + type: 'error' + }); + return; + } + this.$refs.syncChannelProgress.openDialog(itemData.deviceId, ()=>{ console.log(32322) this.initData() diff --git a/web_src/src/components/dialog/SyncChannelProgress.vue b/web_src/src/components/dialog/SyncChannelProgress.vue index b623d249..2ec2844f 100755 --- a/web_src/src/components/dialog/SyncChannelProgress.vue +++ b/web_src/src/components/dialog/SyncChannelProgress.vue @@ -66,7 +66,7 @@ export default { if (res.data.data != null) { if (res.data.data.syncIng) { - if (res.data.data.total == 0) { + if (res.data.data.total === 0) { this.msg = `等待同步中`; this.timmer = setTimeout(this.getProgress, 300) }else { @@ -89,6 +89,9 @@ export default { }, 3000) } } + }else { + this.msg = `同步尚未开始`; + this.timmer = setTimeout(this.getProgress, 300) } }else { if (this.syncFlag) {