添加 lombok 和 mapstruct 支持

添加测试启动类及配置
This commit is contained in:
zxb 2023-08-04 11:16:08 +08:00
parent a251014ed3
commit 5a9354639e
7 changed files with 247 additions and 42 deletions

2
.gitignore vendored
View File

@ -27,4 +27,6 @@ hs_err_pid*
/target/ /target/
/src/main/resources/static/ /src/main/resources/static/
/web_src/node_modules/
/web_src/build/
certificates certificates

97
pom.xml
View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<project <project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -55,6 +55,8 @@
<generated.asciidoc.directory>${project.build.directory}/asciidoc</generated.asciidoc.directory> <generated.asciidoc.directory>${project.build.directory}/asciidoc</generated.asciidoc.directory>
<asciidoctor.html.output.directory>${project.build.directory}/asciidoc/html</asciidoctor.html.output.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> <asciidoctor.pdf.output.directory>${project.build.directory}/asciidoc/pdf</asciidoctor.pdf.output.directory>
<org.mapstruct.version>1.5.3.Final</org.mapstruct.version>
<springboot.version>2.7.2</springboot.version>
</properties> </properties>
<profiles> <profiles>
@ -241,11 +243,11 @@
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/net.sf.kxml/kxml2 --> <!-- https://mvnrepository.com/artifact/net.sf.kxml/kxml2 -->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>net.sf.kxml</groupId>--> <!-- <groupId>net.sf.kxml</groupId>-->
<!-- <artifactId>kxml2</artifactId>--> <!-- <artifactId>kxml2</artifactId>-->
<!-- <version>2.3.0</version>--> <!-- <version>2.3.0</version>-->
<!-- </dependency>--> <!-- </dependency>-->
<!-- jwt实现 --> <!-- jwt实现 -->
<dependency> <dependency>
@ -280,13 +282,13 @@
<artifactId>spring-session-core</artifactId> <artifactId>spring-session-core</artifactId>
</dependency> </dependency>
<!-- &lt;!&ndash; 检测文件编码 &ndash;&gt;--> <!-- &lt;!&ndash; 检测文件编码 &ndash;&gt;-->
<!-- &lt;!&ndash; https://mvnrepository.com/artifact/cpdetector/cpdetector &ndash;&gt;--> <!-- &lt;!&ndash; https://mvnrepository.com/artifact/cpdetector/cpdetector &ndash;&gt;-->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>cpdetector</groupId>--> <!-- <groupId>cpdetector</groupId>-->
<!-- <artifactId>cpdetector</artifactId>--> <!-- <artifactId>cpdetector</artifactId>-->
<!-- <version>1.0.8</version>--> <!-- <version>1.0.8</version>-->
<!-- </dependency>--> <!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/com.google.guava/guava --> <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency> <dependency>
@ -299,9 +301,28 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<!-- <scope>test</scope>--> <!-- <scope>test</scope>-->
</dependency> </dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!--MapStruct-->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
@ -316,15 +337,6 @@
<includeSystemScope>true</includeSystemScope> <includeSystemScope>true</includeSystemScope>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>pl.project13.maven</groupId> <groupId>pl.project13.maven</groupId>
@ -346,6 +358,41 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
<path>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>${springboot.version}</version>
</path>
<!-- other annotation processors -->
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>

View File

@ -112,7 +112,10 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
toTag, callIdHeader, isRegister? parentPlatform.getExpires() : 0); toTag, callIdHeader, isRegister? parentPlatform.getExpires() : 0);
// callid 写入缓存 等注册成功可以更新状态 // callid 写入缓存 等注册成功可以更新状态
String callIdFromHeader = callIdHeader.getCallId(); String callIdFromHeader = callIdHeader.getCallId();
redisCatchStorage.updatePlatformRegisterInfo(callIdFromHeader, PlatformRegisterInfo.getInstance(parentPlatform.getServerGBId(), isRegister)); PlatformRegisterInfo instance = PlatformRegisterInfo.getInstance(parentPlatform.getServerGBId(), isRegister);
logger.info("callIdFromHeader {}",callIdFromHeader);
logger.info("PlatformRegisterInfo {}",instance);
redisCatchStorage.updatePlatformRegisterInfo(callIdFromHeader, instance);
sipSubscribe.addErrorSubscribe(callIdHeader.getCallId(), (event)->{ sipSubscribe.addErrorSubscribe(callIdHeader.getCallId(), (event)->{
if (event != null) { if (event != null) {

View File

@ -15,6 +15,7 @@ import com.genersoft.iot.vmp.service.IPlayService;
import com.genersoft.iot.vmp.service.bean.InviteErrorCode; import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -35,30 +36,25 @@ import java.text.ParseException;
@RestController @RestController
@RequestMapping(value = "/api/v1/stream") @RequestMapping(value = "/api/v1/stream")
@RequiredArgsConstructor
public class ApiStreamController { public class ApiStreamController {
private final static Logger logger = LoggerFactory.getLogger(ApiStreamController.class); private final static Logger logger = LoggerFactory.getLogger(ApiStreamController.class);
@Autowired
private SIPCommander cmder;
@Autowired private final SIPCommander cmder;
private IVideoManagerStorage storager;
@Autowired private final IVideoManagerStorage storager;
private UserSetting userSetting;
@Autowired private final UserSetting userSetting;
private IRedisCatchStorage redisCatchStorage;
@Autowired private final IRedisCatchStorage redisCatchStorage;
private IDeviceService deviceService;
@Autowired private final IDeviceService deviceService;
private IPlayService playService;
@Autowired private final IPlayService playService;
private IInviteStreamService inviteStreamService;
private final IInviteStreamService inviteStreamService;
/** /**
* 实时直播 - 开始直播 * 实时直播 - 开始直播

View File

@ -2,16 +2,17 @@ package com.genersoft.iot.vmp.web.gb28181;
import com.genersoft.iot.vmp.service.IUserService; import com.genersoft.iot.vmp.service.IUserService;
import com.genersoft.iot.vmp.storager.dao.dto.User; import com.genersoft.iot.vmp.storager.dao.dto.User;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@RestController @RestController
@RequestMapping(value = "/auth") @RequestMapping(value = "/auth")
@RequiredArgsConstructor
public class AuthController { public class AuthController {
@Autowired private final IUserService userService;
private IUserService userService;
@RequestMapping("/login") @RequestMapping("/login")
public String devices(String name, String passwd){ public String devices(String name, String passwd){

View File

@ -0,0 +1,14 @@
package com.genersoft.iot.vmp;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
@ServletComponentScan("com.genersoft.iot.vmp.conf")
@SpringBootApplication
@EnableScheduling
public class VManageBootstrapTest {
public static void main(String[] args) {
VManageBootstrap.main(args);
}
}

View File

@ -0,0 +1,142 @@
spring:
# 设置接口超时时间
mvc:
async:
request-timeout: 20000
thymeleaf:
cache: false
# [可选]上传文件大小限制
servlet:
multipart:
max-file-size: 10MB
max-request-size: 100MB
# REDIS数据库配置
redis:
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
host: 192.168.1.241
# [必须修改] 端口号
port: 6379
# [可选] 数据库 DB
database: 7
# [可选] 访问密码,若你的redis服务器没有设置密码就不需要用密码去连接
password:
# [可选] 超时时间
timeout: 10000
# mysql数据源
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.1.241:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
username: root
password: 123456a
hikari:
connection-timeout: 20000 # 是客户端等待连接池连接的最大毫秒数
initialSize: 10 # 连接池初始化连接数
maximum-pool-size: 200 # 连接池最大连接数
minimum-idle: 5 # 连接池最小空闲连接数
idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位)
max-lifetime: 1200000 # 是池中连接关闭后的最长生命周期(以毫秒为单位)
#[可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
server:
port: 18978
# [可选] HTTPS配置 默认不开启
ssl:
# [可选] 是否开启HTTPS访问
enabled: false
# [可选] 证书文件路径放置在resource/目录下即可修改xxx为文件名
key-store: classpath:test.monitor.89iot.cn.jks
# [可选] 证书密码
key-store-password: gpf64qmw
# [可选] 证书类型, 默认为jks根据实际修改
key-store-type: JKS
# 作为28181服务器的配置
sip:
# [必须修改] 本机的IP对应你的网卡监听什么ip就是使用什么网卡
# 如果要监听多张网卡可以使用逗号分隔多个IP 例如: 192.168.1.4,10.0.0.4
# 如果不明白就使用0.0.0.0,大部分情况都是可以的
# 请不要使用127.0.0.1任何包括localhost在内的域名都是不可以的。
ip: 192.168.0.195,10.27.0.1
# [可选] 28181服务监听的端口
port: 5060
# 根据国标6.1.2中规定domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码由省级、市级、区级、基层编号组成参照GB/T 2260-2007
# 后两位为行业编码定义参照附录D.3
# 3701020049标识山东济南历下区 信息行业接入
# [可选]
domain: 4405010000
# [可选]
id: 44050100002000000002
# [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验
password: 123456
# 是否存储alarm信息
alarm: true
##zlm 默认服务器配置
#media:
# id: your_server_id
# # [必须修改] zlm服务器的内网IP
# ip: 192.168.1.241
# # [必须修改] zlm服务器的http.port
# http-port: 5080
# # [可选] 返回流地址时的ip置空使用 media.ip
## stream-ip: 192.168.10.241
# # [可选] wvp在国标信令中使用的ip此ip为摄像机可以访问到的ip 置空使用 media.ip
## sdp-ip: 192.168.10.241
# # [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
# hook-ip:
# # [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置
# http-ssl-port: 5443
# # [可选] zlm服务器的hook.admin_params=secret
# secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
# # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分 点播超时建议使用多端口测试
# rtp:
# # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
# enable: true
# # [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性不然自动配置此属性可能不成功
# port-range: 51000,51300 # 端口范围
# # [可选] 国标级联在此范围内选择端口发送媒体流,
# send-port-range: 51000,51300 # 端口范围
# # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载 0 表示不使用
# record-assist-port: 18979
#zlm 默认服务器配置
media:
id: amrWMKmbKqoBjRQ9
# [必须修改] zlm服务器的内网IP
ip: 10.10.10.200
# [必须修改] zlm服务器的http.port
http-port: 5080
# [可选] 返回流地址时的ip置空使用 media.ip
stream-ip:
# [可选] wvp在国标信令中使用的ip此ip为摄像机可以访问到的ip 置空使用 media.ip
sdp-ip:
# [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
hook-ip:
# [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置
http-ssl-port: 5443
# [可选] zlm服务器的hook.admin_params=secret
secret: 4155cca6-2f9f-11ee-85e6-8de4ce2e7333
# 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分 点播超时建议使用多端口测试
rtp:
# [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
enable: true
# [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性不然自动配置此属性可能不成功
port-range: 61200,61250 # 端口范围
# [可选] 国标级联在此范围内选择端口发送媒体流,
send-port-range: 61200,61250 # 端口范围
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载 0 表示不使用
record-assist-port: 0
# [根据业务需求配置]
user-settings:
# 点播/录像回放 等待超时时间,单位:毫秒
play-timeout: 180000
# [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true
auto-apply-play: true
# 设备/通道状态变化时发送消息
device-status-notify: true
# 跨域配置,配置你访问前端页面的地址即可, 可以配置多个
allowed-origins:
- http://localhost:8080
- http://127.0.0.1:8080
# [可选] 日志配置, 一般不需要改
logging:
config: classpath:logback-spring-local.xml