From a73508a24c7090650588fc3587010c1ef88406f5 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 27 Oct 2023 10:45:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=9A=84=E9=9D=99?= =?UTF-8?q?=E6=80=81=E6=96=87=E4=BB=B6=E6=94=BE=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/conf/security/WebSecurityConfig.java | 4 ++ .../impl/CommonGbChannelServiceImpl.java | 47 ++++++++++++------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java index 6a247359..5ad584a4 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java @@ -75,6 +75,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { matchers.add("/js/**"); matchers.add("/api/device/query/snap/**"); matchers.add("/record_proxy/*/**"); + matchers.add("/_app.config.js"); + matchers.add("/assets/**"); + matchers.add("/resource/**"); + matchers.add("/favicon.ico"); matchers.addAll(userSetting.getInterfaceAuthenticationExcludes()); // 可以直接访问的静态数据 web.ignoring().antMatchers(matchers.toArray(new String[0])); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java index bb1726d4..d3220a9d 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.service.impl; +import com.genersoft.iot.vmp.common.CivilCodePo; import com.genersoft.iot.vmp.common.CommonGbChannel; import com.genersoft.iot.vmp.conf.CivilCodeFileConf; import com.genersoft.iot.vmp.gb28181.bean.Device; @@ -119,18 +120,23 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService { Gb28181CodeType channelIdType = SipUtils.getChannelIdType(deviceChannel.getChannelId()); if (channelIdType != null) { if ( - ( - channelIdType == Gb28181CodeType.CIVIL_CODE_PROVINCE - || channelIdType == Gb28181CodeType.CIVIL_CODE_CITY - || channelIdType == Gb28181CodeType.CIVIL_CODE_COUNTY - || channelIdType == Gb28181CodeType.CIVIL_CODE_GRASS_ROOTS - ) - && - !regionMap.containsKey(deviceChannel.getChannelId()) + ( + channelIdType == Gb28181CodeType.CIVIL_CODE_PROVINCE + || channelIdType == Gb28181CodeType.CIVIL_CODE_CITY + || channelIdType == Gb28181CodeType.CIVIL_CODE_COUNTY + || channelIdType == Gb28181CodeType.CIVIL_CODE_GRASS_ROOTS + ) + && + !regionMap.containsKey(deviceChannel.getChannelId()) ) { + CivilCodePo parentCivilCodePo = civilCodeFileConf.getParentCode(deviceChannel.getChannelId()); + String civilCode = null; + if (parentCivilCodePo != null) { + civilCode = parentCivilCodePo.getCode(); + } // 行政区划条目 Region region = Region.getInstance(deviceChannel.getChannelId(), deviceChannel.getName(), - civilCodeFileConf.getParentCode(deviceChannel.getChannelId()).getCode()); + civilCode); regionMap.put(deviceChannel.getChannelId(), region); } if (channelIdType == Gb28181CodeType.BUSINESS_GROUP @@ -386,18 +392,20 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService { commonGbChannel.setCommonGbManufacturer(deviceChannel.getManufacture()); commonGbChannel.setCommonGbModel(deviceChannel.getModel()); commonGbChannel.setCommonGbOwner(deviceChannel.getOwner()); - Gb28181CodeType channelIdType = SipUtils.getChannelIdType(deviceChannel.getCivilCode()); - if (channelIdType == Gb28181CodeType.CIVIL_CODE_PROVINCE + if (deviceChannel.getCivilCode() != null) { + Gb28181CodeType channelIdType = SipUtils.getChannelIdType(deviceChannel.getCivilCode()); + if (channelIdType == Gb28181CodeType.CIVIL_CODE_PROVINCE || channelIdType == Gb28181CodeType.CIVIL_CODE_CITY || channelIdType == Gb28181CodeType.CIVIL_CODE_COUNTY || channelIdType == Gb28181CodeType.CIVIL_CODE_GRASS_ROOTS - ){ - commonGbChannel.setCommonGbCivilCode(deviceChannel.getCivilCode()); - }else { - logger.warn("[不规范的CivilCode],deviceId: {}, channel: {}, civilCode: {}", - deviceChannel.getDeviceId(), - deviceChannel.getChannelId(), - deviceChannel.getCivilCode()); + ){ + commonGbChannel.setCommonGbCivilCode(deviceChannel.getCivilCode()); + }else { + logger.warn("[不规范的CivilCode],deviceId: {}, channel: {}, civilCode: {}", + deviceChannel.getDeviceId(), + deviceChannel.getChannelId(), + deviceChannel.getCivilCode()); + } } commonGbChannel.setCommonGbCivilCode(deviceChannel.getCivilCode()); @@ -443,6 +451,9 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService { commonGbChannel.setCommonGbOwner(deviceChannel.getOwner()); break; case "commonGbCivilCode": + if (deviceChannel.getCivilCode() == null) { + break; + } Gb28181CodeType channelIdType = SipUtils.getChannelIdType(deviceChannel.getCivilCode()); if (channelIdType == Gb28181CodeType.CIVIL_CODE_PROVINCE || channelIdType == Gb28181CodeType.CIVIL_CODE_CITY