From 4b1ea8ad3039f2a0e6fae935ec0e198ed8c73cc5 Mon Sep 17 00:00:00 2001 From: lin <648540858@qq.com> Date: Fri, 21 Nov 2025 12:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=94=99=E8=AF=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cmd/impl/SIPCommanderForPlatform.java | 2 +- .../conf/CachedBodyHttpServletRequest.java | 19 +++-- .../custom/conf/SignAuthenticationFilter.java | 67 +++++++++++++++-- web/src/views/channel/index.vue | 10 ++- web/src/views/common/CommonChannelEdit.vue | 39 ++++++++-- web/src/views/common/GroupTree.vue | 27 ++++++- web/src/views/common/MapComponent.vue | 7 ++ web/src/views/common/RegionTree.vue | 11 ++- web/src/views/common/channelPlayer/index.vue | 14 ++++ web/src/views/device/list.vue | 25 ++++++- web/src/views/jtDevice/channel/edit.vue | 16 +++- web/src/views/jtDevice/channel/index.vue | 24 ++++-- web/src/views/jtDevice/list.vue | 14 ++++ web/src/views/login/index.vue | 13 +++- web/src/views/map/index.vue | 73 ++++++++++++++++++- web/src/views/recordPlan/index.vue | 6 +- web/src/views/streamProxy/index.vue | 19 ++++- web/src/views/streamPush/index.vue | 21 ++++++ web/src/views/user/index.vue | 6 +- 19 files changed, 368 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java index ed38527fc..0cf5c782c 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java @@ -138,7 +138,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform { @Override public String keepalive(Platform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws SipException, InvalidArgumentException, ParseException { - log.info("[国标级联] 发送心跳, 上级平台编号: {}", parentPlatform.getServerGBId()); + log.info("[国标级联] 发送心跳, 上级平台: {}/{}", parentPlatform.getName(), parentPlatform.getServerGBId()); String characterSet = parentPlatform.getCharacterSet(); StringBuffer keepaliveXml = new StringBuffer(200); keepaliveXml.append(" 0) { + beforeSign.append(paramKey).append(values[0]); + } } // 如果是post请求的json消息,拼接body字符串 if (request.getContentLength() > 0 && request.getMethod().equalsIgnoreCase("POST") + && request.getContentType() != null && request.getContentType().equalsIgnoreCase(MediaType.APPLICATION_JSON_VALUE)) { // 读取body内容 - 使用自定义缓存机制 String requestBody = request.getCachedBody(); @@ -101,7 +108,19 @@ public class SignAuthenticationFilter extends OncePerRequestFilter { log.warn("[SY-接口验签] 请求体内容为空"); } } - beforeSign.append(SyTokenManager.INSTANCE.appMap.get(appKey)); + + // 添加空值检查 + String secret = SyTokenManager.INSTANCE.appMap.get(appKey); + if (secret == null) { + log.info("[SY-接口验签] 无法获取appKey {} 对应的 secret, 请求地址: {} ", appKey, requestURI); + response.setStatus(Response.OK); + PrintWriter out = response.getWriter(); + out.println(getErrorResult(1, "参数非法")); + out.close(); + return; + } + + beforeSign.append(secret); // 生成签名 String buildSign = SmUtil.sm3(beforeSign.toString()); if (!buildSign.equals(sign)) { @@ -115,6 +134,15 @@ public class SignAuthenticationFilter extends OncePerRequestFilter { // 验证请求时间戳 long timestamp = Long.parseLong(timestampStr); long currentTimeMillis = System.currentTimeMillis(); + // 添加空值检查 + if (SyTokenManager.INSTANCE.expires == null) { + log.info("[SY-接口验签] expires配置为空, 请求地址: {} ", requestURI); + response.setStatus(Response.OK); + PrintWriter out = response.getWriter(); + out.println(getErrorResult(2, "签名错误")); + out.close(); + return; + } if (currentTimeMillis > SyTokenManager.INSTANCE.expires * 60 * 1000 + timestamp ) { log.info("[SY-接口验签] 时间戳已经过期, 请求时间戳:{}, 当前时间: {}, 过期时间: {}, 请求地址: {} ", timestamp, currentTimeMillis, timestamp + SyTokenManager.INSTANCE.expires * 60 * 1000, requestURI); response.setStatus(Response.OK); @@ -124,11 +152,29 @@ public class SignAuthenticationFilter extends OncePerRequestFilter { return; } // accessToken校验 + // 添加空值检查 + if (SyTokenManager.INSTANCE.adminToken == null) { + log.info("[SY-接口验签] adminToken配置为空, 请求地址: {} ", requestURI); + response.setStatus(Response.OK); + PrintWriter out = response.getWriter(); + out.println(getErrorResult(2, "签名错误")); + out.close(); + return; + } if (accessToken.equals(SyTokenManager.INSTANCE.adminToken)) { log.info("[SY-接口验签] adminToken已经默认放行, 请求地址: {} ", requestURI); chain.doFilter(request, response); return; }else { + // 添加空值检查 + if (SyTokenManager.INSTANCE.sm4Key == null) { + log.info("[SY-接口验签] sm4Key配置为空, 请求地址: {} ", requestURI); + response.setStatus(Response.OK); + PrintWriter out = response.getWriter(); + out.println(getErrorResult(2, "签名错误")); + out.close(); + return; + } // 对token进行解密 SM4 sm4 = SmUtil.sm4(HexUtil.decodeHex(SyTokenManager.INSTANCE.sm4Key)); String decryptStr = sm4.decryptStr(accessToken, CharsetUtil.CHARSET_UTF_8); @@ -142,7 +188,7 @@ public class SignAuthenticationFilter extends OncePerRequestFilter { } JSONObject jsonObject = JSON.parseObject(decryptStr); Long expirationTime = jsonObject.getLong("expirationTime"); - if (expirationTime < System.currentTimeMillis()) { + if (expirationTime == null || expirationTime < System.currentTimeMillis()) { log.info("[SY-接口验签] accessToken 已经过期, 请求地址: {} ", requestURI); response.setStatus(Response.OK); PrintWriter out = response.getWriter(); @@ -151,8 +197,17 @@ public class SignAuthenticationFilter extends OncePerRequestFilter { return; } } + }catch (NumberFormatException e) { + log.info("[SY-接口验签] 时间戳格式错误, 请求地址: {} ", requestURI); + response.setStatus(Response.OK); + if (!response.isCommitted()) { + PrintWriter out = response.getWriter(); + out.println(getErrorResult(2, "签名错误")); + out.close(); + } + return; }catch (Exception e) { - log.info("[SY-接口验签] 读取body失败, 请求地址: {} ", requestURI, e); + log.info("[SY-接口验签] 读取body失败, 请求地址: {} ", requestURI, e); response.setStatus(Response.OK); if (!response.isCommitted()) { PrintWriter out = response.getWriter(); @@ -171,4 +226,4 @@ public class SignAuthenticationFilter extends OncePerRequestFilter { return JSON.toJSONString(wvpResult); } -} +} \ No newline at end of file diff --git a/web/src/views/channel/index.vue b/web/src/views/channel/index.vue index 76f53d16f..abbd7a214 100755 --- a/web/src/views/channel/index.vue +++ b/web/src/views/channel/index.vue @@ -316,7 +316,15 @@ export default { setTimeout(() => { this.initData() }, 1000) - }).finally(() => { + }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) + .finally(() => { itemData.playLoading = false }) }, diff --git a/web/src/views/common/CommonChannelEdit.vue b/web/src/views/common/CommonChannelEdit.vue index febb1444f..3baefebac 100644 --- a/web/src/views/common/CommonChannelEdit.vue +++ b/web/src/views/common/CommonChannelEdit.vue @@ -333,7 +333,15 @@ export default { message: '保存成功' }) this.$emit('submitSuccess') - }).finally(() => { + }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) + .finally(() => { this.loading = false }) } else { @@ -346,7 +354,15 @@ export default { if (this.saveSuccess) { this.saveSuccess() } - }).finally(() => { + }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) + .finally(() => { this.loading = false }) } @@ -371,9 +387,15 @@ export default { message: '重置成功 已保存' }) this.getCommonChannel(this.form.gbId) - }).catch((error) => { - console.error(error) - }).finally(() => { + }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) + .finally(() => { this.loading = false }) }).catch(() => { @@ -393,6 +415,13 @@ export default { this.getPaths() this.getRegionPaths() }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) .finally(() => { this.loading = false }) diff --git a/web/src/views/common/GroupTree.vue b/web/src/views/common/GroupTree.vue index 18a9b22b1..7c29db223 100755 --- a/web/src/views/common/GroupTree.vue +++ b/web/src/views/common/GroupTree.vue @@ -373,6 +373,13 @@ export default { node.parent.expand() this.$emit('onChannelChange', node.data.deviceId) }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) }, addChannelFormDevice: function(id, node) { this.$refs.gbDeviceSelect.openDialog((rows) => { @@ -393,7 +400,15 @@ export default { this.$emit('onChannelChange', node.data.deviceId) node.loaded = false node.expand() - }).finally(() => { + }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) + .finally(() => { this.loading = false }) }) @@ -413,7 +428,15 @@ export default { this.$emit('onChannelChange', node.data.deviceId) node.loaded = false node.expand() - }).finally(() => { + }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) + .finally(() => { this.loading = false }) }) diff --git a/web/src/views/common/MapComponent.vue b/web/src/views/common/MapComponent.vue index ed212eace..c2e5e1639 100755 --- a/web/src/views/common/MapComponent.vue +++ b/web/src/views/common/MapComponent.vue @@ -73,6 +73,13 @@ export default { } this.initMap() }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) }, initMap(){ let center = fromLonLat([116.41020, 39.915119]) diff --git a/web/src/views/common/RegionTree.vue b/web/src/views/common/RegionTree.vue index 4e9d4c2c7..0bae6dfad 100755 --- a/web/src/views/common/RegionTree.vue +++ b/web/src/views/common/RegionTree.vue @@ -119,7 +119,6 @@ import VueEasyTree from '@wchbrad/vue-easy-tree' import regionEdit from './../dialog/regionEdit' import gbDeviceSelect from './../dialog/GbDeviceSelect' import GbChannelSelect from '../dialog/GbChannelSelect.vue' -import chooseCivilCode from '@/views/dialog/chooseCivilCode.vue' export default { name: 'DeviceTree', @@ -199,6 +198,7 @@ export default { }) }, loadNode: function(node, resolve) { + console.log(22222) if (node.level === 0) { resolve([{ treeId: '', @@ -364,8 +364,13 @@ export default { this.$emit('onChannelChange', node.data.deviceId) node.parent.loaded = false node.parent.expand() - }).catch(function(error) { - console.log(error) + }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) }) }, addChannelFormDevice: function(id, node) { diff --git a/web/src/views/common/channelPlayer/index.vue b/web/src/views/common/channelPlayer/index.vue index c1ac34fb4..ce95f70fc 100755 --- a/web/src/views/common/channelPlayer/index.vue +++ b/web/src/views/common/channelPlayer/index.vue @@ -602,6 +602,13 @@ export default { this.startBroadcast(streamInfo.rtc) } }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) } else if (this.broadcastStatus === 1) { this.broadcastStatus = -1 this.broadcastRtc.close() @@ -690,6 +697,13 @@ export default { this.broadcastRtc.close() this.broadcastStatus = -1 this.$store.dispatch('play/broadcastStop', [this.channelId]) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) } } } diff --git a/web/src/views/device/list.vue b/web/src/views/device/list.vue index d78d8656f..d8d7e281b 100755 --- a/web/src/views/device/list.vue +++ b/web/src/views/device/list.vue @@ -236,7 +236,13 @@ export default { }).then((data) => { this.total = data.total this.deviceList = data.list - }).finally(() => { + }).catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }).finally(() => { this.getDeviceListLoading = false }) }, @@ -256,6 +262,13 @@ export default { .then((data) => { this.getDeviceList() }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) }) }, showChannelList: function(row) { @@ -284,7 +297,15 @@ export default { this.$refs.syncChannelProgress.openDialog(itemData.deviceId, () => { this.getDeviceList() }) - }).finally(() => { + }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) + .finally(() => { this.getDeviceList() }) }, diff --git a/web/src/views/jtDevice/channel/edit.vue b/web/src/views/jtDevice/channel/edit.vue index a33db8d10..e0fb4828e 100644 --- a/web/src/views/jtDevice/channel/edit.vue +++ b/web/src/views/jtDevice/channel/edit.vue @@ -63,8 +63,12 @@ export default { }) this.jtChannel = data }) - .catch(function(error) { - console.log(error) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) }) } else { this.$store.dispatch('jtDevice/addChannel', this.jtChannel) @@ -76,8 +80,12 @@ export default { }) this.jtChannel = data }) - .catch(function(error) { - console.log(error) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) }) } }, diff --git a/web/src/views/jtDevice/channel/index.vue b/web/src/views/jtDevice/channel/index.vue index 2af145de9..e1f248c0a 100755 --- a/web/src/views/jtDevice/channel/index.vue +++ b/web/src/views/jtDevice/channel/index.vue @@ -234,8 +234,12 @@ export default { this.initData() }, 1000) }) - .catch(err => { - console.error(err) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) }) .finally(() => { this.isLoging = false @@ -266,8 +270,12 @@ export default { .then((data) => { this.initData() }) - .catch(function(error) { - console.error(error) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) }) }, getSnap: function(row) { @@ -302,8 +310,12 @@ export default { }, updateChannel: function(row) { this.$store.dispatch('jtDevice/updateChannel', row) - .catch((e) => { - console.log(e) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) }) }, refresh: function() { diff --git a/web/src/views/jtDevice/list.vue b/web/src/views/jtDevice/list.vue index efc2d971b..5ce9c86f6 100755 --- a/web/src/views/jtDevice/list.vue +++ b/web/src/views/jtDevice/list.vue @@ -256,6 +256,13 @@ export default { .then(data => { this.getList() }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) }).catch(() => { }) @@ -330,6 +337,13 @@ export default { this.serverId = data.addOn.serverId this.$refs.configInfo.openDialog(data, 'jt1078Config') }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) }, queryAttribute: function(itemData) { this.$store.dispatch('jtDevice/queryAttribute', itemData.phoneNumber) diff --git a/web/src/views/login/index.vue b/web/src/views/login/index.vue index dd6324d04..ffc6babc2 100644 --- a/web/src/views/login/index.vue +++ b/web/src/views/login/index.vue @@ -116,9 +116,16 @@ export default { this.$store.dispatch('user/login', this.loginForm).then((re) => { this.$router.push({ path: this.redirect || '/' }) this.loading = false - }).catch(() => { - this.loading = false - }) + }).catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) + .finally(() => { + this.loading = false + }) } else { console.log('error submit!!') return false diff --git a/web/src/views/map/index.vue b/web/src/views/map/index.vue index 0aca0bce0..805314231 100755 --- a/web/src/views/map/index.vue +++ b/web/src/views/map/index.vue @@ -242,6 +242,13 @@ export default { .then(data => { this.play(data) }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) } }, { @@ -253,6 +260,13 @@ export default { .then(data => { this.editPosition(data) }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) } }, { @@ -264,6 +278,13 @@ export default { .then(data => { this.edit(data) }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) } } ] @@ -345,7 +366,15 @@ export default { streamInfo: data, hasAudio: channel.hasAudio }) - }).finally(() => { + }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) + .finally(() => { loading.close() }) }, @@ -444,6 +473,13 @@ export default { this.$refs.deviceTree.refresh('channel' + channel.gbId) }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) }, showDrawThinBox: function(show){ this.showDrawThin = show @@ -453,6 +489,13 @@ export default { if (this.drawThinId !== null) { // 发送消息 清空抽稀结果 this.$store.dispatch('commonChanel/clearThin', this.drawThinId) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) this.drawThinId = null } if (this.drawThinLayer !== null) { @@ -496,6 +539,13 @@ export default { this.showDrawThinLayer(drawThinId) }) }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) .finally(() => { this.quicklyDrawThinLoading = false }) @@ -556,6 +606,13 @@ export default { this.showDrawThinLayer(drawThinId) }) }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) .finally(() => { this.boxDrawThinLoading = false }) @@ -590,6 +647,13 @@ export default { }) this.showDrawThinBox(false) }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) .finally(() => { this.saveDrawThinLoading = false }) @@ -607,6 +671,13 @@ export default { message: '数据还原成功' }) }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) }) } } diff --git a/web/src/views/recordPlan/index.vue b/web/src/views/recordPlan/index.vue index c30631be4..01ef33e77 100755 --- a/web/src/views/recordPlan/index.vue +++ b/web/src/views/recordPlan/index.vue @@ -158,7 +158,11 @@ export default { this.initData() }) .catch((error) => { - console.error(error) + this.$message({ + showClose: true, + message: error, + type: 'error' + }) }) }).catch(() => { diff --git a/web/src/views/streamProxy/index.vue b/web/src/views/streamProxy/index.vue index b6004ab5f..ccde54d38 100755 --- a/web/src/views/streamProxy/index.vue +++ b/web/src/views/streamProxy/index.vue @@ -243,7 +243,11 @@ export default { }) }) .catch((error) => { - console.log(error) + this.$message({ + showClose: true, + message: error, + type: 'error' + }) }) .finally(() => { row.playLoading = false @@ -258,7 +262,11 @@ export default { }) }) .catch((error) => { - console.log(error) + this.$message({ + showClose: true, + message: error, + type: 'error' + }) }) }, queryCloudRecords: function(row) { @@ -278,6 +286,13 @@ export default { }) this.initData() }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) }).catch(() => { }) }, diff --git a/web/src/views/streamPush/index.vue b/web/src/views/streamPush/index.vue index 2f35a7d8f..daed42e00 100755 --- a/web/src/views/streamPush/index.vue +++ b/web/src/views/streamPush/index.vue @@ -244,6 +244,13 @@ export default { hasAudio: true }) }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) .finally(() => { row.playLoading = false }) @@ -263,6 +270,13 @@ export default { }) this.initData() }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) }).catch(() => { }) @@ -299,6 +313,13 @@ export default { this.initData() this.$refs.pushListTable.clearSelection() }) + .catch((error) => { + this.$message({ + showClose: true, + message: error, + type: 'error' + }) + }) }).catch(() => { }) diff --git a/web/src/views/user/index.vue b/web/src/views/user/index.vue index 616fefaf5..ad8950d6a 100755 --- a/web/src/views/user/index.vue +++ b/web/src/views/user/index.vue @@ -145,7 +145,11 @@ export default { this.getUserList() }) .catch((error) => { - console.error(error) + this.$message({ + showClose: true, + message: error, + type: 'error' + }) }) }).catch(() => {