From f99c9cac6afc899c244aa66897cb3bf35a2da7d6 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 13 Jan 2022 16:24:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=9A=E9=81=93?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnonymousAuthenticationEntryPoint.java | 2 +- .../request/impl/NotifyRequestProcessor.java | 91 +------------------ .../cmd/CatalogResponseMessageHandler.java | 81 +---------------- .../iot/vmp/gb28181/utils/XmlUtil.java | 86 ++++++++++++++++++ .../impl/VideoManagerStoragerImpl.java | 43 ++++++--- .../vmanager/gb28181/device/DeviceQuery.java | 17 ++-- web_src/src/components/DeviceList.vue | 7 +- 7 files changed, 141 insertions(+), 186 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/security/AnonymousAuthenticationEntryPoint.java b/src/main/java/com/genersoft/iot/vmp/conf/security/AnonymousAuthenticationEntryPoint.java index ebfac955..2356b57b 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/security/AnonymousAuthenticationEntryPoint.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/security/AnonymousAuthenticationEntryPoint.java @@ -21,7 +21,7 @@ public class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoi @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) { - logger.debug("用户需要登录,访问[{}]失败,AuthenticationException=[{}]", request.getRequestURI(), e.getMessage()); +// logger.debug("用户需要登录,访问[{}]失败,AuthenticationException=[{}]", request.getRequestURI(), e.getMessage()); // 允许跨域 response.setHeader("Access-Control-Allow-Origin", "*"); // 允许自定义请求头token(允许head跨域) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java index 2e58d9d3..c3e434d6 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java @@ -257,7 +257,9 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements continue; } Element eventElement = itemDevice.element("Event"); - DeviceChannel channel = channelContentHander(itemDevice); + DeviceChannel channel = XmlUtil.channelContentHander(itemDevice); + channel.setDeviceId(device.getDeviceId()); + logger.debug("收到来自设备【{}】的通道: {}【{}】", device.getDeviceId(), channel.getName(), channel.getChannelId()); switch (eventElement.getText().toUpperCase()) { case "ON" : // 上线 logger.info("收到来自设备【{}】的通道【{}】上线通知", device.getDeviceId(), channel.getChannelId()); @@ -318,93 +320,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements } } - public DeviceChannel channelContentHander(Element itemDevice){ - Element channdelNameElement = itemDevice.element("Name"); - String channelName = channdelNameElement != null ? channdelNameElement.getTextTrim().toString() : ""; - Element statusElement = itemDevice.element("Status"); - String status = statusElement != null ? statusElement.getTextTrim().toString() : "ON"; - DeviceChannel deviceChannel = new DeviceChannel(); - deviceChannel.setName(channelName); - Element channdelIdElement = itemDevice.element("DeviceID"); - String channelId = channdelIdElement != null ? channdelIdElement.getTextTrim().toString() : ""; - deviceChannel.setChannelId(channelId); - // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理 - if (status.equals("ON") || status.equals("On") || status.equals("ONLINE")) { - deviceChannel.setStatus(1); - } - if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) { - deviceChannel.setStatus(0); - } - - deviceChannel.setManufacture(XmlUtil.getText(itemDevice, "Manufacturer")); - deviceChannel.setModel(XmlUtil.getText(itemDevice, "Model")); - deviceChannel.setOwner(XmlUtil.getText(itemDevice, "Owner")); - deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode")); - deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block")); - deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address")); - if (XmlUtil.getText(itemDevice, "Parental") == null - || XmlUtil.getText(itemDevice, "Parental") == "") { - deviceChannel.setParental(0); - } else { - deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental"))); - } - deviceChannel.setParentId(XmlUtil.getText(itemDevice, "ParentID")); - if (XmlUtil.getText(itemDevice, "SafetyWay") == null - || XmlUtil.getText(itemDevice, "SafetyWay") == "") { - deviceChannel.setSafetyWay(0); - } else { - deviceChannel.setSafetyWay(Integer.parseInt(XmlUtil.getText(itemDevice, "SafetyWay"))); - } - if (XmlUtil.getText(itemDevice, "RegisterWay") == null - || XmlUtil.getText(itemDevice, "RegisterWay") == "") { - deviceChannel.setRegisterWay(1); - } else { - deviceChannel.setRegisterWay(Integer.parseInt(XmlUtil.getText(itemDevice, "RegisterWay"))); - } - deviceChannel.setCertNum(XmlUtil.getText(itemDevice, "CertNum")); - if (XmlUtil.getText(itemDevice, "Certifiable") == null - || XmlUtil.getText(itemDevice, "Certifiable") == "") { - deviceChannel.setCertifiable(0); - } else { - deviceChannel.setCertifiable(Integer.parseInt(XmlUtil.getText(itemDevice, "Certifiable"))); - } - if (XmlUtil.getText(itemDevice, "ErrCode") == null - || XmlUtil.getText(itemDevice, "ErrCode") == "") { - deviceChannel.setErrCode(0); - } else { - deviceChannel.setErrCode(Integer.parseInt(XmlUtil.getText(itemDevice, "ErrCode"))); - } - deviceChannel.setEndTime(XmlUtil.getText(itemDevice, "EndTime")); - deviceChannel.setSecrecy(XmlUtil.getText(itemDevice, "Secrecy")); - deviceChannel.setIpAddress(XmlUtil.getText(itemDevice, "IPAddress")); - if (XmlUtil.getText(itemDevice, "Port") == null || XmlUtil.getText(itemDevice, "Port") == "") { - deviceChannel.setPort(0); - } else { - deviceChannel.setPort(Integer.parseInt(XmlUtil.getText(itemDevice, "Port"))); - } - deviceChannel.setPassword(XmlUtil.getText(itemDevice, "Password")); - if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Longitude"))) { - deviceChannel.setLongitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude"))); - } else { - deviceChannel.setLongitude(0.00); - } - if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Latitude"))) { - deviceChannel.setLatitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude"))); - } else { - deviceChannel.setLatitude(0.00); - } - if (XmlUtil.getText(itemDevice, "PTZType") == null - || XmlUtil.getText(itemDevice, "PTZType") == "") { - deviceChannel.setPTZType(0); - } else { - deviceChannel.setPTZType(Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType"))); - } - deviceChannel.setHasAudio(true); // 默认含有音频,播放时再检查是否有音频及是否AAC - return deviceChannel; - } - - - public void setCmder(SIPCommander cmder) { } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java index f8da94b5..6ff374f4 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java @@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; +import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; import com.genersoft.iot.vmp.storager.IVideoManagerStorager; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import org.dom4j.DocumentException; @@ -90,88 +91,14 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp // 遍历DeviceList while (deviceListIterator.hasNext()) { Element itemDevice = deviceListIterator.next(); + Element channelDeviceElement = itemDevice.element("DeviceID"); if (channelDeviceElement == null) { continue; } - String channelDeviceId = channelDeviceElement.getText(); - Element channdelNameElement = itemDevice.element("Name"); - String channelName = channdelNameElement != null ? channdelNameElement.getTextTrim().toString() : ""; - Element statusElement = itemDevice.element("Status"); - String status = statusElement != null ? statusElement.getText().toString() : "ON"; - DeviceChannel deviceChannel = new DeviceChannel(); - deviceChannel.setName(channelName); + DeviceChannel deviceChannel = XmlUtil.channelContentHander(itemDevice); deviceChannel.setDeviceId(device.getDeviceId()); - String now = this.format.format(new Date(System.currentTimeMillis())); - deviceChannel.setCreateTime(now); - deviceChannel.setUpdateTime(now); - deviceChannel.setChannelId(channelDeviceId); - // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理 - if (status.equals("ON") || status.equals("On") || status.equals("ONLINE")) { - deviceChannel.setStatus(1); - } - if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) { - deviceChannel.setStatus(0); - } - - deviceChannel.setManufacture(getText(itemDevice, "Manufacturer")); - deviceChannel.setModel(getText(itemDevice, "Model")); - deviceChannel.setOwner(getText(itemDevice, "Owner")); - deviceChannel.setCivilCode(getText(itemDevice, "CivilCode")); - deviceChannel.setBlock(getText(itemDevice, "Block")); - deviceChannel.setAddress(getText(itemDevice, "Address")); - if (getText(itemDevice, "Parental") == null || getText(itemDevice, "Parental") == "") { - deviceChannel.setParental(0); - } else { - deviceChannel.setParental(Integer.parseInt(getText(itemDevice, "Parental"))); - } - deviceChannel.setParentId(getText(itemDevice, "ParentID")); - if (getText(itemDevice, "SafetyWay") == null || getText(itemDevice, "SafetyWay") == "") { - deviceChannel.setSafetyWay(0); - } else { - deviceChannel.setSafetyWay(Integer.parseInt(getText(itemDevice, "SafetyWay"))); - } - if (getText(itemDevice, "RegisterWay") == null || getText(itemDevice, "RegisterWay") == "") { - deviceChannel.setRegisterWay(1); - } else { - deviceChannel.setRegisterWay(Integer.parseInt(getText(itemDevice, "RegisterWay"))); - } - deviceChannel.setCertNum(getText(itemDevice, "CertNum")); - if (getText(itemDevice, "Certifiable") == null || getText(itemDevice, "Certifiable") == "") { - deviceChannel.setCertifiable(0); - } else { - deviceChannel.setCertifiable(Integer.parseInt(getText(itemDevice, "Certifiable"))); - } - if (getText(itemDevice, "ErrCode") == null || getText(itemDevice, "ErrCode") == "") { - deviceChannel.setErrCode(0); - } else { - deviceChannel.setErrCode(Integer.parseInt(getText(itemDevice, "ErrCode"))); - } - deviceChannel.setEndTime(getText(itemDevice, "EndTime")); - deviceChannel.setSecrecy(getText(itemDevice, "Secrecy")); - deviceChannel.setIpAddress(getText(itemDevice, "IPAddress")); - if (getText(itemDevice, "Port") == null || getText(itemDevice, "Port") == "") { - deviceChannel.setPort(0); - } else { - deviceChannel.setPort(Integer.parseInt(getText(itemDevice, "Port"))); - } - deviceChannel.setPassword(getText(itemDevice, "Password")); - if (NumericUtil.isDouble(getText(itemDevice, "Longitude"))) { - deviceChannel.setLongitude(Double.parseDouble(getText(itemDevice, "Longitude"))); - } else { - deviceChannel.setLongitude(0.00); - } - if (NumericUtil.isDouble(getText(itemDevice, "Latitude"))) { - deviceChannel.setLatitude(Double.parseDouble(getText(itemDevice, "Latitude"))); - } else { - deviceChannel.setLatitude(0.00); - } - if (getText(itemDevice, "PTZType") == null || getText(itemDevice, "PTZType") == "") { - deviceChannel.setPTZType(0); - } else { - deviceChannel.setPTZType(Integer.parseInt(getText(itemDevice, "PTZType"))); - } - deviceChannel.setHasAudio(true); // 默认含有音频,播放时再检查是否有音频及是否AAC + logger.debug("收到来自设备【{}】的通道: {}【{}】", device.getDeviceId(), deviceChannel.getName(), deviceChannel.getChannelId()); channelList.add(deviceChannel); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java index 079a78bb..94e0cd80 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.utils; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import org.dom4j.Attribute; import org.dom4j.Document; import org.dom4j.DocumentException; @@ -178,4 +179,89 @@ public class XmlUtil { Document xml = reader.read(new ByteArrayInputStream(content)); return xml.getRootElement(); } + + public static DeviceChannel channelContentHander(Element itemDevice){ + Element channdelNameElement = itemDevice.element("Name"); + String channelName = channdelNameElement != null ? channdelNameElement.getTextTrim().toString() : ""; + Element statusElement = itemDevice.element("Status"); + String status = statusElement != null ? statusElement.getTextTrim().toString() : "ON"; + DeviceChannel deviceChannel = new DeviceChannel(); + deviceChannel.setName(channelName); + Element channdelIdElement = itemDevice.element("DeviceID"); + String channelId = channdelIdElement != null ? channdelIdElement.getTextTrim().toString() : ""; + deviceChannel.setChannelId(channelId); + // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理 + if (status.equals("ON") || status.equals("On") || status.equals("ONLINE")) { + deviceChannel.setStatus(1); + } + if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) { + deviceChannel.setStatus(0); + } + + deviceChannel.setManufacture(XmlUtil.getText(itemDevice, "Manufacturer")); + deviceChannel.setModel(XmlUtil.getText(itemDevice, "Model")); + deviceChannel.setOwner(XmlUtil.getText(itemDevice, "Owner")); + deviceChannel.setCivilCode(XmlUtil.getText(itemDevice, "CivilCode")); + deviceChannel.setBlock(XmlUtil.getText(itemDevice, "Block")); + deviceChannel.setAddress(XmlUtil.getText(itemDevice, "Address")); + if (XmlUtil.getText(itemDevice, "Parental") == null + || XmlUtil.getText(itemDevice, "Parental") == "") { + deviceChannel.setParental(0); + } else { + deviceChannel.setParental(Integer.parseInt(XmlUtil.getText(itemDevice, "Parental"))); + } + deviceChannel.setParentId(XmlUtil.getText(itemDevice, "ParentID")); + if (XmlUtil.getText(itemDevice, "SafetyWay") == null + || XmlUtil.getText(itemDevice, "SafetyWay") == "") { + deviceChannel.setSafetyWay(0); + } else { + deviceChannel.setSafetyWay(Integer.parseInt(XmlUtil.getText(itemDevice, "SafetyWay"))); + } + if (XmlUtil.getText(itemDevice, "RegisterWay") == null + || XmlUtil.getText(itemDevice, "RegisterWay") == "") { + deviceChannel.setRegisterWay(1); + } else { + deviceChannel.setRegisterWay(Integer.parseInt(XmlUtil.getText(itemDevice, "RegisterWay"))); + } + deviceChannel.setCertNum(XmlUtil.getText(itemDevice, "CertNum")); + if (XmlUtil.getText(itemDevice, "Certifiable") == null + || XmlUtil.getText(itemDevice, "Certifiable") == "") { + deviceChannel.setCertifiable(0); + } else { + deviceChannel.setCertifiable(Integer.parseInt(XmlUtil.getText(itemDevice, "Certifiable"))); + } + if (XmlUtil.getText(itemDevice, "ErrCode") == null + || XmlUtil.getText(itemDevice, "ErrCode") == "") { + deviceChannel.setErrCode(0); + } else { + deviceChannel.setErrCode(Integer.parseInt(XmlUtil.getText(itemDevice, "ErrCode"))); + } + deviceChannel.setEndTime(XmlUtil.getText(itemDevice, "EndTime")); + deviceChannel.setSecrecy(XmlUtil.getText(itemDevice, "Secrecy")); + deviceChannel.setIpAddress(XmlUtil.getText(itemDevice, "IPAddress")); + if (XmlUtil.getText(itemDevice, "Port") == null || XmlUtil.getText(itemDevice, "Port") == "") { + deviceChannel.setPort(0); + } else { + deviceChannel.setPort(Integer.parseInt(XmlUtil.getText(itemDevice, "Port"))); + } + deviceChannel.setPassword(XmlUtil.getText(itemDevice, "Password")); + if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Longitude"))) { + deviceChannel.setLongitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude"))); + } else { + deviceChannel.setLongitude(0.00); + } + if (NumericUtil.isDouble(XmlUtil.getText(itemDevice, "Latitude"))) { + deviceChannel.setLatitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude"))); + } else { + deviceChannel.setLatitude(0.00); + } + if (XmlUtil.getText(itemDevice, "PTZType") == null + || XmlUtil.getText(itemDevice, "PTZType") == "") { + deviceChannel.setPTZType(0); + } else { + deviceChannel.setPTZType(Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType"))); + } + deviceChannel.setHasAudio(true); // 默认含有音频,播放时再检查是否有音频及是否AAC + return deviceChannel; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java index 1d8d83a7..7f82e32c 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java @@ -23,10 +23,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @description:视频设备数据存储-jdbc实现 @@ -223,21 +220,41 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { @Override public boolean resetChannels(String deviceId, List deviceChannelList) { TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); + // 数据去重 + List channels = new ArrayList<>(); + StringBuilder stringBuilder = new StringBuilder(); + if (deviceChannelList.size() > 1) { + // 数据去重 + Set gbIdSet = new HashSet<>(); + for (DeviceChannel deviceChannel : deviceChannelList) { + if (!gbIdSet.contains(deviceChannel.getChannelId())) { + gbIdSet.add(deviceChannel.getChannelId()); + channels.add(deviceChannel); + }else { + stringBuilder.append(deviceChannel.getChannelId() + ","); + } + } + }else { + channels = deviceChannelList; + } + if (stringBuilder.length() > 0) { + logger.debug("[目录查询]收到的数据存在重复: {}" , stringBuilder); + } try { int cleanChannelsResult = deviceChannelMapper.cleanChannelsByDeviceId(deviceId); - int limitCount = 300; - boolean result = cleanChannelsResult <0; - if (!result && deviceChannelList.size() > 0) { - if (deviceChannelList.size() > limitCount) { - for (int i = 0; i < deviceChannelList.size(); i += limitCount) { + int limitCount = 1; + boolean result = cleanChannelsResult < 0; + if (!result && channels.size() > 0) { + if (channels.size() > limitCount) { + for (int i = 0; i < channels.size(); i += limitCount) { int toIndex = i + limitCount; - if (i + limitCount > deviceChannelList.size()) { - toIndex = deviceChannelList.size(); + if (i + limitCount > channels.size()) { + toIndex = channels.size(); } - result = result || deviceChannelMapper.batchAdd(deviceChannelList.subList(i, toIndex)) < 0; + result = result || deviceChannelMapper.batchAdd(channels.subList(i, toIndex)) < 0; } }else { - result = result || deviceChannelMapper.batchAdd(deviceChannelList) < 0; + result = result || deviceChannelMapper.batchAdd(channels) < 0; } } if (result) { diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java index 729eca28..b9891caf 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java @@ -150,15 +150,18 @@ public class DeviceQuery { Device device = storager.queryVideoDevice(deviceId); String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId; String uuid = UUID.randomUUID().toString(); - DeferredResult> result = new DeferredResult>(15*1000L); + // 默认超时时间为30分钟 + DeferredResult> result = new DeferredResult>(30*60*1000L); result.onTimeout(()->{ logger.warn(String.format("设备通道信息同步超时")); - // 释放rtpserver RequestMessage msg = new RequestMessage(); msg.setKey(key); - msg.setId(uuid); - msg.setData("Timeout"); + WVPResult wvpResult = new WVPResult<>(); + wvpResult.setCode(0); + wvpResult.setMsg("Timeout"); + msg.setData(wvpResult); resultHolder.invokeAllResult(msg); + }); // 等待其他相同请求返回时一起返回 if (resultHolder.exist(key, null)) { @@ -167,8 +170,10 @@ public class DeviceQuery { cmder.catalogQuery(device, event -> { RequestMessage msg = new RequestMessage(); msg.setKey(key); - msg.setId(uuid); - msg.setData(String.format("同步通道失败,错误码: %s, %s", event.statusCode, event.msg)); + WVPResult wvpResult = new WVPResult<>(); + wvpResult.setCode(0); + wvpResult.setMsg(String.format("同步通道失败,错误码: %s, %s", event.statusCode, event.msg)); + msg.setData(wvpResult); resultHolder.invokeAllResult(msg); }); diff --git a/web_src/src/components/DeviceList.vue b/web_src/src/components/DeviceList.vue index 586aaee7..0dab7465 100644 --- a/web_src/src/components/DeviceList.vue +++ b/web_src/src/components/DeviceList.vue @@ -213,8 +213,13 @@ that.$refs[itemData.deviceId + 'refbtn' ].loading = false; }).catch(function(e) { console.error(e) + that.$message({ + showClose: true, + message: e, + type: 'error' + }); that.$refs[itemData.deviceId + 'refbtn' ].loading = false; - });; + }); }, //通知设备上传媒体流 sendDevicePush: function(itemData) { From cf23816c80771c9e22bb50d0d89feb34d2edca79 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 13 Jan 2022 16:42:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E7=9A=84limit=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/storager/impl/VideoManagerStoragerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java index cf3f549a..2f4c9664 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java @@ -246,7 +246,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { } try { int cleanChannelsResult = deviceChannelMapper.cleanChannelsByDeviceId(deviceId); - int limitCount = 1; + int limitCount = 300; boolean result = cleanChannelsResult < 0; if (!result && channels.size() > 0) { if (channels.size() > limitCount) {