diff --git a/pom.xml b/pom.xml
index 5b3e945d..5f077f10 100644
--- a/pom.xml
+++ b/pom.xml
@@ -162,22 +162,17 @@
1.4.6
+
org.springdoc
springdoc-openapi-ui
- 1.7.0
-
-
- org.yaml
- snakeyaml
-
-
+ 1.6.10
- org.yaml
- snakeyaml
- 2.2
+ org.springdoc
+ springdoc-openapi-security
+ 1.6.10
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/SpringDocConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/SpringDocConfig.java
index 587518f1..0a472f82 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/SpringDocConfig.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/SpringDocConfig.java
@@ -1,9 +1,12 @@
package com.genersoft.iot.vmp.conf;
+import com.genersoft.iot.vmp.conf.security.JwtUtils;
+import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
+import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.core.annotation.Order;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.beans.factory.annotation.Value;
@@ -26,10 +29,14 @@ public class SpringDocConfig {
contact.setName("pan");
contact.setEmail("648540858@qq.com");
return new OpenAPI()
+ .components(new Components()
+ .addSecuritySchemes(JwtUtils.HEADER, new SecurityScheme()
+ .type(SecurityScheme.Type.HTTP)
+ .bearerFormat("JWT")))
.info(new Info().title("WVP-PRO 接口文档")
.contact(contact)
.description("开箱即用的28181协议视频平台")
- .version("v2.0")
+ .version("v3.1.0")
.license(new License().name("Apache 2.0").url("http://springdoc.org")));
}
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java b/src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java
index 3df75936..fcd19461 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java
@@ -28,7 +28,7 @@ public class JwtUtils implements InitializingBean {
private static final Logger logger = LoggerFactory.getLogger(JwtUtils.class);
- private static final String HEADER = "access-token";
+ public static final String HEADER = "access-token";
private static final String AUDIENCE = "Audience";
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 001f5ee1..2e4e25db 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
@@ -68,6 +68,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
matchers.add("/");
matchers.add("/#/**");
matchers.add("/static/**");
+ matchers.add("/swagger-ui.html");
+ matchers.add("/swagger-ui/");
matchers.add("/index.html");
matchers.add("/doc.html");
matchers.add("/webjars/**");
@@ -81,6 +83,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
matchers.add("/resource/**");
matchers.add("/favicon.ico");
matchers.add("/api/emit");
+ matchers.add("/favicon.ico");
// 可以直接访问的静态数据
web.ignoring().antMatchers(matchers.toArray(new String[0]));
}
@@ -117,7 +120,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.authorizeRequests()
.requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
.antMatchers(userSetting.getInterfaceAuthenticationExcludes().toArray(new String[0])).permitAll()
- .antMatchers("/api/user/login", "/index/hook/**").permitAll()
+ .antMatchers("/api/user/login", "/index/hook/**", "/swagger-ui/**", "/doc.html").permitAll()
.anyRequest().authenticated()
// 异常处理器
.and()
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 e614b9fd..14640d80 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
@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.utils.DateUtil;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.dom4j.Attribute;
import org.dom4j.Document;
@@ -214,8 +215,11 @@ public class XmlUtil {
return deviceChannel;
}
Element nameElement = itemDevice.element("Name");
- if (nameElement != null) {
+ // 当通道名称为空时,设置通道名称为通道编码,避免级联时因通道名称为空导致上级接收通道失败
+ if (nameElement != null && StringUtils.isNotBlank(nameElement.getText())) {
deviceChannel.setName(nameElement.getText());
+ } else {
+ deviceChannel.setName(channelId);
}
if(channelId.length() <= 8) {
deviceChannel.setHasAudio(false);
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
index c4ac0e11..5e4d88b7 100755
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -5,7 +5,6 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
import org.apache.ibatis.annotations.*;
-import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@@ -31,7 +30,7 @@ public interface DeviceChannelMapper {
@Update(value = {" "})
+ List queryChannelListInAll(@Param("query") String query, @Param("online") Boolean online, @Param("hasSubChannel") Boolean hasSubChannel, @Param("platformId") String platformId, @Param("catalogId") String catalogId);
+
+ @Select(value = {" "})
+ List queryChannelByPlatformId(String platformId);
+
+
@Select("SELECT * FROM wvp_device_channel WHERE channel_id=#{channelId}")
List queryChannelByChannelId( String channelId);
@@ -322,6 +397,46 @@ public interface DeviceChannelMapper {
List getAllChannelWithCoordinate(String deviceId);
+ @Select(value = {" "})
+ List getChannelsWithCivilCodeAndLength(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("length") Integer length);
+
+ @Select(value = {" "})
+ List getChannelsByCivilCode(@Param("deviceId") String deviceId, @Param("parentId") String parentId);
+
+ @Select("select min(length(channel_id)) as minLength " +
+ "from wvp_device_channel " +
+ "where device_id=#{deviceId}")
+ Integer getChannelMinLength(String deviceId);
+
+ @Select("select * from wvp_device_channel where device_id=#{deviceId} and civil_code not in " +
+ "(select civil_code from wvp_device_channel where device_id=#{deviceId} group by civil_code)")
+ List getChannelWithoutCivilCode(String deviceId);
+
+ @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}")
+ List getBusinessGroups(@Param("deviceId") String deviceId, @Param("typeCode") String typeCode);
+
+ @Select("select dc.id, dc.channel_id, dc.device_id, COALESCE(dc.custom_name, dc.name) AS name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " +
+ " dc.address, '0' as parental,'0' as channel_type, pc.id as parent_id, dc.safety_way, dc.register_way,dc.cert_num, dc.certifiable, " +
+ " dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, dc.password, dc.status, " +
+ " COALESCE(dc.custom_longitude, dc.longitude) AS longitude, COALESCE(dc.custom_latitude, dc.latitude) AS latitude, pc.business_group_id " +
+ " from wvp_device_channel dc" +
+ " LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" +
+ " LEFT JOIN wvp_platform_catalog pc on pgc.catalog_id = pc.id and pgc.platform_id = pc.platform_id" +
+ " where pgc.platform_id=#{serverGBId}")
+ List queryChannelWithCatalog(String serverGBId);
+
@Select("select * from wvp_device_channel where device_id = #{deviceId}")
List queryAllChannels(String deviceId);
@@ -380,7 +495,44 @@ public interface DeviceChannelMapper {
void clearPlay(String deviceId);
// 设备主子码流逻辑END
@Select(value = {"