Commit 97a87542a63382d2ee129803e69e5751a3d6272c

Authored by 648540858
2 parents 46af3508 0e94aeaf

Merge branch '2.6.9' into wvp-28181-2.0

# Conflicts:
#	pom.xml

Too many changes to show.

To preserve performance only 7 of 8 files are displayed.

@@ -181,6 +181,20 @@ @@ -181,6 +181,20 @@
181 <artifactId>springdoc-openapi-security</artifactId> 181 <artifactId>springdoc-openapi-security</artifactId>
182 <version>1.6.10</version> 182 <version>1.6.10</version>
183 </dependency> 183 </dependency>
  184 + <!-- https://mvnrepository.com/artifact/com.baomidou/dynamic-datasource-spring-boot-starter -->
  185 + <dependency>
  186 + <groupId>com.baomidou</groupId>
  187 + <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
  188 + <version>3.6.1</version>
  189 + </dependency>
  190 +
  191 +
  192 + <!--在线文档 -->
  193 + <dependency>
  194 + <groupId>org.springdoc</groupId>
  195 + <artifactId>springdoc-openapi-ui</artifactId>
  196 + <version>1.6.10</version>
  197 + </dependency>
184 198
185 <dependency> 199 <dependency>
186 <groupId>com.github.xiaoymin</groupId> 200 <groupId>com.github.xiaoymin</groupId>
src/main/java/com/genersoft/iot/vmp/service/ICloudRecordService.java
@@ -33,7 +33,8 @@ public interface ICloudRecordService { @@ -33,7 +33,8 @@ public interface ICloudRecordService {
33 /** 33 /**
34 * 添加合并任务 34 * 添加合并任务
35 */ 35 */
36 - String addTask(String app, String stream, MediaServerItem mediaServerItem, String startTime, String endTime, String callId, String remoteHost); 36 + String addTask(String app, String stream, MediaServerItem mediaServerItem, String startTime,
  37 + String endTime, String callId, String remoteHost, boolean filterMediaServer);
37 38
38 39
39 /** 40 /**
src/main/java/com/genersoft/iot/vmp/service/impl/CloudRecordServiceImpl.java
@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.service.impl; @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.service.impl;
2 2
3 import com.alibaba.fastjson2.JSONArray; 3 import com.alibaba.fastjson2.JSONArray;
4 import com.alibaba.fastjson2.JSONObject; 4 import com.alibaba.fastjson2.JSONObject;
  5 +import com.baomidou.dynamic.datasource.annotation.DS;
5 import com.genersoft.iot.vmp.conf.exception.ControllerException; 6 import com.genersoft.iot.vmp.conf.exception.ControllerException;
6 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; 7 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
7 import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils; 8 import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils;
@@ -29,6 +30,7 @@ import java.time.*; @@ -29,6 +30,7 @@ import java.time.*;
29 import java.util.*; 30 import java.util.*;
30 31
31 @Service 32 @Service
  33 +@DS("share")
32 public class CloudRecordServiceImpl implements ICloudRecordService { 34 public class CloudRecordServiceImpl implements ICloudRecordService {
33 35
34 private final static Logger logger = LoggerFactory.getLogger(CloudRecordServiceImpl.class); 36 private final static Logger logger = LoggerFactory.getLogger(CloudRecordServiceImpl.class);
@@ -109,7 +111,8 @@ public class CloudRecordServiceImpl implements ICloudRecordService { @@ -109,7 +111,8 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
109 } 111 }
110 112
111 @Override 113 @Override
112 - public String addTask(String app, String stream, MediaServerItem mediaServerItem, String startTime, String endTime, String callId, String remoteHost) { 114 + public String addTask(String app, String stream, MediaServerItem mediaServerItem, String startTime, String endTime,
  115 + String callId, String remoteHost, boolean filterMediaServer) {
113 // 参数校验 116 // 参数校验
114 assert app != null; 117 assert app != null;
115 assert stream != null; 118 assert stream != null;
@@ -128,7 +131,8 @@ public class CloudRecordServiceImpl implements ICloudRecordService { @@ -128,7 +131,8 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
128 List<MediaServerItem> mediaServers = new ArrayList<>(); 131 List<MediaServerItem> mediaServers = new ArrayList<>();
129 mediaServers.add(mediaServerItem); 132 mediaServers.add(mediaServerItem);
130 // 检索相关的录像文件 133 // 检索相关的录像文件
131 - List<String> filePathList = cloudRecordServiceMapper.queryRecordFilePathList(app, stream, startTimeStamp, endTimeStamp, callId, mediaServers); 134 + List<String> filePathList = cloudRecordServiceMapper.queryRecordFilePathList(app, stream, startTimeStamp,
  135 + endTimeStamp, callId, filterMediaServer ? mediaServers : null);
132 if (filePathList == null || filePathList.isEmpty()) { 136 if (filePathList == null || filePathList.isEmpty()) {
133 throw new ControllerException(ErrorCode.ERROR100.getCode(), "未检索到视频文件"); 137 throw new ControllerException(ErrorCode.ERROR100.getCode(), "未检索到视频文件");
134 } 138 }
src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java
@@ -167,10 +167,6 @@ public class CloudRecordController { @@ -167,10 +167,6 @@ public class CloudRecordController {
167 @RequestParam(required = false) String callId, 167 @RequestParam(required = false) String callId,
168 @RequestParam(required = false) String remoteHost 168 @RequestParam(required = false) String remoteHost
169 ){ 169 ){
170 - System.out.println(request.getScheme());  
171 - System.out.println(request.getLocalAddr());  
172 - System.out.println(request.getRemoteAddr());  
173 - System.out.println(request.getRequestURI());  
174 MediaServerItem mediaServerItem; 170 MediaServerItem mediaServerItem;
175 if (mediaServerId == null) { 171 if (mediaServerId == null) {
176 mediaServerItem = mediaServerService.getDefaultMediaServer(); 172 mediaServerItem = mediaServerService.getDefaultMediaServer();
@@ -184,7 +180,7 @@ public class CloudRecordController { @@ -184,7 +180,7 @@ public class CloudRecordController {
184 remoteHost = request.getScheme() + "://" + request.getLocalAddr() + ":" + mediaServerItem.getRecordAssistPort(); 180 remoteHost = request.getScheme() + "://" + request.getLocalAddr() + ":" + mediaServerItem.getRecordAssistPort();
185 } 181 }
186 } 182 }
187 - return cloudRecordService.addTask(app, stream, mediaServerItem, startTime, endTime, callId, remoteHost); 183 + return cloudRecordService.addTask(app, stream, mediaServerItem, startTime, endTime, callId, remoteHost, mediaServerId != null);
188 } 184 }
189 185
190 @ResponseBody 186 @ResponseBody
src/main/resources/all-application.yml
@@ -47,18 +47,29 @@ spring: @@ -47,18 +47,29 @@ spring:
47 # username: root 47 # username: root
48 # password: SYceshizu1234 48 # password: SYceshizu1234
49 # mysql配置 49 # mysql配置
50 - type: com.zaxxer.hikari.HikariDataSource  
51 - driver-class-name: com.mysql.cj.jdbc.Driver  
52 - url: jdbc:mysql://127.0.0.1:3306/wvp2?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true  
53 - username: root  
54 - password: root123  
55 - hikari:  
56 - connection-timeout: 20000 # 是客户端等待连接池连接的最大毫秒数  
57 - initialSize: 50 # 连接池初始化连接数  
58 - maximum-pool-size: 200 # 连接池最大连接数  
59 - minimum-idle: 10 # 连接池最小空闲连接数  
60 - idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位)  
61 - max-lifetime: 1200000 # 是池中连接关闭后的最长生命周期(以毫秒为单位) 50 + dynamic:
  51 + primary: master
  52 + datasource:
  53 + master:
  54 + type: com.zaxxer.hikari.HikariDataSource
  55 + driver-class-name: com.mysql.cj.jdbc.Driver
  56 + url: jdbc:mysql://127.0.0.1:3306/wvp2?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
  57 + username: root
  58 + password: root123
  59 + hikari:
  60 + connection-timeout: 20000 # 是客户端等待连接池连接的最大毫秒数
  61 + initialSize: 50 # 连接池初始化连接数
  62 + maximum-pool-size: 200 # 连接池最大连接数
  63 + minimum-idle: 10 # 连接池最小空闲连接数
  64 + idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位)
  65 + max-lifetime: 1200000 # 是池中连接关闭后的最长生命周期(以毫秒为单位)
  66 + share:
  67 + type: com.zaxxer.hikari.HikariDataSource
  68 + driver-class-name: com.mysql.cj.jdbc.Driver
  69 + url: jdbc:mysql://127.0.0.1:3306/wvp269_1?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
  70 + username: root
  71 + password: 12345678
  72 +
62 73
63 74
64 # 修改分页插件为 postgresql, 数据库类型为mysql不需要 75 # 修改分页插件为 postgresql, 数据库类型为mysql不需要
src/main/resources/application-dev.yml
@@ -24,18 +24,22 @@ spring: @@ -24,18 +24,22 @@ spring:
24 timeout: 10000 24 timeout: 10000
25 # mysql数据源 25 # mysql数据源
26 datasource: 26 datasource:
27 - type: com.zaxxer.hikari.HikariDataSource  
28 - driver-class-name: com.mysql.cj.jdbc.Driver  
29 - url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true  
30 - username: root  
31 - password: root  
32 - hikari:  
33 - connection-timeout: 20000 # 是客户端等待连接池连接的最大毫秒数  
34 - initialSize: 10 # 连接池初始化连接数  
35 - maximum-pool-size: 200 # 连接池最大连接数  
36 - minimum-idle: 5 # 连接池最小空闲连接数  
37 - idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位)  
38 - max-lifetime: 1200000 # 是池中连接关闭后的最长生命周期(以毫秒为单位) 27 + dynamic:
  28 + primary: master
  29 + datasource:
  30 + master:
  31 + type: com.zaxxer.hikari.HikariDataSource
  32 + driver-class-name: com.mysql.cj.jdbc.Driver
  33 + url: jdbc:mysql://127.0.0.1:3306/wvp2?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
  34 + username: root
  35 + password: root123
  36 + hikari:
  37 + connection-timeout: 20000 # 是客户端等待连接池连接的最大毫秒数
  38 + initialSize: 50 # 连接池初始化连接数
  39 + maximum-pool-size: 200 # 连接池最大连接数
  40 + minimum-idle: 10 # 连接池最小空闲连接数
  41 + idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位)
  42 + max-lifetime: 1200000 # 是池中连接关闭后的最长生命周期(以毫秒为单位)
39 #[可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 43 #[可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
40 server: 44 server:
41 port: 8080 45 port: 8080
src/main/resources/application-docker.yml
@@ -18,13 +18,22 @@ spring: @@ -18,13 +18,22 @@ spring:
18 timeout: 10000 18 timeout: 10000
19 # [必选] jdbc数据库配置 19 # [必选] jdbc数据库配置
20 datasource: 20 datasource:
21 - # 使用mysql 打开23-28行注释, 删除29-36行  
22 - name: wvp  
23 - url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&allowMultiQueries=true  
24 - username: root  
25 - password: root  
26 - type: com.zaxxer.hikari.HikariDataSource  
27 - driver-class-name: com.mysql.cj.jdbc.Driver 21 + dynamic:
  22 + primary: master
  23 + datasource:
  24 + master:
  25 + type: com.zaxxer.hikari.HikariDataSource
  26 + driver-class-name: com.mysql.cj.jdbc.Driver
  27 + url: jdbc:mysql://127.0.0.1:3306/wvp2?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
  28 + username: root
  29 + password: root123
  30 + hikari:
  31 + connection-timeout: 20000 # 是客户端等待连接池连接的最大毫秒数
  32 + initialSize: 50 # 连接池初始化连接数
  33 + maximum-pool-size: 200 # 连接池最大连接数
  34 + minimum-idle: 10 # 连接池最小空闲连接数
  35 + idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位)
  36 + max-lifetime: 1200000 # 是池中连接关闭后的最长生命周期(以毫秒为单位)
28 37
29 # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 38 # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
30 server: 39 server: