mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-23 21:47:49 +08:00
Compare commits
106 Commits
86461e95a5
...
8dab3ad805
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dab3ad805 | ||
|
|
6de70ccdd5 | ||
|
|
b2f9492cc8 | ||
|
|
869953b08d | ||
|
|
2de8db731c | ||
|
|
7b4c8881aa | ||
|
|
e453b3b394 | ||
|
|
01e72407ac | ||
|
|
f89dee6393 | ||
|
|
0607e1c3b2 | ||
|
|
0ab50eb1c0 | ||
|
|
b84e9d2799 | ||
|
|
826b251544 | ||
|
|
bf5af5779f | ||
|
|
c507709690 | ||
|
|
6ced304143 | ||
|
|
0eefabd034 | ||
|
|
f8235d5b3f | ||
|
|
8f6a9a4729 | ||
|
|
5d471ded1a | ||
|
|
984d2d56ee | ||
|
|
311b59870c | ||
|
|
2a5435c810 | ||
|
|
dab5643541 | ||
|
|
fa9aaf3fa2 | ||
|
|
091d6e67ee | ||
|
|
952d38d69b | ||
|
|
f3e3d5700e | ||
|
|
d76d0483e3 | ||
|
|
d6248ad7fd | ||
|
|
08206ca824 | ||
|
|
a2e3738509 | ||
|
|
d6042c4e16 | ||
|
|
d117a0d83a | ||
|
|
96dc55352b | ||
|
|
cda0a803fc | ||
|
|
e666b9fe00 | ||
|
|
b9aaeec41b | ||
|
|
a02ac63be4 | ||
|
|
35a1733510 | ||
|
|
d029fb7adb | ||
|
|
d132e35094 | ||
|
|
3adf551beb | ||
|
|
2de4932f1e | ||
|
|
6e739dc7d2 | ||
|
|
0e331d6b97 | ||
|
|
aae673e47e | ||
|
|
24c7bfb756 | ||
|
|
d48e0cc031 | ||
|
|
86266acb15 | ||
|
|
62d3a958ad | ||
|
|
2ba0399b7b | ||
|
|
dd906dc7b9 | ||
|
|
feb7e0e9c4 | ||
|
|
c10c982954 | ||
|
|
87afbe3f89 | ||
|
|
dd0a760d8a | ||
|
|
ac92237e08 | ||
|
|
d2ffc867e6 | ||
|
|
83bba5d380 | ||
|
|
b135014aed | ||
|
|
68c20f127e | ||
|
|
1bc8a8f080 | ||
|
|
7ebc23210a | ||
|
|
f4e68e2aef | ||
|
|
b3441de154 | ||
|
|
f724451058 | ||
|
|
efb39fc158 | ||
|
|
29099cbaa4 | ||
|
|
da9aaadda0 | ||
|
|
cdab14b90e | ||
|
|
a885b3d0f1 | ||
|
|
b13207db92 | ||
|
|
d90b0aaff6 | ||
|
|
3a6c59ed6c | ||
|
|
a3c4f02e3f | ||
|
|
ca04df1fec | ||
|
|
bdf7ae5771 | ||
|
|
f9276cf1a5 | ||
|
|
d4da1dc91c | ||
|
|
61c64589b2 | ||
|
|
4aeca7f5dd | ||
|
|
eff1773101 | ||
|
|
85d47af644 | ||
|
|
9941608207 | ||
|
|
77594dae3d | ||
|
|
4280a1d08e | ||
|
|
8d6fe0c9d8 | ||
|
|
6469aefe22 | ||
|
|
bee911fa09 | ||
|
|
554a11ead6 | ||
|
|
c0ef35c3a0 | ||
|
|
602cd390e0 | ||
|
|
842647674a | ||
|
|
1156880194 | ||
|
|
371511f836 | ||
|
|
eada4a64dc | ||
|
|
196ecad3a3 | ||
|
|
2657d61c08 | ||
|
|
5aaa1c016b | ||
|
|
a948b78629 | ||
|
|
f4ba4ef159 | ||
|
|
8848de9d15 | ||
|
|
44bd521446 | ||
|
|
14c85838f4 | ||
|
|
da98101aac |
@ -162,7 +162,6 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git
|
||||
# 付费社群
|
||||
<img src="doc/_media/shequ.png" width="50%" height="50%">
|
||||
|
||||
> 收费是为了提供更好的服务,也是对作者更大的激励。加入星球的用户三天后可以私信我留下微信号,我会拉大家入群。
|
||||
> 加入三天内不满意可以直接自行推出,星球会直接退款给大家。需要发票可以在星球app中直接咨询星球客服获取。
|
||||
|
||||
> 星球还提供了包括闭源的全功能试用包, 会随时更新。
|
||||
|
||||
BIN
libs/smiley-http-proxy-servlet-2.0.jar
Normal file
BIN
libs/smiley-http-proxy-servlet-2.0.jar
Normal file
Binary file not shown.
163
pom.xml
163
pom.xml
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.18</version>
|
||||
<version>3.4.4</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.genersoft</groupId>
|
||||
@ -29,6 +29,10 @@
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>ECC</id>
|
||||
<url>https://maven.ecc.no/releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
@ -48,7 +52,6 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.build.timestamp.format>MMddHHmm</maven.build.timestamp.format>
|
||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||
|
||||
<!-- 依赖版本 -->
|
||||
<snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
|
||||
@ -56,6 +59,9 @@
|
||||
<generated.asciidoc.directory>${project.build.directory}/asciidoc</generated.asciidoc.directory>
|
||||
<asciidoctor.html.output.directory>${project.build.directory}/asciidoc/html</asciidoctor.html.output.directory>
|
||||
<asciidoctor.pdf.output.directory>${project.build.directory}/asciidoc/pdf</asciidoctor.pdf.output.directory>
|
||||
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
@ -113,6 +119,17 @@
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 日志相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
@ -121,7 +138,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<version>3.0.4</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
@ -139,14 +156,13 @@
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 数据库监控页面 -->
|
||||
<!-- h2 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.23</version>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>2.3.232</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- mysql数据库 -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
@ -180,42 +196,48 @@
|
||||
<systemPath>${basedir}/libs/jdbc-x86/kingbase8-8.6.0.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cn.com.kingbase</groupId>-->
|
||||
<!-- <artifactId>kingbase8</artifactId>-->
|
||||
<!-- <version>8.6.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!--Mybatis分页插件 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.6</version>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--在线文档 -->
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<version>1.6.10</version>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
|
||||
<version>2.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-security</artifactId>
|
||||
<version>1.6.10</version>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-springdoc-ui</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
<version>4.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--参数校验 -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 日志相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>javax.validation</groupId>-->
|
||||
<!-- <artifactId>validation-api</artifactId>-->
|
||||
<!-- <version>3.0.2</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- sip协议栈 -->
|
||||
<dependency>
|
||||
@ -228,14 +250,14 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<version>1.7.36</version>
|
||||
<version>2.0.17</version>
|
||||
</dependency>
|
||||
|
||||
<!-- xml解析库 -->
|
||||
<dependency>
|
||||
<groupId>org.dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>2.1.3</version>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- json解析库fastjson2 -->
|
||||
@ -259,21 +281,21 @@
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.10.0</version>
|
||||
<version>4.12.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- okhttp 调试日志 -->
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>logging-interceptor</artifactId>
|
||||
<version>4.10.0</version>
|
||||
<version>4.12.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- okhttp-digest -->
|
||||
<dependency>
|
||||
<groupId>io.github.rburgst</groupId>
|
||||
<artifactId>okhttp-digest</artifactId>
|
||||
<version>2.7</version>
|
||||
<version>3.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/net.sf.kxml/kxml2 -->
|
||||
@ -287,21 +309,20 @@
|
||||
<dependency>
|
||||
<groupId>org.bitbucket.b_c</groupId>
|
||||
<artifactId>jose4j</artifactId>
|
||||
<version>0.9.3</version>
|
||||
<version>0.9.6</version>
|
||||
</dependency>
|
||||
|
||||
<!--反向代理-->
|
||||
<dependency>
|
||||
<groupId>org.mitre.dsmiley.httpproxy</groupId>
|
||||
<artifactId>smiley-http-proxy-servlet</artifactId>
|
||||
<version>1.12.1</version>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.14</version>
|
||||
</dependency>
|
||||
|
||||
<!--excel解析库-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.3.2</version>
|
||||
<version>4.0.3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
@ -312,64 +333,44 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.24.0</version>
|
||||
<version>1.27.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 获取系统信息 -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<version>6.2.2</version>
|
||||
<version>6.6.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 检测文件编码 -->
|
||||
<!-- https://mvnrepository.com/artifact/cpdetector/cpdetector -->
|
||||
<!--<dependency>-->
|
||||
<!-- <groupId>cpdetector</groupId>-->
|
||||
<!-- <artifactId>cpdetector</artifactId>-->
|
||||
<!-- <version>1.0.8</version>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.1.3-jre</version>
|
||||
<version>33.4.8-jre</version>
|
||||
</dependency>
|
||||
|
||||
<!--ftp server-->
|
||||
<dependency>
|
||||
<groupId>org.apache.ftpserver</groupId>
|
||||
<artifactId>ftpserver-core</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.ftpserver</groupId>
|
||||
<artifactId>ftplet-api</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 自动化生成代码工具 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<version>1.18.38</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 自动化生成代码工具 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--LogViewer-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>io.github.sevdokimov.logviewer</groupId>-->
|
||||
@ -383,6 +384,32 @@
|
||||
<version>1.0.10</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.38</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcpkix-jdk18on</artifactId>
|
||||
<version>1.78.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mvt矢量瓦片库 -->
|
||||
<dependency>
|
||||
<groupId>no.ecc.vectortile</groupId>
|
||||
<artifactId>java-vector-tile</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JTS for geometry creation -->
|
||||
<dependency>
|
||||
<groupId>org.locationtech.jts</groupId>
|
||||
<artifactId>jts-core</artifactId>
|
||||
<version>1.18.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
@ -396,7 +423,7 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<version>3.4.10</version>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
<executable>true</executable>
|
||||
@ -406,10 +433,10 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>3.14.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>21</source>
|
||||
<target>21</target>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
@ -423,7 +450,7 @@
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>4.9.10</version>
|
||||
<configuration>
|
||||
<offline>true</offline>
|
||||
<failOnNoGitDirectory>false</failOnNoGitDirectory>
|
||||
@ -434,7 +461,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.2</version>
|
||||
<version>3.2.5</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
@ -443,7 +470,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.2</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>**/配置详情.yml</exclude>
|
||||
|
||||
@ -13,10 +13,10 @@ import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.SessionCookieConfig;
|
||||
import javax.servlet.SessionTrackingMode;
|
||||
import jakarta.servlet.ServletContext;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.SessionCookieConfig;
|
||||
import jakarta.servlet.SessionTrackingMode;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
|
||||
@ -31,7 +31,7 @@ public class VideoManagerConstants {
|
||||
public static final String SIP_INVITE_SESSION_CALL_ID = SIP_INVITE_SESSION + "CALL_ID:";
|
||||
public static final String SIP_INVITE_SESSION_STREAM = SIP_INVITE_SESSION + "STREAM:";
|
||||
|
||||
public static final String MEDIA_STREAM_AUTHORITY = "VMP_MEDIA_STREAM_AUTHORITY:";
|
||||
public static final String MEDIA_STREAM_AUTHORITY = "VMP_MEDIA_STREAM_AUTHORITY";
|
||||
|
||||
public static final String SIP_CSEQ_PREFIX = "VMP_SIP_CSEQ_";
|
||||
|
||||
@ -50,6 +50,7 @@ public class VideoManagerConstants {
|
||||
public static final String WAITE_SEND_PUSH_STREAM = "VMP_WAITE_SEND_PUSH_STREAM:";
|
||||
public static final String START_SEND_PUSH_STREAM = "VMP_START_SEND_PUSH_STREAM:";
|
||||
public static final String SSE_TASK_KEY = "SSE_TASK_";
|
||||
public static final String DRAW_THIN_PROCESS_PREFIX = "VMP_DRAW_THIN_PROCESS_";
|
||||
|
||||
|
||||
|
||||
@ -75,6 +76,21 @@ public class VideoManagerConstants {
|
||||
*/
|
||||
public static final String VM_MSG_PUSH_STREAM_LIST_CHANGE = "VM_MSG_PUSH_STREAM_LIST_CHANGE";
|
||||
|
||||
/**
|
||||
* 请求同步三方组织结构
|
||||
*/
|
||||
public static final String VM_MSG_GROUP_LIST_REQUEST = "VM_MSG_GROUP_LIST_REQUEST";
|
||||
|
||||
/**
|
||||
* 同步三方组织结构回复
|
||||
*/
|
||||
public static final String VM_MSG_GROUP_LIST_RESPONSE = "VM_MSG_GROUP_LIST_RESPONSE";
|
||||
|
||||
/**
|
||||
* 同步三方组织结构回复
|
||||
*/
|
||||
public static final String VM_MSG_GROUP_LIST_CHANGE = "VM_MSG_GROUP_LIST_CHANGE";
|
||||
|
||||
/**
|
||||
* redis 消息通知设备推流到平台
|
||||
*/
|
||||
@ -111,11 +127,6 @@ public class VideoManagerConstants {
|
||||
*/
|
||||
public static final String VM_MSG_GET_ALL_ONLINE_REQUESTED = "VM_MSG_GET_ALL_ONLINE_REQUESTED";
|
||||
|
||||
/**
|
||||
* 移动位置订阅通知
|
||||
*/
|
||||
public static final String VM_MSG_SUBSCRIBE_MOBILE_POSITION = "mobileposition";
|
||||
|
||||
/**
|
||||
* 报警订阅的通知(收到报警向redis发出通知)
|
||||
*/
|
||||
@ -133,6 +144,8 @@ public class VideoManagerConstants {
|
||||
public static final String VM_MSG_SUBSCRIBE_DEVICE_STATUS = "device";
|
||||
|
||||
|
||||
|
||||
|
||||
//************************** 第三方 ****************************************
|
||||
|
||||
public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_";
|
||||
|
||||
@ -17,5 +17,18 @@ public class ChannelDataType {
|
||||
public final static String PTZ_SERVICE = "sourceChannelPTZService";
|
||||
|
||||
|
||||
public static String getDateTypeDesc(Integer dataType) {
|
||||
if (dataType == null) {
|
||||
return "未知";
|
||||
}
|
||||
return switch (dataType) {
|
||||
case ChannelDataType.GB28181 -> "国标28181";
|
||||
case ChannelDataType.STREAM_PUSH -> "推流设备";
|
||||
case ChannelDataType.STREAM_PROXY -> "拉流代理";
|
||||
case ChannelDataType.JT_1078 -> "部标设备";
|
||||
default -> "未知";
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@ -38,6 +38,10 @@ public class GlobalResponseAdvice implements ResponseBodyAdvice<Object> {
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedContentType.equals(MediaType.parseMediaType("application/x-protobuf"))) {
|
||||
return body;
|
||||
}
|
||||
|
||||
if (body instanceof WVPResult) {
|
||||
return body;
|
||||
}
|
||||
|
||||
@ -1,301 +0,0 @@
|
||||
package com.genersoft.iot.vmp.conf;
|
||||
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.HttpRequest;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.mitre.dsmiley.httpproxy.ProxyServlet;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
|
||||
/**
|
||||
* @author lin
|
||||
*/
|
||||
@SuppressWarnings(value = {"rawtypes", "unchecked"})
|
||||
@Configuration
|
||||
@Order(1)
|
||||
@Slf4j
|
||||
public class ProxyServletConfig {
|
||||
|
||||
@Autowired
|
||||
private IMediaServerService mediaServerService;
|
||||
|
||||
@Value("${server.port}")
|
||||
private int serverPort;
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean zlmServletRegistrationBean(){
|
||||
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new ZlmProxyServlet(),"/zlm/*");
|
||||
servletRegistrationBean.setName("zlm_Proxy");
|
||||
servletRegistrationBean.addInitParameter("targetUri", "http://127.0.0.1:6080");
|
||||
servletRegistrationBean.addUrlMappings();
|
||||
if (log.isDebugEnabled()) {
|
||||
servletRegistrationBean.addInitParameter("log", "true");
|
||||
}
|
||||
return servletRegistrationBean;
|
||||
}
|
||||
|
||||
class ZlmProxyServlet extends ProxyServlet{
|
||||
@Override
|
||||
protected String rewriteQueryStringFromRequest(HttpServletRequest servletRequest, String queryString) {
|
||||
String queryStr = super.rewriteQueryStringFromRequest(servletRequest, queryString);
|
||||
MediaServer mediaInfo = getMediaInfoByUri(servletRequest.getRequestURI());
|
||||
if (mediaInfo != null) {
|
||||
if (!ObjectUtils.isEmpty(queryStr)) {
|
||||
queryStr += "&secret=" + mediaInfo.getSecret();
|
||||
}else {
|
||||
queryStr = "secret=" + mediaInfo.getSecret();
|
||||
}
|
||||
}
|
||||
return queryStr;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected HttpResponse doExecute(HttpServletRequest servletRequest, HttpServletResponse servletResponse,
|
||||
HttpRequest proxyRequest) throws IOException {
|
||||
HttpResponse response = super.doExecute(servletRequest, servletResponse, proxyRequest);
|
||||
response.removeHeaders("Access-Control-Allow-Origin");
|
||||
response.setHeader("Access-Control-Allow-Credentials","true");
|
||||
response.removeHeaders("Access-Control-Allow-Credentials");
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常处理
|
||||
*/
|
||||
@Override
|
||||
protected void handleRequestException(HttpRequest proxyRequest, HttpResponse proxyResonse, Exception e){
|
||||
try {
|
||||
super.handleRequestException(proxyRequest, proxyResonse, e);
|
||||
} catch (ServletException servletException) {
|
||||
log.error("zlm 代理失败: ", e);
|
||||
} catch (IOException ioException) {
|
||||
if (ioException instanceof ConnectException) {
|
||||
log.error("zlm 连接失败");
|
||||
} else {
|
||||
log.error("zlm 代理失败: ", e);
|
||||
}
|
||||
} catch (RuntimeException exception){
|
||||
log.error("zlm 代理失败: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对于为按照格式请求的可以直接返回404
|
||||
*/
|
||||
@Override
|
||||
protected String getTargetUri(HttpServletRequest servletRequest) {
|
||||
String requestURI = servletRequest.getRequestURI();
|
||||
MediaServer mediaInfo = getMediaInfoByUri(requestURI);
|
||||
|
||||
String uri = null;
|
||||
if (mediaInfo != null) {
|
||||
// String realRequestURI = requestURI.substring(requestURI.indexOf(mediaInfo.getId())+ mediaInfo.getId().length());
|
||||
uri = String.format("http://%s:%s", mediaInfo.getIp(), mediaInfo.getHttpPort());
|
||||
}else {
|
||||
uri = "http://127.0.0.1:" + serverPort +"/index/hook/null"; // 只是一个能返回404的请求而已, 其他的也可以
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态替换请求目标
|
||||
*/
|
||||
@Override
|
||||
protected HttpHost getTargetHost(HttpServletRequest servletRequest) {
|
||||
String requestURI = servletRequest.getRequestURI();
|
||||
MediaServer mediaInfo = getMediaInfoByUri(requestURI);
|
||||
HttpHost host;
|
||||
if (mediaInfo != null) {
|
||||
host = new HttpHost(mediaInfo.getIp(), mediaInfo.getHttpPort());
|
||||
}else {
|
||||
host = new HttpHost("127.0.0.1", serverPort);
|
||||
}
|
||||
return host;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据uri获取流媒体信息
|
||||
*/
|
||||
MediaServer getMediaInfoByUri(String uri){
|
||||
String[] split = uri.split("/");
|
||||
String mediaServerId = split[2];
|
||||
if ("default".equalsIgnoreCase(mediaServerId)) {
|
||||
return mediaServerService.getDefaultMediaServer();
|
||||
}else {
|
||||
return mediaServerService.getOne(mediaServerId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉url中的标志信息
|
||||
*/
|
||||
@Override
|
||||
protected String rewriteUrlFromRequest(HttpServletRequest servletRequest) {
|
||||
String requestURI = servletRequest.getRequestURI();
|
||||
MediaServer mediaInfo = getMediaInfoByUri(requestURI);
|
||||
String url = super.rewriteUrlFromRequest(servletRequest);
|
||||
if (mediaInfo == null) {
|
||||
log.error("[ZLM服务访问代理],错误:处理url信息时未找到流媒体信息=>{}", requestURI);
|
||||
return url;
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(mediaInfo.getId())) {
|
||||
url = url.replace(mediaInfo.getId() + "/", "");
|
||||
}
|
||||
return url.replace("default/", "");
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean recordServletRegistrationBean(){
|
||||
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new RecordProxyServlet(),"/record_proxy/*");
|
||||
servletRegistrationBean.setName("record_proxy");
|
||||
servletRegistrationBean.addInitParameter("targetUri", "http://127.0.0.1:18081");
|
||||
servletRegistrationBean.addUrlMappings();
|
||||
if (log.isDebugEnabled()) {
|
||||
servletRegistrationBean.addInitParameter("log", "true");
|
||||
}
|
||||
return servletRegistrationBean;
|
||||
}
|
||||
|
||||
class RecordProxyServlet extends ProxyServlet{
|
||||
|
||||
@Override
|
||||
protected String rewriteQueryStringFromRequest(HttpServletRequest servletRequest, String queryString) {
|
||||
String queryStr = super.rewriteQueryStringFromRequest(servletRequest, queryString);
|
||||
MediaServer mediaInfo = getMediaInfoByUri(servletRequest.getRequestURI());
|
||||
if (mediaInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String remoteHost = String.format("http://%s:%s", mediaInfo.getStreamIp(), mediaInfo.getRecordAssistPort());
|
||||
if (!ObjectUtils.isEmpty(queryStr)) {
|
||||
queryStr += "&remoteHost=" + remoteHost;
|
||||
}else {
|
||||
queryStr = "remoteHost=" + remoteHost;
|
||||
}
|
||||
return queryStr;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected HttpResponse doExecute(HttpServletRequest servletRequest, HttpServletResponse servletResponse,
|
||||
HttpRequest proxyRequest) throws IOException {
|
||||
HttpResponse response = super.doExecute(servletRequest, servletResponse, proxyRequest);
|
||||
String origin = servletRequest.getHeader("origin");
|
||||
response.setHeader("Access-Control-Allow-Origin",origin);
|
||||
response.setHeader("Access-Control-Allow-Credentials","true");
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常处理
|
||||
*/
|
||||
@Override
|
||||
protected void handleRequestException(HttpRequest proxyRequest, HttpResponse proxyResponse, Exception e){
|
||||
try {
|
||||
super.handleRequestException(proxyRequest, proxyResponse, e);
|
||||
} catch (ServletException servletException) {
|
||||
log.error("录像服务 代理失败: ", e);
|
||||
} catch (IOException ioException) {
|
||||
if (ioException instanceof ConnectException) {
|
||||
log.error("录像服务 连接失败");
|
||||
// }else if (ioException instanceof ClientAbortException) {
|
||||
// /**
|
||||
// * TODO 使用这个代理库实现代理在遇到代理视频文件时,如果是206结果,会遇到报错蛋市目前功能正常,
|
||||
// * TODO 暂时去除异常处理。后续使用其他代理框架修改测试
|
||||
// */
|
||||
|
||||
}else {
|
||||
log.error("录像服务 代理失败: ", e);
|
||||
}
|
||||
} catch (RuntimeException exception){
|
||||
log.error("录像服务 代理失败: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对于为按照格式请求的可以直接返回404
|
||||
*/
|
||||
@Override
|
||||
protected String getTargetUri(HttpServletRequest servletRequest) {
|
||||
String requestURI = servletRequest.getRequestURI();
|
||||
MediaServer mediaInfo = getMediaInfoByUri(requestURI);
|
||||
|
||||
String uri = null;
|
||||
if (mediaInfo != null) {
|
||||
// String realRequestURI = requestURI.substring(requestURI.indexOf(mediaInfo.getId())+ mediaInfo.getId().length());
|
||||
uri = String.format("http://%s:%s", mediaInfo.getIp(), mediaInfo.getRecordAssistPort());
|
||||
}else {
|
||||
uri = "http://127.0.0.1:" + serverPort +"/index/hook/null"; // 只是一个能返回404的请求而已, 其他的也可以
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态替换请求目标
|
||||
*/
|
||||
@Override
|
||||
protected HttpHost getTargetHost(HttpServletRequest servletRequest) {
|
||||
String requestURI = servletRequest.getRequestURI();
|
||||
MediaServer mediaInfo = getMediaInfoByUri(requestURI);
|
||||
HttpHost host;
|
||||
if (mediaInfo != null) {
|
||||
host = new HttpHost(mediaInfo.getIp(), mediaInfo.getRecordAssistPort());
|
||||
}else {
|
||||
host = new HttpHost("127.0.0.1", serverPort);
|
||||
}
|
||||
return host;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据uri获取流媒体信息
|
||||
*/
|
||||
MediaServer getMediaInfoByUri(String uri){
|
||||
String[] split = uri.split("/");
|
||||
String mediaServerId = split[2];
|
||||
if ("default".equalsIgnoreCase(mediaServerId)) {
|
||||
return mediaServerService.getDefaultMediaServer();
|
||||
}else {
|
||||
return mediaServerService.getOne(mediaServerId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉url中的标志信息
|
||||
*/
|
||||
@Override
|
||||
protected String rewriteUrlFromRequest(HttpServletRequest servletRequest) {
|
||||
String requestURI = servletRequest.getRequestURI();
|
||||
MediaServer mediaInfo = getMediaInfoByUri(requestURI);
|
||||
String url = super.rewriteUrlFromRequest(servletRequest);
|
||||
if (mediaInfo == null) {
|
||||
log.error("[录像服务访问代理],错误:处理url信息时未找到流媒体信息=>{}", requestURI);
|
||||
return url;
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(mediaInfo.getId())) {
|
||||
url = url.replace(mediaInfo.getId() + "/", "");
|
||||
}
|
||||
return url.replace("default/", "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -106,4 +106,12 @@ public class SpringDocConfig {
|
||||
.packagesToScan("com.genersoft.iot.vmp.jt1078.controller")
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi publicApi99() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("99. 第三方接口")
|
||||
.packagesToScan("com.genersoft.iot.vmp.web.custom")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,4 +209,14 @@ public class UserSetting {
|
||||
*/
|
||||
private boolean disableDateHeader = false;
|
||||
|
||||
/**
|
||||
* 同步业务分组时自动生成分组国标编号的模板,不配置则默认参考当前的sip域信息生成
|
||||
*/
|
||||
private String groupSyncDeviceTemplate;
|
||||
|
||||
/**
|
||||
* 与第三方进行分组同步时使用别名而不是分组ID, 如果没有设置此项为true,那么分组编号就是必须传递的。如果是设置为true则,自动为别名的分组生成新的编号
|
||||
*/
|
||||
private boolean useAliasForGroupSync = false;
|
||||
|
||||
}
|
||||
|
||||
@ -34,6 +34,11 @@ public class RedisMsgListenConfig {
|
||||
@Autowired
|
||||
private RedisPushStreamListMsgListener pushStreamListMsgListener;
|
||||
|
||||
@Autowired
|
||||
private RedisGroupMsgListener groupMsgListener;
|
||||
|
||||
@Autowired
|
||||
private RedisGroupChangeListener groupChangeListener;
|
||||
|
||||
@Autowired
|
||||
private RedisCloseStreamMsgListener redisCloseStreamMsgListener;
|
||||
@ -64,6 +69,8 @@ public class RedisMsgListenConfig {
|
||||
container.addMessageListener(redisCloseStreamMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_STREAM_PUSH_CLOSE));
|
||||
container.addMessageListener(redisRpcConfig, new PatternTopic(RedisRpcConfig.REDIS_REQUEST_CHANNEL_KEY));
|
||||
container.addMessageListener(redisPushStreamCloseResponseListener, new PatternTopic(VideoManagerConstants.VM_MSG_STREAM_PUSH_RESPONSE));
|
||||
container.addMessageListener(groupMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_GROUP_LIST_RESPONSE));
|
||||
container.addMessageListener(groupChangeListener, new PatternTopic(VideoManagerConstants.VM_MSG_GROUP_LIST_CHANGE));
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,4 +42,5 @@ public class RedisTemplateConfig {
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
return redisTemplate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -10,8 +10,8 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
@ -4,17 +4,19 @@ import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.security.dto.JwtUser;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.Role;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.User;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
import org.springframework.web.util.ContentCachingRequestWrapper;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -22,6 +24,7 @@ import java.util.ArrayList;
|
||||
* jwt token 过滤器
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
|
||||
@ -33,14 +36,15 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
|
||||
protected void doFilterInternal(HttpServletRequest servletRequest, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
ContentCachingRequestWrapper request = new ContentCachingRequestWrapper(servletRequest);
|
||||
// 忽略登录请求的token验证
|
||||
String requestURI = request.getRequestURI();
|
||||
if ((requestURI.startsWith("/doc.html") || requestURI.startsWith("/swagger-ui") ) && !userSetting.getDocEnable()) {
|
||||
if ((requestURI.startsWith("/doc.html") || requestURI.startsWith("/swagger-ui") ) && !userSetting.getDocEnable()) {
|
||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
|
||||
if (requestURI.equalsIgnoreCase("/api/user/login")) {
|
||||
chain.doFilter(request, response);
|
||||
return;
|
||||
@ -53,8 +57,6 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
String jwt = request.getHeader(JwtUtils.getHeader());
|
||||
// 这里如果没有jwt,继续往后走,因为后面还有鉴权管理器等去判断是否拥有身份凭证,所以是可以放行的
|
||||
// 没有jwt相当于匿名访问,若有一些接口是需要权限的,则不能访问这些接口
|
||||
@ -83,7 +85,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
// TODO 处理各个状态
|
||||
switch (jwtUser.getStatus()){
|
||||
case EXPIRED:
|
||||
response.setStatus(400);
|
||||
response.setStatus(401);
|
||||
chain.doFilter(request, response);
|
||||
// 异常
|
||||
return;
|
||||
@ -109,5 +111,4 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
SecurityContextHolder.getContext().setAuthentication(token);
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
@ -5,9 +5,9 @@ import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
|
||||
@ -7,14 +7,15 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
@ -35,7 +36,7 @@ import java.util.List;
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
@Order(1)
|
||||
@Slf4j
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
public class WebSecurityConfig {
|
||||
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
@ -55,15 +56,13 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
@Autowired
|
||||
private JwtAuthenticationFilter jwtAuthenticationFilter;
|
||||
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception {
|
||||
return config.getAuthenticationManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置认证方式
|
||||
*
|
||||
* @param auth
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
@Bean
|
||||
public AuthenticationProvider authProvider() {
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
// 设置不隐藏 未找到用户异常
|
||||
provider.setHideUserNotFoundExceptions(true);
|
||||
@ -71,11 +70,11 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
provider.setUserDetailsService(userDetailsService);
|
||||
// 设置密码加密算法
|
||||
provider.setPasswordEncoder(passwordEncoder());
|
||||
auth.authenticationProvider(provider);
|
||||
return provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
List<String> defaultExcludes = new ArrayList<>();
|
||||
defaultExcludes.add("/");
|
||||
defaultExcludes.add("/#/**");
|
||||
@ -103,33 +102,29 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
defaultExcludes.add("/api/jt1078/playback/download");
|
||||
defaultExcludes.add("/api/jt1078/snap");
|
||||
|
||||
|
||||
|
||||
if (userSetting.getInterfaceAuthentication() && !userSetting.getInterfaceAuthenticationExcludes().isEmpty()) {
|
||||
defaultExcludes.addAll(userSetting.getInterfaceAuthenticationExcludes());
|
||||
}
|
||||
|
||||
http.headers().contentTypeOptions().disable()
|
||||
.and().cors().configurationSource(configurationSource())
|
||||
.and().csrf().disable()
|
||||
.sessionManagement()
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
|
||||
http
|
||||
.headers(headers -> headers.contentTypeOptions(contentType -> contentType.disable()))
|
||||
.cors(cors -> cors.configurationSource(configurationSource()))
|
||||
.csrf(csrf -> csrf.disable())
|
||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.ALWAYS))
|
||||
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
|
||||
// 配置拦截规则
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
|
||||
.antMatchers(defaultExcludes.toArray(new String[0])).permitAll()
|
||||
.anyRequest().authenticated()
|
||||
.authorizeHttpRequests(auth -> auth
|
||||
.requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
|
||||
.requestMatchers(defaultExcludes.toArray(new String[0])).permitAll()
|
||||
.anyRequest().authenticated()
|
||||
)
|
||||
// 异常处理器
|
||||
.and()
|
||||
.exceptionHandling()
|
||||
.authenticationEntryPoint(anonymousAuthenticationEntryPoint)
|
||||
.and().logout().logoutUrl("/api/user/logout").permitAll()
|
||||
.logoutSuccessHandler(logoutHandler)
|
||||
;
|
||||
http.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
.exceptionHandling(exception -> exception.authenticationEntryPoint(anonymousAuthenticationEntryPoint))
|
||||
.logout(logout -> logout.logoutUrl("/api/user/logout")
|
||||
.permitAll()
|
||||
.logoutSuccessHandler(logoutHandler));
|
||||
|
||||
return http.build();
|
||||
}
|
||||
|
||||
CorsConfigurationSource configurationSource() {
|
||||
@ -141,7 +136,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
if (userSetting.getAllowedOrigins() != null && !userSetting.getAllowedOrigins().isEmpty()) {
|
||||
corsConfiguration.setAllowCredentials(true);
|
||||
corsConfiguration.setAllowedOrigins(userSetting.getAllowedOrigins());
|
||||
}else {
|
||||
} else {
|
||||
// 在SpringBoot 2.4及以上版本处理跨域时,遇到错误提示:当allowCredentials为true时,allowedOrigins不能包含特殊值"*"。
|
||||
// 解决方法是明确指定allowedOrigins或使用allowedOriginPatterns。
|
||||
corsConfiguration.setAllowCredentials(true);
|
||||
@ -158,17 +153,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
/**
|
||||
* 描述: 密码加密算法 BCrypt 推荐使用
|
||||
**/
|
||||
@Bean
|
||||
public BCryptPasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述: 注入AuthenticationManager管理器
|
||||
**/
|
||||
@Override
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManager() throws Exception {
|
||||
return super.authenticationManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,13 +2,13 @@ package com.genersoft.iot.vmp.conf.webLog;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
import jakarta.websocket.*;
|
||||
import jakarta.websocket.server.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
@ServerEndpoint(value = "/channel/log")
|
||||
@ServerEndpoint(value = "/channel/log")
|
||||
@Slf4j
|
||||
public class LogChannel {
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ import java.util.Random;
|
||||
@Slf4j
|
||||
public class DigestServerAuthenticationHelper {
|
||||
|
||||
private MessageDigest messageDigest;
|
||||
private final MessageDigest messageDigest;
|
||||
|
||||
public static final String DEFAULT_ALGORITHM = "MD5";
|
||||
public static final String DEFAULT_SCHEME = "Digest";
|
||||
@ -59,19 +59,18 @@ public class DigestServerAuthenticationHelper {
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public DigestServerAuthenticationHelper()
|
||||
throws NoSuchAlgorithmException {
|
||||
messageDigest = MessageDigest.getInstance(DEFAULT_ALGORITHM);
|
||||
}
|
||||
|
||||
public static String toHexString(byte b[]) {
|
||||
public static String toHexString(byte[] b) {
|
||||
int pos = 0;
|
||||
char[] c = new char[b.length * 2];
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
c[pos++] = toHex[(b[i] >> 4) & 0x0F];
|
||||
c[pos++] = toHex[b[i] & 0x0f];
|
||||
for (byte value : b) {
|
||||
c[pos++] = toHex[(value >> 4) & 0x0F];
|
||||
c[pos++] = toHex[value & 0x0f];
|
||||
}
|
||||
return new String(c);
|
||||
}
|
||||
@ -87,8 +86,8 @@ public class DigestServerAuthenticationHelper {
|
||||
long pad = rand.nextLong();
|
||||
String nonceString = Long.valueOf(time).toString()
|
||||
+ Long.valueOf(pad).toString();
|
||||
byte mdbytes[] = messageDigest.digest(nonceString.getBytes());
|
||||
return toHexString(mdbytes);
|
||||
byte[] mdBytes = messageDigest.digest(nonceString.getBytes());
|
||||
return toHexString(mdBytes);
|
||||
}
|
||||
|
||||
public Response generateChallenge(HeaderFactory headerFactory, Response response, String realm) {
|
||||
@ -132,8 +131,6 @@ public class DigestServerAuthenticationHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
|
||||
String HA1 = hashedPassword;
|
||||
|
||||
@ -177,12 +174,11 @@ public class DigestServerAuthenticationHelper {
|
||||
if ( authHeader == null || authHeader.getRealm() == null) {
|
||||
return false;
|
||||
}
|
||||
String realm = authHeader.getRealm().trim();
|
||||
String username = authHeader.getUsername().trim();
|
||||
|
||||
if ( username == null || realm == null ) {
|
||||
if ( authHeader.getUsername() == null || authHeader.getRealm() == null ) {
|
||||
return false;
|
||||
}
|
||||
String realm = authHeader.getRealm().trim();
|
||||
String username = authHeader.getUsername().trim();
|
||||
|
||||
String nonce = authHeader.getNonce();
|
||||
URI uri = authHeader.getURI();
|
||||
@ -199,26 +195,24 @@ public class DigestServerAuthenticationHelper {
|
||||
// nonce计数器,是一个16进制的数值,表示同一nonce下客户端发送出请求的数量
|
||||
int nc = authHeader.getNonceCount();
|
||||
String ncStr = String.format("%08x", nc).toUpperCase();
|
||||
// String ncStr = new DecimalFormat("00000000").format(nc);
|
||||
// String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16));
|
||||
|
||||
String A1 = username + ":" + realm + ":" + pass;
|
||||
|
||||
String A2 = request.getMethod().toUpperCase() + ":" + uri.toString();
|
||||
|
||||
byte mdbytes[] = messageDigest.digest(A1.getBytes());
|
||||
byte[] mdbytes = messageDigest.digest(A1.getBytes());
|
||||
String HA1 = toHexString(mdbytes);
|
||||
log.debug("A1: " + A1);
|
||||
log.debug("A2: " + A2);
|
||||
log.debug("A1: {}", A1);
|
||||
log.debug("A2: {}", A2);
|
||||
mdbytes = messageDigest.digest(A2.getBytes());
|
||||
String HA2 = toHexString(mdbytes);
|
||||
log.debug("HA1: " + HA1);
|
||||
log.debug("HA2: " + HA2);
|
||||
log.debug("HA1: {}", HA1);
|
||||
log.debug("HA2: {}", HA2);
|
||||
// String cnonce = authHeader.getCNonce();
|
||||
log.debug("nonce: " + nonce);
|
||||
log.debug("nc: " + ncStr);
|
||||
log.debug("cnonce: " + cnonce);
|
||||
log.debug("qop: " + qop);
|
||||
log.debug("nonce: {}", nonce);
|
||||
log.debug("nc: {}", ncStr);
|
||||
log.debug("cnonce: {}", cnonce);
|
||||
log.debug("qop: {}", qop);
|
||||
String KD = HA1 + ":" + nonce;
|
||||
|
||||
if (qop != null && qop.equalsIgnoreCase("auth") ) {
|
||||
@ -231,12 +225,12 @@ public class DigestServerAuthenticationHelper {
|
||||
KD += ":" + qop;
|
||||
}
|
||||
KD += ":" + HA2;
|
||||
log.debug("KD: " + KD);
|
||||
log.debug("KD: {}", KD);
|
||||
mdbytes = messageDigest.digest(KD.getBytes());
|
||||
String mdString = toHexString(mdbytes);
|
||||
log.debug("mdString: " + mdString);
|
||||
log.debug("mdString: {}", mdString);
|
||||
String response = authHeader.getResponse();
|
||||
log.debug("response: " + response);
|
||||
log.debug("response: {}", response);
|
||||
return mdString.equals(response);
|
||||
|
||||
}
|
||||
|
||||
@ -86,22 +86,19 @@ public class CommonGBChannel {
|
||||
@Schema(description = "国标-纬度 WGS-84坐标系")
|
||||
private Double gbLatitude;
|
||||
|
||||
@Schema(description = "")
|
||||
private Double gpsAltitude;
|
||||
|
||||
@Schema(description = "")
|
||||
private Double gpsSpeed;
|
||||
|
||||
@Schema(description = "")
|
||||
private Double gpsDirection;
|
||||
|
||||
@Schema(description = "")
|
||||
private String gpsTime;
|
||||
|
||||
@Schema(description = "国标-虚拟组织所属的业务分组ID")
|
||||
private String gbBusinessGroupId;
|
||||
|
||||
@Schema(description = "国标-摄像机结构类型,标识摄像机类型: 1-球机; 2-半球; 3-固定枪机; 4-遥控枪机;5-遥控半球;6-多目设备的全景/拼接通道;7-多目设备的分割通道")
|
||||
@Schema(description = "国标-摄像机结构类型,标识摄像机类型: 1-球机; 2-半球; 3-固定枪机; 4-遥控枪机;5-遥控半球;6-多目设备的全景/拼接通道;" +
|
||||
"7-多目设备的分割通道; 99-移动设备(非标)98-会议设备(非标)")
|
||||
private Integer gbPtzType;
|
||||
|
||||
// 2016
|
||||
@ -153,6 +150,12 @@ public class CommonGBChannel {
|
||||
@Schema(description = "流唯一编号,存在表示正在直播")
|
||||
private String streamId;
|
||||
|
||||
@Schema(description = "是否支持对讲 1支持,0不支持")
|
||||
private Integer enableBroadcast;
|
||||
|
||||
@Schema(description = "抽稀后的图层层级")
|
||||
private Integer mapLevel;
|
||||
|
||||
public String encode(String serverDeviceId) {
|
||||
return encode(null, serverDeviceId);
|
||||
}
|
||||
@ -340,6 +343,9 @@ public class CommonGBChannel {
|
||||
if (this.getGbSvcTimeSupportMode() != null) {
|
||||
content.append(" <SVCTimeSupportMode>" + this.getGbSvcTimeSupportMode() + "</SVCTimeSupportMode>\n");
|
||||
}
|
||||
if (this.getEnableBroadcast() != null) {
|
||||
content.append(" <EnableBroadcast>" + this.getEnableBroadcast() + "</EnableBroadcast>\n");
|
||||
}
|
||||
content.append("</Info>\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,4 +212,8 @@ public class Device {
|
||||
|
||||
@Schema(description = "所属服务Id")
|
||||
private String serverId;
|
||||
|
||||
public boolean checkWgs84() {
|
||||
return geoCoordSys.equalsIgnoreCase("WGS84");
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,7 +122,6 @@ public class DeviceChannel extends CommonGBChannel {
|
||||
@Schema(description = "经度 WGS-84坐标系")
|
||||
private Double longitude;
|
||||
|
||||
|
||||
@MessageElementForCatalog("Latitude")
|
||||
@Schema(description = ",纬度 WGS-84坐标系")
|
||||
private Double latitude;
|
||||
@ -236,7 +235,11 @@ public class DeviceChannel extends CommonGBChannel {
|
||||
GbCode gbCode = GbCode.decode(deviceChannel.getDeviceId());
|
||||
if (gbCode != null && "138".equals(gbCode.getTypeCode())) {
|
||||
deviceChannel.setHasAudio(true);
|
||||
if (deviceChannel.getEnableBroadcast() == null && "138".equals(gbCode.getTypeCode())) {
|
||||
deviceChannel.setEnableBroadcast(1);
|
||||
}
|
||||
}
|
||||
|
||||
return deviceChannel;
|
||||
}
|
||||
|
||||
@ -244,6 +247,7 @@ public class DeviceChannel extends CommonGBChannel {
|
||||
Element deviceElement = element.element("DeviceID");
|
||||
DeviceChannel deviceChannel = new DeviceChannel();
|
||||
deviceChannel.setDeviceId(deviceElement.getText());
|
||||
deviceChannel.setDataType(ChannelDataType.GB28181);
|
||||
return deviceChannel;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DrawThinProcess {
|
||||
|
||||
private double process;
|
||||
private String msg;
|
||||
|
||||
public DrawThinProcess(double process, String msg) {
|
||||
this.process = process;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 解析收到的前端控制指令
|
||||
|
||||
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.gb28181.bean;
|
||||
import gov.nist.core.InternalErrorHandler;
|
||||
import gov.nist.javax.sip.header.SIPDate;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -10,11 +11,9 @@ import java.util.*;
|
||||
*/
|
||||
public class GbSipDate extends SIPDate {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private Calendar javaCal;
|
||||
|
||||
public GbSipDate(long timeMillis) {
|
||||
|
||||
@ -58,12 +58,19 @@ public class Group implements Comparable<Group>{
|
||||
*/
|
||||
@Schema(description = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 行政区划
|
||||
*/
|
||||
@Schema(description = "行政区划")
|
||||
private String civilCode;
|
||||
|
||||
/**
|
||||
* 别名
|
||||
*/
|
||||
@Schema(description = "别名, 此别名为唯一值,可以对接第三方是存储对方的ID")
|
||||
private String alias;
|
||||
|
||||
public static Group getInstance(DeviceChannel channel) {
|
||||
GbCode gbCode = GbCode.decode(channel.getDeviceId());
|
||||
if (gbCode == null || (!gbCode.getTypeCode().equals("215") && !gbCode.getTypeCode().equals("216"))) {
|
||||
|
||||
@ -20,6 +20,11 @@ public class MobilePosition {
|
||||
*/
|
||||
private Integer channelId;
|
||||
|
||||
/**
|
||||
* 通道国标编号
|
||||
*/
|
||||
private String channelDeviceId;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RedisGroupMessage {
|
||||
|
||||
/**
|
||||
* 分组国标ID
|
||||
*/
|
||||
private String groupGbId;
|
||||
|
||||
/**
|
||||
* 分组别名
|
||||
*/
|
||||
private String groupAlias;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 分组所属的行政区划
|
||||
*/
|
||||
private String groupCivilCode;
|
||||
|
||||
/**
|
||||
* 分组所属父分组国标ID
|
||||
*/
|
||||
private String parentGroupGbId;
|
||||
|
||||
/**
|
||||
* 分组所属父分组别名
|
||||
*/
|
||||
private String parentGAlias;
|
||||
|
||||
/**
|
||||
* 分组所属业务分组国标ID
|
||||
*/
|
||||
private String topGroupGbId;
|
||||
|
||||
/**
|
||||
* 分组所属业务分组别名
|
||||
*/
|
||||
private String topGroupGAlias;
|
||||
|
||||
/**
|
||||
* 分组变化消息中的消息类型,取值为 add update delete
|
||||
*/
|
||||
private String messageType;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RedisGroupMessage{" +
|
||||
"groupGbId='" + groupGbId + '\'' +
|
||||
", groupAlias='" + groupAlias + '\'' +
|
||||
", groupName='" + groupName + '\'' +
|
||||
", groupCivilCode='" + groupCivilCode + '\'' +
|
||||
", parentGroupGbId='" + parentGroupGbId + '\'' +
|
||||
", parentGAlias='" + parentGAlias + '\'' +
|
||||
", topGroupGbId='" + topGroupGbId + '\'' +
|
||||
", topGroupGAlias='" + topGroupGAlias + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.service.bean.RequestPushStreamMsg;
|
||||
import lombok.Data;
|
||||
@ -236,4 +237,13 @@ public class SendRtpInfo {
|
||||
}
|
||||
|
||||
|
||||
public void setPlayTypeByChannelDataType(Integer dataType, String sessionName) {
|
||||
if (dataType == ChannelDataType.STREAM_PUSH) {
|
||||
this.setPlayType(InviteStreamType.PUSH);
|
||||
}else if (dataType == ChannelDataType.STREAM_PROXY){
|
||||
this.setPlayType(InviteStreamType.PROXY);
|
||||
}else {
|
||||
this.setPlayType("Play".equalsIgnoreCase(sessionName) ? InviteStreamType.PLAY : InviteStreamType.PLAYBACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class VectorTileSource {
|
||||
|
||||
/**
|
||||
* 抽稀的图层数据
|
||||
*/
|
||||
private Map<String, byte[]> vectorTileMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 抽稀的原始数据
|
||||
*/
|
||||
private List<CommonGBChannel> channelList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 创建时间, 大于6小时后删除
|
||||
*/
|
||||
private long time;
|
||||
|
||||
public VectorTileSource() {
|
||||
this.time = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
@ -5,16 +5,12 @@ import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupByGbDeviceParam;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupParam;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionByGbDeviceParam;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionParam;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.VectorTileUtils;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||
@ -24,14 +20,21 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
@ -45,14 +48,11 @@ import java.util.concurrent.TimeUnit;
|
||||
public class ChannelController {
|
||||
|
||||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
@Autowired
|
||||
private IGbChannelService channelService;
|
||||
|
||||
@Autowired
|
||||
private IMediaServerService mediaServerService;
|
||||
|
||||
@Autowired
|
||||
private IGbChannelPlayService channelPlayService;
|
||||
|
||||
@ -88,13 +88,26 @@ public class ChannelController {
|
||||
@Operation(summary = "更新通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/update")
|
||||
public void update(@RequestBody CommonGBChannel channel){
|
||||
BeanWrapperImpl wrapper = new BeanWrapperImpl(channel);
|
||||
int count = 0;
|
||||
for (PropertyDescriptor pd : wrapper.getPropertyDescriptors()) {
|
||||
String name = pd.getName();
|
||||
if ("class".equals(name)) continue;
|
||||
if (pd.getReadMethod() == null) continue;
|
||||
Object val = wrapper.getPropertyValue(name);
|
||||
if (val != null) count++;
|
||||
}
|
||||
Assert.isTrue(count > 1, "未进行任何修改");
|
||||
channelService.update(channel);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "重置国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/reset")
|
||||
public void reset(Integer id){
|
||||
channelService.reset(id);
|
||||
public void reset(@RequestBody ResetParam param){
|
||||
Assert.notNull(param.getId(), "通道ID不能为空");
|
||||
Assert.notEmpty(param.getChanelFields(), "待重置字段不可以空");
|
||||
channelService.reset(param.getId(), param.getChanelFields());
|
||||
}
|
||||
|
||||
@Operation(summary = "增加通道", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@ -111,16 +124,26 @@ public class ChannelController {
|
||||
@Parameter(name = "online", description = "是否在线")
|
||||
@Parameter(name = "hasRecordPlan", description = "是否已设置录制计划")
|
||||
@Parameter(name = "channelType", description = "通道类型, 0:国标设备,1:推流设备,2:拉流代理")
|
||||
@Parameter(name = "civilCode", description = "行政区划")
|
||||
@Parameter(name = "parentDeviceId", description = "父节点编码")
|
||||
@GetMapping("/list")
|
||||
public PageInfo<CommonGBChannel> queryList(int page, int count,
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) Boolean online,
|
||||
@RequestParam(required = false) Boolean hasRecordPlan,
|
||||
@RequestParam(required = false) Integer channelType){
|
||||
@RequestParam(required = false) Integer channelType,
|
||||
@RequestParam(required = false) String civilCode,
|
||||
@RequestParam(required = false) String parentDeviceId){
|
||||
if (ObjectUtils.isEmpty(query)){
|
||||
query = null;
|
||||
}
|
||||
return channelService.queryList(page, count, query, online, hasRecordPlan, channelType);
|
||||
if (ObjectUtils.isEmpty(civilCode)){
|
||||
civilCode = null;
|
||||
}
|
||||
if (ObjectUtils.isEmpty(parentDeviceId)){
|
||||
parentDeviceId = null;
|
||||
}
|
||||
return channelService.queryList(page, count, query, online, hasRecordPlan, channelType, civilCode, parentDeviceId);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取关联行政区划通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@ -323,7 +346,7 @@ public class ChannelController {
|
||||
Assert.notNull(channelId,"参数异常");
|
||||
CommonGBChannel channel = channelService.getOne(channelId);
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
channelPlayService.stopPlay(channel, channel.getStreamId());
|
||||
channelPlayService.stopPlay(channel);
|
||||
}
|
||||
|
||||
@Operation(summary = "录像查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@ -464,4 +487,104 @@ public class ChannelController {
|
||||
Assert.notNull(channel, "通道不存在");
|
||||
channelPlayService.playbackSpeed(channel, stream, speed);
|
||||
}
|
||||
|
||||
@Operation(summary = "为地图获取通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "query", description = "查询内容")
|
||||
@Parameter(name = "online", description = "是否在线")
|
||||
@Parameter(name = "hasRecordPlan", description = "是否已设置录制计划")
|
||||
@Parameter(name = "channelType", description = "通道类型, 0:国标设备,1:推流设备,2:拉流代理")
|
||||
@Parameter(name = "geoCoordSys", description = "地理坐标系, WGS84/GCJ02")
|
||||
@GetMapping("/map/list")
|
||||
public List<CommonGBChannel> queryListForMap(
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) Boolean online,
|
||||
@RequestParam(required = false) Boolean hasRecordPlan,
|
||||
@RequestParam(required = false) Integer channelType){
|
||||
if (ObjectUtils.isEmpty(query)){
|
||||
query = null;
|
||||
}
|
||||
return channelService.queryListForMap(query, online, hasRecordPlan, channelType);
|
||||
}
|
||||
|
||||
@Operation(summary = "为地图去除抽稀结果", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/map/reset-level")
|
||||
public void resetLevel(){
|
||||
channelService.resetLevel();
|
||||
}
|
||||
|
||||
@Operation(summary = "执行抽稀", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@PostMapping("/map/thin/draw")
|
||||
public String drawThin(@RequestBody DrawThinParam param){
|
||||
if(param == null || param.getZoomParam() == null || param.getZoomParam().isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR400);
|
||||
}
|
||||
return channelService.drawThin(param.getZoomParam(), param.getExtent(), param.getGeoCoordSys());
|
||||
}
|
||||
|
||||
@Operation(summary = "清除未保存的抽稀结果", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "id", description = "抽稀ID", required = true)
|
||||
@GetMapping("/map/thin/clear")
|
||||
public void clearThin(String id){
|
||||
VectorTileUtils.INSTANCE.remove(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "保存的抽稀结果", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "id", description = "抽稀ID", required = true)
|
||||
@GetMapping("/map/thin/save")
|
||||
public void saveThin(String id){
|
||||
channelService.saveThin(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取抽稀执行的进度", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "id", description = "抽稀ID", required = true)
|
||||
@GetMapping("/map/thin/progress")
|
||||
public DrawThinProcess thinProgress(String id){
|
||||
return channelService.thinProgress(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "为地图提供标准mvt图层", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@GetMapping(value = "/map/tile/{z}/{x}/{y}", produces = "application/x-protobuf")
|
||||
@Parameter(name = "geoCoordSys", description = "地理坐标系, WGS84/GCJ02")
|
||||
public ResponseEntity<byte[]> getTile(@PathVariable int z, @PathVariable int x, @PathVariable int y, String geoCoordSys){
|
||||
|
||||
try {
|
||||
byte[] mvt = channelService.getTile(z, x, y, geoCoordSys);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.parseMediaType("application/x-protobuf"));
|
||||
if (mvt == null) {
|
||||
headers.setContentLength(0);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||
}
|
||||
headers.setContentLength(mvt.length);
|
||||
return new ResponseEntity<>(mvt, headers, HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
log.error("构建矢量瓦片失败: z: {}, x: {}, y:{}", z, x, y, e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "为地图提供经过抽稀的标准mvt图层", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@GetMapping(value = "/map/thin/tile/{z}/{x}/{y}", produces = "application/x-protobuf")
|
||||
@Parameter(name = "geoCoordSys", description = "地理坐标系, WGS84/GCJ02")
|
||||
@Parameter(name = "thinId", description = "抽稀结果ID")
|
||||
public ResponseEntity<byte[]> getThinTile(@PathVariable int z, @PathVariable int x, @PathVariable int y,
|
||||
String geoCoordSys, @RequestParam(required = false) String thinId){
|
||||
|
||||
if (ObjectUtils.isEmpty(thinId)) {
|
||||
thinId = "DEFAULT";
|
||||
}
|
||||
String catchKey = z + "_" + x + "_" + y + "_" + geoCoordSys.toUpperCase();
|
||||
byte[] mvt = VectorTileUtils.INSTANCE.getVectorTile(thinId, catchKey);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.parseMediaType("application/x-protobuf"));
|
||||
if (mvt == null) {
|
||||
headers.setContentLength(0);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(null);
|
||||
}
|
||||
|
||||
headers.setContentLength(mvt.length);
|
||||
return new ResponseEntity<>(mvt, headers, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -31,8 +31,8 @@ import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -341,9 +341,13 @@ public class DeviceQuery {
|
||||
}else if (channelSyncStatus.getErrorMsg() != null) {
|
||||
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
||||
wvpResult.setMsg(channelSyncStatus.getErrorMsg());
|
||||
}else if (channelSyncStatus.getTotal() == null || channelSyncStatus.getTotal() == 0){
|
||||
}else if (channelSyncStatus.getTotal() == null){
|
||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
||||
wvpResult.setMsg("等待通道信息...");
|
||||
}else if (channelSyncStatus.getTotal() == 0){
|
||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
||||
wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
|
||||
wvpResult.setData(channelSyncStatus);
|
||||
}else {
|
||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
||||
wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
|
||||
|
||||
@ -31,7 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@ -89,6 +89,13 @@ public class GroupController {
|
||||
return groupService.getPath(deviceId, businessGroup);
|
||||
}
|
||||
|
||||
@Operation(summary = "从第三方同步组织结构")
|
||||
@ResponseBody
|
||||
@GetMapping("/sync")
|
||||
public void sync(){
|
||||
groupService.sync();
|
||||
}
|
||||
|
||||
// @Operation(summary = "根据分组Id查询分组")
|
||||
// @Parameter(name = "groupDeviceId", description = "分组节点编号", required = true)
|
||||
// @ResponseBody
|
||||
|
||||
@ -18,13 +18,13 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
|
||||
@ -93,9 +93,6 @@ public class PlatformController {
|
||||
@ResponseBody
|
||||
public void add(@RequestBody Platform platform) {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("保存上级平台信息API调用");
|
||||
}
|
||||
Assert.notNull(platform.getName(), "平台名称不可为空");
|
||||
Assert.notNull(platform.getServerGBId(), "上级平台国标编号不可为空");
|
||||
Assert.notNull(platform.getServerIp(), "上级平台IP不可为空");
|
||||
@ -140,9 +137,6 @@ public class PlatformController {
|
||||
@ResponseBody
|
||||
public void updatePlatform(@RequestBody Platform parentPlatform) {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("保存上级平台信息API调用");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(parentPlatform.getName())
|
||||
|| ObjectUtils.isEmpty(parentPlatform.getServerGBId())
|
||||
|| ObjectUtils.isEmpty(parentPlatform.getServerGBDomain())
|
||||
@ -163,16 +157,14 @@ public class PlatformController {
|
||||
@Parameter(name = "id", description = "上级平台ID")
|
||||
@DeleteMapping("/delete")
|
||||
@ResponseBody
|
||||
public DeferredResult<Object> deletePlatform(Integer id) {
|
||||
public DeferredResult<WVPResult<?>> deletePlatform(Integer id) {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("删除上级平台API调用");
|
||||
}
|
||||
DeferredResult<Object> deferredResult = new DeferredResult<>();
|
||||
DeferredResult<WVPResult<?>> deferredResult = new DeferredResult<>();
|
||||
|
||||
platformService.delete(id, (object)->{
|
||||
deferredResult.setResult(WVPResult.success());
|
||||
});
|
||||
platformService.delete(id, (object)-> deferredResult.setResult(WVPResult.success()));
|
||||
return deferredResult;
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
@ -33,7 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
@ -8,8 +8,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package com.genersoft.iot.vmp.gb28181.controller.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ChannelForThin {
|
||||
private Integer gbId;
|
||||
private Integer mapLevel;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.genersoft.iot.vmp.gb28181.controller.bean;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DrawThinParam {
|
||||
private Map<Integer, Double> zoomParam;
|
||||
private Extent extent;
|
||||
|
||||
/**
|
||||
* 地理坐标系, WGS84/GCJ02, 用来标识 extent 参数的坐标系
|
||||
*/
|
||||
private String geoCoordSys;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.genersoft.iot.vmp.gb28181.controller.bean;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class Extent {
|
||||
private Double minLng;
|
||||
private Double maxLng;
|
||||
private Double minLat;
|
||||
private Double maxLat;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.genersoft.iot.vmp.gb28181.controller.bean;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ResetParam {
|
||||
|
||||
private Integer id;
|
||||
private List<String> chanelFields;
|
||||
|
||||
}
|
||||
@ -1,9 +1,13 @@
|
||||
package com.genersoft.iot.vmp.gb28181.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.Extent;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.provider.ChannelProvider;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.web.custom.bean.CameraChannel;
|
||||
import com.genersoft.iot.vmp.web.custom.bean.CameraGroup;
|
||||
import com.genersoft.iot.vmp.web.custom.bean.Point;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@ -16,7 +20,7 @@ public interface CommonGBChannelMapper {
|
||||
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByDeviceId")
|
||||
CommonGBChannel queryByDeviceId(@Param("gbDeviceId") String gbDeviceId);
|
||||
List<CommonGBChannel> queryByDeviceId(@Param("gbDeviceId") String gbDeviceId);
|
||||
|
||||
@Insert(" <script>" +
|
||||
"INSERT INTO wvp_device_channel (" +
|
||||
@ -57,7 +61,8 @@ public interface CommonGBChannelMapper {
|
||||
"gb_business_group_id," +
|
||||
"gb_download_speed," +
|
||||
"gb_svc_space_support_mod," +
|
||||
"gb_svc_time_support_mode ) " +
|
||||
"gb_svc_time_support_mode," +
|
||||
"enable_broadcast ) " +
|
||||
"VALUES (" +
|
||||
"#{gbDeviceId}, " +
|
||||
"#{dataType}, " +
|
||||
@ -96,7 +101,8 @@ public interface CommonGBChannelMapper {
|
||||
"#{gbBusinessGroupId},"+
|
||||
"#{gbDownloadSpeed},"+
|
||||
"#{gbSvcSpaceSupportMod},"+
|
||||
"#{gbSvcTimeSupportMode}"+
|
||||
"#{gbSvcTimeSupportMode},"+
|
||||
"#{enableBroadcast}"+
|
||||
")" +
|
||||
" </script>")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "gbId", keyColumn = "id")
|
||||
@ -111,39 +117,40 @@ public interface CommonGBChannelMapper {
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_device_channel " +
|
||||
"SET update_time=#{updateTime}" +
|
||||
", gb_device_id = #{gbDeviceId}" +
|
||||
", gb_name = #{gbName}" +
|
||||
", gb_manufacturer = #{gbManufacturer}" +
|
||||
", gb_model = #{gbModel}" +
|
||||
", gb_owner = #{gbOwner}" +
|
||||
", gb_civil_code = #{gbCivilCode}" +
|
||||
", gb_block = #{gbBlock}" +
|
||||
", gb_address = #{gbAddress}" +
|
||||
", gb_parental = #{gbParental}" +
|
||||
", gb_parent_id = #{gbParentId}" +
|
||||
", gb_safety_way = #{gbSafetyWay}" +
|
||||
", gb_register_way = #{gbRegisterWay}" +
|
||||
", gb_cert_num = #{gbCertNum}" +
|
||||
", gb_certifiable = #{gbCertifiable}" +
|
||||
", gb_err_code = #{gbErrCode}" +
|
||||
", gb_end_time = #{gbEndTime}" +
|
||||
", gb_ip_address = #{gbIpAddress}" +
|
||||
", gb_port = #{gbPort}" +
|
||||
", gb_password = #{gbPassword}" +
|
||||
", gb_status = #{gbStatus}" +
|
||||
", gb_longitude = #{gbLongitude}" +
|
||||
", gb_latitude = #{gbLatitude}" +
|
||||
", gb_ptz_type = #{gbPtzType}" +
|
||||
", gb_position_type = #{gbPositionType}" +
|
||||
", gb_room_type = #{gbRoomType}" +
|
||||
", gb_use_type = #{gbUseType}" +
|
||||
", gb_supply_light_type = #{gbSupplyLightType}" +
|
||||
", gb_direction_type = #{gbDirectionType}" +
|
||||
", gb_resolution = #{gbResolution}" +
|
||||
", gb_business_group_id = #{gbBusinessGroupId}" +
|
||||
", gb_download_speed = #{gbDownloadSpeed}" +
|
||||
", gb_svc_space_support_mod = #{gbSvcSpaceSupportMod}" +
|
||||
", gb_svc_time_support_mode = #{gbSvcTimeSupportMode}" +
|
||||
"<if test='gbDeviceId != null' > , gb_device_id = #{gbDeviceId}</if> " +
|
||||
"<if test='gbName != null' > , gb_name = #{gbName}</if> " +
|
||||
"<if test='gbManufacturer != null' > , gb_manufacturer = #{gbManufacturer}</if> " +
|
||||
"<if test='gbModel != null' > , gb_model = #{gbModel}</if> " +
|
||||
"<if test='gbOwner != null' > , gb_owner = #{gbOwner}</if> " +
|
||||
"<if test='gbCivilCode != null' > , gb_civil_code = #{gbCivilCode}</if> " +
|
||||
"<if test='gbBlock != null' > , gb_block = #{gbBlock}</if> " +
|
||||
"<if test='gbAddress != null' > , gb_address = #{gbAddress}</if> " +
|
||||
"<if test='gbParental != null' > , gb_parental = #{gbParental}</if> " +
|
||||
"<if test='gbParentId != null' > , gb_parent_id = #{gbParentId}</if> " +
|
||||
"<if test='gbSafetyWay != null' > , gb_safety_way = #{gbSafetyWay}</if> " +
|
||||
"<if test='gbRegisterWay != null' > , gb_register_way = #{gbRegisterWay}</if> " +
|
||||
"<if test='gbCertNum != null' > , gb_cert_num = #{gbCertNum}</if> " +
|
||||
"<if test='gbCertifiable != null' > , gb_certifiable = #{gbCertifiable}</if> " +
|
||||
"<if test='gbErrCode != null' > , gb_err_code = #{gbErrCode}</if> " +
|
||||
"<if test='gbEndTime != null' > , gb_end_time = #{gbEndTime}</if> " +
|
||||
"<if test='gbIpAddress != null' > , gb_ip_address = #{gbIpAddress}</if> " +
|
||||
"<if test='gbPort != null' > , gb_port = #{gbPort}</if> " +
|
||||
"<if test='gbPassword != null' > , gb_password = #{gbPassword}</if> " +
|
||||
"<if test='gbStatus != null' > , gb_status = #{gbStatus}</if> " +
|
||||
"<if test='gbLongitude != null' > , gb_longitude = #{gbLongitude}</if> " +
|
||||
"<if test='gbLatitude != null' > , gb_latitude = #{gbLatitude}</if> " +
|
||||
"<if test='gbPtzType != null' > , gb_ptz_type = #{gbPtzType}</if> " +
|
||||
"<if test='gbPositionType != null' > , gb_position_type = #{gbPositionType}</if> " +
|
||||
"<if test='gbRoomType != null' > , gb_room_type = #{gbRoomType}</if> " +
|
||||
"<if test='gbUseType != null' > , gb_use_type = #{gbUseType}</if> " +
|
||||
"<if test='gbSupplyLightType != null' > , gb_supply_light_type = #{gbSupplyLightType}</if> " +
|
||||
"<if test='gbDirectionType != null' > , gb_direction_type = #{gbDirectionType}</if> " +
|
||||
"<if test='gbResolution != null' > , gb_resolution = #{gbResolution}</if> " +
|
||||
"<if test='gbBusinessGroupId != null' > , gb_business_group_id = #{gbBusinessGroupId}</if> " +
|
||||
"<if test='gbDownloadSpeed != null' > , gb_download_speed = #{gbDownloadSpeed}</if> " +
|
||||
"<if test='gbSvcSpaceSupportMod != null' > , gb_svc_space_support_mod = #{gbSvcSpaceSupportMod}</if> " +
|
||||
"<if test='gbSvcTimeSupportMode != null' > , gb_svc_time_support_mode = #{gbSvcTimeSupportMode}</if> " +
|
||||
"<if test='enableBroadcast != null' > , enable_broadcast = #{enableBroadcast}</if> " +
|
||||
" WHERE id = #{gbId}"+
|
||||
" </script>"})
|
||||
int update(CommonGBChannel commonGBChannel);
|
||||
@ -205,7 +212,8 @@ public interface CommonGBChannelMapper {
|
||||
"gb_business_group_id," +
|
||||
"gb_download_speed," +
|
||||
"gb_svc_space_support_mod," +
|
||||
"gb_svc_time_support_mode ) " +
|
||||
"gb_svc_time_support_mode," +
|
||||
"enable_broadcast ) " +
|
||||
"VALUES" +
|
||||
"<foreach collection='commonGBChannels' index='index' item='item' separator=','> " +
|
||||
"(#{item.gbDeviceId}, #{item.dataType}, #{item.dataDeviceId},#{item.createTime},#{item.updateTime}," +
|
||||
@ -214,7 +222,7 @@ public interface CommonGBChannelMapper {
|
||||
"#{item.gbRegisterWay},#{item.gbCertNum},#{item.gbCertifiable},#{item.gbErrCode},#{item.gbEndTime}, #{item.gbSecrecy},#{item.gbIpAddress}," +
|
||||
"#{item.gbPort},#{item.gbPassword},#{item.gbStatus},#{item.gbLongitude}, #{item.gbLatitude},#{item.gbPtzType},#{item.gbPositionType},#{item.gbRoomType}," +
|
||||
"#{item.gbUseType},#{item.gbSupplyLightType},#{item.gbDirectionType},#{item.gbResolution},#{item.gbBusinessGroupId},#{item.gbDownloadSpeed}," +
|
||||
"#{item.gbSvcSpaceSupportMod},#{item.gbSvcTimeSupportMode})" +
|
||||
"#{item.gbSvcSpaceSupportMod},#{item.gbSvcTimeSupportMode},#{item.enableBroadcast})" +
|
||||
"</foreach> " +
|
||||
" </script>")
|
||||
int batchAdd(List<CommonGBChannel> commonGBChannels);
|
||||
@ -228,17 +236,13 @@ public interface CommonGBChannelMapper {
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET update_time=#{updateTime}, gb_device_id = null, gb_name = null, gb_manufacturer = null," +
|
||||
" gb_model = null, gb_owner = null, gb_block = null, gb_address = null," +
|
||||
" gb_parental = null, gb_parent_id = null, gb_safety_way = null, gb_register_way = null, gb_cert_num = null," +
|
||||
" gb_certifiable = null, gb_err_code = null, gb_end_time = null, gb_secrecy = null, gb_ip_address = null, " +
|
||||
" gb_port = null, gb_password = null, gb_status = null, gb_longitude = null, gb_latitude = null, " +
|
||||
" gb_ptz_type = null, gb_position_type = null, gb_room_type = null, gb_use_type = null, gb_supply_light_type = null, " +
|
||||
" gb_direction_type = null, gb_resolution = null, gb_business_group_id = null, gb_download_speed = null, gb_svc_space_support_mod = null, " +
|
||||
" gb_svc_time_support_mode = null" +
|
||||
" WHERE id = #{id} and data_type = #{dataType} and data_device_id = #{dataDeviceId}"+
|
||||
" SET update_time=#{updateTime}" +
|
||||
"<foreach collection='fields' index='index' item='item'> " +
|
||||
" ,${item} = null" +
|
||||
"</foreach> " +
|
||||
" WHERE id = #{id}"+
|
||||
" </script>"})
|
||||
void reset(@Param("id") int id, @Param("dataType") Integer dataType, @Param("dataDeviceId") int dataDeviceId, @Param("updateTime") String updateTime);
|
||||
void reset(@Param("id") int id, List<String> fields, @Param("updateTime") String updateTime);
|
||||
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByIds")
|
||||
@ -317,8 +321,11 @@ public interface CommonGBChannelMapper {
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByCivilCode")
|
||||
List<CommonGBChannel> queryByCivilCode(@Param("civilCode") String civilCode);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByDataTypeAndDeviceIds")
|
||||
List<CommonGBChannel> queryByDataTypeAndDeviceIds(@Param("dataType") Integer dataType, List<Integer> deviceIds);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryByGbDeviceIds")
|
||||
List<CommonGBChannel> queryByGbDeviceIds(@Param("dataType") Integer dataType, List<Integer> deviceIds);
|
||||
List<CommonGBChannel> queryByGbDeviceIds(List<String> deviceIds);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
" select id from wvp_device_channel " +
|
||||
@ -410,7 +417,7 @@ public interface CommonGBChannelMapper {
|
||||
", gb_ip_address=#{item.gbIpAddress}" +
|
||||
", gb_port=#{item.gbPort}" +
|
||||
", gb_password=#{item.gbPassword}" +
|
||||
", gb_status=#{item.gbStatus}" +
|
||||
"<if test='item.gbStatus != null' > , gb_status=#{item.gbStatus}</if> " +
|
||||
", gb_longitude=#{item.gbLongitude}" +
|
||||
", gb_latitude=#{item.gbLatitude}" +
|
||||
", gb_ptz_type=#{item.gbPtzType}" +
|
||||
@ -424,6 +431,7 @@ public interface CommonGBChannelMapper {
|
||||
", gb_download_speed=#{item.gbDownloadSpeed}" +
|
||||
", gb_svc_space_support_mod=#{item.gbSvcSpaceSupportMod}" +
|
||||
", gb_svc_time_support_mode=#{item.gbSvcTimeSupportMode}" +
|
||||
", enable_broadcast = #{item.enableBroadcast}" +
|
||||
" WHERE id=#{item.gbId}" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
@ -465,7 +473,8 @@ public interface CommonGBChannelMapper {
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryList")
|
||||
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online,
|
||||
@Param("hasRecordPlan") Boolean hasRecordPlan, @Param("dataType") Integer dataType);
|
||||
@Param("hasRecordPlan") Boolean hasRecordPlan, @Param("dataType") Integer dataType,
|
||||
@Param("civilCode") String civilCode, @Param("parentDeviceId") String parentDeviceId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
@ -505,6 +514,7 @@ public interface CommonGBChannelMapper {
|
||||
" wdc.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" wdc.record_plan_id,\n" +
|
||||
" wdc.enable_broadcast,\n" +
|
||||
" coalesce( wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce( wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce( wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
@ -581,6 +591,9 @@ public interface CommonGBChannelMapper {
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryOnlineListsByGbDeviceId")
|
||||
List<CommonGBChannel> queryOnlineListsByGbDeviceId(@Param("deviceId") int deviceId);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryCommonChannelByDeviceChannel")
|
||||
CommonGBChannel queryCommonChannelByDeviceChannel(@Param("dataType") Integer dataType, @Param("dataDeviceId") Integer dataDeviceId, @Param("deviceId") String deviceId);
|
||||
|
||||
@Update("UPDATE wvp_device_channel SET stream_id = #{stream} where id = #{gbId}")
|
||||
void updateStream(int gbId, String stream);
|
||||
|
||||
@ -597,4 +610,89 @@ public interface CommonGBChannelMapper {
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
void updateGps(List<CommonGBChannel> commonGBChannels);
|
||||
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListForSy")
|
||||
List<CameraChannel> queryListForSy(@Param("groupDeviceId") String groupDeviceId, @Param("online") Boolean online);
|
||||
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryGbChannelByChannelDeviceIdAndGbDeviceId")
|
||||
List<CameraChannel> queryGbChannelByChannelDeviceIdAndGbDeviceId(@Param("channelDeviceId") String channelDeviceId, @Param("gbDeviceId") String gbDeviceId);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListByDeviceIds")
|
||||
List<CameraChannel> queryListByDeviceIds(List<String> deviceIds);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListWithChildForSy")
|
||||
List<CameraChannel> queryListWithChildForSy(@Param("query") String query, @Param("sortName") String sortName, @Param("order") Boolean order, @Param("groupList") List<CameraGroup> groupList, @Param("online") Boolean online);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListByAddressAndDirectionType")
|
||||
List<CameraChannel> queryListByAddressAndDirectionType(@Param("address") String address, @Param("directionType") Integer directionType);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInBox")
|
||||
List<CameraChannel> queryListInBox(@Param("minLongitude") Double minLongitude, @Param("maxLongitude") Double maxLongitude,
|
||||
@Param("minLatitude") Double minLatitude, @Param("maxLatitude") Double maxLatitude,
|
||||
@Param("level") Integer level, @Param("groupList") List<CameraGroup> groupList);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInCircleForMysql", databaseId = "mysql")
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInCircleForH2", databaseId = "h2")
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInCircleForKingBase", databaseId = "kingbase")
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInCircleForKingBase", databaseId = "postgresql")
|
||||
List<CameraChannel> queryListInCircle(@Param("centerLongitude") Double centerLongitude, @Param("centerLatitude") Double centerLatitude,
|
||||
@Param("radius") Double radius, @Param("level") Integer level, @Param("groupList") List<CameraGroup> groupList);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInPolygonForMysql", databaseId = "mysql")
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInPolygonForH2", databaseId = "h2")
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInPolygonForKingBase", databaseId = "kingbase")
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInPolygonForKingBase", databaseId = "postgresql")
|
||||
List<CameraChannel> queryListInPolygon(@Param("pointList") List<Point> pointList, @Param("level") Integer level, @Param("groupList") List<CameraGroup> groupList);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListForSyMobile")
|
||||
List<CameraChannel> queryListForSyMobile(@Param("business") String business);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryCameraChannelById")
|
||||
CameraChannel queryCameraChannelById(@Param("gbId") Integer id);
|
||||
|
||||
@Update("<script> " +
|
||||
"<foreach collection='channels' index='index' item='item' separator=';'> " +
|
||||
"UPDATE wvp_device_channel SET map_level=#{item.mapLevel} " +
|
||||
"WHERE id = #{item.gbId}" +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
void saveLevel(List<CommonGBChannel> channels);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryCameraChannelByIds")
|
||||
List<CameraChannel> queryCameraChannelByIds(List<CommonGBChannel> channelList);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryOldChanelListByChannels")
|
||||
List<CommonGBChannel> queryOldChanelListByChannels(List<CommonGBChannel> channelList);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryMeetingChannelList")
|
||||
List<CameraChannel> queryMeetingChannelList(@Param("business") String business);
|
||||
|
||||
@Update("UPDATE wvp_device_channel SET map_level=null")
|
||||
int resetLevel();
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryCameraChannelInBox")
|
||||
List<CommonGBChannel> queryCameraChannelInBox(@Param("minLon") double minLon, @Param("maxLon") double maxLon,
|
||||
@Param("minLat") double minLat, @Param("maxLat") double maxLat);
|
||||
|
||||
@Select("select " +
|
||||
"MAX(coalesce(gb_longitude, longitude)) as maxLng, " +
|
||||
"MIN(coalesce(gb_longitude, longitude)) as minLng, " +
|
||||
"MAX(coalesce(gb_latitude, latitude)) as maxLat, " +
|
||||
"MIN(coalesce(gb_latitude, latitude)) as minLat " +
|
||||
" from wvp_device_channel " +
|
||||
" where channel_type = 0")
|
||||
Extent queryExtent();
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryAllWithPosition")
|
||||
List<CommonGBChannel> queryAllWithPosition();
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListInExtent")
|
||||
List<CommonGBChannel> queryListInExtent(@Param("minLng") double minLng, @Param("maxLng") double maxLng,
|
||||
@Param("minLat") double minLat, @Param("maxLat") double maxLat);
|
||||
|
||||
@SelectProvider(type = ChannelProvider.class, method = "queryListOutExtent")
|
||||
List<CommonGBChannel> queryListOutExtent(@Param("minLng") double minLng, @Param("maxLng") double maxLng,
|
||||
@Param("minLat") double minLat, @Param("maxLat") double maxLat);
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.provider.DeviceChannelProvider;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@ -23,13 +22,13 @@ public interface DeviceChannelMapper {
|
||||
"insert into wvp_device_channel " +
|
||||
"(device_id, data_type, data_device_id, name, manufacturer, model, owner, civil_code, block, " +
|
||||
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
|
||||
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
|
||||
"ip_address, port, password, status, longitude, latitude, gb_longitude, gb_latitude, ptz_type, position_type, room_type, use_type, " +
|
||||
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
|
||||
"svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification, channel_type) " +
|
||||
"values " +
|
||||
"(#{deviceId}, #{dataType}, #{dataDeviceId}, #{name}, #{manufacturer}, #{model}, #{owner}, #{civilCode}, #{block}, " +
|
||||
"#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{endTime}, #{secrecy}, " +
|
||||
"#{ipAddress}, #{port}, #{password}, #{status}, #{longitude}, #{latitude}, #{ptzType}, #{positionType}, #{roomType}, #{useType}, " +
|
||||
"#{ipAddress}, #{port}, #{password}, #{status}, #{longitude}, #{latitude}, #{gbLongitude}, #{gbLatitude}, #{ptzType}, #{positionType}, #{roomType}, #{useType}, " +
|
||||
"#{supplyLightType}, #{directionType}, #{resolution}, #{businessGroupId}, #{downloadSpeed}, #{svcSpaceSupportMod}," +
|
||||
" #{svcTimeSupportMode}, #{createTime}, #{updateTime}, #{subCount}, #{streamId}, #{hasAudio}, #{gpsTime}, #{streamIdentification}, #{channelType}) " +
|
||||
"</script>")
|
||||
@ -64,6 +63,8 @@ public interface DeviceChannelMapper {
|
||||
", status=#{status}" +
|
||||
", longitude=#{longitude}" +
|
||||
", latitude=#{latitude}" +
|
||||
", gb_longitude=#{gbLongitude}" +
|
||||
", gb_latitude=#{gbLatitude}" +
|
||||
", ptz_type=#{ptzType}" +
|
||||
", position_type=#{positionType}" +
|
||||
", room_type=#{roomType}" +
|
||||
@ -104,8 +105,8 @@ public interface DeviceChannelMapper {
|
||||
@Delete("DELETE FROM wvp_device_channel WHERE data_type =1 and data_device_id=#{dataDeviceId}")
|
||||
int cleanChannelsByDeviceId(@Param("dataDeviceId") int dataDeviceId);
|
||||
|
||||
@Delete("DELETE FROM wvp_device_channel WHERE id=#{id}")
|
||||
int del(@Param("id") int id);
|
||||
@Delete("DELETE FROM wvp_device_channel WHERE data_type=#{dataType} and data_device_id=#{dataDeviceId} AND device_id=#{deviceId}")
|
||||
int deleteForNotify(DeviceChannel channel);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
" SELECT " +
|
||||
@ -199,14 +200,14 @@ public interface DeviceChannelMapper {
|
||||
"insert into wvp_device_channel " +
|
||||
"(device_id, data_type, data_device_id, name, manufacturer, model, owner, civil_code, block, " +
|
||||
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
|
||||
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
|
||||
"ip_address, port, password, status, longitude, latitude, gb_longitude, gb_latitude, ptz_type, position_type, room_type, use_type, " +
|
||||
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
|
||||
"svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification, channel_type) " +
|
||||
"values " +
|
||||
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
|
||||
"(#{item.deviceId}, #{item.dataType}, #{item.dataDeviceId}, #{item.name}, #{item.manufacturer}, #{item.model}, #{item.owner}, #{item.civilCode}, #{item.block}, " +
|
||||
"#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, #{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.endTime}, #{item.secrecy}, " +
|
||||
"#{item.ipAddress}, #{item.port}, #{item.password}, #{item.status}, #{item.longitude}, #{item.latitude}, #{item.ptzType}, #{item.positionType}, #{item.roomType}, #{item.useType}, " +
|
||||
"#{item.ipAddress}, #{item.port}, #{item.password}, #{item.status}, #{item.longitude}, #{item.latitude}, #{item.gbLongitude}, #{item.gbLatitude}, #{item.ptzType}, #{item.positionType}, #{item.roomType}, #{item.useType}, " +
|
||||
"#{item.supplyLightType}, #{item.directionType}, #{item.resolution}, #{item.businessGroupId}, #{item.downloadSpeed}, #{item.svcSpaceSupportMod}," +
|
||||
" #{item.svcTimeSupportMode}, #{item.createTime}, #{item.updateTime}, #{item.subCount}, #{item.streamId}, #{item.hasAudio}, #{item.gpsTime}, #{item.streamIdentification}, #{item.channelType}) " +
|
||||
"</foreach> " +
|
||||
@ -269,67 +270,6 @@ public interface DeviceChannelMapper {
|
||||
"</script>"})
|
||||
int batchUpdate(List<DeviceChannel> updateChannels);
|
||||
|
||||
|
||||
@Update({"<script>" +
|
||||
"<foreach collection='updateChannels' item='item' separator=';'>" +
|
||||
" UPDATE" +
|
||||
" wvp_device_channel" +
|
||||
" SET update_time=#{item.updateTime}" +
|
||||
", device_id=#{item.deviceId}" +
|
||||
", data_type=#{item.dataType}" +
|
||||
", data_device_id=#{item.dataDeviceId}" +
|
||||
", name=#{item.name}" +
|
||||
", manufacturer=#{item.manufacturer}" +
|
||||
", model=#{item.model}" +
|
||||
", owner=#{item.owner}" +
|
||||
", civil_code=#{item.civilCode}" +
|
||||
", block=#{item.block}" +
|
||||
", address=#{item.address}" +
|
||||
", parental=#{item.parental}" +
|
||||
", parent_id=#{item.parentId}" +
|
||||
", safety_way=#{item.safetyWay}" +
|
||||
", register_way=#{item.registerWay}" +
|
||||
", cert_num=#{item.certNum}" +
|
||||
", certifiable=#{item.certifiable}" +
|
||||
", err_code=#{item.errCode}" +
|
||||
", end_time=#{item.endTime}" +
|
||||
", secrecy=#{item.secrecy}" +
|
||||
", ip_address=#{item.ipAddress}" +
|
||||
", port=#{item.port}" +
|
||||
", password=#{item.password}" +
|
||||
", status=#{item.status}" +
|
||||
", longitude=#{item.longitude}" +
|
||||
", latitude=#{item.latitude}" +
|
||||
", ptz_type=#{item.ptzType}" +
|
||||
", position_type=#{item.positionType}" +
|
||||
", room_type=#{item.roomType}" +
|
||||
", use_type=#{item.useType}" +
|
||||
", supply_light_type=#{item.supplyLightType}" +
|
||||
", direction_type=#{item.directionType}" +
|
||||
", resolution=#{item.resolution}" +
|
||||
", business_group_id=#{item.businessGroupId}" +
|
||||
", download_speed=#{item.downloadSpeed}" +
|
||||
", svc_space_support_mod=#{item.svcSpaceSupportMod}" +
|
||||
", svc_time_support_mode=#{item.svcTimeSupportMode}" +
|
||||
", sub_count=#{item.subCount}" +
|
||||
", stream_id=#{item.streamId}" +
|
||||
", has_audio=#{item.hasAudio}" +
|
||||
", gps_time=#{item.gpsTime}" +
|
||||
", stream_identification=#{item.streamIdentification}" +
|
||||
", channel_type=#{item.channelType}" +
|
||||
" WHERE data_type = #{item.dataType} and data_device_id = #{item.dataDeviceId} and device_id=#{item.deviceId}" +
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int batchUpdateForNotify(List<DeviceChannel> updateChannels);
|
||||
|
||||
@Update(" update wvp_device_channel" +
|
||||
" set sub_count = (select *" +
|
||||
" from (select count(0)" +
|
||||
" from wvp_device_channel" +
|
||||
" where data_type = 1 and data_device_id = #{dataDeviceId} and parent_id = #{channelId}) as temp)" +
|
||||
" where data_type = 1 and data_device_id = #{dataDeviceId} and device_id = #{channelId}")
|
||||
int updateChannelSubCount(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET " +
|
||||
@ -374,6 +314,8 @@ public interface DeviceChannelMapper {
|
||||
" status,\n" +
|
||||
" longitude,\n" +
|
||||
" latitude,\n" +
|
||||
" gb_longitude,\n" +
|
||||
" gb_latitude,\n" +
|
||||
" ptz_type,\n" +
|
||||
" position_type,\n" +
|
||||
" room_type,\n" +
|
||||
@ -474,6 +416,8 @@ public interface DeviceChannelMapper {
|
||||
" status,\n" +
|
||||
" longitude,\n" +
|
||||
" latitude,\n" +
|
||||
" gb_longitude,\n" +
|
||||
" gb_latitude,\n" +
|
||||
" ptz_type,\n" +
|
||||
" position_type,\n" +
|
||||
" room_type,\n" +
|
||||
@ -529,6 +473,8 @@ public interface DeviceChannelMapper {
|
||||
" status,\n" +
|
||||
" longitude,\n" +
|
||||
" latitude,\n" +
|
||||
" gb_longitude,\n" +
|
||||
" gb_latitude,\n" +
|
||||
" ptz_type,\n" +
|
||||
" position_type,\n" +
|
||||
" room_type,\n" +
|
||||
@ -556,17 +502,10 @@ public interface DeviceChannelMapper {
|
||||
" </script>"})
|
||||
void changeAudio(@Param("channelId") int channelId, @Param("audio") boolean audio);
|
||||
|
||||
@Update("<script> " +
|
||||
"<foreach collection='gpsMsgInfoList' index='index' item='item' separator=';'> " +
|
||||
"UPDATE wvp_device_channel SET gb_longitude = #{item.lng}, gb_latitude=#{item.lat} WHERE id = #{item.channelId}" +
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList);
|
||||
|
||||
@Update("UPDATE wvp_device_channel SET status=#{status} WHERE data_type=#{dataType} and data_device_id=#{dataDeviceId} AND device_id=#{deviceId}")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
void updateStatus(DeviceChannel channel);
|
||||
|
||||
|
||||
@Update({"<script>" +
|
||||
" UPDATE" +
|
||||
" wvp_device_channel" +
|
||||
@ -595,6 +534,8 @@ public interface DeviceChannelMapper {
|
||||
", status=#{status}" +
|
||||
", longitude=#{longitude}" +
|
||||
", latitude=#{latitude}" +
|
||||
", gb_longitude=#{gbLongitude}" +
|
||||
", gb_latitude=#{gbLatitude}" +
|
||||
", ptz_type=#{ptzType}" +
|
||||
", position_type=#{positionType}" +
|
||||
", room_type=#{roomType}" +
|
||||
@ -652,6 +593,8 @@ public interface DeviceChannelMapper {
|
||||
" status,\n" +
|
||||
" longitude,\n" +
|
||||
" latitude,\n" +
|
||||
" gb_longitude,\n" +
|
||||
" gb_latitude,\n" +
|
||||
" ptz_type,\n" +
|
||||
" position_type,\n" +
|
||||
" room_type,\n" +
|
||||
@ -671,4 +614,5 @@ public interface DeviceChannelMapper {
|
||||
@Update(value = {"UPDATE wvp_device_channel SET status = 'OFF' WHERE data_type = 1 and data_device_id=#{deviceId}"})
|
||||
void offlineByDeviceId(@Param("deviceId") int deviceId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -459,4 +459,47 @@ public interface DeviceMapper {
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
void batchUpdate(List<Device> devices);
|
||||
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
"SELECT " +
|
||||
"coalesce(custom_name, name) as name, " +
|
||||
"id" +
|
||||
",device_id" +
|
||||
",manufacturer" +
|
||||
",model" +
|
||||
",firmware" +
|
||||
",transport" +
|
||||
",stream_mode" +
|
||||
",on_line" +
|
||||
",register_time" +
|
||||
",keepalive_time" +
|
||||
",ip" +
|
||||
",create_time" +
|
||||
",update_time" +
|
||||
",port" +
|
||||
",expires" +
|
||||
",subscribe_cycle_for_catalog" +
|
||||
",subscribe_cycle_for_mobile_position" +
|
||||
",mobile_position_submission_interval" +
|
||||
",subscribe_cycle_for_alarm" +
|
||||
",host_address" +
|
||||
",charset" +
|
||||
",ssrc_check" +
|
||||
",geo_coord_sys" +
|
||||
",media_server_id" +
|
||||
",sdp_ip" +
|
||||
",local_ip" +
|
||||
",password" +
|
||||
",as_message_channel" +
|
||||
",heart_beat_interval" +
|
||||
",heart_beat_count" +
|
||||
",position_capability" +
|
||||
",broadcast_push_after_ack" +
|
||||
",server_id" +
|
||||
" FROM wvp_device" +
|
||||
" WHERE device_id in"+
|
||||
"<foreach collection='deviceIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
" </script>"})
|
||||
List<Device> queryByDeviceIds(List<String> deviceIds);
|
||||
}
|
||||
|
||||
@ -4,21 +4,24 @@ import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.web.custom.bean.CameraCount;
|
||||
import com.genersoft.iot.vmp.web.custom.bean.CameraGroup;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Mapper
|
||||
public interface GroupMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_common_group (device_id, name, parent_id, parent_device_id, business_group, create_time, update_time, civil_code) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode})")
|
||||
@Insert("INSERT INTO wvp_common_group (device_id, name, parent_id, parent_device_id, business_group, create_time, update_time, civil_code, alias) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode}, #{alias})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int add(Group group);
|
||||
|
||||
@Insert("INSERT INTO wvp_common_group (device_id, name, business_group, create_time, update_time, civil_code) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode})")
|
||||
@Insert("INSERT INTO wvp_common_group (device_id, name, business_group, create_time, update_time, civil_code, alias) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode}, #{alias})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int addBusinessGroup(Group group);
|
||||
|
||||
@ -27,7 +30,8 @@ public interface GroupMapper {
|
||||
|
||||
@Update(" UPDATE wvp_common_group " +
|
||||
" SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_id=#{parentId}, " +
|
||||
" parent_device_id=#{parentDeviceId}, business_group=#{businessGroup}, civil_code=#{civilCode}" +
|
||||
" parent_device_id=#{parentDeviceId}, business_group=#{businessGroup}, civil_code=#{civilCode}, " +
|
||||
" alias=#{alias}" +
|
||||
" WHERE id = #{id}")
|
||||
int update(Group group);
|
||||
|
||||
@ -55,10 +59,12 @@ public interface GroupMapper {
|
||||
" business_group," +
|
||||
" create_time," +
|
||||
" civil_code," +
|
||||
" alias," +
|
||||
" update_time) " +
|
||||
" VALUES " +
|
||||
" <foreach collection='groupList' index='index' item='item' separator=','> " +
|
||||
" (#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.parentId}, #{item.businessGroup},#{item.createTime},#{item.civilCode},#{item.updateTime})" +
|
||||
" (#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.parentId}, #{item.businessGroup}," +
|
||||
"#{item.createTime},#{item.civilCode},#{item.alias},#{item.updateTime})" +
|
||||
" </foreach> " +
|
||||
" </script>")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
@ -105,6 +111,9 @@ public interface GroupMapper {
|
||||
@Select("SELECT * from wvp_common_group WHERE device_id = #{deviceId} and business_group = #{businessGroup}")
|
||||
Group queryOneByDeviceId(@Param("deviceId") String deviceId, @Param("businessGroup") String businessGroup);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE device_id = #{deviceId}")
|
||||
Group queryOneByOnlyDeviceId(@Param("deviceId") String deviceId);
|
||||
|
||||
@Delete("<script>" +
|
||||
" DELETE FROM wvp_common_group WHERE id in " +
|
||||
" <foreach collection='allChildren' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
@ -117,6 +126,10 @@ public interface GroupMapper {
|
||||
@Select("SELECT * from wvp_common_group WHERE business_group = #{businessGroup} ")
|
||||
List<Group> queryByBusinessGroup(@Param("businessGroup") String businessGroup);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE business_group = #{businessGroup}")
|
||||
@MapKey("id")
|
||||
Map<Integer, CameraGroup> queryByBusinessGroupForMap(@Param("businessGroup") String businessGroup);
|
||||
|
||||
@Delete("DELETE FROM wvp_common_group WHERE business_group = #{businessGroup}")
|
||||
int deleteByBusinessGroup(@Param("businessGroup") String businessGroup);
|
||||
|
||||
@ -200,6 +213,13 @@ public interface GroupMapper {
|
||||
" where w1.id in " +
|
||||
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "mysql")
|
||||
@Update(value = " <script>" +
|
||||
" update wvp_common_group w1 " +
|
||||
" inner join (select * from wvp_common_group ) w2 on w1.parent_device_id = w2.device_id " +
|
||||
" set w1.parent_id = w2.id" +
|
||||
" where w1.id in " +
|
||||
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "h2")
|
||||
@Update( value = " <script>" +
|
||||
" update wvp_common_group w1\n" +
|
||||
" set parent_id = w2.id\n" +
|
||||
@ -230,6 +250,18 @@ public interface GroupMapper {
|
||||
" where w1.id in " +
|
||||
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "mysql")
|
||||
@Update(value = " <script>" +
|
||||
" update wvp_common_group w1 " +
|
||||
" inner join (select * from wvp_common_group ) w2" +
|
||||
" on w1.parent_device_id is null" +
|
||||
" and w2.parent_device_id is null" +
|
||||
" and w2.device_id = w2.business_group " +
|
||||
" and w1.business_group = w2.device_id " +
|
||||
" and w1.device_id != w1.business_group " +
|
||||
" set w1.parent_id = w2.id" +
|
||||
" where w1.id in " +
|
||||
" <foreach collection='groupListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "h2")
|
||||
@Update( value = " <script>" +
|
||||
" update wvp_common_group w1 " +
|
||||
" set parent_id = w2.id " +
|
||||
@ -267,4 +299,25 @@ public interface GroupMapper {
|
||||
|
||||
@Delete("DELETE FROM wvp_platform_group WHERE group_id = #{groupId}")
|
||||
void deletePlatformGroup(@Param("groupId") int groupId);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE alias = #{alias} ")
|
||||
CameraGroup queryGroupByAlias(@Param("alias") String alias);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE alias = #{alias} and business_group = #{businessGroup}")
|
||||
Group queryGroupByAliasAndBusinessGroup(@Param("alias") String alias, @Param("deviceId") String businessGroup);
|
||||
|
||||
|
||||
@Select("<script>" +
|
||||
" SELECT " +
|
||||
" MIN(coalesce( wdc.gb_parent_id, wdc.parent_id)) as deviceId," +
|
||||
" COUNT(*) AS allCount," +
|
||||
" SUM(CASE WHEN coalesce( wdc.gb_status, wdc.status) = 'ON' THEN 1 ELSE 0 END) AS onlineCount" +
|
||||
" FROM " +
|
||||
" wvp_device_channel wdc " +
|
||||
" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
|
||||
" AND coalesce( wdc.gb_parent_id, wdc.parent_id) in " +
|
||||
" <foreach collection='groupList' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
|
||||
" GROUP BY coalesce(wdc.gb_parent_id, wdc.parent_id)" +
|
||||
"</script>")
|
||||
List<CameraCount> queryCountWithChild(List<CameraGroup> groupList);
|
||||
}
|
||||
|
||||
@ -114,6 +114,13 @@ public interface RegionMapper {
|
||||
" where w1.id in " +
|
||||
" <foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "mysql")
|
||||
@Update(value = " <script>" +
|
||||
" update wvp_common_region w1 " +
|
||||
" inner join (select * from wvp_common_region ) w2 on w1.parent_device_id = w2.device_id " +
|
||||
" set w1.parent_id = w2.id" +
|
||||
" where w1.id in " +
|
||||
" <foreach collection='regionListForAdd' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>", databaseId = "h2")
|
||||
@Update( value = " <script>" +
|
||||
" update wvp_common_region w1\n" +
|
||||
" set parent_id = w2.id\n" +
|
||||
|
||||
@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.gb28181.dao.provider;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.web.custom.bean.CameraGroup;
|
||||
import com.genersoft.iot.vmp.web.custom.bean.Point;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -18,6 +20,8 @@ public class ChannelProvider {
|
||||
" update_time,\n" +
|
||||
" stream_id,\n" +
|
||||
" record_plan_id,\n" +
|
||||
" enable_broadcast,\n" +
|
||||
" map_level,\n" +
|
||||
" coalesce(gb_device_id, device_id) as gb_device_id,\n" +
|
||||
" coalesce(gb_name, name) as gb_name,\n" +
|
||||
" coalesce(gb_manufacturer, manufacturer) as gb_manufacturer,\n" +
|
||||
@ -63,6 +67,7 @@ public class ChannelProvider {
|
||||
" wdc.update_time,\n" +
|
||||
" wdc.stream_id,\n" +
|
||||
" wdc.record_plan_id,\n" +
|
||||
" wdc.enable_broadcast,\n" +
|
||||
" coalesce(wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce(wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce(wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
@ -107,6 +112,7 @@ public class ChannelProvider {
|
||||
" wdc.data_device_id,\n" +
|
||||
" wdc.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" wdc.enable_broadcast,\n" +
|
||||
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce(wpgc.custom_name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce(wpgc.custom_manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
@ -145,6 +151,59 @@ public class ChannelProvider {
|
||||
" left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id"
|
||||
;
|
||||
|
||||
private final static String BASE_SQL_FOR_CAMERA_DEVICE =
|
||||
"select\n" +
|
||||
" wdc.id as gb_id,\n" +
|
||||
" wdc.data_type,\n" +
|
||||
" wdc.data_device_id,\n" +
|
||||
" wdc.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" wdc.stream_id,\n" +
|
||||
" wdc.record_plan_id,\n" +
|
||||
" wdc.enable_broadcast,\n" +
|
||||
" wd.device_id as deviceCode,\n" +
|
||||
" wcg.alias as groupAlias,\n" +
|
||||
" wcg2.alias as topGroupGAlias,\n" +
|
||||
" coalesce(wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce(wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce(wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce(wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||
" coalesce(wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||
" coalesce(wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
||||
" coalesce(wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||
" coalesce(wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||
" coalesce(wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||
" coalesce(wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||
" coalesce(wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||
" coalesce(wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||
" coalesce(wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||
" coalesce(wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||
" coalesce(wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||
" coalesce(wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||
" coalesce(wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||
" coalesce(wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||
" coalesce(wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||
" coalesce(wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||
" coalesce(wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||
" coalesce(wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||
" coalesce(wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||
" coalesce(wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||
" coalesce(wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||
" coalesce(wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||
" coalesce(wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||
" coalesce(wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce(wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||
" coalesce(wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||
" coalesce(wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||
" coalesce(wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||
" coalesce(wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" coalesce(wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
|
||||
" from wvp_device_channel wdc\n" +
|
||||
" left join wvp_device wd on wdc.data_type = 1 AND wd.id = wdc.data_device_id" +
|
||||
" left join wvp_common_group wcg on wcg.device_id = coalesce(wdc.gb_parent_id, wdc.parent_id)" +
|
||||
" left join wvp_common_group wcg2 on wcg2.device_id = wcg.business_group"
|
||||
;
|
||||
|
||||
public String queryByDeviceId(Map<String, Object> params ){
|
||||
return BASE_SQL + " where channel_type = 0 and coalesce(gb_device_id, device_id) = #{gbDeviceId}";
|
||||
}
|
||||
@ -230,6 +289,12 @@ public class ChannelProvider {
|
||||
if (params.get("dataType") != null) {
|
||||
sqlBuild.append(" AND data_type = #{dataType}");
|
||||
}
|
||||
if (params.get("civilCode") != null) {
|
||||
sqlBuild.append(" AND coalesce(gb_civil_code, civil_code) = #{civilCode}");
|
||||
}
|
||||
if (params.get("parentDeviceId") != null) {
|
||||
sqlBuild.append(" AND coalesce(gb_parent_id, parent_id) = #{parentDeviceId}");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
@ -269,7 +334,7 @@ public class ChannelProvider {
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryByGbDeviceIds(Map<String, Object> params ){
|
||||
public String queryByDataTypeAndDeviceIds(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append("where channel_type = 0 and data_type = #{dataType} and data_device_id in ( ");
|
||||
@ -287,6 +352,26 @@ public class ChannelProvider {
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryByGbDeviceIds(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append("where channel_type = 0 and coalesce(gb_device_id, device_id) in ( ");
|
||||
|
||||
Collection<String> ids = (Collection<String>)params.get("deviceIds");
|
||||
boolean first = true;
|
||||
for (String id : ids) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append("'");
|
||||
sqlBuild.append(id);
|
||||
sqlBuild.append("'");
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryByDeviceIds(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
@ -457,13 +542,39 @@ public class ChannelProvider {
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryOnlineListsByGbDeviceId(Map<String, Object> params ){
|
||||
public String queryCommonChannelByDeviceChannel(Map<String, Object> params ){
|
||||
return BASE_SQL +
|
||||
" where data_type=#{dataType} and data_device_id=#{dataDeviceId} AND device_id=#{deviceId}";
|
||||
}
|
||||
|
||||
public String queryCameraChannelInBox(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_TABLE_NAME);
|
||||
sqlBuild.append(" where wdc.channel_type = 0 AND coalesce(wdc.gb_status, wdc.status) = 'ON' AND wdc.data_type = 1 AND data_device_id = #{deviceId}");
|
||||
sqlBuild.append(" where wdc.channel_type = 0 AND coalesce(wdc.gb_longitude, wdc.longitude) > #{minLon} " +
|
||||
"AND coalesce(wdc.gb_longitude, wdc.longitude) <= #{maxLon} " +
|
||||
"AND coalesce(wdc.gb_latitude, wdc.latitude) > #{minLat} " +
|
||||
"AND coalesce(wdc.gb_latitude, wdc.latitude) <= #{maxLat}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryOldChanelListByChannels(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append(" where id in ( ");
|
||||
|
||||
List<CommonGBChannel> channelList = (List<CommonGBChannel>)params.get("channelList");
|
||||
boolean first = true;
|
||||
for (CommonGBChannel channel : channelList) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(channel.getGbId());
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryAllForUnusualCivilCode(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append("select wdc.id from wvp_device_channel wdc ");
|
||||
@ -481,4 +592,363 @@ public class ChannelProvider {
|
||||
sqlBuild.append(" AND wdc.channel_type = 0 ");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryOnlineListsByGbDeviceId(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_TABLE_NAME);
|
||||
sqlBuild.append(" where wdc.channel_type = 0 AND coalesce(wdc.gb_status, wdc.status) = 'ON' AND wdc.data_type = 1 AND data_device_id = #{deviceId}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryListForSy(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) AND coalesce(wdc.gb_parent_id, wdc.parent_id) = #{groupDeviceId}");
|
||||
if (params.get("online") != null && (Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(wdc.gb_status, wdc.status) = 'ON'");
|
||||
}
|
||||
if (params.get("online") != null && !(Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(wdc.gb_status, wdc.status) = 'OFF'");
|
||||
}
|
||||
sqlBuild.append(" order by coalesce(wdc.gb_status, wdc.status) desc");
|
||||
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryListWithChildForSy(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) ");
|
||||
|
||||
|
||||
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
|
||||
if (groupList != null && !groupList.isEmpty()) {
|
||||
sqlBuild.append(" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
|
||||
boolean first = true;
|
||||
for (CameraGroup group : groupList) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append("'" + group.getDeviceId() + "'");
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
}
|
||||
if (params.get("query") != null) {
|
||||
sqlBuild.append(" AND (coalesce(wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') escape '/'" +
|
||||
" OR coalesce(wdc.gb_name, wdc.name) LIKE concat('%',#{query},'%') escape '/' )")
|
||||
;
|
||||
}
|
||||
|
||||
if (params.get("online") != null && (Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(wdc.gb_status, status) = 'ON'");
|
||||
}
|
||||
if (params.get("online") != null && !(Boolean)params.get("online")) {
|
||||
sqlBuild.append(" AND coalesce(wdc.gb_status, status) = 'OFF'");
|
||||
}
|
||||
|
||||
if (params.get("sortName") != null) {
|
||||
StringBuilder sqlBuildForSort = new StringBuilder();
|
||||
sqlBuildForSort.append("select * from ( ");
|
||||
sqlBuildForSort.append(sqlBuild);
|
||||
sqlBuildForSort.append(" ) as temp");
|
||||
String sortName = (String)params.get("sortName");
|
||||
switch (sortName) {
|
||||
case "gbId":
|
||||
sqlBuildForSort.append(" order by gb_id ");
|
||||
break;
|
||||
case "gbDeviceId":
|
||||
sqlBuildForSort.append(" order by gb_device_id ");
|
||||
break;
|
||||
case "gbName":
|
||||
sqlBuildForSort.append(" order by gb_name ");
|
||||
break;
|
||||
case "gbStatus":
|
||||
sqlBuildForSort.append(" order by gb_status ");
|
||||
break;
|
||||
case "createTime":
|
||||
sqlBuildForSort.append(" order by create_time ");
|
||||
break;
|
||||
case "updateTime":
|
||||
sqlBuildForSort.append(" order by update_time ");
|
||||
break;
|
||||
case "deviceCode":
|
||||
sqlBuildForSort.append(" order by deviceCode ");
|
||||
break;
|
||||
}
|
||||
|
||||
if (params.get("order") != null && (Boolean)params.get("order")) {
|
||||
sqlBuildForSort.append(" ASC");
|
||||
}
|
||||
if (params.get("order") != null && !(Boolean)params.get("order")) {
|
||||
sqlBuildForSort.append(" DESC");
|
||||
}
|
||||
return sqlBuildForSort.toString();
|
||||
}else {
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public String queryListInBox(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
|
||||
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
|
||||
|
||||
sqlBuild.append(" ");
|
||||
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
|
||||
boolean first = true;
|
||||
for (CameraGroup group : groupList) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append("'" + group.getDeviceId() + "'");
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
|
||||
sqlBuild.append(" AND coalesce(wdc.gb_longitude, wdc.longitude) >= #{minLongitude} AND coalesce(wdc.gb_longitude, wdc.longitude) <= #{maxLongitude}");
|
||||
sqlBuild.append(" AND coalesce(wdc.gb_latitude, wdc.latitude) >= #{minLatitude} AND coalesce(wdc.gb_latitude, wdc.latitude) <= #{maxLatitude}");
|
||||
|
||||
if (params.get("level") != null) {
|
||||
sqlBuild.append(" AND ( map_level <= #{level} or map_level is null )");
|
||||
}
|
||||
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryListInCircleForMysql(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
|
||||
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
|
||||
|
||||
sqlBuild.append(" ");
|
||||
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
|
||||
boolean first = true;
|
||||
for (CameraGroup group : groupList) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append("'" + group.getDeviceId() + "'");
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
|
||||
String geomTextBuilder = "point(" + params.get("centerLongitude") + " " + params.get("centerLatitude") + ")";
|
||||
|
||||
sqlBuild.append("AND ST_Distance_Sphere(point(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText('").append(geomTextBuilder).append("')) < #{radius}");
|
||||
|
||||
if (params.get("level") != null) {
|
||||
sqlBuild.append(" AND ( map_level <= #{level} or map_level is null )");
|
||||
}
|
||||
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryListInCircleForKingBase(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
|
||||
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
|
||||
|
||||
sqlBuild.append(" ");
|
||||
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
|
||||
boolean first = true;
|
||||
for (CameraGroup group : groupList) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append("'" + group.getDeviceId() + "'");
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
|
||||
String geomTextBuilder = "point(" + params.get("centerLongitude") + " " + params.get("centerLatitude") + ")";
|
||||
|
||||
sqlBuild.append("AND ST_DistanceSphere(ST_MakePoint(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText('").append(geomTextBuilder).append("')) < #{radius}");
|
||||
|
||||
if (params.get("level") != null) {
|
||||
sqlBuild.append(" AND ( map_level <= #{level} or map_level is null )");
|
||||
}
|
||||
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryListInPolygonForMysql(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
|
||||
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
|
||||
|
||||
sqlBuild.append(" ");
|
||||
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
|
||||
boolean first = true;
|
||||
for (CameraGroup group : groupList) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append("'" + group.getDeviceId() + "'");
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
|
||||
StringBuilder geomTextBuilder = new StringBuilder();
|
||||
geomTextBuilder.append("POLYGON((");
|
||||
List<Point> pointList = (List<Point>)params.get("pointList");
|
||||
for (int i = 0; i < pointList.size(); i++) {
|
||||
if (i > 0) {
|
||||
geomTextBuilder.append(", ");
|
||||
}
|
||||
Point point = pointList.get(i);
|
||||
geomTextBuilder.append(point.getLng()).append(" ").append(point.getLat());
|
||||
}
|
||||
geomTextBuilder.append("))");
|
||||
sqlBuild.append("AND ST_Within(point(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText('").append(geomTextBuilder).append("'))");
|
||||
|
||||
if (params.get("level") != null) {
|
||||
sqlBuild.append(" AND ( map_level <= #{level} or map_level is null )");
|
||||
}
|
||||
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryListInPolygonForKingBase(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where wdc.channel_type = 0 AND wdc.data_type != 2 AND (wdc.gb_ptz_type is null or ( wdc.gb_ptz_type != 98 AND wdc.gb_ptz_type != 99)) " +
|
||||
" AND coalesce(wdc.gb_parent_id, wdc.parent_id) in (");
|
||||
|
||||
sqlBuild.append(" ");
|
||||
List<CameraGroup> groupList = (List<CameraGroup>)params.get("groupList");
|
||||
boolean first = true;
|
||||
for (CameraGroup group : groupList) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append("'" + group.getDeviceId() + "'");
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
|
||||
StringBuilder geomTextBuilder = new StringBuilder();
|
||||
geomTextBuilder.append("POLYGON((");
|
||||
List<Point> pointList = (List<Point>)params.get("pointList");
|
||||
for (int i = 0; i < pointList.size(); i++) {
|
||||
if (i > 0) {
|
||||
geomTextBuilder.append(", ");
|
||||
}
|
||||
Point point = pointList.get(i);
|
||||
geomTextBuilder.append(point.getLng()).append(" ").append(point.getLat());
|
||||
}
|
||||
geomTextBuilder.append("))");
|
||||
sqlBuild.append("AND ST_Within(ST_MakePoint(coalesce(wdc.gb_longitude, wdc.longitude), coalesce(wdc.gb_latitude, wdc.latitude)), ST_GeomFromText('").append(geomTextBuilder).append("'))");
|
||||
|
||||
if (params.get("level") != null) {
|
||||
sqlBuild.append(" AND ( map_level <= #{level} or map_level is null )");
|
||||
}
|
||||
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryGbChannelByChannelDeviceIdAndGbDeviceId(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where coalesce(wdc.gb_device_id, wdc.device_id) = #{channelDeviceId}");
|
||||
if (params.get("gbDeviceId") != null) {
|
||||
sqlBuild.append(" AND wdc.data_type = 1 and wd.device_id = #{gbDeviceId}");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryListByAddressAndDirectionType(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where coalesce(wdc.gb_address, wdc.address) = #{address}");
|
||||
if (params.get("directionType") != null) {
|
||||
sqlBuild.append(" and coalesce(wdc.gb_direction_type, wdc.direction_type) = #{directionType}");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
|
||||
public String queryListByDeviceIds(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append("<script> ");
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where coalesce(wdc.gb_device_id, wdc.device_id) in ");
|
||||
sqlBuild.append(" <foreach item='item' index='index' collection='deviceIds' open='(' separator=',' close=')'> #{item} </foreach>");
|
||||
sqlBuild.append(" </script>");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryCameraChannelByIds(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" where wdc.id in ( ");
|
||||
|
||||
List<CommonGBChannel> channelList = (List<CommonGBChannel>)params.get("channelList");
|
||||
boolean first = true;
|
||||
for (CommonGBChannel channel : channelList) {
|
||||
if (!first) {
|
||||
sqlBuild.append(",");
|
||||
}
|
||||
sqlBuild.append(channel.getGbId());
|
||||
first = false;
|
||||
}
|
||||
sqlBuild.append(" )");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
public String queryListForSyMobile(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" WHERE wdc.gb_ptz_type = 99 and wdc.channel_type = 0 AND wdc.data_type != 2 ");
|
||||
if (params.get("business") != null) {
|
||||
sqlBuild.append(" AND coalesce(gb_business_group_id, business_group_id) = #{business}");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryMeetingChannelList(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
|
||||
sqlBuild.append(" WHERE wdc.channel_type = 0 AND wdc.data_type = 3 and wdc.gb_ptz_type = 98 and coalesce(wdc.gb_business_group_id, wdc.business_group_id) = #{business}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
|
||||
public String queryCameraChannelById(Map<String, Object> params ){
|
||||
return BASE_SQL_FOR_CAMERA_DEVICE + " where wdc.id = #{gbId}";
|
||||
}
|
||||
|
||||
public String queryAllWithPosition(Map<String, Object> params ){
|
||||
return BASE_SQL + " where channel_type = 0 " +
|
||||
" AND coalesce(gb_longitude, longitude) > 0" +
|
||||
" AND coalesce(gb_latitude, latitude) > 0";
|
||||
}
|
||||
|
||||
public String queryListInExtent(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append(" where channel_type = 0 " +
|
||||
"AND coalesce(gb_longitude, longitude) > #{minLng} " +
|
||||
"AND coalesce(gb_longitude, longitude) <= #{maxLng} " +
|
||||
"AND coalesce(gb_latitude, latitude) > #{minLat} " +
|
||||
"AND coalesce(gb_latitude, latitude) <= #{maxLat}");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
public String queryListOutExtent(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(BASE_SQL);
|
||||
sqlBuild.append(" where channel_type = 0 AND ( " +
|
||||
"coalesce(gb_longitude, longitude) <= #{minLng} " +
|
||||
"or coalesce(gb_longitude, longitude) > #{maxLng} " +
|
||||
"or coalesce(gb_latitude, latitude) <= #{minLat} " +
|
||||
"or coalesce(gb_latitude, latitude) > #{maxLat}" +
|
||||
")");
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.channel.ChannelEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition.MobilePositionEvent;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
@ -17,10 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @description:Event事件通知推送器,支持推送在线事件、离线事件
|
||||
@ -62,11 +60,27 @@ public class EventPublisher {
|
||||
applicationEventPublisher.publishEvent(outEvent);
|
||||
}
|
||||
|
||||
public void channelEventPublish(CommonGBChannel commonGBChannel, ChannelEvent.ChannelEventMessageType type) {
|
||||
channelEventPublish(Collections.singletonList(commonGBChannel), type);
|
||||
}
|
||||
|
||||
public void channelEventPublishForUpdate(CommonGBChannel commonGBChannel, CommonGBChannel deviceChannelForOld) {
|
||||
ChannelEvent channelEvent = ChannelEvent.getInstanceForUpdate(this, Collections.singletonList(commonGBChannel), Collections.singletonList(deviceChannelForOld));
|
||||
applicationEventPublisher.publishEvent(channelEvent);
|
||||
}
|
||||
|
||||
public void channelEventPublishForUpdate(List<CommonGBChannel> channelList, List<CommonGBChannel> channelListForOld) {
|
||||
ChannelEvent channelEvent = ChannelEvent.getInstanceForUpdate(this, channelList, channelListForOld);
|
||||
applicationEventPublisher.publishEvent(channelEvent);
|
||||
}
|
||||
|
||||
public void channelEventPublish(List<CommonGBChannel> channelList, ChannelEvent.ChannelEventMessageType type) {
|
||||
ChannelEvent channelEvent = ChannelEvent.getInstance(this, type, channelList);
|
||||
applicationEventPublisher.publishEvent(channelEvent);
|
||||
}
|
||||
|
||||
public void catalogEventPublish(Platform platform, CommonGBChannel deviceChannel, String type) {
|
||||
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
||||
deviceChannelList.add(deviceChannel);
|
||||
catalogEventPublish(platform, deviceChannelList, type);
|
||||
catalogEventPublish(platform, Collections.singletonList(deviceChannel), type);
|
||||
}
|
||||
public void catalogEventPublish(Platform platform, List<CommonGBChannel> deviceChannels, String type) {
|
||||
if (platform != null && !userSetting.getServerId().equals(platform.getServerId())) {
|
||||
|
||||
@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.gb28181.event.alarm;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* @description: 报警事件
|
||||
* @author: lawrencehj
|
||||
@ -10,9 +12,8 @@ import org.springframework.context.ApplicationEvent;
|
||||
*/
|
||||
|
||||
public class AlarmEvent extends ApplicationEvent {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AlarmEvent(Object source) {
|
||||
@ -24,7 +25,7 @@ public class AlarmEvent extends ApplicationEvent {
|
||||
public DeviceAlarm getAlarmInfo() {
|
||||
return deviceAlarm;
|
||||
}
|
||||
|
||||
|
||||
public void setAlarmInfo(DeviceAlarm deviceAlarm) {
|
||||
this.deviceAlarm = deviceAlarm;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 报警事件监听器.
|
||||
|
||||
53
src/main/java/com/genersoft/iot/vmp/gb28181/event/channel/ChannelEvent.java
Executable file
53
src/main/java/com/genersoft/iot/vmp/gb28181/event/channel/ChannelEvent.java
Executable file
@ -0,0 +1,53 @@
|
||||
package com.genersoft.iot.vmp.gb28181.event.channel;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通道事件
|
||||
*/
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public class ChannelEvent extends ApplicationEvent {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ChannelEvent(Object source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
private List<CommonGBChannel> channels;
|
||||
|
||||
private List<CommonGBChannel> oldChannels;
|
||||
|
||||
private ChannelEventMessageType messageType;
|
||||
|
||||
|
||||
|
||||
public enum ChannelEventMessageType {
|
||||
ADD, UPDATE, DEL, ON, OFF, VLOST, DEFECT
|
||||
}
|
||||
|
||||
public static ChannelEvent getInstance(Object source, ChannelEventMessageType messageType, List<CommonGBChannel> channelList) {
|
||||
ChannelEvent channelEvent = new ChannelEvent(source);
|
||||
channelEvent.setMessageType(messageType);
|
||||
channelEvent.setChannels(channelList);
|
||||
return channelEvent;
|
||||
}
|
||||
|
||||
public static ChannelEvent getInstanceForUpdate(Object source, List<CommonGBChannel> channelList, List<CommonGBChannel> channelListForOld) {
|
||||
ChannelEvent channelEvent = new ChannelEvent(source);
|
||||
channelEvent.setMessageType(ChannelEventMessageType.UPDATE);
|
||||
channelEvent.setChannels(channelList);
|
||||
channelEvent.setOldChannels(channelListForOld);
|
||||
return channelEvent;
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,6 +5,8 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* @description: 录像查询结束时间
|
||||
* @author: pan
|
||||
@ -13,9 +15,8 @@ import org.springframework.context.ApplicationEvent;
|
||||
@Setter
|
||||
@Getter
|
||||
public class RecordInfoEndEvent extends ApplicationEvent {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RecordInfoEndEvent(Object source) {
|
||||
|
||||
@ -5,6 +5,8 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* @description: 录像查询结束时间
|
||||
* @author: pan
|
||||
@ -14,9 +16,8 @@ import org.springframework.context.ApplicationEvent;
|
||||
@Setter
|
||||
@Getter
|
||||
public class RecordInfoEvent extends ApplicationEvent {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RecordInfoEvent(Object source) {
|
||||
|
||||
@ -11,7 +11,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
@ -25,7 +24,7 @@ import java.util.Map;
|
||||
* catalog事件
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
//@Component
|
||||
public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||
|
||||
@Autowired
|
||||
|
||||
@ -2,14 +2,13 @@ package com.genersoft.iot.vmp.gb28181.service;
|
||||
|
||||
import com.genersoft.iot.vmp.common.enums.DeviceControlType;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
||||
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dom4j.Element;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -29,28 +28,6 @@ public interface IDeviceChannelService {
|
||||
*/
|
||||
ResourceBaseInfo getOverview();
|
||||
|
||||
/**
|
||||
* 查询所有未分配的通道
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
List<ChannelReduce> queryAllChannelList(String platformId);
|
||||
|
||||
PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId);
|
||||
|
||||
/**
|
||||
* 查询通道所属的设备
|
||||
*/
|
||||
List<Device> getDeviceByChannelId(String channelId);
|
||||
|
||||
/**
|
||||
* 批量删除通道
|
||||
* @param deleteChannelList 待删除的通道列表
|
||||
*/
|
||||
int deleteChannelsForNotify(List<DeviceChannel> deleteChannelList);
|
||||
|
||||
int updateChannelsStatus(List<DeviceChannel> channels);
|
||||
|
||||
/**
|
||||
* 获取一个通道
|
||||
*/
|
||||
@ -58,16 +35,6 @@ public interface IDeviceChannelService {
|
||||
|
||||
DeviceChannel getOneForSource(String deviceId, String channelId);
|
||||
|
||||
/**
|
||||
* 直接批量更新通道
|
||||
*/
|
||||
void batchUpdateChannelForNotify(List<DeviceChannel> channels);
|
||||
|
||||
/**
|
||||
* 直接批量添加
|
||||
*/
|
||||
void batchAddChannel(List<DeviceChannel> deviceChannels);
|
||||
|
||||
/**
|
||||
* 修改通道的码流类型
|
||||
*/
|
||||
@ -81,15 +48,11 @@ public interface IDeviceChannelService {
|
||||
|
||||
void stopPlay(Integer channelId);
|
||||
|
||||
void batchUpdateChannelGPS(List<DeviceChannel> channelList);
|
||||
|
||||
void batchAddMobilePosition(List<MobilePosition> addMobilePositionList);
|
||||
|
||||
void online(DeviceChannel channel);
|
||||
|
||||
void offline(DeviceChannel channel);
|
||||
|
||||
void delete(DeviceChannel channel);
|
||||
void deleteForNotify(DeviceChannel channel);
|
||||
|
||||
void cleanChannelsForDevice(int deviceId);
|
||||
|
||||
@ -115,7 +78,7 @@ public interface IDeviceChannelService {
|
||||
|
||||
void changeAudio(Integer channelId, Boolean audio);
|
||||
|
||||
void updateChannelStatus(DeviceChannel channel);
|
||||
void updateChannelStatusForNotify(DeviceChannel channel);
|
||||
|
||||
void addChannel(DeviceChannel channel);
|
||||
|
||||
@ -125,8 +88,6 @@ public interface IDeviceChannelService {
|
||||
|
||||
DeviceChannel getOneBySourceId(int deviceDbId, String channelId);
|
||||
|
||||
List<DeviceChannel> queryChaneListByDeviceDbId(Integer deviceDbId);
|
||||
|
||||
List<Integer> queryChaneIdListByDeviceDbIds(List<Integer> deviceDbId);
|
||||
|
||||
void handlePtzCmd(@NotNull Integer dataDeviceId, @NotNull Integer gbId, Element rootElement, DeviceControlType type, ErrorCallback<String> callback);
|
||||
|
||||
@ -21,7 +21,7 @@ public interface IGbChannelPlayService {
|
||||
void download(CommonGBChannel channel, Long startTime, Long stopTime, Integer downloadSpeed,
|
||||
ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlay(CommonGBChannel channel, String stream);
|
||||
void stopPlay(CommonGBChannel channel);
|
||||
|
||||
void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.Extent;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IGbChannelService {
|
||||
|
||||
@ -40,7 +42,7 @@ public interface IGbChannelService {
|
||||
|
||||
List<NetworkIdentificationType> getNetworkIdentificationTypeList();
|
||||
|
||||
void reset(int id);
|
||||
void reset(int id, List<String> chanelFields);
|
||||
|
||||
PageInfo<CommonGBChannel> queryListByCivilCode(int page, int count, String query, Boolean online, Integer channelType, String civilCode);
|
||||
|
||||
@ -84,7 +86,7 @@ public interface IGbChannelService {
|
||||
|
||||
List<CommonGBChannel> queryListByStreamPushList(List<StreamPush> streamPushList);
|
||||
|
||||
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType);
|
||||
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType, String civilCode, String parentDeviceId);
|
||||
|
||||
PageInfo<CommonGBChannel> queryListByCivilCodeForUnusual(int page, int count, String query, Boolean online, Integer channelType);
|
||||
|
||||
@ -97,4 +99,18 @@ public interface IGbChannelService {
|
||||
void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList);
|
||||
|
||||
void updateGPS(List<CommonGBChannel> channelList);
|
||||
|
||||
List<CommonGBChannel> queryListForMap(String query, Boolean online, Boolean hasRecordPlan, Integer channelType);
|
||||
|
||||
CommonGBChannel queryCommonChannelByDeviceChannel(DeviceChannel channel);
|
||||
|
||||
void resetLevel();
|
||||
|
||||
byte[] getTile(int z, int x, int y, String geoCoordSys);
|
||||
|
||||
String drawThin(Map<Integer, Double> zoomParam, Extent extent, String geoCoordSys);
|
||||
|
||||
DrawThinProcess thinProgress(String id);
|
||||
|
||||
void saveThin(String id);
|
||||
}
|
||||
|
||||
@ -11,14 +11,14 @@ public interface IGroupService {
|
||||
|
||||
void add(Group group);
|
||||
|
||||
List<Group> queryAllChildren(Integer id);
|
||||
|
||||
void update(Group group);
|
||||
|
||||
Group queryGroupByDeviceId(String regionDeviceId);
|
||||
|
||||
List<GroupTree> queryForTree(String query, Integer parent, Boolean hasChannel);
|
||||
|
||||
void syncFromChannel();
|
||||
|
||||
boolean delete(int id);
|
||||
|
||||
boolean batchAdd(List<Group> groupList);
|
||||
@ -26,4 +26,9 @@ public interface IGroupService {
|
||||
List<Group> getPath(String deviceId, String businessGroup);
|
||||
|
||||
PageInfo<Group> queryList(Integer page, Integer count, String query);
|
||||
|
||||
Group queryGroupByAlias(String groupAlias);
|
||||
|
||||
void sync();
|
||||
|
||||
}
|
||||
|
||||
@ -72,6 +72,8 @@ public interface IPlayService {
|
||||
|
||||
void play(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlay(InviteSessionType inviteSessionType, CommonGBChannel channel);
|
||||
|
||||
void stop(InviteSessionType inviteSessionType, CommonGBChannel channel, String stream);
|
||||
|
||||
void playBack(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
@ -12,6 +12,6 @@ public interface ISourcePlayService {
|
||||
|
||||
void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback);
|
||||
|
||||
void stopPlay(CommonGBChannel channel, String stream);
|
||||
void stopPlay(CommonGBChannel channel);
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.InviteInfo;
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
@ -8,7 +7,6 @@ import com.genersoft.iot.vmp.common.enums.DeviceControlType;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.DeviceMobilePositionMapper;
|
||||
@ -24,12 +22,14 @@ import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcPlayService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.utils.Coordtransform;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
||||
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dom4j.Element;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -43,7 +43,6 @@ import org.springframework.util.ObjectUtils;
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
import javax.sip.message.Response;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -209,66 +208,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
return new ResourceBaseInfo(total, online);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ChannelReduce> queryAllChannelList(String platformId) {
|
||||
return channelMapper.queryChannelListInAll(null, null, null, platformId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId) {
|
||||
PageHelper.startPage(page, count);
|
||||
List<ChannelReduce> all = channelMapper.queryChannelListInAll(query, online, channelType, platformId, catalogId);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Device> getDeviceByChannelId(String channelId) {
|
||||
return channelMapper.getDeviceByChannelDeviceId(channelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteChannelsForNotify(List<DeviceChannel> channels) {
|
||||
int limitCount = 1000;
|
||||
int result = 0;
|
||||
if (!channels.isEmpty()) {
|
||||
if (channels.size() > limitCount) {
|
||||
for (int i = 0; i < channels.size(); i += limitCount) {
|
||||
int toIndex = i + limitCount;
|
||||
if (i + limitCount > channels.size()) {
|
||||
toIndex = channels.size();
|
||||
}
|
||||
result += channelMapper.batchDel(channels.subList(i, toIndex));
|
||||
}
|
||||
}else {
|
||||
result += channelMapper.batchDel(channels);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateChannelsStatus(List<DeviceChannel> channels) {
|
||||
int limitCount = 1000;
|
||||
int result = 0;
|
||||
if (!channels.isEmpty()) {
|
||||
if (channels.size() > limitCount) {
|
||||
for (int i = 0; i < channels.size(); i += limitCount) {
|
||||
int toIndex = i + limitCount;
|
||||
if (i + limitCount > channels.size()) {
|
||||
toIndex = channels.size();
|
||||
}
|
||||
result += channelMapper.batchUpdateStatus(channels.subList(i, toIndex));
|
||||
}
|
||||
}else {
|
||||
result += channelMapper.batchUpdateStatus(channels);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void online(DeviceChannel channel) {
|
||||
channelMapper.online(channel.getId());
|
||||
@ -280,8 +219,8 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(DeviceChannel channel) {
|
||||
channelMapper.del(channel.getId());
|
||||
public void deleteForNotify(DeviceChannel channel) {
|
||||
channelMapper.deleteForNotify(channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -312,58 +251,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
return channelMapper.getOneBySourceChannelId(deviceDbId, channelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public synchronized void batchUpdateChannelForNotify(List<DeviceChannel> channels) {
|
||||
String now = DateUtil.getNow();
|
||||
for (DeviceChannel channel : channels) {
|
||||
channel.setUpdateTime(now);
|
||||
}
|
||||
int limitCount = 1000;
|
||||
if (!channels.isEmpty()) {
|
||||
if (channels.size() > limitCount) {
|
||||
for (int i = 0; i < channels.size(); i += limitCount) {
|
||||
int toIndex = i + limitCount;
|
||||
if (i + limitCount > channels.size()) {
|
||||
toIndex = channels.size();
|
||||
}
|
||||
channelMapper.batchUpdateForNotify(channels.subList(i, toIndex));
|
||||
}
|
||||
}else {
|
||||
channelMapper.batchUpdateForNotify(channels);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void batchAddChannel(List<DeviceChannel> channels) {
|
||||
String now = DateUtil.getNow();
|
||||
for (DeviceChannel channel : channels) {
|
||||
channel.setUpdateTime(now);
|
||||
channel.setCreateTime(now);
|
||||
}
|
||||
int limitCount = 1000;
|
||||
if (!channels.isEmpty()) {
|
||||
if (channels.size() > limitCount) {
|
||||
for (int i = 0; i < channels.size(); i += limitCount) {
|
||||
int toIndex = i + limitCount;
|
||||
if (i + limitCount > channels.size()) {
|
||||
toIndex = channels.size();
|
||||
}
|
||||
channelMapper.batchAdd(channels.subList(i, toIndex));
|
||||
}
|
||||
}else {
|
||||
channelMapper.batchAdd(channels);
|
||||
}
|
||||
}
|
||||
for (DeviceChannel channel : channels) {
|
||||
if (channel.getParentId() != null) {
|
||||
channelMapper.updateChannelSubCount(channel.getDataDeviceId(), channel.getParentId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateChannelStreamIdentification(DeviceChannel channel) {
|
||||
Assert.hasLength(channel.getStreamIdentification(), "码流标识必须存在");
|
||||
@ -389,11 +276,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
return channelMapper.queryChannelsByDeviceDbId(device.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceChannel> queryChaneListByDeviceDbId(Integer deviceDbId) {
|
||||
return channelMapper.queryChannelsByDeviceDbId(deviceDbId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> queryChaneIdListByDeviceDbIds(List<Integer> deviceDbIds) {
|
||||
return channelMapper.queryChaneIdListByDeviceDbIds(deviceDbIds);
|
||||
@ -434,6 +316,17 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
|
||||
@Override
|
||||
public void updateChannelGPS(Device device, DeviceChannel deviceChannel, MobilePosition mobilePosition) {
|
||||
|
||||
if (device.getGeoCoordSys().equalsIgnoreCase("GCJ02")) {
|
||||
Double[] wgs84Position = Coordtransform.GCJ02ToWGS84(mobilePosition.getLongitude(), mobilePosition.getLatitude());
|
||||
mobilePosition.setLongitude(wgs84Position[0]);
|
||||
mobilePosition.setLatitude(wgs84Position[1]);
|
||||
|
||||
Double[] wgs84PositionForChannel = Coordtransform.GCJ02ToWGS84(deviceChannel.getLongitude(), deviceChannel.getLatitude());
|
||||
deviceChannel.setGbLongitude(wgs84PositionForChannel[0]);
|
||||
deviceChannel.setGbLatitude(wgs84PositionForChannel[1]);
|
||||
}
|
||||
|
||||
if (userSetting.getSavePositionHistory()) {
|
||||
deviceMobilePositionMapper.insertNewPosition(mobilePosition);
|
||||
}
|
||||
@ -468,22 +361,12 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
for (DeviceChannel channel : deviceChannels) {
|
||||
// 向关联了该通道并且开启移动位置订阅的上级平台发送移动位置订阅消息
|
||||
mobilePosition.setChannelId(channel.getId());
|
||||
mobilePosition.setChannelDeviceId(channel.getDeviceId());
|
||||
try {
|
||||
eventPublisher.mobilePositionEventPublish(mobilePosition);
|
||||
}catch (Exception e) {
|
||||
log.error("[向上级转发移动位置失败] ", e);
|
||||
}
|
||||
// 发送redis消息。 通知位置信息的变化
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime()));
|
||||
jsonObject.put("serial", mobilePosition.getDeviceId());
|
||||
jsonObject.put("code", channel.getDeviceId());
|
||||
jsonObject.put("longitude", mobilePosition.getLongitude());
|
||||
jsonObject.put("latitude", mobilePosition.getLatitude());
|
||||
jsonObject.put("altitude", mobilePosition.getAltitude());
|
||||
jsonObject.put("direction", mobilePosition.getDirection());
|
||||
jsonObject.put("speed", mobilePosition.getSpeed());
|
||||
redisCatchStorage.sendMobilePositionMsg(jsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
@ -497,49 +380,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
channelMapper.stopPlayById(channelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void batchUpdateChannelGPS(List<DeviceChannel> channelList) {
|
||||
for (DeviceChannel deviceChannel : channelList) {
|
||||
deviceChannel.setUpdateTime(DateUtil.getNow());
|
||||
if (deviceChannel.getGpsTime() == null) {
|
||||
deviceChannel.setGpsTime(DateUtil.getNow());
|
||||
}
|
||||
}
|
||||
int count = 1000;
|
||||
if (channelList.size() > count) {
|
||||
for (int i = 0; i < channelList.size(); i+=count) {
|
||||
int toIndex = i+count;
|
||||
if ( i + count > channelList.size()) {
|
||||
toIndex = channelList.size();
|
||||
}
|
||||
List<DeviceChannel> channels = channelList.subList(i, toIndex);
|
||||
channelMapper.batchUpdatePosition(channels);
|
||||
}
|
||||
}else {
|
||||
channelMapper.batchUpdatePosition(channelList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void batchAddMobilePosition(List<MobilePosition> mobilePositions) {
|
||||
// int count = 500;
|
||||
// if (mobilePositions.size() > count) {
|
||||
// for (int i = 0; i < mobilePositions.size(); i+=count) {
|
||||
// int toIndex = i+count;
|
||||
// if ( i + count > mobilePositions.size()) {
|
||||
// toIndex = mobilePositions.size();
|
||||
// }
|
||||
// List<MobilePosition> mobilePositionsSub = mobilePositions.subList(i, toIndex);
|
||||
// deviceMobilePositionMapper.batchadd(mobilePositionsSub);
|
||||
// }
|
||||
// }else {
|
||||
// deviceMobilePositionMapper.batchadd(mobilePositions);
|
||||
// }
|
||||
deviceMobilePositionMapper.batchadd(mobilePositions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanChannelsForDevice(int deviceId) {
|
||||
channelMapper.cleanChannelsByDeviceId(deviceId);
|
||||
@ -774,7 +614,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateChannelStatus(DeviceChannel channel) {
|
||||
public void updateChannelStatusForNotify(DeviceChannel channel) {
|
||||
channelMapper.updateStatus(channel);
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.channel.ChannelEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IInviteStreamService;
|
||||
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
|
||||
@ -39,6 +39,7 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import gov.nist.javax.sip.message.SIPResponse;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
@ -51,7 +52,6 @@ import org.springframework.util.Assert;
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.ResponseEvent;
|
||||
import javax.sip.SipException;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.text.ParseException;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
@ -356,7 +356,6 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
// 发送redis消息
|
||||
redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), null, true);
|
||||
}
|
||||
|
||||
}else {
|
||||
deviceMapper.update(device);
|
||||
redisCatchStorage.updateDevice(device);
|
||||
@ -423,7 +422,7 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
}
|
||||
deviceChannelMapper.offlineByDeviceId(device.getId());
|
||||
// 发送通道离线通知
|
||||
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.OFF);
|
||||
eventPublisher.channelEventPublish(channelList, ChannelEvent.ChannelEventMessageType.OFF);
|
||||
}
|
||||
|
||||
private boolean isDevice(String deviceId) {
|
||||
@ -824,6 +823,15 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
if (deviceStatusTaskRunner.containsKey(deviceId)) {
|
||||
deviceStatusTaskRunner.removeTask(deviceId);
|
||||
}
|
||||
List<CommonGBChannel> commonGBChannels = commonGBChannelMapper.queryByDataTypeAndDeviceIds(1, List.of(device.getId()));
|
||||
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.channelEventPublish(commonGBChannels, ChannelEvent.ChannelEventMessageType.DEL);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道删除] 发送失败,数量:{}", commonGBChannels.size(), e);
|
||||
}
|
||||
|
||||
platformChannelMapper.delChannelForDeviceId(deviceId);
|
||||
deviceChannelMapper.cleanChannelsByDeviceId(device.getId());
|
||||
deviceMapper.del(deviceId);
|
||||
|
||||
@ -6,9 +6,10 @@ import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.service.*;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourceDownloadService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePlayService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.ISourcePlaybackService;
|
||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078PlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
||||
@ -70,7 +71,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
public void stopInvite(InviteSessionType type, CommonGBChannel channel, String stream) {
|
||||
switch (type) {
|
||||
case PLAY:
|
||||
stopPlay(channel, stream);
|
||||
stopPlay(channel);
|
||||
break;
|
||||
case PLAYBACK:
|
||||
stopPlayback(channel, stream);
|
||||
@ -89,12 +90,12 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
|
||||
@Override
|
||||
public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
|
||||
log.info("[通用通道] 播放, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
log.info("[通用通道] 播放, 类型: {}, 编号:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlayService sourceChannelPlayService = sourcePlayServiceMap.get(ChannelDataType.PLAY_SERVICE + dataType);
|
||||
if (sourceChannelPlayService == null) {
|
||||
// 通道数据异常
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持实时流预览", dataType);
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持实时流预览", ChannelDataType.getDateTypeDesc(channel.getDataType()));
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourceChannelPlayService.play(channel, platform, record, (code, msg, data) -> {
|
||||
@ -109,7 +110,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
}
|
||||
@Override
|
||||
public void playback(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback) {
|
||||
log.info("[通用通道] 回放, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
log.info("[通用通道] 回放, 类型: {}, 编号:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
@ -123,7 +124,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
@Override
|
||||
public void download(CommonGBChannel channel, Long startTime, Long stopTime, Integer downloadSpeed,
|
||||
ErrorCallback<StreamInfo> callback){
|
||||
log.info("[通用通道] 录像下载, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
log.info("[通用通道] 录像下载, 类型: {}, 编号:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourceDownloadService downloadService = sourceDownloadServiceMap.get(ChannelDataType.DOWNLOAD_SERVICE + dataType);
|
||||
if (downloadService == null) {
|
||||
@ -135,7 +136,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(CommonGBChannel channel, String stream) {
|
||||
public void stopPlay(CommonGBChannel channel) {
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlayService sourceChannelPlayService = sourcePlayServiceMap.get(ChannelDataType.PLAY_SERVICE + dataType);
|
||||
if (sourceChannelPlayService == null) {
|
||||
@ -143,12 +144,12 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
log.error("[点播通用通道] 类型编号: {} 不支持停止实时流", dataType);
|
||||
throw new PlayException(Response.BUSY_HERE, "channel not support");
|
||||
}
|
||||
sourceChannelPlayService.stopPlay(channel, stream);
|
||||
sourceChannelPlayService.stopPlay(channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlayback(CommonGBChannel channel, String stream) {
|
||||
log.info("[通用通道] 停止回放, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
log.info("[通用通道] 停止回放, 类型: {}, 编号:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
@ -161,7 +162,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
|
||||
@Override
|
||||
public void stopDownload(CommonGBChannel channel, String stream) {
|
||||
log.info("[通用通道] 停止录像下载, 类型: {}, 编号:{} stream: {}", channel.getDataType(), channel.getGbDeviceId(), stream);
|
||||
log.info("[通用通道] 停止录像下载, 类型: {}, 编号:{} stream: {}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId(), stream);
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourceDownloadService downloadService = sourceDownloadServiceMap.get(ChannelDataType.DOWNLOAD_SERVICE + dataType);
|
||||
if (downloadService == null) {
|
||||
@ -174,7 +175,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
|
||||
@Override
|
||||
public void playbackPause(CommonGBChannel channel, String stream) {
|
||||
log.info("[通用通道] 回放暂停, 类型: {}, 编号:{} stream:{}", channel.getDataType(), channel.getGbDeviceId(), stream);
|
||||
log.info("[通用通道] 回放暂停, 类型: {}, 编号:{} stream:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId(), stream);
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
@ -187,7 +188,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
|
||||
@Override
|
||||
public void playbackResume(CommonGBChannel channel, String stream) {
|
||||
log.info("[通用通道] 回放暂停恢复, 类型: {}, 编号:{} stream:{}", channel.getDataType(), channel.getGbDeviceId(), stream);
|
||||
log.info("[通用通道] 回放暂停恢复, 类型: {}, 编号:{} stream:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId(), stream);
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
@ -200,7 +201,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
|
||||
@Override
|
||||
public void playbackSeek(CommonGBChannel channel, String stream, long seekTime) {
|
||||
log.info("[通用通道] 回放拖动播放, 类型: {}, 编号:{} stream:{}", channel.getDataType(), channel.getGbDeviceId(), stream);
|
||||
log.info("[通用通道] 回放拖动播放, 类型: {}, 编号:{} stream:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId(), stream);
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
@ -213,7 +214,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
|
||||
@Override
|
||||
public void playbackSpeed(CommonGBChannel channel, String stream, Double speed) {
|
||||
log.info("[通用通道] 回放倍速播放, 类型: {}, 编号:{} stream:{}", channel.getDataType(), channel.getGbDeviceId(), stream);
|
||||
log.info("[通用通道] 回放倍速播放, 类型: {}, 编号:{} stream:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId(), stream);
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
@ -226,7 +227,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
|
||||
|
||||
@Override
|
||||
public void queryRecord(CommonGBChannel channel, String startTime, String endTime, ErrorCallback<List<CommonRecordInfo>> callback) {
|
||||
log.info("[通用通道] 录像查询, 类型: {}, 编号:{}", channel.getDataType(), channel.getGbDeviceId());
|
||||
log.info("[通用通道] 录像查询, 类型: {}, 编号:{}", ChannelDataType.getDateTypeDesc(channel.getDataType()), channel.getGbDeviceId());
|
||||
Integer dataType = channel.getDataType();
|
||||
ISourcePlaybackService playbackService = sourcePlaybackServiceMap.get(ChannelDataType.PLAYBACK_SERVICE + dataType);
|
||||
if (playbackService == null) {
|
||||
|
||||
@ -1,36 +1,48 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.alibaba.excel.support.cglib.beans.BeanMap;
|
||||
import com.alibaba.excel.util.BeanMapUtils;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.controller.bean.Extent;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.RegionMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.event.channel.ChannelEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.VectorTileUtils;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||
import com.genersoft.iot.vmp.utils.Coordtransform;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.utils.TileUtils;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import no.ecc.vectortile.VectorTileEncoder;
|
||||
import org.locationtech.jts.geom.Coordinate;
|
||||
import org.locationtech.jts.geom.GeometryFactory;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import javax.sip.message.Response;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.time.Duration;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -55,11 +67,21 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
private GroupMapper groupMapper;
|
||||
|
||||
@Autowired
|
||||
private IDeviceChannelService deviceChannelService;
|
||||
private DynamicTask dynamicTask;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
private final GeometryFactory geometryFactory = new GeometryFactory();
|
||||
|
||||
@Override
|
||||
public CommonGBChannel queryByDeviceId(String gbDeviceId) {
|
||||
return commonGBChannelMapper.queryByDeviceId(gbDeviceId);
|
||||
List<CommonGBChannel> commonGBChannels = commonGBChannelMapper.queryByDeviceId(gbDeviceId);
|
||||
if (commonGBChannels.isEmpty()) {
|
||||
return null;
|
||||
}else {
|
||||
return commonGBChannels.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,12 +90,22 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "缺少通道数据类型或通道数据关联设备ID");
|
||||
}
|
||||
CommonGBChannel commonGBChannelInDb = commonGBChannelMapper.queryByDataId(commonGBChannel.getDataType(), commonGBChannel.getDataDeviceId());
|
||||
if (commonGBChannelInDb != null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "此推流已经关联通道");
|
||||
}
|
||||
Assert.isNull(commonGBChannelInDb, "此推流已经关联通道");
|
||||
|
||||
// 检验国标编号是否重复
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByDeviceId(commonGBChannel.getGbDeviceId());
|
||||
Assert.isTrue(channelList.isEmpty(), "国标编号已经存在");
|
||||
|
||||
commonGBChannel.setCreateTime(DateUtil.getNow());
|
||||
commonGBChannel.setUpdateTime(DateUtil.getNow());
|
||||
return commonGBChannelMapper.insert(commonGBChannel);
|
||||
int result = commonGBChannelMapper.insert(commonGBChannel);
|
||||
try {
|
||||
// 发送通知
|
||||
eventPublisher.channelEventPublish(commonGBChannel, ChannelEvent.ChannelEventMessageType.ADD);
|
||||
} catch (Exception e) {
|
||||
log.warn("[通道移除通知] 发送失败,{}", commonGBChannel.getGbDeviceId(), e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -91,7 +123,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
commonGBChannelMapper.delete(gbId);
|
||||
try {
|
||||
// 发送通知
|
||||
eventPublisher.catalogEventPublish(null, channel, CatalogEvent.DEL);
|
||||
eventPublisher.channelEventPublish(channel, ChannelEvent.ChannelEventMessageType.DEL);
|
||||
} catch (Exception e) {
|
||||
log.warn("[通道移除通知] 发送失败,{}", channel.getGbDeviceId(), e);
|
||||
}
|
||||
@ -113,6 +145,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
return;
|
||||
}
|
||||
commonGBChannelMapper.batchDelete(channelListInDb);
|
||||
try {
|
||||
// 发送通知
|
||||
eventPublisher.channelEventPublish(channelListInDb, ChannelEvent.ChannelEventMessageType.DEL);
|
||||
} catch (Exception e) {
|
||||
log.warn("[通道移除通知] 发送失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -122,14 +160,37 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
log.warn("[更新通道] 未找到数据库ID,更新失败, {}({})", commonGBChannel.getGbName(), commonGBChannel.getGbDeviceId());
|
||||
return 0;
|
||||
}
|
||||
// 确定编号是否重复
|
||||
List<CommonGBChannel> channels = commonGBChannelMapper.queryByDeviceId(commonGBChannel.getGbDeviceId());
|
||||
if (channels.size() > 1) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "国标编号重复,请修改编号后保存");
|
||||
}
|
||||
CommonGBChannel oldChannel = commonGBChannelMapper.queryById(commonGBChannel.getGbId());
|
||||
commonGBChannel.setUpdateTime(DateUtil.getNow());
|
||||
int result = commonGBChannelMapper.update(commonGBChannel);
|
||||
|
||||
if (result > 0) {
|
||||
try {
|
||||
CommonGBChannel newChannel = commonGBChannelMapper.queryById(commonGBChannel.getGbId());
|
||||
// 发送通知
|
||||
eventPublisher.catalogEventPublish(null, commonGBChannel, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(newChannel, oldChannel);
|
||||
|
||||
if (newChannel.getGbLongitude() != null && !Objects.equals(oldChannel.getGbLongitude(), newChannel.getGbLongitude())
|
||||
&& newChannel.getGbLatitude() != null && !Objects.equals(oldChannel.getGbLatitude(), newChannel.getGbLatitude())) {
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setDeviceId(newChannel.getGbDeviceId());
|
||||
mobilePosition.setChannelId(newChannel.getGbId());
|
||||
mobilePosition.setChannelDeviceId(newChannel.getGbDeviceId());
|
||||
mobilePosition.setDeviceName(newChannel.getGbName());
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
mobilePosition.setTime(DateUtil.getNow());
|
||||
mobilePosition.setLongitude(newChannel.getGbLongitude());
|
||||
mobilePosition.setLatitude(newChannel.getGbLatitude());
|
||||
eventPublisher.mobilePositionEventPublish(mobilePosition);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("[更新通道通知] 发送失败,{}", commonGBChannel.getGbDeviceId(), e);
|
||||
log.warn("[更新通道通知] 发送失败,{}", JSONObject.toJSONString(commonGBChannel), e);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -145,7 +206,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
if (result > 0) {
|
||||
try {
|
||||
// 发送通知
|
||||
eventPublisher.catalogEventPublish(null, commonGBChannel, CatalogEvent.OFF);
|
||||
eventPublisher.channelEventPublish(commonGBChannel, ChannelEvent.ChannelEventMessageType.OFF);
|
||||
} catch (Exception e) {
|
||||
log.warn("[通道离线通知] 发送失败,{}", commonGBChannel.getGbDeviceId(), e);
|
||||
}
|
||||
@ -177,7 +238,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
if (result > 0) {
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(null, commonGBChannelList, CatalogEvent.OFF);
|
||||
eventPublisher.channelEventPublish(commonGBChannelList, ChannelEvent.ChannelEventMessageType.OFF);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道离线] 发送失败,数量:{}", commonGBChannelList.size(), e);
|
||||
}
|
||||
@ -195,7 +256,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
if (result > 0) {
|
||||
try {
|
||||
// 发送通知
|
||||
eventPublisher.catalogEventPublish(null, commonGBChannel, CatalogEvent.ON);
|
||||
eventPublisher.channelEventPublish(commonGBChannel, ChannelEvent.ChannelEventMessageType.ON);
|
||||
} catch (Exception e) {
|
||||
log.warn("[通道上线通知] 发送失败,{}", commonGBChannel.getGbDeviceId(), e);
|
||||
}
|
||||
@ -226,7 +287,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
}
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(null, commonGBChannelList, CatalogEvent.ON);
|
||||
eventPublisher.channelEventPublish(commonGBChannelList, ChannelEvent.ChannelEventMessageType.ON);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道上线] 发送失败,数量:{}", commonGBChannelList.size(), e);
|
||||
}
|
||||
@ -255,6 +316,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
} else {
|
||||
result += commonGBChannelMapper.batchAdd(commonGBChannels);
|
||||
}
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.channelEventPublish(commonGBChannels, ChannelEvent.ChannelEventMessageType.ADD);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道新增] 发送失败,数量:{}", commonGBChannels.size(), e);
|
||||
}
|
||||
log.warn("[新增多个通道] 通道数量为{},成功保存:{}", commonGBChannels.size(), result);
|
||||
}
|
||||
|
||||
@ -264,6 +331,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
log.warn("[更新多个通道] 通道数量为0,更新失败");
|
||||
return;
|
||||
}
|
||||
List<CommonGBChannel> oldCommonGBChannelList = commonGBChannelMapper.queryOldChanelListByChannels(commonGBChannels);
|
||||
// 批量保存
|
||||
int limitCount = 1000;
|
||||
int result = 0;
|
||||
@ -282,7 +350,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
// 发送通过更新通知
|
||||
try {
|
||||
// 发送通知
|
||||
eventPublisher.catalogEventPublish(null, commonGBChannels, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(commonGBChannels, oldCommonGBChannelList);
|
||||
} catch (Exception e) {
|
||||
log.warn("[更新多个通道] 发送失败,{}个", commonGBChannels.size(), e);
|
||||
}
|
||||
@ -295,6 +363,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
log.warn("[更新多个通道状态] 通道数量为0,更新失败");
|
||||
return;
|
||||
}
|
||||
List<CommonGBChannel> oldChanelListByChannels = commonGBChannelMapper.queryOldChanelListByChannels(commonGBChannels);
|
||||
int limitCount = 1000;
|
||||
int result = 0;
|
||||
if (commonGBChannels.size() > limitCount) {
|
||||
@ -312,7 +381,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
// 发送通过更新通知
|
||||
try {
|
||||
// 发送通知
|
||||
eventPublisher.catalogEventPublish(null, commonGBChannels, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(commonGBChannels, oldChanelListByChannels);
|
||||
} catch (Exception e) {
|
||||
log.warn("[更新多个通道] 发送失败,{}个", commonGBChannels.size(), e);
|
||||
}
|
||||
@ -359,8 +428,9 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(int id) {
|
||||
public void reset(int id, List<String> chanelFields) {
|
||||
log.info("[重置国标通道] id: {}", id);
|
||||
Assert.notEmpty(chanelFields, "待重置字段为空");
|
||||
CommonGBChannel channel = getOne(id);
|
||||
if (channel == null) {
|
||||
log.warn("[重置国标通道] 未找到对应Id的通道: id: {}", id);
|
||||
@ -370,13 +440,23 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
log.warn("[重置国标通道] 非国标下级通道无法重置: id: {}", id);
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "非国标下级通道无法重置");
|
||||
}
|
||||
List<String> dbFields = new ArrayList<>();
|
||||
|
||||
for (String chanelField : chanelFields) {
|
||||
BeanWrapperImpl wrapper = new BeanWrapperImpl(channel);
|
||||
if (wrapper.isReadableProperty(chanelField)) {
|
||||
dbFields.add(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, chanelField));
|
||||
}
|
||||
}
|
||||
Assert.notEmpty(dbFields, "待重置字段为空");
|
||||
|
||||
// 这个多加一个参数,为了防止将非国标的通道通过此方法清空内容,导致意外发生
|
||||
commonGBChannelMapper.reset(id, ChannelDataType.GB28181, channel.getDataDeviceId(), DateUtil.getNow());
|
||||
commonGBChannelMapper.reset(id, dbFields, DateUtil.getNow());
|
||||
CommonGBChannel channelNew = getOne(id);
|
||||
// 发送通过更新通知
|
||||
try {
|
||||
// 发送通知
|
||||
eventPublisher.catalogEventPublish(null, channelNew, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(channelNew, channel);
|
||||
} catch (Exception e) {
|
||||
log.warn("[通道移除通知] 发送失败,{}", channelNew.getGbDeviceId(), e);
|
||||
}
|
||||
@ -419,6 +499,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
if (channelList.isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||
}
|
||||
List<CommonGBChannel> channelListForOld = new ArrayList<>(channelList);
|
||||
for (CommonGBChannel channel : channelList) {
|
||||
channel.setGbCivilCode(civilCode);
|
||||
}
|
||||
@ -428,7 +509,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
platformChannelService.checkRegionAdd(channelList);
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(channelList, channelListForOld);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道添加行政区划] 发送失败,数量:{}", channelList.size(), e);
|
||||
}
|
||||
@ -494,10 +575,11 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
|
||||
@Override
|
||||
public void addChannelToRegionByGbDevice(String civilCode, List<Integer> deviceIds) {
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByDataTypeAndDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
if (channelList.isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||
}
|
||||
List<CommonGBChannel> channelListForOld = new ArrayList<>(channelList);
|
||||
for (CommonGBChannel channel : channelList) {
|
||||
channel.setGbCivilCode(civilCode);
|
||||
}
|
||||
@ -506,7 +588,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
if (result > 0) {
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(channelList, channelListForOld);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道添加行政区划] 发送失败,数量:{}", channelList.size(), e);
|
||||
}
|
||||
@ -515,7 +597,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
|
||||
@Override
|
||||
public void deleteChannelToRegionByGbDevice(List<Integer> deviceIds) {
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByDataTypeAndDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
if (channelList.isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||
}
|
||||
@ -549,8 +631,11 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
@Override
|
||||
public void updateBusinessGroup(String oldBusinessGroup, String newBusinessGroup) {
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByBusinessGroup(oldBusinessGroup);
|
||||
Assert.notEmpty(channelList, "旧的业务分组的通道不存在");
|
||||
|
||||
if (channelList.isEmpty()) {
|
||||
log.info("[更新业务分组] 发现未关联任何通道: {}", oldBusinessGroup);
|
||||
return;
|
||||
}
|
||||
List<CommonGBChannel> channelListForOld = new ArrayList<>(channelList);
|
||||
int result = commonGBChannelMapper.updateBusinessGroupByChannelList(newBusinessGroup, channelList);
|
||||
if (result > 0) {
|
||||
for (CommonGBChannel channel : channelList) {
|
||||
@ -558,7 +643,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
}
|
||||
// 发送catalog
|
||||
try {
|
||||
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(channelList, channelListForOld);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道业务分组] 发送失败,数量:{}", channelList.size(), e);
|
||||
}
|
||||
@ -571,7 +656,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
if (channelList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<CommonGBChannel> channelListForOld = new ArrayList<>(channelList);
|
||||
int result = commonGBChannelMapper.updateParentIdByChannelList(newParentId, channelList);
|
||||
if (result > 0) {
|
||||
for (CommonGBChannel channel : channelList) {
|
||||
@ -579,7 +664,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
}
|
||||
// 发送catalog
|
||||
try {
|
||||
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(channelList, channelListForOld);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道业务分组] 发送失败,数量:{}", channelList.size(), e);
|
||||
}
|
||||
@ -593,6 +678,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
if (channelList.isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||
}
|
||||
List<CommonGBChannel> channelListForOld = new ArrayList<>(channelList);
|
||||
int result = commonGBChannelMapper.updateGroup(parentId, businessGroup, channelList);
|
||||
for (CommonGBChannel commonGBChannel : channelList) {
|
||||
commonGBChannel.setGbParentId(parentId);
|
||||
@ -604,7 +690,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
platformChannelService.checkGroupAdd(channelList);
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(channelList, channelListForOld);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道添加行政区划] 发送失败,数量:{}", channelList.size(), e);
|
||||
}
|
||||
@ -632,10 +718,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
@Override
|
||||
@Transactional
|
||||
public void addChannelToGroupByGbDevice(String parentId, String businessGroup, List<Integer> deviceIds) {
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByDataTypeAndDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
if (channelList.isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||
}
|
||||
List<CommonGBChannel> channelListForOld = new ArrayList<>(channelList);
|
||||
|
||||
for (CommonGBChannel channel : channelList) {
|
||||
channel.setGbParentId(parentId);
|
||||
channel.setGbBusinessGroupId(businessGroup);
|
||||
@ -651,7 +739,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
platformChannelService.checkGroupAdd(channelList);
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(channelList, channelListForOld);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道添加行政区划] 发送失败,数量:{}", channelList.size(), e);
|
||||
}
|
||||
@ -660,7 +748,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
|
||||
@Override
|
||||
public void deleteChannelToGroupByGbDevice(List<Integer> deviceIds) {
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByDataTypeAndDeviceIds(ChannelDataType.GB28181, deviceIds);
|
||||
if (channelList.isEmpty()) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||
}
|
||||
@ -685,7 +773,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
if (channelList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<CommonGBChannel> channelListForOld = new ArrayList<>(channelList);
|
||||
int result = commonGBChannelMapper.updateCivilCodeByChannelList(newCivilCode, channelList);
|
||||
if (result > 0) {
|
||||
for (CommonGBChannel channel : channelList) {
|
||||
@ -693,7 +781,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
}
|
||||
// 发送catalog
|
||||
try {
|
||||
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(channelList, channelListForOld);
|
||||
} catch (Exception e) {
|
||||
log.warn("[多个通道业务分组] 发送失败,数量:{}", channelList.size(), e);
|
||||
}
|
||||
@ -706,14 +794,15 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType) {
|
||||
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan,
|
||||
Integer channelType, String civilCode, String parentDeviceId) {
|
||||
PageHelper.startPage(page, count);
|
||||
if (query != null) {
|
||||
query = query.replaceAll("/", "//")
|
||||
.replaceAll("%", "/%")
|
||||
.replaceAll("_", "/_");
|
||||
}
|
||||
List<CommonGBChannel> all = commonGBChannelMapper.queryList(query, online, hasRecordPlan, channelType);
|
||||
List<CommonGBChannel> all = commonGBChannelMapper.queryList(query, online, hasRecordPlan, channelType, civilCode, parentDeviceId);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
||||
@ -769,7 +858,29 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
if (gpsMsgInfoList == null || gpsMsgInfoList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 此处来源默认为WGS84, 所以直接入库
|
||||
commonGBChannelMapper.updateGpsByDeviceId(gpsMsgInfoList);
|
||||
//
|
||||
// Map<String, GPSMsgInfo> gpsMsgInfoMap = new ConcurrentReferenceHashMap<>();
|
||||
// for (GPSMsgInfo gpsMsgInfo : gpsMsgInfoList) {
|
||||
// gpsMsgInfoMap.put(gpsMsgInfo.getId(), gpsMsgInfo);
|
||||
// }
|
||||
//
|
||||
// List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(new ArrayList<>(gpsMsgInfoMap.keySet()));
|
||||
// if (channelList.isEmpty()) {
|
||||
// return;
|
||||
// }
|
||||
// channelList.forEach(commonGBChannel -> {
|
||||
// MobilePosition mobilePosition = new MobilePosition();
|
||||
// mobilePosition.setDeviceId(commonGBChannel.getGbDeviceId());
|
||||
// mobilePosition.setChannelId(commonGBChannel.getGbId());
|
||||
// mobilePosition.setDeviceName(commonGBChannel.getGbName());
|
||||
// mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
// mobilePosition.setTime(DateUtil.getNow());
|
||||
// mobilePosition.setLongitude(commonGBChannel.getGbLongitude());
|
||||
// mobilePosition.setLatitude(commonGBChannel.getGbLatitude());
|
||||
// eventPublisher.mobilePositionEventPublish(mobilePosition);
|
||||
// });
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ -788,4 +899,263 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||
commonGBChannelMapper.updateGps(commonGBChannels);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonGBChannel> queryListForMap(String query, Boolean online, Boolean hasRecordPlan, Integer channelType) {
|
||||
if (query != null) {
|
||||
query = query.replaceAll("/", "//")
|
||||
.replaceAll("%", "/%")
|
||||
.replaceAll("_", "/_");
|
||||
}
|
||||
return commonGBChannelMapper.queryList(query, online, hasRecordPlan, channelType, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonGBChannel queryCommonChannelByDeviceChannel(DeviceChannel channel) {
|
||||
return commonGBChannelMapper.queryCommonChannelByDeviceChannel(channel.getDataType(), channel.getDataDeviceId(), channel.getDeviceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetLevel() {
|
||||
commonGBChannelMapper.resetLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getTile(int z, int x, int y, String geoCoordSys) {
|
||||
double minLon = TileUtils.tile2lon(x, z);
|
||||
double maxLon = TileUtils.tile2lon(x + 1, z);
|
||||
double maxLat = TileUtils.tile2lat(y, z);
|
||||
double minLat = TileUtils.tile2lat(y + 1, z);
|
||||
|
||||
if (geoCoordSys != null) {
|
||||
if (geoCoordSys.equalsIgnoreCase("GCJ02")) {
|
||||
Double[] minPosition = Coordtransform.GCJ02ToWGS84(minLon, minLat);
|
||||
minLon = minPosition[0];
|
||||
minLat = minPosition[1];
|
||||
|
||||
Double[] maxPosition = Coordtransform.GCJ02ToWGS84(maxLon, maxLat);
|
||||
maxLon = maxPosition[0];
|
||||
maxLat = maxPosition[1];
|
||||
}
|
||||
}
|
||||
// 从数据库查询对应的数据
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryCameraChannelInBox(minLon, maxLon, minLat, maxLat);
|
||||
VectorTileEncoder encoder = new VectorTileEncoder();
|
||||
if (!channelList.isEmpty()) {
|
||||
channelList.forEach(commonGBChannel -> {
|
||||
double lon = commonGBChannel.getGbLongitude();
|
||||
double lat = commonGBChannel.getGbLatitude();
|
||||
// 转换为目标坐标系
|
||||
if (geoCoordSys != null) {
|
||||
if (geoCoordSys.equalsIgnoreCase("GCJ02")) {
|
||||
Double[] minPosition = Coordtransform.WGS84ToGCJ02(lon, lat);
|
||||
lon = minPosition[0];
|
||||
lat = minPosition[1];
|
||||
}
|
||||
}
|
||||
|
||||
// 将 lon/lat 转为瓦片内像素坐标(0..256)
|
||||
double[] px = TileUtils.lonLatToTilePixel(lon, lat, z, x, y);
|
||||
Point pointGeom = geometryFactory.createPoint(new Coordinate(px[0], px[1]));
|
||||
|
||||
BeanMap beanMap = BeanMapUtils.create(commonGBChannel);
|
||||
encoder.addFeature("points", beanMap, pointGeom);
|
||||
});
|
||||
}
|
||||
return encoder.encode();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String drawThin(Map<Integer, Double> zoomParam, Extent extent, String geoCoordSys) {
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
String id = UUID.randomUUID().toString();
|
||||
List<CommonGBChannel> channelListInExtent;
|
||||
if (extent == null) {
|
||||
log.info("[抽稀] ID: {}, 未设置范围,从数据库读取摄像头的范围", id);
|
||||
extent = commonGBChannelMapper.queryExtent();
|
||||
channelListInExtent = commonGBChannelMapper.queryAllWithPosition();
|
||||
}else {
|
||||
if (geoCoordSys != null && geoCoordSys.equalsIgnoreCase("GCJ02")) {
|
||||
Double[] maxPosition = Coordtransform.GCJ02ToWGS84(extent.getMaxLng(), extent.getMaxLat());
|
||||
Double[] minPosition = Coordtransform.GCJ02ToWGS84(extent.getMinLng(), extent.getMinLat());
|
||||
|
||||
extent.setMaxLng(maxPosition[0]);
|
||||
extent.setMaxLat(maxPosition[1]);
|
||||
|
||||
extent.setMinLng(minPosition[0]);
|
||||
extent.setMinLat(minPosition[1]);
|
||||
}
|
||||
// 获取数据源
|
||||
channelListInExtent = commonGBChannelMapper.queryListInExtent(extent.getMinLng(), extent.getMaxLng(), extent.getMinLat(), extent.getMaxLat());
|
||||
}
|
||||
Assert.isTrue(!channelListInExtent.isEmpty(), "通道数据为空");
|
||||
|
||||
log.info("[开始抽稀] ID: {}, 范围,[{}, {}, {}, {}]", id, extent.getMinLng(), extent.getMinLat(), extent.getMaxLng(), extent.getMaxLat());
|
||||
|
||||
Extent finalExtent = extent;
|
||||
// 记录进度
|
||||
saveProcess(id, 0, "开始抽稀");
|
||||
dynamicTask.startDelay(id, () -> {
|
||||
try {
|
||||
// 存储每层的抽稀结果, key为层级(zoom),value为摄像头数组
|
||||
Map<Integer, Collection<CommonGBChannel>> zoomCameraMap = new HashMap<>();
|
||||
|
||||
// 冗余一份已经处理过的摄像头的数据, 避免多次循环获取
|
||||
Map<Integer, CommonGBChannel> useCameraMap = new HashMap<>();
|
||||
AtomicReference<Double> process = new AtomicReference<>((double) 0);
|
||||
for (Integer zoom : zoomParam.keySet()) {
|
||||
|
||||
Map<String, CommonGBChannel> useCameraMapForZoom = new HashMap<>();
|
||||
Map<String, CommonGBChannel> cameraMapForZoom = new HashMap<>();
|
||||
|
||||
if (Objects.equals(zoom, Collections.max(zoomParam.keySet()))) {
|
||||
// 最大层级不进行抽稀, 将未进行抽稀的数据直接存储到这个层级
|
||||
for (CommonGBChannel channel : channelListInExtent) {
|
||||
if (!useCameraMap.containsKey(channel.getGbId())) {
|
||||
channel.setMapLevel(zoom);
|
||||
// 这个的key跟后面的不一致是因为无需抽稀, 直接存储原始数据
|
||||
cameraMapForZoom.put(channel.getGbId() + "", channel);
|
||||
useCameraMap.put(channel.getGbId(), channel);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Double diff = zoomParam.get(zoom);
|
||||
// 对这个层级展开抽稀
|
||||
log.info("[抽稀] ID:{},当前层级: {}, 坐标间隔: {}", id, zoom, diff);
|
||||
|
||||
// 更新上级图层的数据到当前层级,确保当前层级展示时考虑到之前层级的数据
|
||||
for (CommonGBChannel channel : useCameraMap.values()) {
|
||||
int lngGrid = (int)(channel.getGbLongitude() / diff);
|
||||
int latGrid = (int)(channel.getGbLatitude() / diff);
|
||||
String gridKey = latGrid + ":" + lngGrid;
|
||||
useCameraMapForZoom.put(gridKey, channel);
|
||||
}
|
||||
|
||||
// 对数据开始执行抽稀
|
||||
for (CommonGBChannel channel : channelListInExtent) {
|
||||
// 已经分配再其他层级的,本层级不再使用
|
||||
if (useCameraMap.containsKey(channel.getGbId())) {
|
||||
continue;
|
||||
}
|
||||
int lngGrid = (int)(channel.getGbLongitude() / diff);
|
||||
int latGrid = (int)(channel.getGbLatitude() / diff);
|
||||
// 数据网格Id
|
||||
String gridKey = latGrid + ":" + lngGrid;
|
||||
if (useCameraMapForZoom.containsKey(gridKey)) {
|
||||
continue;
|
||||
}
|
||||
if (cameraMapForZoom.containsKey(gridKey)) {
|
||||
CommonGBChannel oldChannel = cameraMapForZoom.get(gridKey);
|
||||
// 如果一个网格存在多个数据,则选择最接近中心点的, 目前只选择了经度方向作为参考
|
||||
if (channel.getGbLongitude() % diff < oldChannel.getGbLongitude() % diff) {
|
||||
channel.setMapLevel(zoom);
|
||||
cameraMapForZoom.put(gridKey, channel);
|
||||
useCameraMap.put(channel.getGbId(), channel);
|
||||
useCameraMap.remove(oldChannel.getGbId());
|
||||
oldChannel.setMapLevel(null);
|
||||
}
|
||||
}else {
|
||||
channel.setMapLevel(zoom);
|
||||
cameraMapForZoom.put(gridKey, channel);
|
||||
useCameraMap.put(channel.getGbId(), channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 存储
|
||||
zoomCameraMap.put(zoom, cameraMapForZoom.values());
|
||||
process.updateAndGet(v -> (v + 0.5 / zoomParam.size()));
|
||||
saveProcess(id, process.get(), "抽稀图层: " + zoom);
|
||||
}
|
||||
|
||||
// 抽稀完成, 对数据生成mvt矢量瓦片
|
||||
List<CommonGBChannel> beforeData = new ArrayList<>();
|
||||
for (Integer key : zoomCameraMap.keySet()) {
|
||||
beforeData.addAll(zoomCameraMap.get(key));
|
||||
log.info("[抽稀-生成mvt矢量瓦片] ID:{},当前层级: {}", id, key);
|
||||
// 按照 z/x/y 数据组织数据, 矢量数据暂时保存在内存中
|
||||
// 按照范围生成 x y范围,
|
||||
saveTile(id, key, "WGS84", beforeData);
|
||||
saveTile(id, key, "GCJ02", beforeData);
|
||||
process.updateAndGet(v -> (v + 0.5 / zoomParam.size()));
|
||||
saveProcess(id, process.get(), "发布矢量瓦片: " + key);
|
||||
}
|
||||
// 记录原始数据,未保存做准备
|
||||
VectorTileUtils.INSTANCE.addSource(id, new ArrayList<>(useCameraMap.values()));
|
||||
|
||||
log.info("[抽稀完成] ID:{}, 耗时: {}ms", id, (System.currentTimeMillis() - time));
|
||||
saveProcess(id, 1, "抽稀完成");
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}, 1);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
private void saveTile(String id, int z, String geoCoordSys, Collection<CommonGBChannel> commonGBChannelList ) {
|
||||
Map<String, VectorTileEncoder> encoderMap = new HashMap<>();
|
||||
commonGBChannelList.forEach(commonGBChannel -> {
|
||||
double lon = commonGBChannel.getGbLongitude();
|
||||
double lat = commonGBChannel.getGbLatitude();
|
||||
if (geoCoordSys != null && geoCoordSys.equalsIgnoreCase("GCJ02")) {
|
||||
Double[] minPosition = Coordtransform.WGS84ToGCJ02(lon, lat);
|
||||
lon = minPosition[0];
|
||||
lat = minPosition[1];
|
||||
}
|
||||
double[] doubles = TileUtils.lonLatToTileXY(lon, lat, z);
|
||||
int x = (int) doubles[0];
|
||||
int y = (int) doubles[1];
|
||||
String key = z + "_" + x + "_" + y + "_" + geoCoordSys;
|
||||
VectorTileEncoder encoder =encoderMap.get(key);
|
||||
if (encoder == null) {
|
||||
encoder = new VectorTileEncoder();
|
||||
encoderMap.put(key, encoder);
|
||||
}
|
||||
// 将 lon/lat 转为瓦片内像素坐标(0..256)
|
||||
double[] px = TileUtils.lonLatToTilePixel(lon, lat, z, x, y);
|
||||
Point pointGeom = geometryFactory.createPoint(new Coordinate(px[0], px[1]));
|
||||
BeanMap beanMap = BeanMapUtils.create(commonGBChannel);
|
||||
encoder.addFeature("points", beanMap, pointGeom);
|
||||
});
|
||||
encoderMap.forEach((key, encoder) -> {
|
||||
VectorTileUtils.INSTANCE.addVectorTile(id, key, encoder.encode());
|
||||
});
|
||||
}
|
||||
|
||||
private void saveProcess(String id, double process, String msg) {
|
||||
String key = VideoManagerConstants.DRAW_THIN_PROCESS_PREFIX + id;
|
||||
Duration duration = Duration.ofMinutes(30);
|
||||
redisTemplate.opsForValue().set(key, new DrawThinProcess(process, msg), duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DrawThinProcess thinProgress(String id) {
|
||||
String key = VideoManagerConstants.DRAW_THIN_PROCESS_PREFIX + id;
|
||||
return (DrawThinProcess) redisTemplate.opsForValue().get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveThin(String id) {
|
||||
commonGBChannelMapper.resetLevel();
|
||||
List<CommonGBChannel> channelList = VectorTileUtils.INSTANCE.getChannelList(id);
|
||||
if (channelList != null && !channelList.isEmpty()) {
|
||||
int limitCount = 1000;
|
||||
if (channelList.size() > limitCount) {
|
||||
for (int i = 0; i < channelList.size(); i += limitCount) {
|
||||
int toIndex = i + limitCount;
|
||||
if (i + limitCount > channelList.size()) {
|
||||
toIndex = channelList.size();
|
||||
}
|
||||
commonGBChannelMapper.saveLevel(channelList.subList(i, toIndex));
|
||||
}
|
||||
} else {
|
||||
commonGBChannelMapper.saveLevel(channelList);
|
||||
}
|
||||
}
|
||||
VectorTileUtils.INSTANCE.save(id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
||||
@ -15,6 +16,8 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
@ -27,7 +30,7 @@ import java.util.*;
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GroupServiceImpl implements IGroupService {
|
||||
public class GroupServiceImpl implements IGroupService, CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
private GroupMapper groupManager;
|
||||
@ -41,15 +44,26 @@ public class GroupServiceImpl implements IGroupService {
|
||||
@Autowired
|
||||
private EventPublisher eventPublisher;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
// 启动后请求组织结构同步
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
String key = VideoManagerConstants.VM_MSG_GROUP_LIST_REQUEST;
|
||||
log.info("[redis发送通知] 发送 同步组织结构请求 {}", key);
|
||||
redisTemplate.convertAndSend(key, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(Group group) {
|
||||
Assert.notNull(group, "参数不可为NULL");
|
||||
Assert.notNull(group.getDeviceId(), "设备编号不可为NULL");
|
||||
Assert.isTrue(group.getDeviceId().trim().length() == 20, "设备编号必须为20位");
|
||||
Assert.notNull(group.getName(), "设备编号不可为NULL");
|
||||
Assert.notNull(group.getDeviceId(), "分组编号不可为NULL");
|
||||
Assert.isTrue(group.getDeviceId().trim().length() == 20, "分组编号必须为20位");
|
||||
Assert.notNull(group.getName(), "分组名称不可为NULL");
|
||||
|
||||
GbCode gbCode = GbCode.decode(group.getDeviceId());
|
||||
Assert.notNull(gbCode, "设备编号不满足国标定义");
|
||||
Assert.notNull(gbCode, "分组编号不满足国标定义");
|
||||
|
||||
// 查询数据库中已经存在的.
|
||||
List<Group> groupListInDb = groupManager.queryInGroupListByDeviceId(Lists.newArrayList(group));
|
||||
@ -90,7 +104,8 @@ public class GroupServiceImpl implements IGroupService {
|
||||
groupManager.addBusinessGroup(group);
|
||||
}
|
||||
|
||||
private List<Group> queryAllChildren(Integer id) {
|
||||
@Override
|
||||
public List<Group> queryAllChildren(Integer id) {
|
||||
List<Group> children = groupManager.getChildren(id);
|
||||
if (ObjectUtils.isEmpty(children)) {
|
||||
return children;
|
||||
@ -133,7 +148,7 @@ public class GroupServiceImpl implements IGroupService {
|
||||
CommonGBChannel channel = CommonGBChannel.build(chjildGroup);
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(null, channel, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(channel, null);
|
||||
}catch (Exception e) {
|
||||
log.warn("[业务分组/虚拟组织变化] 发送失败,{}", group.getDeviceId(), e);
|
||||
}
|
||||
@ -145,7 +160,7 @@ public class GroupServiceImpl implements IGroupService {
|
||||
CommonGBChannel channel = CommonGBChannel.build(group);
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(null, channel, CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(channel, null);
|
||||
}catch (Exception e) {
|
||||
log.warn("[业务分组/虚拟组织变化] 发送失败,{}", group.getDeviceId(), e);
|
||||
}
|
||||
@ -165,7 +180,7 @@ public class GroupServiceImpl implements IGroupService {
|
||||
|
||||
@Override
|
||||
public Group queryGroupByDeviceId(String regionDeviceId) {
|
||||
return null;
|
||||
return groupManager.queryOneByOnlyDeviceId(regionDeviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -186,11 +201,6 @@ public class GroupServiceImpl implements IGroupService {
|
||||
return groupTrees;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncFromChannel() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean delete(int id) {
|
||||
@ -275,9 +285,9 @@ public class GroupServiceImpl implements IGroupService {
|
||||
if (group == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "虚拟组织不存在");
|
||||
}
|
||||
groupList.add(group);
|
||||
List<Group> allParent = getAllParent(group);
|
||||
groupList.addAll(allParent);
|
||||
groupList.add(group);
|
||||
return groupList;
|
||||
}
|
||||
|
||||
@ -307,4 +317,18 @@ public class GroupServiceImpl implements IGroupService {
|
||||
List<Group> all = groupManager.query(query, null, null);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Group queryGroupByAlias(String groupAlias) {
|
||||
return groupManager.queryGroupByAlias(groupAlias);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sync() {
|
||||
try {
|
||||
this.run();
|
||||
}catch (Exception e) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "同步失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.*;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.channel.ChannelEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||
@ -11,6 +13,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
@ -49,6 +52,153 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||
@Autowired
|
||||
private ISIPCommanderForPlatform sipCommanderFroPlatform;
|
||||
|
||||
@Autowired
|
||||
private SubscribeHolder subscribeHolder;
|
||||
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
// 监听通道信息变化
|
||||
@EventListener
|
||||
public void onApplicationEvent(ChannelEvent event) {
|
||||
if (event.getChannels().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 获取通道所关联的平台
|
||||
List<Platform> allPlatform = platformMapper.queryByServerId(userSetting.getServerId());
|
||||
// 获取所用订阅
|
||||
List<String> platforms = subscribeHolder.getAllCatalogSubscribePlatform(allPlatform);
|
||||
|
||||
Map<String, List<Platform>> platformMap = new HashMap<>();
|
||||
Map<String, CommonGBChannel> channelMap = new HashMap<>();
|
||||
if (platforms.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (CommonGBChannel deviceChannel : event.getChannels()) {
|
||||
List<Platform> parentPlatformsForGB = queryPlatFormListByChannelDeviceId(
|
||||
deviceChannel.getGbId(), platforms);
|
||||
platformMap.put(deviceChannel.getGbDeviceId(), parentPlatformsForGB);
|
||||
channelMap.put(deviceChannel.getGbDeviceId(), deviceChannel);
|
||||
}
|
||||
if (platformMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
switch (event.getMessageType()) {
|
||||
case ON:
|
||||
case OFF:
|
||||
case DEL:
|
||||
for (String serverGbId : platformMap.keySet()) {
|
||||
List<Platform> platformList = platformMap.get(serverGbId);
|
||||
if (platformList != null && !platformList.isEmpty()) {
|
||||
for (Platform platform : platformList) {
|
||||
SubscribeInfo subscribeInfo = subscribeHolder.getCatalogSubscribe(platform.getServerGBId());
|
||||
if (subscribeInfo == null) {
|
||||
continue;
|
||||
}
|
||||
log.info("[Catalog事件: {}]平台:{},影响通道{}", event.getMessageType(), platform.getServerGBId(), serverGbId);
|
||||
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
||||
CommonGBChannel deviceChannel = new CommonGBChannel();
|
||||
deviceChannel.setGbDeviceId(serverGbId);
|
||||
deviceChannelList.add(deviceChannel);
|
||||
try {
|
||||
sipCommanderFroPlatform.sendNotifyForCatalogOther(event.getMessageType().name(), platform, deviceChannelList, subscribeInfo, null);
|
||||
} catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException |
|
||||
IllegalAccessException e) {
|
||||
log.error("[命令发送失败] 国标级联 Catalog通知: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}else {
|
||||
log.info("[Catalog事件: {}] 未找到上级平台: {}", event.getMessageType(), serverGbId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VLOST:
|
||||
break;
|
||||
case DEFECT:
|
||||
break;
|
||||
case ADD:
|
||||
case UPDATE:
|
||||
for (String gbId : platformMap.keySet()) {
|
||||
List<Platform> parentPlatforms = platformMap.get(gbId);
|
||||
if (parentPlatforms != null && !parentPlatforms.isEmpty()) {
|
||||
for (Platform platform : parentPlatforms) {
|
||||
SubscribeInfo subscribeInfo = subscribeHolder.getCatalogSubscribe(platform.getServerGBId());
|
||||
if (subscribeInfo == null) {
|
||||
continue;
|
||||
}
|
||||
log.info("[Catalog事件: {}]平台:{},影响通道{}", event.getMessageType(), platform.getServerGBId(), gbId);
|
||||
List<CommonGBChannel> channelList = new ArrayList<>();
|
||||
CommonGBChannel deviceChannel = channelMap.get(gbId);
|
||||
channelList.add(deviceChannel);
|
||||
try {
|
||||
sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getMessageType().name(), platform, channelList, subscribeInfo, null);
|
||||
} catch (InvalidArgumentException | ParseException | NoSuchFieldException |
|
||||
SipException | IllegalAccessException e) {
|
||||
log.error("[命令发送失败] 国标级联 Catalog通知: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@EventListener
|
||||
public void onApplicationEvent(CatalogEvent event) {
|
||||
log.info("[Catalog事件: {}]通道数量: {}", event.getType(), event.getChannels().size());
|
||||
Platform platform = event.getPlatform();
|
||||
if (platform == null || platform.getServerGBId() == null) {
|
||||
return;
|
||||
}
|
||||
SubscribeInfo subscribe = subscribeHolder.getCatalogSubscribe(platform.getServerGBId());
|
||||
if (subscribe == null) {
|
||||
return;
|
||||
}
|
||||
switch (event.getType()) {
|
||||
case CatalogEvent.ON:
|
||||
case CatalogEvent.OFF:
|
||||
case CatalogEvent.DEL:
|
||||
List<CommonGBChannel> channels = new ArrayList<>();
|
||||
if (event.getChannels() != null) {
|
||||
channels.addAll(event.getChannels());
|
||||
}
|
||||
if (!channels.isEmpty()) {
|
||||
log.info("[Catalog事件: {}]平台:{},影响通道{}个", event.getType(), platform.getServerGBId(), channels.size());
|
||||
try {
|
||||
sipCommanderFroPlatform.sendNotifyForCatalogOther(event.getType(), platform, channels, subscribe, null);
|
||||
} catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException |
|
||||
IllegalAccessException e) {
|
||||
log.error("[命令发送失败] 国标级联 Catalog通知: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CatalogEvent.VLOST:
|
||||
break;
|
||||
case CatalogEvent.DEFECT:
|
||||
break;
|
||||
case CatalogEvent.ADD:
|
||||
case CatalogEvent.UPDATE:
|
||||
List<CommonGBChannel> deviceChannelList = new ArrayList<>();
|
||||
if (event.getChannels() != null) {
|
||||
deviceChannelList.addAll(event.getChannels());
|
||||
}
|
||||
if (!deviceChannelList.isEmpty()) {
|
||||
log.info("[Catalog事件: {}]平台:{},影响通道{}个", event.getType(), platform.getServerGBId(), deviceChannelList.size());
|
||||
try {
|
||||
sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), platform, deviceChannelList, subscribe, null);
|
||||
} catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException |
|
||||
IllegalAccessException e) {
|
||||
log.error("[命令发送失败] 国标级联 Catalog通知: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<PlatformChannel> queryChannelList(int page, int count, String query, Integer channelType, Boolean online, Integer platformId, Boolean hasShare) {
|
||||
@ -242,7 +392,6 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
try {
|
||||
// 发送catalog
|
||||
@ -604,9 +753,11 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||
|
||||
@Override
|
||||
public List<Platform> queryByPlatformBySharChannelId(String channelDeviceId) {
|
||||
CommonGBChannel commonGBChannel = commonGBChannelMapper.queryByDeviceId(channelDeviceId);
|
||||
List<CommonGBChannel> commonGBChannels = commonGBChannelMapper.queryByDeviceId(channelDeviceId);
|
||||
ArrayList<Integer> ids = new ArrayList<>();
|
||||
ids.add(commonGBChannel.getGbId());
|
||||
for (CommonGBChannel commonGBChannel : commonGBChannels) {
|
||||
ids.add(commonGBChannel.getGbId());
|
||||
}
|
||||
return platformChannelMapper.queryPlatFormListByChannelList(ids);
|
||||
}
|
||||
}
|
||||
|
||||
@ -540,7 +540,6 @@ public class PlatformServiceImpl implements IPlatformService, CommandLineRunner
|
||||
}
|
||||
for (CommonGBChannel channel : channelList) {
|
||||
GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(channel.getGbDeviceId());
|
||||
|
||||
// 无最新位置则发送当前位置
|
||||
if (gpsMsgInfo != null && (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0)) {
|
||||
gpsMsgInfo = null;
|
||||
|
||||
@ -130,7 +130,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
* 流到来的处理
|
||||
*/
|
||||
@Async("taskExecutor")
|
||||
@org.springframework.context.event.EventListener
|
||||
@EventListener
|
||||
public void onApplicationEvent(MediaArrivalEvent event) {
|
||||
if ("broadcast".equals(event.getApp()) || "talk".equals(event.getApp())) {
|
||||
if (event.getStream().indexOf("_") > 0) {
|
||||
@ -366,7 +366,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
InviteErrorCode.SUCCESS.getCode(),
|
||||
InviteErrorCode.SUCCESS.getMsg(),
|
||||
streamInfo);
|
||||
log.info("[点播已存在] 直接返回, deviceId: {}, channelId: {}", device.getDeviceId(), channel.getDeviceId());
|
||||
log.info("[点播已存在] 直接返回, 设备编号: {}, 通道编号: {}", device.getDeviceId(), channel.getDeviceId());
|
||||
return inviteInfoInCatch.getSsrcInfo();
|
||||
}else {
|
||||
// 点播发起了但是尚未成功, 仅注册回调等待结果即可
|
||||
@ -413,7 +413,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
InviteErrorCode.SUCCESS.getMsg(),
|
||||
streamInfo);
|
||||
|
||||
log.info("[点播成功] deviceId: {}, channelId:{}, 码流类型:{}", device.getDeviceId(), channel.getDeviceId(),
|
||||
log.info("[点播成功] 设备编号: {}, 通道编号:{}, 码流类型:{}", device.getDeviceId(), channel.getDeviceId(),
|
||||
channel.getStreamIdentification());
|
||||
snapOnPlay(result.getHookData().getMediaServer(), device.getDeviceId(), channel.getDeviceId(), streamId);
|
||||
}else {
|
||||
@ -435,7 +435,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||
}
|
||||
});
|
||||
if (ssrcInfo == null || ssrcInfo.getPort() <= 0) {
|
||||
log.info("[点播端口/SSRC]获取失败,deviceId={},channelId={},ssrcInfo={}", device.getDeviceId(), channel.getDeviceId(), ssrcInfo);
|
||||
log.info("[点播端口/SSRC]获取失败,设备编号:{}, 通道编号:{},ssrcInfo;{}", device.getDeviceId(), channel.getDeviceId(), ssrcInfo);
|
||||
callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), "获取端口或者ssrc失败", null);
|
||||
inviteStreamService.call(InviteSessionType.PLAY, channel.getId(), null,
|
||||
InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(),
|
||||
@ -443,9 +443,9 @@ public class PlayServiceImpl implements IPlayService {
|
||||
null);
|
||||
return null;
|
||||
}
|
||||
log.info("[点播开始] deviceId: {}, channelId({}): {},码流类型:{}, 收流端口: {}, 码流:{}, 收流模式:{}, SSRC: {}, SSRC校验:{}",
|
||||
device.getDeviceId(), channel.getDeviceId(), channel.getId(), channel.getStreamIdentification(), ssrcInfo.getPort(), ssrcInfo.getStream(),
|
||||
device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck());
|
||||
log.info("[点播开始] 设备编号: {}, 通道编号: {}, 收流端口: {}, 流ID:{}, 收流模式:{}, SSRC: {}, SSRC校验:{}",
|
||||
device.getDeviceId(), channel.getDeviceId(), channel.getStreamIdentification(), ssrcInfo.getPort(), ssrcInfo.getStream(),
|
||||
ssrcInfo.getSsrc(), device.isSsrcCheck());
|
||||
|
||||
// 初始化redis中的invite消息状态
|
||||
InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channel.getId(), ssrcInfo.getStream(), ssrcInfo, mediaServerItem.getId(),
|
||||
@ -1741,6 +1741,18 @@ public class PlayServiceImpl implements IPlayService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(InviteSessionType inviteSessionType, CommonGBChannel channel) {
|
||||
Device device = deviceService.getDevice(channel.getDataDeviceId());
|
||||
if (device == null) {
|
||||
log.warn("[停止播放] 未找到通道{}的设备信息", channel);
|
||||
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
|
||||
}
|
||||
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId());
|
||||
String stream = String.format("%s_%s", device.getDeviceId(), deviceChannel.getDeviceId());
|
||||
stop(inviteSessionType, device, deviceChannel, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(InviteSessionType inviteSessionType, CommonGBChannel channel, String stream) {
|
||||
Device device = deviceService.getDevice(channel.getDataDeviceId());
|
||||
|
||||
@ -8,7 +8,6 @@ import com.genersoft.iot.vmp.gb28181.bean.RegionTree;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.RegionMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IRegionService;
|
||||
import com.genersoft.iot.vmp.utils.CivilCodeUtil;
|
||||
@ -125,7 +124,7 @@ public class RegionServiceImpl implements IRegionService {
|
||||
// 发送变化通知
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(null, CommonGBChannel.build(region), CatalogEvent.UPDATE);
|
||||
eventPublisher.channelEventPublishForUpdate(CommonGBChannel.build(region), null);
|
||||
}catch (Exception e) {
|
||||
log.warn("[行政区划变化] 发送失败,{}", region.getDeviceId(), e);
|
||||
}
|
||||
|
||||
@ -40,10 +40,10 @@ public class SourcePlayServiceForGbImpl implements ISourcePlayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(CommonGBChannel channel, String stream) {
|
||||
public void stopPlay(CommonGBChannel channel) {
|
||||
// 国标通道
|
||||
try {
|
||||
deviceChannelPlayService.stop(InviteSessionType.PLAY, channel, stream);
|
||||
deviceChannelPlayService.stopPlay(InviteSessionType.PLAY, channel);
|
||||
} catch (Exception e) {
|
||||
log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.utils.GitUtil;
|
||||
import com.genersoft.iot.vmp.utils.IpPortUtil;
|
||||
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.DigestUtils;
|
||||
@ -20,7 +21,6 @@ import javax.sip.address.Address;
|
||||
import javax.sip.address.SipURI;
|
||||
import javax.sip.header.*;
|
||||
import javax.sip.message.Request;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -42,6 +42,7 @@ import javax.sip.header.WWWAuthenticateHeader;
|
||||
import javax.sip.message.Request;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@ -218,16 +219,18 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
|
||||
if (index > channels.size()) {
|
||||
return;
|
||||
}
|
||||
List<CommonGBChannel> deviceChannels;
|
||||
if (index + parentPlatform.getCatalogGroup() < channels.size()) {
|
||||
deviceChannels = channels.subList(index, index + parentPlatform.getCatalogGroup());
|
||||
String catalogXml;
|
||||
if (channels.isEmpty()) {
|
||||
catalogXml = getCatalogXml(Collections.emptyList(), sn, parentPlatform, 0);
|
||||
}else {
|
||||
deviceChannels = channels.subList(index, channels.size());
|
||||
List<CommonGBChannel> subChannelList;
|
||||
if (index + parentPlatform.getCatalogGroup() < channels.size()) {
|
||||
subChannelList = channels.subList(index, index + parentPlatform.getCatalogGroup());
|
||||
}else {
|
||||
subChannelList = channels.subList(index, channels.size());
|
||||
}
|
||||
catalogXml = getCatalogXml(subChannelList, sn, parentPlatform, channels.size());
|
||||
}
|
||||
if(deviceChannels.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String catalogXml = getCatalogXml(deviceChannels, sn, parentPlatform, channels.size());
|
||||
// callid
|
||||
CallIdHeader callIdHeader = sipSender.getNewCallIdHeader(parentPlatform.getDeviceIp(),parentPlatform.getTransport());
|
||||
|
||||
@ -353,6 +356,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
|
||||
if (parentPlatform == null) {
|
||||
return;
|
||||
}
|
||||
log.info("[发送 移动位置订阅] {}/{}->{},{}", parentPlatform.getServerGBId(), gpsMsgInfo.getId(), gpsMsgInfo.getLng(), gpsMsgInfo.getLat());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("[发送 移动位置订阅] {}/{}->{},{}", parentPlatform.getServerGBId(), gpsMsgInfo.getId(), gpsMsgInfo.getLng(), gpsMsgInfo.getLat());
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
|
||||
if (parentPlatform != null) {
|
||||
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(sendRtpItem.getChannelId());
|
||||
if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) {
|
||||
WVPResult wvpResult = redisRpcService.startSendRtp(callIdHeader.getCallId(), sendRtpItem);
|
||||
WVPResult<?> wvpResult = redisRpcService.startSendRtp(callIdHeader.getCallId(), sendRtpItem);
|
||||
if (wvpResult.getCode() == 0) {
|
||||
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, deviceChannel, parentPlatform);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
|
||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
@ -140,17 +141,17 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
}
|
||||
return;
|
||||
}
|
||||
log.info("[上级Invite] 平台:{}, 通道:{}({}), 收流地址:{}:{},收流方式:{}, 点播类型:{}, ssrc:{}",
|
||||
log.info("[上级INVITE] 平台:{}, 通道:{}({}), 收流地址:{}:{},收流方式:{}, 点播类型:{}, SSRC:{}",
|
||||
platform.getName(), channel.getGbName(), channel.getGbDeviceId(), inviteInfo.getIp(),
|
||||
inviteInfo.getPort(), inviteInfo.isTcp()?(inviteInfo.isTcpActive()?"TCP主动":"TCP被动"): "UDP",
|
||||
inviteInfo.getSessionName(), inviteInfo.getSsrc());
|
||||
if(!userSetting.getUseCustomSsrcForParentInvite() && ObjectUtils.isEmpty(inviteInfo.getSsrc())) {
|
||||
log.warn("[上级INVITE] 点播失败, 上级为携带SSRC, 并且本级未设置使用自定义ssrc");
|
||||
log.warn("[上级INVITE] 点播失败, 上级未携带SSRC, 并且本级未设置使用自定义SSRC");
|
||||
// 通道存在,发100,TRYING
|
||||
try {
|
||||
responseAck(request, Response.BAD_REQUEST);
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
log.error("[命令发送失败] 上级Invite TRYING: {}", e.getMessage());
|
||||
log.error("[命令发送失败] 上级INVITE TRYING: {}", e.getMessage());
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -158,7 +159,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
try {
|
||||
responseAck(request, Response.TRYING);
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
log.error("[命令发送失败] 上级Invite TRYING: {}", e.getMessage());
|
||||
log.error("[命令发送失败] 上级INVITE TRYING: {}", e.getMessage());
|
||||
}
|
||||
|
||||
channelPlayService.startInvite(channel, inviteInfo, platform, ((code, msg, streamInfo) -> {
|
||||
@ -166,7 +167,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
try {
|
||||
responseAck(request, Response.BUSY_HERE , msg);
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
log.error("[命令发送失败] 上级Invite 点播失败: {}", e.getMessage());
|
||||
log.error("[命令发送失败] 上级INVITE 点播失败: {}", e.getMessage());
|
||||
}
|
||||
}else {
|
||||
// 点播成功, TODO 可以在此处检测cancel命令是否存在,存在则不发送
|
||||
@ -190,7 +191,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
}
|
||||
sendRtpItem.setStatus(1);
|
||||
sendRtpItem.setCallId(inviteInfo.getCallId());
|
||||
sendRtpItem.setPlayType("Play".equalsIgnoreCase(inviteInfo.getSessionName()) ? InviteStreamType.PLAY : InviteStreamType.PLAYBACK);
|
||||
|
||||
sendRtpItem.setPlayTypeByChannelDataType(channel.getDataType(), inviteInfo.getSessionName());
|
||||
sendRtpItem.setServerId(streamInfo.getServerId());
|
||||
sendRtpServerService.update(sendRtpItem);
|
||||
String sdpIp = streamInfo.getMediaServer().getSdpIp();
|
||||
@ -208,7 +210,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
try {
|
||||
responseSdpAck(request, content, platform);
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
log.error("[命令发送失败] 上级Invite 发送 200(SDP): {}", e.getMessage());
|
||||
log.error("[命令发送失败] 上级INVITE 发送 200(SDP): {}", e.getMessage());
|
||||
}
|
||||
|
||||
// tcp主动模式,回复sdp后开启监听
|
||||
@ -221,7 +223,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, deviceChannel, platform);
|
||||
}
|
||||
}catch (ControllerException e) {
|
||||
log.warn("[上级Invite] tcp主动模式 发流失败", e);
|
||||
log.warn("[上级INVITE] tcp主动模式 发流失败", e);
|
||||
sendBye(platform, inviteInfo.getCallId());
|
||||
}
|
||||
}
|
||||
@ -277,6 +279,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
(channelIdArrayFromSub != null? channelIdArrayFromSub[0]: null);
|
||||
String requesterId = SipUtils.getUserIdFromFromHeader(request);
|
||||
CallIdHeader callIdHeader = (CallIdHeader) request.getHeader(CallIdHeader.NAME);
|
||||
|
||||
if (requesterId == null || channelId == null) {
|
||||
log.warn("[解析INVITE消息] 无法从请求中获取到来源id,返回400错误");
|
||||
throw new InviteDecodeException(Response.BAD_REQUEST, "request decode fail");
|
||||
@ -399,7 +402,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||
}
|
||||
cmderFroPlatform.streamByeCmd(platform, sendRtpItem, channel);
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
log.error("[命令发送失败] 上级Invite 发送BYE: {}", e.getMessage());
|
||||
log.error("[命令发送失败] 上级INVITE 发送BYE: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,11 +3,14 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.channel.ChannelEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.utils.Coordtransform;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dom4j.DocumentException;
|
||||
@ -49,6 +52,9 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
@Autowired
|
||||
private IDeviceChannelService deviceChannelService;
|
||||
|
||||
@Autowired
|
||||
private IGbChannelService channelService;
|
||||
|
||||
// @Scheduled(fixedRate = 2000) //每400毫秒执行一次
|
||||
// public void showSize(){
|
||||
// log.warn("[notify-目录订阅] 待处理消息数量: {}", taskQueue.size() );
|
||||
@ -116,6 +122,19 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
continue;
|
||||
}
|
||||
catalogChannelEvent.getChannel().setDataDeviceId(device.getId());
|
||||
if (catalogChannelEvent.getChannel().getLongitude() != null
|
||||
&& catalogChannelEvent.getChannel().getLatitude() != null
|
||||
&& catalogChannelEvent.getChannel().getLongitude() > 0
|
||||
&& catalogChannelEvent.getChannel().getLatitude() > 0) {
|
||||
if (device.checkWgs84()) {
|
||||
catalogChannelEvent.getChannel().setGbLongitude(catalogChannelEvent.getChannel().getLongitude());
|
||||
catalogChannelEvent.getChannel().setGbLatitude(catalogChannelEvent.getChannel().getLatitude());
|
||||
}else {
|
||||
Double[] wgs84Position = Coordtransform.GCJ02ToWGS84(catalogChannelEvent.getChannel().getLongitude(), catalogChannelEvent.getChannel().getLatitude());
|
||||
catalogChannelEvent.getChannel().setGbLongitude(wgs84Position[0]);
|
||||
catalogChannelEvent.getChannel().setGbLatitude(wgs84Position[1]);
|
||||
}
|
||||
}
|
||||
} catch (InvocationTargetException | NoSuchMethodException | InstantiationException |
|
||||
IllegalAccessException e) {
|
||||
log.error("[解析CatalogChannelEvent]失败,", e);
|
||||
@ -133,6 +152,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
log.info("[收到通道上线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), catalogChannelEvent.getChannel().getDeviceId());
|
||||
channel.setStatus("ON");
|
||||
channelList.add(NotifyCatalogChannel.getInstance(NotifyCatalogChannel.Type.STATUS_CHANGED, channel));
|
||||
|
||||
if (userSetting.getDeviceStatusNotify()) {
|
||||
// 发送redis消息
|
||||
redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), catalogChannelEvent.getChannel().getDeviceId(), true);
|
||||
@ -160,6 +180,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
} else {
|
||||
channel.setStatus("OFF");
|
||||
channelList.add(NotifyCatalogChannel.getInstance(NotifyCatalogChannel.Type.STATUS_CHANGED, channel));
|
||||
|
||||
if (userSetting.getDeviceStatusNotify()) {
|
||||
// 发送redis消息
|
||||
redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), catalogChannelEvent.getChannel().getDeviceId(), false);
|
||||
@ -174,6 +195,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
} else {
|
||||
channel.setStatus("OFF");
|
||||
channelList.add(NotifyCatalogChannel.getInstance(NotifyCatalogChannel.Type.STATUS_CHANGED, channel));
|
||||
|
||||
if (userSetting.getDeviceStatusNotify()) {
|
||||
// 发送redis消息
|
||||
redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), catalogChannelEvent.getChannel().getDeviceId(), false);
|
||||
@ -191,10 +213,12 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
channel.setHasAudio(deviceChannel.isHasAudio());
|
||||
channel.setUpdateTime(DateUtil.getNow());
|
||||
channelList.add(NotifyCatalogChannel.getInstance(NotifyCatalogChannel.Type.UPDATE, channel));
|
||||
|
||||
} else {
|
||||
catalogChannelEvent.getChannel().setUpdateTime(DateUtil.getNow());
|
||||
catalogChannelEvent.getChannel().setCreateTime(DateUtil.getNow());
|
||||
channelList.add(NotifyCatalogChannel.getInstance(NotifyCatalogChannel.Type.ADD, channel));
|
||||
|
||||
if (userSetting.getDeviceStatusNotify()) {
|
||||
// 发送redis消息
|
||||
redisCatchStorage.sendChannelAddOrDelete(device.getDeviceId(), catalogChannelEvent.getChannel().getDeviceId(), true);
|
||||
@ -206,6 +230,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
// 删除
|
||||
log.info("[收到删除通道通知] 来自设备: {}, 通道 {}", device.getDeviceId(), catalogChannelEvent.getChannel().getDeviceId());
|
||||
channelList.add(NotifyCatalogChannel.getInstance(NotifyCatalogChannel.Type.DELETE, channel));
|
||||
|
||||
if (userSetting.getDeviceStatusNotify()) {
|
||||
// 发送redis消息
|
||||
redisCatchStorage.sendChannelAddOrDelete(device.getDeviceId(), catalogChannelEvent.getChannel().getDeviceId(), false);
|
||||
@ -222,10 +247,12 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
channel.setUpdateTime(DateUtil.getNow());
|
||||
channel.setUpdateTime(DateUtil.getNow());
|
||||
channelList.add(NotifyCatalogChannel.getInstance(NotifyCatalogChannel.Type.UPDATE, channel));
|
||||
|
||||
} else {
|
||||
catalogChannelEvent.getChannel().setCreateTime(DateUtil.getNow());
|
||||
catalogChannelEvent.getChannel().setUpdateTime(DateUtil.getNow());
|
||||
channelList.add(NotifyCatalogChannel.getInstance(NotifyCatalogChannel.Type.ADD, channel));
|
||||
|
||||
if (userSetting.getDeviceStatusNotify()) {
|
||||
// 发送redis消息
|
||||
redisCatchStorage.sendChannelAddOrDelete(device.getDeviceId(), catalogChannelEvent.getChannel().getDeviceId(), true);
|
||||
@ -236,8 +263,6 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
log.warn("[ NotifyCatalog ] event not found : {}", catalogChannelEvent.getEvent());
|
||||
|
||||
}
|
||||
// 转发变化信息
|
||||
eventPublisher.catalogEventPublish(null, catalogChannelEvent.getChannel(), catalogChannelEvent.getEvent());
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,20 +287,33 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
try {
|
||||
switch (notifyCatalogChannel.getType()) {
|
||||
case STATUS_CHANGED:
|
||||
deviceChannelService.updateChannelStatus(notifyCatalogChannel.getChannel());
|
||||
deviceChannelService.updateChannelStatusForNotify(notifyCatalogChannel.getChannel());
|
||||
CommonGBChannel channelForStatus = channelService.queryCommonChannelByDeviceChannel(notifyCatalogChannel.getChannel());
|
||||
if ("ON".equals(notifyCatalogChannel.getChannel().getStatus()) ) {
|
||||
eventPublisher.channelEventPublish(channelForStatus, ChannelEvent.ChannelEventMessageType.ON);
|
||||
}else {
|
||||
eventPublisher.channelEventPublish(channelForStatus, ChannelEvent.ChannelEventMessageType.OFF);
|
||||
}
|
||||
break;
|
||||
case ADD:
|
||||
deviceChannelService.addChannel(notifyCatalogChannel.getChannel());
|
||||
CommonGBChannel channelForAdd = channelService.getOne(notifyCatalogChannel.getChannel().getId());
|
||||
eventPublisher.channelEventPublish(channelForAdd, ChannelEvent.ChannelEventMessageType.ADD);
|
||||
break;
|
||||
case UPDATE:
|
||||
CommonGBChannel oldCommonChannel = channelService.getOne(notifyCatalogChannel.getChannel().getId());
|
||||
deviceChannelService.updateChannelForNotify(notifyCatalogChannel.getChannel());
|
||||
CommonGBChannel channel = channelService.getOne(oldCommonChannel.getGbId());
|
||||
eventPublisher.channelEventPublishForUpdate(channel, oldCommonChannel);
|
||||
break;
|
||||
case DELETE:
|
||||
deviceChannelService.delete(notifyCatalogChannel.getChannel());
|
||||
CommonGBChannel oldCommonChannelForDelete = channelService.queryCommonChannelByDeviceChannel(notifyCatalogChannel.getChannel());
|
||||
deviceChannelService.deleteForNotify(notifyCatalogChannel.getChannel());
|
||||
eventPublisher.channelEventPublish(oldCommonChannelForDelete, ChannelEvent.ChannelEventMessageType.DEL);
|
||||
break;
|
||||
}
|
||||
}catch (Exception e) {
|
||||
log.error("[存储收到的通道]类型:{},编号:{}", notifyCatalogChannel.getType(),
|
||||
log.error("[存储收到的通道-异常]类型:{},编号:{}", notifyCatalogChannel.getType(),
|
||||
notifyCatalogChannel.getChannel().getDeviceId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.HandlerCatchData;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||
import com.genersoft.iot.vmp.service.IMobilePositionService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
@ -107,6 +106,7 @@ public class NotifyRequestForMobilePositionProcessor extends SIPRequestProcessor
|
||||
deviceChannel = deviceChannelService.getOne(device.getDeviceId(), channelId);
|
||||
if (deviceChannel != null) {
|
||||
mobilePosition.setChannelId(deviceChannel.getId());
|
||||
mobilePosition.setChannelDeviceId(deviceChannel.getDeviceId());
|
||||
}else {
|
||||
log.error("[notify-移动位置] 未找到通道 {}/{}", device.getDeviceId(), channelId);
|
||||
break readDocument;
|
||||
@ -166,37 +166,7 @@ public class NotifyRequestForMobilePositionProcessor extends SIPRequestProcessor
|
||||
try {
|
||||
eventPublisher.mobilePositionEventPublish(mobilePosition);
|
||||
}catch (Exception e) {
|
||||
log.error("[向上级转发移动位置失败] ", e);
|
||||
}
|
||||
if (mobilePosition.getChannelId() == null) {
|
||||
List<DeviceChannel> channels = deviceChannelService.queryChaneListByDeviceId(mobilePosition.getDeviceId());
|
||||
channels.forEach(channel -> {
|
||||
// 发送redis消息。 通知位置信息的变化
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime()));
|
||||
jsonObject.put("serial", device.getDeviceId());
|
||||
jsonObject.put("code", channel.getDeviceId());
|
||||
jsonObject.put("longitude", mobilePosition.getLongitude());
|
||||
jsonObject.put("latitude", mobilePosition.getLatitude());
|
||||
jsonObject.put("altitude", mobilePosition.getAltitude());
|
||||
jsonObject.put("direction", mobilePosition.getDirection());
|
||||
jsonObject.put("speed", mobilePosition.getSpeed());
|
||||
redisCatchStorage.sendMobilePositionMsg(jsonObject);
|
||||
});
|
||||
}else {
|
||||
// 发送redis消息。 通知位置信息的变化
|
||||
if (deviceChannel != null) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime()));
|
||||
jsonObject.put("serial", mobilePosition.getDeviceId());
|
||||
jsonObject.put("code", deviceChannel.getDeviceId());
|
||||
jsonObject.put("longitude", mobilePosition.getLongitude());
|
||||
jsonObject.put("latitude", mobilePosition.getLatitude());
|
||||
jsonObject.put("altitude", mobilePosition.getAltitude());
|
||||
jsonObject.put("direction", mobilePosition.getDirection());
|
||||
jsonObject.put("speed", mobilePosition.getSpeed());
|
||||
redisCatchStorage.sendMobilePositionMsg(jsonObject);
|
||||
}
|
||||
log.error("[MobilePositionEvent] 发送失败: ", e);
|
||||
}
|
||||
} catch (DocumentException e) {
|
||||
log.error("[收到移动位置订阅通知] 文档解析异常: \r\n{}", evt.getRequest(), e);
|
||||
|
||||
@ -154,6 +154,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
}else {
|
||||
MobilePosition mobilePosition = new MobilePosition();
|
||||
mobilePosition.setChannelId(deviceChannel.getId());
|
||||
mobilePosition.setChannelDeviceId(deviceChannel.getDeviceId());
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
|
||||
mobilePosition.setTime(deviceAlarm.getAlarmTime());
|
||||
|
||||
@ -153,6 +153,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
mobilePosition.setCreateTime(DateUtil.getNow());
|
||||
mobilePosition.setDeviceId(deviceAlarm.getDeviceId());
|
||||
mobilePosition.setChannelId(deviceChannel.getId());
|
||||
mobilePosition.setChannelDeviceId(deviceChannel.getDeviceId());
|
||||
mobilePosition.setTime(deviceAlarm.getAlarmTime());
|
||||
mobilePosition.setLongitude(deviceAlarm.getLongitude());
|
||||
mobilePosition.setLatitude(deviceAlarm.getLatitude());
|
||||
|
||||
@ -90,6 +90,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen
|
||||
mobilePosition.setDeviceId(sipMsgInfo.getDevice().getDeviceId());
|
||||
|
||||
mobilePosition.setChannelId(deviceChannel.getId());
|
||||
mobilePosition.setChannelDeviceId(deviceChannel.getDeviceId());
|
||||
String time = getText(rootElementAfterCharset, "Time");
|
||||
if (ObjectUtils.isEmpty(time)){
|
||||
mobilePosition.setTime(DateUtil.getNow());
|
||||
|
||||
@ -22,6 +22,7 @@ import javax.sip.SipException;
|
||||
import javax.sip.header.FromHeader;
|
||||
import javax.sip.message.Response;
|
||||
import java.text.ParseException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@ -75,7 +76,7 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
|
||||
cmderFroPlatform.catalogQuery(channelList, platform, sn, fromHeader.getTag());
|
||||
}else {
|
||||
// 回复无通道
|
||||
cmderFroPlatform.catalogQuery(null, platform, sn, fromHeader.getTag(), 0);
|
||||
cmderFroPlatform.catalogQuery(Collections.emptyList(), platform, sn, fromHeader.getTag());
|
||||
}
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
log.error("[命令发送失败] 国标级联 目录查询回复: {}", e.getMessage());
|
||||
|
||||
@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.gb28181.session.CatalogDataManager;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||
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.utils.Coordtransform;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dom4j.DocumentException;
|
||||
@ -25,6 +26,7 @@ import javax.sip.SipException;
|
||||
import javax.sip.message.Response;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
@ -113,13 +115,19 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||
Element deviceListElement = rootElement.element("DeviceList");
|
||||
Element sumNumElement = rootElement.element("SumNum");
|
||||
Element snElement = rootElement.element("SN");
|
||||
|
||||
sn = Integer.parseInt(snElement.getText());
|
||||
int sumNum = Integer.parseInt(sumNumElement.getText());
|
||||
|
||||
if (sumNum == 0) {
|
||||
log.info("[收到通道]设备:{}的: 0个", take.getDevice().getDeviceId());
|
||||
// 数据已经完整接收
|
||||
deviceChannelService.cleanChannelsForDevice(take.getDevice().getId());
|
||||
// 推送空数据,不然无法及时结束
|
||||
catalogDataCatch.put(take.getDevice().getDeviceId(), sn, 0, take.getDevice(),
|
||||
Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
|
||||
catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), sn, null);
|
||||
return;
|
||||
} else {
|
||||
Iterator<Element> deviceListIterator = deviceListElement.elementIterator();
|
||||
if (deviceListIterator != null) {
|
||||
@ -158,10 +166,15 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||
channel.setChannelType(2);
|
||||
groupList.add(group);
|
||||
}
|
||||
if (channel.getLongitude() != null && channel.getLatitude() != null && channel.getLongitude() > 0 && channel.getLatitude() > 0) {
|
||||
Double[] wgs84Position = Coordtransform.GCJ02ToWGS84(channel.getLongitude(), channel.getLatitude());
|
||||
channel.setGbLongitude(wgs84Position[0]);
|
||||
channel.setGbLatitude(wgs84Position[1]);
|
||||
}
|
||||
}
|
||||
channelList.add(channel);
|
||||
}
|
||||
sn = Integer.parseInt(snElement.getText());
|
||||
|
||||
catalogDataCatch.put(take.getDevice().getDeviceId(), sn, sumNum, take.getDevice(),
|
||||
channelList, regionList, groupList);
|
||||
log.info("[收到通道]设备: {} -> {}个,{}/{}", take.getDevice().getDeviceId(), channelList.size(), catalogDataCatch.size(take.getDevice().getDeviceId(), sn), sumNum);
|
||||
@ -171,15 +184,17 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||
log.warn("[收到通道] 发现未处理的异常, \r\n{}", evt.getRequest());
|
||||
log.error("[收到通道] 异常内容: ", e);
|
||||
} finally {
|
||||
if (catalogDataCatch.size(take.getDevice().getDeviceId(), sn) == catalogDataCatch.sumNum(take.getDevice().getDeviceId(), sn)) {
|
||||
String deviceId = take.getDevice().getDeviceId();
|
||||
if (catalogDataCatch.size(deviceId, sn) > 0
|
||||
&& catalogDataCatch.size(deviceId, sn) == catalogDataCatch.sumNum(deviceId, sn)) {
|
||||
// 数据已经完整接收, 此时可能存在某个设备离线变上线的情况,但是考虑到性能,此处不做处理,
|
||||
// 目前支持设备通道上线通知时和设备上线时向上级通知
|
||||
boolean resetChannelsResult = saveData(take.getDevice(), sn);
|
||||
if (!resetChannelsResult) {
|
||||
String errorMsg = "接收成功,写入失败,共" + catalogDataCatch.sumNum(take.getDevice().getDeviceId(), sn) + "条,已接收" + catalogDataCatch.getDeviceChannelList(take.getDevice().getDeviceId(), sn).size() + "条";
|
||||
catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), sn, errorMsg);
|
||||
String errorMsg = "接收成功,写入失败,共" + catalogDataCatch.sumNum(deviceId, sn) + "条,已接收" + catalogDataCatch.getDeviceChannelList(take.getDevice().getDeviceId(), sn).size() + "条";
|
||||
catalogDataCatch.setChannelSyncEnd(deviceId, sn, errorMsg);
|
||||
} else {
|
||||
catalogDataCatch.setChannelSyncEnd(take.getDevice().getDeviceId(), sn, null);
|
||||
catalogDataCatch.setChannelSyncEnd(deviceId, sn, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,6 +81,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar
|
||||
}
|
||||
mobilePosition.setDeviceId(device.getDeviceId());
|
||||
mobilePosition.setChannelId(deviceChannel.getId());
|
||||
mobilePosition.setChannelDeviceId(deviceChannel.getDeviceId());
|
||||
//兼容ISO 8601格式时间
|
||||
String time = getText(rootElement, "Time");
|
||||
if (ObjectUtils.isEmpty(time)){
|
||||
|
||||
@ -187,8 +187,16 @@ public class SipUtils {
|
||||
remotePort = request.getTopmostViaHeader().getRPort();
|
||||
// 解析本地地址替代
|
||||
if (ObjectUtils.isEmpty(remoteAddress) || remotePort == -1) {
|
||||
remoteAddress = request.getPeerPacketSourceAddress().getHostAddress();
|
||||
remotePort = request.getPeerPacketSourcePort();
|
||||
if (request.getPeerPacketSourceAddress() != null) {
|
||||
remoteAddress = request.getPeerPacketSourceAddress().getHostAddress();
|
||||
}else {
|
||||
remoteAddress = request.getRemoteAddress().getHostAddress();
|
||||
}
|
||||
if( request.getPeerPacketSourcePort() > 0) {
|
||||
remotePort = request.getPeerPacketSourcePort();
|
||||
}else {
|
||||
remotePort = request.getRemotePort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,4 +264,4 @@ public class SipUtils {
|
||||
}
|
||||
return localDateTime.format(DateUtil.formatter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,66 @@
|
||||
package com.genersoft.iot.vmp.gb28181.utils;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.VectorTileSource;
|
||||
import org.springframework.util.ConcurrentReferenceHashMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public enum VectorTileUtils {
|
||||
INSTANCE;
|
||||
|
||||
private Map<String, VectorTileSource> vectorTileMap = new ConcurrentReferenceHashMap<>();
|
||||
|
||||
public void addVectorTile(String id, String key, byte[] content) {
|
||||
VectorTileSource vectorTileSource = vectorTileMap.get(id);
|
||||
if (vectorTileSource == null) {
|
||||
vectorTileSource = new VectorTileSource();
|
||||
vectorTileMap.put(id, vectorTileSource);
|
||||
}
|
||||
|
||||
vectorTileSource.getVectorTileMap().put(key, content);
|
||||
}
|
||||
|
||||
public byte[] getVectorTile(String id, String key) {
|
||||
if (!vectorTileMap.containsKey(id)) {
|
||||
return null;
|
||||
}
|
||||
return vectorTileMap.get(id).getVectorTileMap().get(key);
|
||||
}
|
||||
|
||||
public void addSource(String id, List<CommonGBChannel> channelList) {
|
||||
VectorTileSource vectorTileSource = vectorTileMap.get(id);
|
||||
if (vectorTileSource == null) {
|
||||
vectorTileSource = new VectorTileSource();
|
||||
vectorTileMap.put(id, vectorTileSource);
|
||||
}
|
||||
vectorTileMap.get(id).getChannelList().addAll(channelList);
|
||||
}
|
||||
|
||||
|
||||
public void remove(String id) {
|
||||
vectorTileMap.remove(id);
|
||||
}
|
||||
|
||||
public List<CommonGBChannel> getChannelList(String id) {
|
||||
if (!vectorTileMap.containsKey(id)) {
|
||||
return null;
|
||||
}
|
||||
return vectorTileMap.get(id).getChannelList();
|
||||
}
|
||||
|
||||
public void save(String id) {
|
||||
if (!vectorTileMap.containsKey(id)) {
|
||||
return;
|
||||
}
|
||||
VectorTileSource vectorTileSource = vectorTileMap.get(id);
|
||||
if (vectorTileSource == null) {
|
||||
return;
|
||||
}
|
||||
vectorTileMap.remove(id);
|
||||
vectorTileMap.put("DEFAULT", vectorTileSource);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -18,6 +18,10 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
@ -27,10 +31,6 @@ import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
@ -1,18 +1,19 @@
|
||||
package com.genersoft.iot.vmp.jt1078.controller;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.*;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTChannel;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTDevice;
|
||||
import com.genersoft.iot.vmp.jt1078.service.Ijt1078Service;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Slf4j
|
||||
|
||||
@ -5,6 +5,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.Clock;
|
||||
|
||||
/**
|
||||
@ -15,6 +16,7 @@ import java.time.Clock;
|
||||
@Getter
|
||||
public class ConnectChangeEvent extends ApplicationEvent {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ConnectChangeEvent(Object source) {
|
||||
|
||||
@ -5,11 +5,14 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 设备更新事件
|
||||
*/
|
||||
public class DeviceUpdateEvent extends ApplicationEvent {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public DeviceUpdateEvent(Object source) {
|
||||
|
||||
@ -6,11 +6,14 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 设备更新事件
|
||||
*/
|
||||
public class JTPositionEvent extends ApplicationEvent {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JTPositionEvent(Object source) {
|
||||
|
||||
@ -4,8 +4,8 @@ import com.genersoft.iot.vmp.common.CommonCallback;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.*;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ public class SourcePlayServiceForJTImpl implements ISourcePlayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopPlay(CommonGBChannel channel, String stream) {
|
||||
public void stopPlay(CommonGBChannel channel) {
|
||||
// 推流
|
||||
try {
|
||||
playService.stop(channel.getDataDeviceId());
|
||||
|
||||
@ -4,10 +4,10 @@ import com.genersoft.iot.vmp.common.CommonCallback;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||
import com.genersoft.iot.vmp.conf.ftpServer.FtpFileSystemFactory;
|
||||
import com.genersoft.iot.vmp.conf.ftpServer.FtpSetting;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.ftpServer.FtpFileSystemFactory;
|
||||
import com.genersoft.iot.vmp.conf.ftpServer.FtpSetting;
|
||||
import com.genersoft.iot.vmp.conf.ftpServer.UserManager;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||
@ -30,6 +30,8 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.ftpserver.usermanager.impl.BaseUser;
|
||||
@ -42,13 +44,13 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
||||
@ -18,8 +18,10 @@ import com.genersoft.iot.vmp.media.event.media.*;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.HookResult;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.HookResultForOnPublish;
|
||||
import com.genersoft.iot.vmp.service.*;
|
||||
import com.genersoft.iot.vmp.service.IMediaService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -30,7 +32,6 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -39,6 +40,7 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/index/hook/abl")
|
||||
@Hidden
|
||||
public class ABLHttpHookListener {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(ABLHttpHookListener.class);
|
||||
|
||||
@ -5,10 +5,12 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
|
||||
public abstract class MediaServerEventAbstract extends ApplicationEvent {
|
||||
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Getter
|
||||
|
||||
@ -21,13 +21,17 @@ import com.genersoft.iot.vmp.media.service.IMediaNodeServerService;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
|
||||
import com.genersoft.iot.vmp.service.bean.*;
|
||||
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
|
||||
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.dao.MediaServerMapper;
|
||||
import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
@ -41,7 +45,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@ -14,13 +14,14 @@ import com.genersoft.iot.vmp.media.zlm.event.HookZlmServerKeepaliveEvent;
|
||||
import com.genersoft.iot.vmp.media.zlm.event.HookZlmServerStartEvent;
|
||||
import com.genersoft.iot.vmp.service.IMediaService;
|
||||
import com.genersoft.iot.vmp.utils.MediaServerUtils;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
@ -34,6 +35,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/index/hook")
|
||||
@Hidden
|
||||
public class ZLMHttpHookListener {
|
||||
|
||||
@Autowired
|
||||
|
||||
@ -228,7 +228,7 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
|
||||
@Override
|
||||
public MediaInfo getMediaInfo(MediaServer mediaServer, String app, String stream) {
|
||||
ZLMResult<JSONObject> zlmResult = zlmresTfulUtils.getMediaInfo(mediaServer, app, "rtsp", stream);
|
||||
if (zlmResult.getCode() != 0) {
|
||||
if (zlmResult.getCode() != 0 || zlmResult.getData() == null || zlmResult.getData().getString("app") == null ) {
|
||||
return null;
|
||||
}
|
||||
return MediaInfo.getInstance(zlmResult.getData(), mediaServer, userSetting.getServerId());
|
||||
@ -636,7 +636,15 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
|
||||
param.put("callId", callId);
|
||||
}
|
||||
if (mediaInfo != null && !ObjectUtils.isEmpty(mediaInfo.getOriginTypeStr())) {
|
||||
param.put("originTypeStr", mediaInfo.getOriginTypeStr());
|
||||
if (!ObjectUtils.isEmpty(mediaInfo.getOriginTypeStr())) {
|
||||
param.put("originTypeStr", mediaInfo.getOriginTypeStr());
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(mediaInfo.getVideoCodec())) {
|
||||
param.put("videoCodec", mediaInfo.getVideoCodec());
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(mediaInfo.getAudioCodec())) {
|
||||
param.put("audioCodec", mediaInfo.getAudioCodec());
|
||||
}
|
||||
}
|
||||
StringBuilder callIdParamBuilder = new StringBuilder();
|
||||
if (!param.isEmpty()) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user