Merge branch 'wvp-28181-2.0' into wvp-pro-record
# Conflicts: # src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java # web_src/src/components/control.vuepull/375/head
commit
29191373aa
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
# Log file
|
# Log file
|
||||||
*.log
|
*.log
|
||||||
|
logs/*
|
||||||
# BlueJ files
|
# BlueJ files
|
||||||
*.ctxt
|
*.ctxt
|
||||||
|
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -90,8 +90,8 @@
|
||||||
<!-- druid数据库连接池 -->
|
<!-- druid数据库连接池 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>druid</artifactId>
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
<version>1.2.3</version>
|
<version>1.1.22</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- mysql数据库 -->
|
<!-- mysql数据库 -->
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.genersoft.iot.vmp;
|
||||||
|
|
||||||
import java.util.logging.LogManager;
|
import java.util.logging.LogManager;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.conf.druid.EnableDruidSupport;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
|
@ -17,6 +18,7 @@ import springfox.documentation.oas.annotations.EnableOpenApi;
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@EnableOpenApi
|
@EnableOpenApi
|
||||||
|
@EnableDruidSupport
|
||||||
public class VManageBootstrap extends LogManager {
|
public class VManageBootstrap extends LogManager {
|
||||||
private static String[] args;
|
private static String[] args;
|
||||||
private static ConfigurableApplicationContext context;
|
private static ConfigurableApplicationContext context;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.conf;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||||
|
@ -30,7 +31,7 @@ public class SipPlatformRunner implements CommandLineRunner {
|
||||||
private EventPublisher publisher;
|
private EventPublisher publisher;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ZLMRTPServerFactory zlmrtpServerFactory;
|
private ISIPCommanderForPlatform sipCommanderForPlatform;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,6 +58,9 @@ public class SipPlatformRunner implements CommandLineRunner {
|
||||||
parentPlatformCatch.setId(parentPlatform.getServerGBId());
|
parentPlatformCatch.setId(parentPlatform.getServerGBId());
|
||||||
redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
|
redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
|
||||||
|
|
||||||
|
// 取消订阅
|
||||||
|
sipCommanderForPlatform.unregister(parentPlatform, null, null);
|
||||||
|
Thread.sleep(500);
|
||||||
// 发送平台未注册消息
|
// 发送平台未注册消息
|
||||||
publisher.platformNotRegisterEventPublish(parentPlatform.getServerGBId());
|
publisher.platformNotRegisterEventPublish(parentPlatform.getServerGBId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.genersoft.iot.vmp.conf.druid;
|
||||||
|
|
||||||
|
import com.alibaba.druid.support.http.StatViewServlet;
|
||||||
|
import com.alibaba.druid.support.http.WebStatFilter;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
|
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
|
import javax.servlet.Filter;
|
||||||
|
import javax.servlet.Servlet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* druid监控配置
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
public class DruidConfiguration {
|
||||||
|
|
||||||
|
@Value("${rj-druid-manage.allow:127.0.0.1}")
|
||||||
|
private String allow;
|
||||||
|
|
||||||
|
@Value("${rj-druid-manage.deny:}")
|
||||||
|
private String deny;
|
||||||
|
|
||||||
|
@Value("${rj-druid-manage.loginUsername:admin}")
|
||||||
|
private String loginUsername;
|
||||||
|
|
||||||
|
@Value("${rj-druid-manage.loginPassword:admin}")
|
||||||
|
private String loginPassword;
|
||||||
|
|
||||||
|
@Value("${rj-druid-manage.resetEnable:false}")
|
||||||
|
private String resetEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* druid监控页面开启
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public ServletRegistrationBean druidServlet() {
|
||||||
|
ServletRegistrationBean<Servlet> servletRegistrationBean = new ServletRegistrationBean<>(new StatViewServlet(), "/druid/*");
|
||||||
|
// IP白名单
|
||||||
|
servletRegistrationBean.addInitParameter("allow", allow);
|
||||||
|
// IP黑名单(共同存在时,deny优先于allow)
|
||||||
|
servletRegistrationBean.addInitParameter("deny", deny);
|
||||||
|
//控制台管理用户
|
||||||
|
servletRegistrationBean.addInitParameter("loginUsername", loginUsername);
|
||||||
|
servletRegistrationBean.addInitParameter("loginPassword", loginPassword);
|
||||||
|
//是否能够重置数据 禁用HTML页面上的“Reset All”功能
|
||||||
|
servletRegistrationBean.addInitParameter("resetEnable", resetEnable);
|
||||||
|
return servletRegistrationBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* druid url监控配置
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public FilterRegistrationBean filterRegistrationBean() {
|
||||||
|
FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>(new WebStatFilter());
|
||||||
|
filterRegistrationBean.addUrlPatterns("/*");
|
||||||
|
filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
|
||||||
|
return filterRegistrationBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.genersoft.iot.vmp.conf.druid;
|
||||||
|
|
||||||
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* druid监控支持注解
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
* {@link DruidConfiguration} druid监控页面安全配置支持
|
||||||
|
* {@link ServletComponentScan} druid监控页面需要扫描servlet
|
||||||
|
*/
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
@Inherited
|
||||||
|
@Import({
|
||||||
|
DruidConfiguration.class,
|
||||||
|
})
|
||||||
|
@ServletComponentScan
|
||||||
|
public @interface EnableDruidSupport {
|
||||||
|
}
|
|
@ -18,13 +18,16 @@ public class SubscribeInfo {
|
||||||
this.fromTag = fromHeader.getTag();
|
this.fromTag = fromHeader.getTag();
|
||||||
ExpiresHeader expiresHeader = (ExpiresHeader)request.getHeader(ExpiresHeader.NAME);
|
ExpiresHeader expiresHeader = (ExpiresHeader)request.getHeader(ExpiresHeader.NAME);
|
||||||
this.expires = expiresHeader.getExpires();
|
this.expires = expiresHeader.getExpires();
|
||||||
this.event = ((EventHeader)request.getHeader(EventHeader.NAME)).getName();
|
EventHeader eventHeader = (EventHeader)request.getHeader(EventHeader.NAME);
|
||||||
|
this.eventId = eventHeader.getEventId();
|
||||||
|
this.eventType = eventHeader.getEventType();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private int expires;
|
private int expires;
|
||||||
private String callId;
|
private String callId;
|
||||||
private String event;
|
private String eventId;
|
||||||
|
private String eventType;
|
||||||
private String fromTag;
|
private String fromTag;
|
||||||
private String toTag;
|
private String toTag;
|
||||||
|
|
||||||
|
@ -68,11 +71,19 @@ public class SubscribeInfo {
|
||||||
this.fromTag = fromTag;
|
this.fromTag = fromTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEvent() {
|
public String getEventId() {
|
||||||
return event;
|
return eventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEvent(String event) {
|
public void setEventId(String eventId) {
|
||||||
this.event = event;
|
this.eventId = eventId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEventType() {
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventType(String eventType) {
|
||||||
|
this.eventType = eventType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,14 +99,14 @@ public class EventPublisher {
|
||||||
applicationEventPublisher.publishEvent(outEvent);
|
applicationEventPublisher.publishEvent(outEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
|
||||||
public void catalogEventPublish(String platformId, DeviceChannel deviceChannel, String type) {
|
public void catalogEventPublish(String platformId, DeviceChannel deviceChannel, String type) {
|
||||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
||||||
deviceChannelList.add(deviceChannel);
|
deviceChannelList.add(deviceChannel);
|
||||||
catalogEventPublish(platformId, deviceChannelList, type);
|
catalogEventPublish(platformId, deviceChannelList, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
|
||||||
public void catalogEventPublish(String platformId, List<DeviceChannel> deviceChannels, String type) {
|
public void catalogEventPublish(String platformId, List<DeviceChannel> deviceChannels, String type) {
|
||||||
CatalogEvent outEvent = new CatalogEvent(this);
|
CatalogEvent outEvent = new CatalogEvent(this);
|
||||||
List<DeviceChannel> channels = new ArrayList<>();
|
List<DeviceChannel> channels = new ArrayList<>();
|
||||||
|
@ -128,8 +128,8 @@ public class EventPublisher {
|
||||||
applicationEventPublisher.publishEvent(outEvent);
|
applicationEventPublisher.publishEvent(outEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
|
||||||
public void catalogEventPublishForStream(String platformId, GbStream[] gbStreams, String type) {
|
public void catalogEventPublishForStream(String platformId, List<GbStream> gbStreams, String type) {
|
||||||
CatalogEvent outEvent = new CatalogEvent(this);
|
CatalogEvent outEvent = new CatalogEvent(this);
|
||||||
outEvent.setGbStreams(gbStreams);
|
outEvent.setGbStreams(gbStreams);
|
||||||
outEvent.setType(type);
|
outEvent.setType(type);
|
||||||
|
@ -137,10 +137,11 @@ public class EventPublisher {
|
||||||
applicationEventPublisher.publishEvent(outEvent);
|
applicationEventPublisher.publishEvent(outEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
|
||||||
public void catalogEventPublishForStream(String platformId, GbStream gbStream, String type) {
|
public void catalogEventPublishForStream(String platformId, GbStream gbStream, String type) {
|
||||||
GbStream[] gbStreams = {gbStream};
|
List<GbStream> gbStreamList = new ArrayList<>();
|
||||||
catalogEventPublishForStream(platformId, gbStreams, type);
|
gbStreamList.add(gbStream);
|
||||||
|
catalogEventPublishForStream(platformId, gbStreamList, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordEndEventPush(RecordInfo recordInfo) {
|
public void recordEndEventPush(RecordInfo recordInfo) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class CatalogEvent extends ApplicationEvent {
|
||||||
public static final String UPDATE = "UPDATE"; // 更新
|
public static final String UPDATE = "UPDATE"; // 更新
|
||||||
|
|
||||||
private List<DeviceChannel> deviceChannels;
|
private List<DeviceChannel> deviceChannels;
|
||||||
private GbStream[] gbStreams;
|
private List<GbStream> gbStreams;
|
||||||
private String type;
|
private String type;
|
||||||
private String platformId;
|
private String platformId;
|
||||||
|
|
||||||
|
@ -48,11 +48,11 @@ public class CatalogEvent extends ApplicationEvent {
|
||||||
this.platformId = platformId;
|
this.platformId = platformId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GbStream[] getGbStreams() {
|
public List<GbStream> getGbStreams() {
|
||||||
return gbStreams;
|
return gbStreams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGbStreams(GbStream[] gbStreams) {
|
public void setGbStreams(List<GbStream> gbStreams) {
|
||||||
this.gbStreams = gbStreams;
|
this.gbStreams = gbStreams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,11 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
if (parentPlatform != null && !parentPlatform.isStatus())return;
|
if (parentPlatform != null && !parentPlatform.isStatus())return;
|
||||||
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId();
|
String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId();
|
||||||
subscribe = redisCatchStorage.getSubscribe(key);
|
subscribe = redisCatchStorage.getSubscribe(key);
|
||||||
if (subscribe == null) return;
|
|
||||||
|
if (subscribe == null) {
|
||||||
|
logger.debug("发送订阅消息时发现订阅信息已经不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
// 获取所用订阅
|
// 获取所用订阅
|
||||||
List<String> platforms = redisCatchStorage.getAllSubscribePlatform();
|
List<String> platforms = redisCatchStorage.getAllSubscribePlatform();
|
||||||
|
@ -94,7 +98,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
if (event.getDeviceChannels() != null) {
|
if (event.getDeviceChannels() != null) {
|
||||||
deviceChannelList.addAll(event.getDeviceChannels());
|
deviceChannelList.addAll(event.getDeviceChannels());
|
||||||
}
|
}
|
||||||
if (event.getGbStreams() != null && event.getGbStreams().length > 0){
|
if (event.getGbStreams() != null && event.getGbStreams().size() > 0){
|
||||||
for (GbStream gbStream : event.getGbStreams()) {
|
for (GbStream gbStream : event.getGbStreams()) {
|
||||||
DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
|
DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
|
||||||
deviceChannelList.add(deviceChannelByStream);
|
deviceChannelList.add(deviceChannelByStream);
|
||||||
|
@ -134,7 +138,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
if (event.getDeviceChannels() != null) {
|
if (event.getDeviceChannels() != null) {
|
||||||
deviceChannelList.addAll(event.getDeviceChannels());
|
deviceChannelList.addAll(event.getDeviceChannels());
|
||||||
}
|
}
|
||||||
if (event.getGbStreams() != null && event.getGbStreams().length > 0){
|
if (event.getGbStreams() != null && event.getGbStreams().size() > 0){
|
||||||
for (GbStream gbStream : event.getGbStreams()) {
|
for (GbStream gbStream : event.getGbStreams()) {
|
||||||
DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
|
DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
|
||||||
deviceChannelList.add(deviceChannelByStream);
|
deviceChannelList.add(deviceChannelByStream);
|
||||||
|
@ -142,7 +146,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
||||||
}
|
}
|
||||||
if (deviceChannelList.size() > 0) {
|
if (deviceChannelList.size() > 0) {
|
||||||
logger.info("[Catalog事件: {}]平台:{},影响通道{}个", event.getType(), event.getPlatformId(), deviceChannelList.size());
|
logger.info("[Catalog事件: {}]平台:{},影响通道{}个", event.getType(), event.getPlatformId(), deviceChannelList.size());
|
||||||
sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), parentPlatform, deviceChannelList, subscribe);
|
sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), parentPlatform, deviceChannelList, subscribe, null);
|
||||||
}
|
}
|
||||||
}else if (parentPlatformMap.keySet().size() > 0) {
|
}else if (parentPlatformMap.keySet().size() > 0) {
|
||||||
for (String gbId : parentPlatformMap.keySet()) {
|
for (String gbId : parentPlatformMap.keySet()) {
|
||||||
|
|
|
@ -73,6 +73,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
|
||||||
@Override
|
@Override
|
||||||
@Async
|
@Async
|
||||||
public void processRequest(RequestEvent requestEvent) {
|
public void processRequest(RequestEvent requestEvent) {
|
||||||
|
logger.debug("\n收到请求:\n{}", requestEvent.getRequest());
|
||||||
String method = requestEvent.getRequest().getMethod();
|
String method = requestEvent.getRequest().getMethod();
|
||||||
ISIPRequestProcessor sipRequestProcessor = requestProcessorMap.get(method);
|
ISIPRequestProcessor sipRequestProcessor = requestProcessorMap.get(method);
|
||||||
if (sipRequestProcessor == null) {
|
if (sipRequestProcessor == null) {
|
||||||
|
@ -90,9 +91,8 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
|
||||||
@Override
|
@Override
|
||||||
@Async
|
@Async
|
||||||
public void processResponse(ResponseEvent responseEvent) {
|
public void processResponse(ResponseEvent responseEvent) {
|
||||||
logger.debug(responseEvent.getResponse().toString());
|
|
||||||
Response response = responseEvent.getResponse();
|
Response response = responseEvent.getResponse();
|
||||||
logger.debug(responseEvent.getResponse().toString());
|
logger.debug("\n收到响应:\n{}", responseEvent.getResponse());
|
||||||
int status = response.getStatusCode();
|
int status = response.getStatusCode();
|
||||||
if (((status >= 200) && (status < 300)) || status == 401) { // Success!
|
if (((status >= 200) && (status < 300)) || status == 401) { // Success!
|
||||||
CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME);
|
CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME);
|
||||||
|
@ -107,8 +107,8 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
|
||||||
SipSubscribe.Event subscribe = sipSubscribe.getOkSubscribe(callIdHeader.getCallId());
|
SipSubscribe.Event subscribe = sipSubscribe.getOkSubscribe(callIdHeader.getCallId());
|
||||||
if (subscribe != null) {
|
if (subscribe != null) {
|
||||||
SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent);
|
SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent);
|
||||||
subscribe.response(eventResult);
|
|
||||||
sipSubscribe.removeOkSubscribe(callIdHeader.getCallId());
|
sipSubscribe.removeOkSubscribe(callIdHeader.getCallId());
|
||||||
|
subscribe.response(eventResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ public interface ISIPCommanderForPlatform {
|
||||||
* @param parentPlatform
|
* @param parentPlatform
|
||||||
* @param deviceChannels
|
* @param deviceChannels
|
||||||
*/
|
*/
|
||||||
boolean sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo);
|
boolean sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo, Integer index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 回复catalog事件-删除
|
* 回复catalog事件-删除
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -223,30 +224,31 @@ public class SIPRequestHeaderPlarformProvider {
|
||||||
UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam);
|
UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam);
|
||||||
request.addHeader(userAgentHeader);
|
request.addHeader(userAgentHeader);
|
||||||
|
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "MANSCDP+xml");
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
||||||
request.setContent(content, contentTypeHeader);
|
request.setContent(content, contentTypeHeader);
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Request createNotifyRequest(ParentPlatform parentPlatform, String content, String fromTag, String toTag, CallIdHeader callIdHeader) throws PeerUnavailableException, ParseException, InvalidArgumentException {
|
public Request createNotifyRequest(ParentPlatform parentPlatform, String content, CallIdHeader callIdHeader, String viaTag, SubscribeInfo subscribeInfo) throws PeerUnavailableException, ParseException, InvalidArgumentException {
|
||||||
Request request = null;
|
Request request = null;
|
||||||
// sipuri
|
// sipuri
|
||||||
SipURI requestURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerIP()+ ":" + parentPlatform.getServerPort());
|
SipURI requestURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerIP()+ ":" + parentPlatform.getServerPort());
|
||||||
// via
|
// via
|
||||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||||
ViaHeader viaHeader = sipFactory.createHeaderFactory().createViaHeader(parentPlatform.getDeviceIp(), Integer.parseInt(parentPlatform.getDevicePort()),
|
ViaHeader viaHeader = sipFactory.createHeaderFactory().createViaHeader(parentPlatform.getDeviceIp(), Integer.parseInt(parentPlatform.getDevicePort()),
|
||||||
parentPlatform.getTransport(), null);
|
parentPlatform.getTransport(), viaTag);
|
||||||
viaHeader.setRPort();
|
viaHeader.setRPort();
|
||||||
viaHeaders.add(viaHeader);
|
viaHeaders.add(viaHeader);
|
||||||
// from
|
// from
|
||||||
SipURI fromSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getDeviceGBId(),
|
SipURI fromSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getDeviceGBId(),
|
||||||
parentPlatform.getDeviceIp() + ":" + parentPlatform.getDevicePort());
|
parentPlatform.getDeviceIp() + ":" + parentPlatform.getDevicePort());
|
||||||
Address fromAddress = sipFactory.createAddressFactory().createAddress(fromSipURI);
|
Address fromAddress = sipFactory.createAddressFactory().createAddress(fromSipURI);
|
||||||
FromHeader fromHeader = sipFactory.createHeaderFactory().createFromHeader(fromAddress, fromTag);
|
String tm = Long.toString(System.currentTimeMillis());
|
||||||
|
FromHeader fromHeader = sipFactory.createHeaderFactory().createFromHeader(fromAddress, "fromtag" + tm);
|
||||||
// to
|
// to
|
||||||
SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerGBDomain());
|
SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerGBDomain());
|
||||||
Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI);
|
Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI);
|
||||||
ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress, toTag);
|
ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress, subscribeInfo.getToTag());
|
||||||
|
|
||||||
// Forwards
|
// Forwards
|
||||||
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
|
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
|
||||||
|
@ -262,7 +264,19 @@ public class SIPRequestHeaderPlarformProvider {
|
||||||
UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam);
|
UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam);
|
||||||
request.addHeader(userAgentHeader);
|
request.addHeader(userAgentHeader);
|
||||||
|
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "MANSCDP+xml");
|
EventHeader event = sipFactory.createHeaderFactory().createEventHeader(subscribeInfo.getEventType());
|
||||||
|
event.setEventId(subscribeInfo.getEventId());
|
||||||
|
request.addHeader(event);
|
||||||
|
|
||||||
|
SubscriptionStateHeader active = sipFactory.createHeaderFactory().createSubscriptionStateHeader("active");
|
||||||
|
request.setHeader(active);
|
||||||
|
|
||||||
|
String sipAddress = sipConfig.getIp() + ":" + sipConfig.getPort();
|
||||||
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory()
|
||||||
|
.createSipURI(parentPlatform.getDeviceGBId(), sipAddress));
|
||||||
|
request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
||||||
|
|
||||||
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
||||||
request.setContent(content, contentTypeHeader);
|
request.setContent(content, contentTypeHeader);
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class SIPRequestHeaderProvider {
|
||||||
|
|
||||||
request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
|
request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
|
||||||
toHeader, viaHeaders, maxForwards);
|
toHeader, viaHeaders, maxForwards);
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "MANSCDP+xml");
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
||||||
request.setContent(content, contentTypeHeader);
|
request.setContent(content, contentTypeHeader);
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ public class SIPRequestHeaderProvider {
|
||||||
EventHeader eventHeader = sipFactory.createHeaderFactory().createEventHeader(event);
|
EventHeader eventHeader = sipFactory.createHeaderFactory().createEventHeader(event);
|
||||||
request.addHeader(eventHeader);
|
request.addHeader(eventHeader);
|
||||||
|
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "MANSCDP+xml");
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
||||||
request.setContent(content, contentTypeHeader);
|
request.setContent(content, contentTypeHeader);
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,21 +31,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(SIPCommanderFroPlatform.class);
|
private final Logger logger = LoggerFactory.getLogger(SIPCommanderFroPlatform.class);
|
||||||
|
|
||||||
// @Autowired
|
|
||||||
// private SipConfig sipConfig;
|
|
||||||
|
|
||||||
// @Autowired
|
|
||||||
// private SIPRequestHeaderProvider headerProvider;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SIPRequestHeaderPlarformProvider headerProviderPlarformProvider;
|
private SIPRequestHeaderPlarformProvider headerProviderPlarformProvider;
|
||||||
|
|
||||||
// @Autowired
|
|
||||||
// private VideoStreamSessionManager streamSession;
|
|
||||||
|
|
||||||
// @Autowired
|
|
||||||
// private IVideoManagerStorager storager;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
|
@ -172,6 +160,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void transmitRequest(ParentPlatform parentPlatform, Request request, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws SipException {
|
private void transmitRequest(ParentPlatform parentPlatform, Request request, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws SipException {
|
||||||
|
logger.debug("\n发送消息:\n{}", request);
|
||||||
if("TCP".equals(parentPlatform.getTransport())) {
|
if("TCP".equals(parentPlatform.getTransport())) {
|
||||||
tcpSipProvider.sendRequest(request);
|
tcpSipProvider.sendRequest(request);
|
||||||
|
|
||||||
|
@ -222,7 +211,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||||
catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
|
catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
|
||||||
catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
|
catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
|
||||||
catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
|
catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
|
||||||
catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n");
|
if (channel.getParentId() != null) {
|
||||||
|
catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n");
|
||||||
|
}
|
||||||
catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
|
catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
|
||||||
catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
|
catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
|
||||||
catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n");
|
catalogXml.append("<Status>" + (channel.getStatus() == 0?"OFF":"ON") + "</Status>\r\n");
|
||||||
|
@ -357,7 +348,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||||
|
|
||||||
String tm = Long.toString(System.currentTimeMillis());
|
String tm = Long.toString(System.currentTimeMillis());
|
||||||
|
|
||||||
Request request = headerProviderPlarformProvider.createNotifyRequest(parentPlatform, deviceStatusXml.toString(), subscribeInfo.getToTag(), subscribeInfo.getFromTag(), callIdHeader);
|
Request request = headerProviderPlarformProvider.createNotifyRequest(parentPlatform,
|
||||||
|
deviceStatusXml.toString(),callIdHeader,
|
||||||
|
"z9hG4bK-" + UUID.randomUUID().toString().replace("-", ""), subscribeInfo);
|
||||||
transmitRequest(parentPlatform, request);
|
transmitRequest(parentPlatform, request);
|
||||||
|
|
||||||
} catch (SipException | ParseException | InvalidArgumentException e) {
|
} catch (SipException | ParseException | InvalidArgumentException e) {
|
||||||
|
@ -368,63 +361,73 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo) {
|
public boolean sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo, Integer index) {
|
||||||
if (parentPlatform == null || deviceChannels == null || deviceChannels.size() == 0 || subscribeInfo == null) {
|
if (parentPlatform == null || deviceChannels == null || deviceChannels.size() == 0 || subscribeInfo == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (DeviceChannel channel : deviceChannels) {
|
if (index == null) {
|
||||||
try {
|
index = 0;
|
||||||
StringBuffer catalogXml = new StringBuffer(600);
|
}
|
||||||
catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
|
||||||
catalogXml.append("<Notify>\r\n");
|
|
||||||
catalogXml.append("<CmdType>Catalog</CmdType>\r\n");
|
|
||||||
catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n");
|
|
||||||
catalogXml.append("<SumNum>" + deviceChannels.size() + "</SumNum>\r\n");
|
|
||||||
catalogXml.append("<DeviceList Num=\"1\">\r\n");
|
|
||||||
catalogXml.append("<Item>\r\n");
|
|
||||||
catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n");
|
|
||||||
catalogXml.append("<Event>" + type + "</Event>\r\n");
|
|
||||||
catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n");
|
|
||||||
catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n");
|
|
||||||
catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
|
|
||||||
catalogXml.append("<Owner>" + channel.getOwner() + "</Owner>\r\n");
|
|
||||||
catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
|
|
||||||
catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
|
|
||||||
catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
|
|
||||||
catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n");
|
|
||||||
catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
|
|
||||||
catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
|
|
||||||
catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n");
|
|
||||||
catalogXml.append("<Longitude>" + channel.getLongitude() + "</Longitude>\r\n");
|
|
||||||
catalogXml.append("<Latitude>" + channel.getLatitude() + "</Latitude>\r\n");
|
|
||||||
catalogXml.append("<IPAddress>" + channel.getIpAddress() + "</IPAddress>\r\n");
|
|
||||||
catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
|
|
||||||
catalogXml.append("<Info>\r\n");
|
|
||||||
catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n");
|
|
||||||
catalogXml.append("</Info>\r\n");
|
|
||||||
catalogXml.append("</Item>\r\n");
|
|
||||||
catalogXml.append("</DeviceList>\r\n");
|
|
||||||
catalogXml.append("</Notify>\r\n");
|
|
||||||
|
|
||||||
CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
|
try {
|
||||||
: udpSipProvider.getNewCallId();
|
if (index == deviceChannels.size() - 1) {
|
||||||
callIdHeader.setCallId(subscribeInfo.getCallId());
|
return true;
|
||||||
|
|
||||||
String tm = Long.toString(System.currentTimeMillis());
|
|
||||||
|
|
||||||
Request request = headerProviderPlarformProvider.createNotifyRequest(parentPlatform, catalogXml.toString(), subscribeInfo.getToTag(), subscribeInfo.getFromTag(), callIdHeader);
|
|
||||||
transmitRequest(parentPlatform, request);
|
|
||||||
Thread.sleep(10);
|
|
||||||
} catch (SipException | ParseException | InvalidArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
Request request = getCatalogNotifyRequest(parentPlatform, deviceChannels.get(index), deviceChannels.size(), type, subscribeInfo);
|
||||||
|
index += 1;
|
||||||
|
Integer finalIndex = index;
|
||||||
|
transmitRequest(parentPlatform, request, null, (eventResult -> {
|
||||||
|
sendNotifyForCatalogAddOrUpdate(type, parentPlatform, deviceChannels, subscribeInfo, finalIndex);
|
||||||
|
}));
|
||||||
|
} catch (SipException | ParseException | InvalidArgumentException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Request getCatalogNotifyRequest(ParentPlatform parentPlatform, DeviceChannel channel, int size, String type,
|
||||||
|
SubscribeInfo subscribeInfo) throws ParseException, InvalidArgumentException,
|
||||||
|
PeerUnavailableException {
|
||||||
|
String catalogXmlContent = getCatalogXmlContent(parentPlatform, channel, size, type);
|
||||||
|
|
||||||
|
CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
|
||||||
|
: udpSipProvider.getNewCallId();
|
||||||
|
callIdHeader.setCallId(subscribeInfo.getCallId());
|
||||||
|
Request request = headerProviderPlarformProvider.createNotifyRequest(parentPlatform, catalogXmlContent,
|
||||||
|
callIdHeader, "z9hG4bK-" + UUID.randomUUID().toString().replace("-", ""), subscribeInfo);
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCatalogXmlContent(ParentPlatform parentPlatform, DeviceChannel channel, int sumNum, String type) {
|
||||||
|
StringBuffer catalogXml = new StringBuffer(600);
|
||||||
|
catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
||||||
|
catalogXml.append("<Notify>\r\n");
|
||||||
|
catalogXml.append("<CmdType>Catalog</CmdType>\r\n");
|
||||||
|
catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n");
|
||||||
|
catalogXml.append("<DeviceID>" + parentPlatform.getDeviceGBId() + "</DeviceID>\r\n");
|
||||||
|
catalogXml.append("<SumNum>" + sumNum + "</SumNum>\r\n");
|
||||||
|
catalogXml.append("<DeviceList Num=\"1\">\r\n");
|
||||||
|
catalogXml.append("<Item>\r\n");
|
||||||
|
catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n");
|
||||||
|
catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n");
|
||||||
|
catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n");
|
||||||
|
catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n");
|
||||||
|
catalogXml.append("<Owner>0</Owner>\r\n");
|
||||||
|
catalogXml.append("<CivilCode>CivilCode</CivilCode>\r\n");
|
||||||
|
catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
|
||||||
|
catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
|
||||||
|
catalogXml.append("<ParentID>" + channel.getParentId() + "</ParentID>\r\n");
|
||||||
|
catalogXml.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n");
|
||||||
|
catalogXml.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n");
|
||||||
|
catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n");
|
||||||
|
catalogXml.append("<Event>" + type + "</Event>\r\n");
|
||||||
|
catalogXml.append("</Item>\r\n");
|
||||||
|
catalogXml.append("</DeviceList>\r\n");
|
||||||
|
catalogXml.append("</Notify>\r\n");
|
||||||
|
return catalogXml.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendNotifyForCatalogOther(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo) {
|
public boolean sendNotifyForCatalogOther(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo) {
|
||||||
if (parentPlatform == null
|
if (parentPlatform == null
|
||||||
|
@ -441,6 +444,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||||
catalogXml.append("<Notify>\r\n");
|
catalogXml.append("<Notify>\r\n");
|
||||||
catalogXml.append("<CmdType>Catalog</CmdType>\r\n");
|
catalogXml.append("<CmdType>Catalog</CmdType>\r\n");
|
||||||
catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n");
|
catalogXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n");
|
||||||
|
catalogXml.append("<DeviceID>" + parentPlatform.getDeviceGBId() + "</DeviceID>\r\n");
|
||||||
catalogXml.append("<SumNum>" + deviceChannels.size() + "</SumNum>\r\n");
|
catalogXml.append("<SumNum>" + deviceChannels.size() + "</SumNum>\r\n");
|
||||||
catalogXml.append("<DeviceList Num=\"1\">\r\n");
|
catalogXml.append("<DeviceList Num=\"1\">\r\n");
|
||||||
catalogXml.append("<Item>\r\n");
|
catalogXml.append("<Item>\r\n");
|
||||||
|
@ -456,7 +460,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||||
|
|
||||||
String tm = Long.toString(System.currentTimeMillis());
|
String tm = Long.toString(System.currentTimeMillis());
|
||||||
|
|
||||||
Request request = headerProviderPlarformProvider.createNotifyRequest(parentPlatform, catalogXml.toString(), subscribeInfo.getToTag(), subscribeInfo.getFromTag(), callIdHeader);
|
Request request = headerProviderPlarformProvider.createNotifyRequest(parentPlatform, catalogXml.toString(),
|
||||||
|
callIdHeader,
|
||||||
|
"z9hG4bK-" + UUID.randomUUID().toString().replace("-", ""), subscribeInfo);
|
||||||
transmitRequest(parentPlatform, request);
|
transmitRequest(parentPlatform, request);
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
} catch (SipException | ParseException | InvalidArgumentException e) {
|
} catch (SipException | ParseException | InvalidArgumentException e) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request;
|
package com.genersoft.iot.vmp.gb28181.transmit.event.request;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
import gov.nist.javax.sip.SipProviderImpl;
|
import gov.nist.javax.sip.SipProviderImpl;
|
||||||
import gov.nist.javax.sip.SipStackImpl;
|
import gov.nist.javax.sip.SipStackImpl;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
|
@ -160,13 +161,18 @@ public abstract class SIPRequestProcessorParent {
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
*/
|
*/
|
||||||
public void responseSdpAck(RequestEvent evt, String sdp) throws SipException, InvalidArgumentException, ParseException {
|
public void responseSdpAck(RequestEvent evt, String sdp, ParentPlatform platform) throws SipException, InvalidArgumentException, ParseException {
|
||||||
Response response = getMessageFactory().createResponse(Response.OK, evt.getRequest());
|
Response response = getMessageFactory().createResponse(Response.OK, evt.getRequest());
|
||||||
SipFactory sipFactory = SipFactory.getInstance();
|
SipFactory sipFactory = SipFactory.getInstance();
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "SDP");
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "SDP");
|
||||||
response.setContent(sdp, contentTypeHeader);
|
response.setContent(sdp, contentTypeHeader);
|
||||||
|
|
||||||
|
// 兼容国标中的使用编码@域名作为RequestURI的情况
|
||||||
SipURI sipURI = (SipURI)evt.getRequest().getRequestURI();
|
SipURI sipURI = (SipURI)evt.getRequest().getRequestURI();
|
||||||
|
if (sipURI.getPort() == -1) {
|
||||||
|
sipURI = sipFactory.createAddressFactory().createSipURI(platform.getServerGBId(), platform.getServerIP()+":"+platform.getServerPort());
|
||||||
|
}
|
||||||
|
logger.debug("responseSdpAck SipURI: {}:{}", sipURI.getHost(), sipURI.getPort());
|
||||||
|
|
||||||
Address concatAddress = sipFactory.createAddressFactory().createAddress(
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(
|
||||||
sipFactory.createAddressFactory().createSipURI(sipURI.getUser(), sipURI.getHost()+":"+sipURI.getPort()
|
sipFactory.createAddressFactory().createSipURI(sipURI.getUser(), sipURI.getHost()+":"+sipURI.getPort()
|
||||||
|
@ -183,13 +189,18 @@ public abstract class SIPRequestProcessorParent {
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
*/
|
*/
|
||||||
public Response responseXmlAck(RequestEvent evt, String xml) throws SipException, InvalidArgumentException, ParseException {
|
public Response responseXmlAck(RequestEvent evt, String xml, ParentPlatform platform) throws SipException, InvalidArgumentException, ParseException {
|
||||||
Response response = getMessageFactory().createResponse(Response.OK, evt.getRequest());
|
Response response = getMessageFactory().createResponse(Response.OK, evt.getRequest());
|
||||||
SipFactory sipFactory = SipFactory.getInstance();
|
SipFactory sipFactory = SipFactory.getInstance();
|
||||||
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "MANSCDP+xml");
|
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml");
|
||||||
response.setContent(xml, contentTypeHeader);
|
response.setContent(xml, contentTypeHeader);
|
||||||
|
|
||||||
|
// 兼容国标中的使用编码@域名作为RequestURI的情况
|
||||||
SipURI sipURI = (SipURI)evt.getRequest().getRequestURI();
|
SipURI sipURI = (SipURI)evt.getRequest().getRequestURI();
|
||||||
|
if (sipURI.getPort() == -1) {
|
||||||
|
sipURI = sipFactory.createAddressFactory().createSipURI(platform.getServerGBId(), platform.getServerIP()+":"+platform.getServerPort());
|
||||||
|
}
|
||||||
|
logger.debug("responseXmlAck SipURI: {}:{}", sipURI.getHost(), sipURI.getPort());
|
||||||
|
|
||||||
Address concatAddress = sipFactory.createAddressFactory().createAddress(
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(
|
||||||
sipFactory.createAddressFactory().createSipURI(sipURI.getUser(), sipURI.getHost()+":"+sipURI.getPort()
|
sipFactory.createAddressFactory().createSipURI(sipURI.getUser(), sipURI.getHost()+":"+sipURI.getPort()
|
||||||
|
|
|
@ -293,7 +293,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
content.append("f=\r\n");
|
content.append("f=\r\n");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
responseSdpAck(evt, content.toString());
|
responseSdpAck(evt, content.toString(), platform);
|
||||||
} catch (SipException e) {
|
} catch (SipException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (InvalidArgumentException e) {
|
} catch (InvalidArgumentException e) {
|
||||||
|
@ -369,7 +369,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
content.append("f=\r\n");
|
content.append("f=\r\n");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
responseSdpAck(evt, content.toString());
|
responseSdpAck(evt, content.toString(), platform);
|
||||||
} catch (SipException e) {
|
} catch (SipException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (InvalidArgumentException e) {
|
} catch (InvalidArgumentException e) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetup;
|
import com.genersoft.iot.vmp.conf.UserSetup;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.CmdType;
|
import com.genersoft.iot.vmp.gb28181.bean.CmdType;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
|
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
|
||||||
import com.genersoft.iot.vmp.gb28181.task.GPSSubscribeTask;
|
import com.genersoft.iot.vmp.gb28181.task.GPSSubscribeTask;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
|
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
|
||||||
|
@ -105,9 +106,6 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
|
||||||
logger.info("processRequest serverTransactionId is null.");
|
logger.info("processRequest serverTransactionId is null.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (SipException e) {
|
} catch (SipException e) {
|
||||||
|
@ -155,7 +153,8 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Response response = responseXmlAck(evt, resultXml.toString());
|
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
|
||||||
|
Response response = responseXmlAck(evt, resultXml.toString(), parentPlatform);
|
||||||
ToHeader toHeader = (ToHeader)response.getHeader(ToHeader.NAME);
|
ToHeader toHeader = (ToHeader)response.getHeader(ToHeader.NAME);
|
||||||
subscribeInfo.setToTag(toHeader.getTag());
|
subscribeInfo.setToTag(toHeader.getTag());
|
||||||
redisCatchStorage.updateSubscribe(key, subscribeInfo);
|
redisCatchStorage.updateSubscribe(key, subscribeInfo);
|
||||||
|
@ -196,7 +195,8 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Response response = responseXmlAck(evt, resultXml.toString());
|
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
|
||||||
|
Response response = responseXmlAck(evt, resultXml.toString(), parentPlatform);
|
||||||
ToHeader toHeader = (ToHeader)response.getHeader(ToHeader.NAME);
|
ToHeader toHeader = (ToHeader)response.getHeader(ToHeader.NAME);
|
||||||
subscribeInfo.setToTag(toHeader.getTag());
|
subscribeInfo.setToTag(toHeader.getTag());
|
||||||
redisCatchStorage.updateSubscribe(key, subscribeInfo);
|
redisCatchStorage.updateSubscribe(key, subscribeInfo);
|
||||||
|
|
|
@ -72,6 +72,9 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
|
||||||
List<PlatformCatalog> catalogs = storager.queryCatalogInPlatform(parentPlatform.getServerGBId());
|
List<PlatformCatalog> catalogs = storager.queryCatalogInPlatform(parentPlatform.getServerGBId());
|
||||||
if (catalogs.size() > 0) {
|
if (catalogs.size() > 0) {
|
||||||
for (PlatformCatalog catalog : catalogs) {
|
for (PlatformCatalog catalog : catalogs) {
|
||||||
|
if (catalog.getParentId().equals(catalog.getPlatformId())) {
|
||||||
|
catalog.setParentId(parentPlatform.getDeviceGBId());
|
||||||
|
}
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
DeviceChannel deviceChannel = new DeviceChannel();
|
||||||
deviceChannel.setChannelId(catalog.getId());
|
deviceChannel.setChannelId(catalog.getId());
|
||||||
deviceChannel.setName(catalog.getName());
|
deviceChannel.setName(catalog.getName());
|
||||||
|
@ -83,29 +86,35 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
|
||||||
deviceChannel.setParental(1);
|
deviceChannel.setParental(1);
|
||||||
deviceChannel.setParentId(catalog.getParentId());
|
deviceChannel.setParentId(catalog.getParentId());
|
||||||
deviceChannel.setRegisterWay(1);
|
deviceChannel.setRegisterWay(1);
|
||||||
deviceChannel.setCivilCode(config.getDomain());
|
deviceChannel.setCivilCode(config.getDomain().substring(0, config.getDomain().length() - 2));
|
||||||
deviceChannel.setModel("live");
|
deviceChannel.setModel("live");
|
||||||
deviceChannel.setOwner("wvp-pro");
|
deviceChannel.setOwner("wvp-pro");
|
||||||
deviceChannel.setSecrecy("0");
|
deviceChannel.setSecrecy("0");
|
||||||
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
||||||
// 防止发送过快
|
// 防止发送过快
|
||||||
Thread.sleep(50);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 回复级联的通道
|
// 回复级联的通道
|
||||||
if (channelReduces.size() > 0) {
|
if (channelReduces.size() > 0) {
|
||||||
for (ChannelReduce channelReduce : channelReduces) {
|
for (ChannelReduce channelReduce : channelReduces) {
|
||||||
|
if (channelReduce.getCatalogId().equals(parentPlatform.getServerGBId())) {
|
||||||
|
channelReduce.setCatalogId(parentPlatform.getDeviceGBId());
|
||||||
|
}
|
||||||
DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
|
DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
|
||||||
deviceChannel.setParental(0);
|
deviceChannel.setParental(0);
|
||||||
deviceChannel.setParentId(channelReduce.getCatalogId());
|
deviceChannel.setParentId(channelReduce.getCatalogId());
|
||||||
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
||||||
// 防止发送过快
|
// 防止发送过快
|
||||||
Thread.sleep(50);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 回复直播的通道
|
// 回复直播的通道
|
||||||
if (gbStreams.size() > 0) {
|
if (gbStreams.size() > 0) {
|
||||||
for (GbStream gbStream : gbStreams) {
|
for (GbStream gbStream : gbStreams) {
|
||||||
|
if (gbStream.getCatalogId().equals(parentPlatform.getServerGBId())) {
|
||||||
|
gbStream.setCatalogId(null);
|
||||||
|
}
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
DeviceChannel deviceChannel = new DeviceChannel();
|
||||||
deviceChannel.setChannelId(gbStream.getGbId());
|
deviceChannel.setChannelId(gbStream.getGbId());
|
||||||
deviceChannel.setName(gbStream.getName());
|
deviceChannel.setName(gbStream.getName());
|
||||||
|
@ -116,14 +125,14 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple
|
||||||
deviceChannel.setStatus(gbStream.isStatus()?1:0);
|
deviceChannel.setStatus(gbStream.isStatus()?1:0);
|
||||||
deviceChannel.setParentId(gbStream.getCatalogId());
|
deviceChannel.setParentId(gbStream.getCatalogId());
|
||||||
deviceChannel.setRegisterWay(1);
|
deviceChannel.setRegisterWay(1);
|
||||||
deviceChannel.setCivilCode(config.getDomain());
|
deviceChannel.setCivilCode(config.getDomain().substring(0, config.getDomain().length() - 2));
|
||||||
deviceChannel.setModel("live");
|
deviceChannel.setModel("live");
|
||||||
deviceChannel.setOwner("wvp-pro");
|
deviceChannel.setOwner("wvp-pro");
|
||||||
deviceChannel.setParental(0);
|
deviceChannel.setParental(0);
|
||||||
deviceChannel.setSecrecy("0");
|
deviceChannel.setSecrecy("0");
|
||||||
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
||||||
// 防止发送过快
|
// 防止发送过快
|
||||||
Thread.sleep(50);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
|
|
|
@ -75,6 +75,9 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
|
||||||
int size = catalogs.size() + channelReduces.size() + gbStreams.size();
|
int size = catalogs.size() + channelReduces.size() + gbStreams.size();
|
||||||
if (catalogs.size() > 0) {
|
if (catalogs.size() > 0) {
|
||||||
for (PlatformCatalog catalog : catalogs) {
|
for (PlatformCatalog catalog : catalogs) {
|
||||||
|
if (catalog.getParentId().equals(parentPlatform.getServerGBId())) {
|
||||||
|
catalog.setParentId(parentPlatform.getDeviceGBId());
|
||||||
|
}
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
DeviceChannel deviceChannel = new DeviceChannel();
|
||||||
deviceChannel.setChannelId(catalog.getId());
|
deviceChannel.setChannelId(catalog.getId());
|
||||||
deviceChannel.setName(catalog.getName());
|
deviceChannel.setName(catalog.getName());
|
||||||
|
@ -86,30 +89,35 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
|
||||||
deviceChannel.setParental(1);
|
deviceChannel.setParental(1);
|
||||||
deviceChannel.setParentId(catalog.getParentId());
|
deviceChannel.setParentId(catalog.getParentId());
|
||||||
deviceChannel.setRegisterWay(1);
|
deviceChannel.setRegisterWay(1);
|
||||||
deviceChannel.setCivilCode(config.getDomain());
|
deviceChannel.setCivilCode(config.getDomain().substring(0, config.getDomain().length() - 2));
|
||||||
deviceChannel.setModel("live");
|
deviceChannel.setModel("live");
|
||||||
deviceChannel.setOwner("wvp-pro");
|
deviceChannel.setOwner("wvp-pro");
|
||||||
deviceChannel.setSecrecy("0");
|
deviceChannel.setSecrecy("0");
|
||||||
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
||||||
// 防止发送过快
|
// 防止发送过快
|
||||||
Thread.sleep(50);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 回复级联的通道
|
// 回复级联的通道
|
||||||
if (channelReduces.size() > 0) {
|
if (channelReduces.size() > 0) {
|
||||||
for (ChannelReduce channelReduce : channelReduces) {
|
for (ChannelReduce channelReduce : channelReduces) {
|
||||||
|
if (channelReduce.getCatalogId().equals(parentPlatform.getServerGBId())) {
|
||||||
|
channelReduce.setCatalogId(parentPlatform.getDeviceGBId());
|
||||||
|
}
|
||||||
DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
|
DeviceChannel deviceChannel = storager.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
|
||||||
// TODO 目前暂时认为这里只用通道没有目录
|
|
||||||
deviceChannel.setParental(0);
|
deviceChannel.setParental(0);
|
||||||
deviceChannel.setParentId(channelReduce.getCatalogId());
|
deviceChannel.setParentId(channelReduce.getCatalogId());
|
||||||
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
||||||
// 防止发送过快
|
// 防止发送过快
|
||||||
Thread.sleep(50);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 回复直播的通道
|
// 回复直播的通道
|
||||||
if (gbStreams.size() > 0) {
|
if (gbStreams.size() > 0) {
|
||||||
for (GbStream gbStream : gbStreams) {
|
for (GbStream gbStream : gbStreams) {
|
||||||
|
if (gbStream.getCatalogId().equals(parentPlatform.getServerGBId())) {
|
||||||
|
gbStream.setCatalogId(parentPlatform.getDeviceGBId());
|
||||||
|
}
|
||||||
DeviceChannel deviceChannel = new DeviceChannel();
|
DeviceChannel deviceChannel = new DeviceChannel();
|
||||||
deviceChannel.setChannelId(gbStream.getGbId());
|
deviceChannel.setChannelId(gbStream.getGbId());
|
||||||
deviceChannel.setName(gbStream.getName());
|
deviceChannel.setName(gbStream.getName());
|
||||||
|
@ -120,7 +128,7 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
|
||||||
deviceChannel.setStatus(gbStream.isStatus()?1:0);
|
deviceChannel.setStatus(gbStream.isStatus()?1:0);
|
||||||
deviceChannel.setParentId(gbStream.getCatalogId());
|
deviceChannel.setParentId(gbStream.getCatalogId());
|
||||||
deviceChannel.setRegisterWay(1);
|
deviceChannel.setRegisterWay(1);
|
||||||
deviceChannel.setCivilCode(config.getDomain());
|
deviceChannel.setCivilCode(config.getDomain().substring(0, config.getDomain().length() - 2));
|
||||||
deviceChannel.setModel("live");
|
deviceChannel.setModel("live");
|
||||||
deviceChannel.setOwner("wvp-pro");
|
deviceChannel.setOwner("wvp-pro");
|
||||||
deviceChannel.setParental(0);
|
deviceChannel.setParental(0);
|
||||||
|
@ -128,7 +136,7 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
|
||||||
|
|
||||||
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
cmderFroPlatform.catalogQuery(deviceChannel, parentPlatform, sn, fromHeader.getTag(), size);
|
||||||
// 防止发送过快
|
// 防止发送过快
|
||||||
Thread.sleep(50);
|
Thread.sleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
|
|
|
@ -358,6 +358,8 @@ public class ZLMHttpHookListener {
|
||||||
if (mediaServerItem != null){
|
if (mediaServerItem != null){
|
||||||
if (regist) {
|
if (regist) {
|
||||||
StreamPushItem streamPushItem = null;
|
StreamPushItem streamPushItem = null;
|
||||||
|
StreamInfo streamInfoByAppAndStream = mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, streamId, tracks);
|
||||||
|
item.setStreamInfo(streamInfoByAppAndStream);
|
||||||
redisCatchStorage.addStream(mediaServerItem, type, app, streamId, item);
|
redisCatchStorage.addStream(mediaServerItem, type, app, streamId, item);
|
||||||
if (item.getOriginType() == OriginType.RTSP_PUSH.ordinal()
|
if (item.getOriginType() == OriginType.RTSP_PUSH.ordinal()
|
||||||
|| item.getOriginType() == OriginType.RTMP_PUSH.ordinal()
|
|| item.getOriginType() == OriginType.RTMP_PUSH.ordinal()
|
||||||
|
@ -375,7 +377,7 @@ public class ZLMHttpHookListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gbStreams.size() > 0) {
|
if (gbStreams.size() > 0) {
|
||||||
eventPublisher.catalogEventPublishForStream(null, gbStreams.toArray(new GbStream[0]), CatalogEvent.ON);
|
eventPublisher.catalogEventPublishForStream(null, gbStreams, CatalogEvent.ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.genersoft.iot.vmp.media.zlm.dto;
|
package com.genersoft.iot.vmp.media.zlm.dto;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MediaItem {
|
public class MediaItem {
|
||||||
|
@ -281,6 +283,8 @@ public class MediaItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private StreamInfo streamInfo;
|
||||||
|
|
||||||
public String getApp() {
|
public String getApp() {
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
@ -402,4 +406,12 @@ public class MediaItem {
|
||||||
public void setMediaServerId(String mediaServerId) {
|
public void setMediaServerId(String mediaServerId) {
|
||||||
this.mediaServerId = mediaServerId;
|
this.mediaServerId = mediaServerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StreamInfo getStreamInfo() {
|
||||||
|
return streamInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStreamInfo(StreamInfo streamInfo) {
|
||||||
|
this.streamInfo = streamInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
||||||
deviceChannel.setStatus(gbStream.isStatus()?1:0);
|
deviceChannel.setStatus(gbStream.isStatus()?1:0);
|
||||||
deviceChannel.setParentId(catalogId ==null?gbStream.getCatalogId():catalogId);
|
deviceChannel.setParentId(catalogId ==null?gbStream.getCatalogId():catalogId);
|
||||||
deviceChannel.setRegisterWay(1);
|
deviceChannel.setRegisterWay(1);
|
||||||
deviceChannel.setCivilCode(sipConfig.getDomain());
|
deviceChannel.setCivilCode(sipConfig.getDomain().substring(0, sipConfig.getDomain().length() - 2));
|
||||||
deviceChannel.setModel("live");
|
deviceChannel.setModel("live");
|
||||||
deviceChannel.setOwner("wvp-pro");
|
deviceChannel.setOwner("wvp-pro");
|
||||||
deviceChannel.setParental(0);
|
deviceChannel.setParental(0);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
|
import com.genersoft.iot.vmp.conf.MediaConfig;
|
||||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetup;
|
import com.genersoft.iot.vmp.conf.UserSetup;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
|
@ -278,6 +279,7 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MediaServerItem getDefaultMediaServer() {
|
public MediaServerItem getDefaultMediaServer() {
|
||||||
|
|
||||||
return mediaServerMapper.queryDefault();
|
return mediaServerMapper.queryDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
|
import com.genersoft.iot.vmp.conf.MediaConfig;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
|
@ -26,6 +27,10 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMediaServerService mediaServerService;
|
private IMediaServerService mediaServerService;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MediaConfig mediaConfig;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ZLMRESTfulUtils zlmresTfulUtils;
|
private ZLMRESTfulUtils zlmresTfulUtils;
|
||||||
|
|
||||||
|
@ -39,15 +44,12 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
@Override
|
@Override
|
||||||
public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) {
|
public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) {
|
||||||
StreamInfo streamInfo = null;
|
StreamInfo streamInfo = null;
|
||||||
|
|
||||||
MediaServerItem mediaInfo;
|
|
||||||
if (mediaServerId == null) {
|
if (mediaServerId == null) {
|
||||||
mediaInfo = mediaServerService.getDefaultMediaServer();
|
mediaServerId = mediaConfig.getId();
|
||||||
}else {
|
|
||||||
mediaInfo = mediaServerService.getOne(mediaServerId);
|
|
||||||
}
|
}
|
||||||
|
MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);;
|
||||||
if (mediaInfo == null) {
|
if (mediaInfo == null) {
|
||||||
return streamInfo;
|
return null;
|
||||||
}
|
}
|
||||||
JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream);
|
JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream);
|
||||||
if (mediaList != null) {
|
if (mediaList != null) {
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.service.impl;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.connection.Message;
|
import org.springframework.data.redis.connection.Message;
|
||||||
import org.springframework.data.redis.connection.MessageListener;
|
import org.springframework.data.redis.connection.MessageListener;
|
||||||
|
@ -11,11 +13,14 @@ import org.springframework.stereotype.Component;
|
||||||
@Component
|
@Component
|
||||||
public class RedisGPSMsgListener implements MessageListener {
|
public class RedisGPSMsgListener implements MessageListener {
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(RedisGPSMsgListener.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(Message message, byte[] bytes) {
|
public void onMessage(Message message, byte[] bytes) {
|
||||||
|
logger.debug("收到来自REDIS的GPS通知: {}", new String(message.getBody()));
|
||||||
GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class);
|
GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class);
|
||||||
redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo);
|
redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,7 +377,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
|
|
||||||
if (streamPushItemsForPlatform.size() > 0) {
|
if (streamPushItemsForPlatform.size() > 0) {
|
||||||
List<StreamPushItem> streamPushItemListFroPlatform = new ArrayList<>();
|
List<StreamPushItem> streamPushItemListFroPlatform = new ArrayList<>();
|
||||||
Map<String, List<StreamPushItem>> platformForEvent = new HashMap<>();
|
Map<String, List<GbStream>> platformForEvent = new HashMap<>();
|
||||||
// 遍历存储结果,查找app+Stream->platformId+catalogId的对应关系,然后执行批量写入
|
// 遍历存储结果,查找app+Stream->platformId+catalogId的对应关系,然后执行批量写入
|
||||||
for (StreamPushItem streamPushItem : streamPushItemsForPlatform) {
|
for (StreamPushItem streamPushItem : streamPushItemsForPlatform) {
|
||||||
List<String[]> platFormInfoList = streamPushItemsForAll.get(streamPushItem.getApp() + streamPushItem.getStream());
|
List<String[]> platFormInfoList = streamPushItemsForAll.get(streamPushItem.getApp() + streamPushItem.getStream());
|
||||||
|
@ -390,16 +390,17 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
// 数组 platFormInfoArray 0 为平台ID。 1为目录ID
|
// 数组 platFormInfoArray 0 为平台ID。 1为目录ID
|
||||||
streamPushItemForPlatform.setPlatformId(platFormInfoArray[0]);
|
streamPushItemForPlatform.setPlatformId(platFormInfoArray[0]);
|
||||||
|
|
||||||
List<StreamPushItem> streamPushItemsInPlatform = platformForEvent.get(streamPushItem.getPlatformId());
|
List<GbStream> gbStreamList = platformForEvent.get(streamPushItem.getPlatformId());
|
||||||
if (streamPushItemsInPlatform == null) {
|
if (gbStreamList == null) {
|
||||||
streamPushItemsInPlatform = new ArrayList<>();
|
gbStreamList = new ArrayList<>();
|
||||||
platformForEvent.put(platFormInfoArray[0], streamPushItemsInPlatform);
|
platformForEvent.put(platFormInfoArray[0], gbStreamList);
|
||||||
}
|
}
|
||||||
// 为发送通知整理数据
|
// 为发送通知整理数据
|
||||||
|
streamPushItemForPlatform.setName(streamPushItem.getName());
|
||||||
streamPushItemForPlatform.setApp(streamPushItem.getApp());
|
streamPushItemForPlatform.setApp(streamPushItem.getApp());
|
||||||
streamPushItemForPlatform.setStream(streamPushItem.getStream());
|
streamPushItemForPlatform.setStream(streamPushItem.getStream());
|
||||||
streamPushItemForPlatform.setGbId(streamPushItem.getGbId());
|
streamPushItemForPlatform.setGbId(streamPushItem.getGbId());
|
||||||
streamPushItemsInPlatform.add(streamPushItemForPlatform);
|
gbStreamList.add(streamPushItemForPlatform);
|
||||||
}
|
}
|
||||||
if (platFormInfoArray.length > 1) {
|
if (platFormInfoArray.length > 1) {
|
||||||
streamPushItemForPlatform.setCatalogId(platFormInfoArray[1]);
|
streamPushItemForPlatform.setCatalogId(platFormInfoArray[1]);
|
||||||
|
@ -416,7 +417,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
// 发送通知
|
// 发送通知
|
||||||
for (String platformId : platformForEvent.keySet()) {
|
for (String platformId : platformForEvent.keySet()) {
|
||||||
eventPublisher.catalogEventPublishForStream(
|
eventPublisher.catalogEventPublishForStream(
|
||||||
platformId, platformForEvent.get(platformId).toArray(new GbStream[0]), CatalogEvent.ADD);
|
platformId, platformForEvent.get(platformId), CatalogEvent.ADD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public interface DeviceMapper {
|
||||||
"<if test=\"keepaliveTime != null\">, keepaliveTime='${keepaliveTime}'</if>" +
|
"<if test=\"keepaliveTime != null\">, keepaliveTime='${keepaliveTime}'</if>" +
|
||||||
"<if test=\"expires != null\">, expires=${expires}</if>" +
|
"<if test=\"expires != null\">, expires=${expires}</if>" +
|
||||||
"<if test=\"charset != null\">, charset='${charset}'</if>" +
|
"<if test=\"charset != null\">, charset='${charset}'</if>" +
|
||||||
"<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=#{subscribeCycleForCatalog}</if>" +
|
"<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" +
|
||||||
"WHERE deviceId='${deviceId}'"+
|
"WHERE deviceId='${deviceId}'"+
|
||||||
" </script>"})
|
" </script>"})
|
||||||
int update(Device device);
|
int update(Device device);
|
||||||
|
|
|
@ -34,7 +34,6 @@ public interface PlatformChannelMapper {
|
||||||
"</script>")
|
"</script>")
|
||||||
int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
|
int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
|
||||||
|
|
||||||
|
|
||||||
@Delete("<script> "+
|
@Delete("<script> "+
|
||||||
"DELETE FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceChannelId in" +
|
"DELETE FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceChannelId in" +
|
||||||
"<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > '${item.id}'</foreach>" +
|
"<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > '${item.id}'</foreach>" +
|
||||||
|
@ -42,7 +41,11 @@ public interface PlatformChannelMapper {
|
||||||
int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
|
int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
|
||||||
|
|
||||||
@Delete("<script> "+
|
@Delete("<script> "+
|
||||||
"DELETE FROM platform_gb_channel WHERE deviceId='${deviceId}' " +
|
"DELETE FROM platform_gb_channel WHERE deviceChannelId in " +
|
||||||
|
"( select temp.deviceChannelId from " +
|
||||||
|
"(select pgc.deviceChannelId from platform_gb_channel pgc " +
|
||||||
|
"left join device_channel dc on dc.id = pgc.deviceChannelId where dc.deviceId =#{deviceId} " +
|
||||||
|
") temp)" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int delChannelForDeviceId(String deviceId);
|
int delChannelForDeviceId(String deviceId);
|
||||||
|
|
||||||
|
@ -51,18 +54,19 @@ public interface PlatformChannelMapper {
|
||||||
"</script>")
|
"</script>")
|
||||||
int cleanChannelForGB(String platformId);
|
int cleanChannelForGB(String platformId);
|
||||||
|
|
||||||
|
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}' and pgc.platformId='${platformId}'")
|
||||||
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE " +
|
|
||||||
"pgc.platformId=#{platformId} AND dc.channelId=#{channelId}")
|
|
||||||
DeviceChannel queryChannelInParentPlatform(String platformId, String channelId);
|
DeviceChannel queryChannelInParentPlatform(String platformId, String channelId);
|
||||||
|
|
||||||
|
|
||||||
@Select("select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +
|
@Select("select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +
|
||||||
"from device_channel dc left join platform_gb_channel pgc on dc.deviceId = pgc.deviceId and dc.channelId = pgc.channelId " +
|
"from device_channel dc left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId" +
|
||||||
"where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}")
|
"where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}")
|
||||||
List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
|
List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
|
||||||
|
|
||||||
@Select("SELECT * FROM device WHERE deviceId = (SELECT deviceId FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE pgc.platformId='${platformId}' AND dc.channelId='${channelId}')")
|
@Select("select d.*\n" +
|
||||||
|
"from platform_gb_channel pgc\n" +
|
||||||
|
" left join device_channel dc on dc.id = pgc.deviceChannelId\n" +
|
||||||
|
" left join device d on dc.deviceId = d.deviceId\n" +
|
||||||
|
"where dc.channelId = #{channelId} and pgc.platformId=#{platformId}")
|
||||||
Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
|
Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
|
||||||
|
|
||||||
@Delete("<script> "+
|
@Delete("<script> "+
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.storager.dao;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
import org.omg.PortableInterceptor.INACTIVE;
|
// import org.omg.PortableInterceptor.INACTIVE;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
|
@ -204,10 +204,7 @@ public class DeviceQuery {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("设备信息删除API调用,deviceId:" + deviceId);
|
logger.debug("设备信息删除API调用,deviceId:" + deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offLineDetector.isOnline(deviceId)) {
|
|
||||||
return new ResponseEntity<String>("不允许删除在线设备!", HttpStatus.NOT_ACCEPTABLE);
|
|
||||||
}
|
|
||||||
// 清除redis记录
|
// 清除redis记录
|
||||||
boolean isSuccess = storager.delete(deviceId);
|
boolean isSuccess = storager.delete(deviceId);
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
|
@ -319,20 +316,20 @@ public class DeviceQuery {
|
||||||
if (!StringUtils.isEmpty(device.getCharset())) deviceInStore.setCharset(device.getCharset());
|
if (!StringUtils.isEmpty(device.getCharset())) deviceInStore.setCharset(device.getCharset());
|
||||||
if (!StringUtils.isEmpty(device.getMediaServerId())) deviceInStore.setMediaServerId(device.getMediaServerId());
|
if (!StringUtils.isEmpty(device.getMediaServerId())) deviceInStore.setMediaServerId(device.getMediaServerId());
|
||||||
|
|
||||||
if ((deviceInStore.getSubscribeCycleForCatalog() <=0 && device.getSubscribeCycleForCatalog() > 0)
|
if (device.getSubscribeCycleForCatalog() > 0) {
|
||||||
|| deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
|
if (deviceInStore.getSubscribeCycleForCatalog() == 0 || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
|
||||||
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
// 开启订阅
|
||||||
// 开启订阅
|
deviceService.addCatalogSubscribe(deviceInStore);
|
||||||
deviceService.addCatalogSubscribe(deviceInStore);
|
}
|
||||||
}
|
}else if (device.getSubscribeCycleForCatalog() == 0) {
|
||||||
if (deviceInStore.getSubscribeCycleForCatalog() > 0 && device.getSubscribeCycleForCatalog() <= 0) {
|
if (deviceInStore.getSubscribeCycleForCatalog() != 0) {
|
||||||
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
// 取消订阅
|
||||||
// 取消订阅
|
deviceService.removeCatalogSubscribe(deviceInStore);
|
||||||
deviceService.removeCatalogSubscribe(deviceInStore);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storager.updateDevice(deviceInStore);
|
storager.updateDevice(device);
|
||||||
cmder.deviceInfoQuery(deviceInStore);
|
cmder.deviceInfoQuery(device);
|
||||||
}
|
}
|
||||||
WVPResult<String> result = new WVPResult<>();
|
WVPResult<String> result = new WVPResult<>();
|
||||||
result.setCode(0);
|
result.setCode(0);
|
||||||
|
|
|
@ -154,8 +154,16 @@ public class PlatformController {
|
||||||
if (updateResult) {
|
if (updateResult) {
|
||||||
// 保存时启用就发送注册
|
// 保存时启用就发送注册
|
||||||
if (parentPlatform.isEnable()) {
|
if (parentPlatform.isEnable()) {
|
||||||
// 只要保存就发送注册
|
if (parentPlatformOld.isStatus()) {
|
||||||
commanderForPlatform.register(parentPlatform, null, null);
|
commanderForPlatform.unregister(parentPlatformOld, null, eventResult -> {
|
||||||
|
// 只要保存就发送注册
|
||||||
|
commanderForPlatform.register(parentPlatform, null, null);
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
// 只要保存就发送注册
|
||||||
|
commanderForPlatform.register(parentPlatform, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销
|
} else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销
|
||||||
commanderForPlatform.unregister(parentPlatform, null, null);
|
commanderForPlatform.unregister(parentPlatform, null, null);
|
||||||
}
|
}
|
||||||
|
@ -208,8 +216,24 @@ public class PlatformController {
|
||||||
if (updateResult) {
|
if (updateResult) {
|
||||||
// 保存时启用就发送注册
|
// 保存时启用就发送注册
|
||||||
if (parentPlatform.isEnable()) {
|
if (parentPlatform.isEnable()) {
|
||||||
// 只要保存就发送注册
|
// 保存时启用就发送注册
|
||||||
commanderForPlatform.register(parentPlatform, null, null);
|
if (parentPlatform.isEnable()) {
|
||||||
|
if (parentPlatformOld.isStatus()) {
|
||||||
|
commanderForPlatform.unregister(parentPlatformOld, null, null);
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// 只要保存就发送注册
|
||||||
|
commanderForPlatform.register(parentPlatform, null, null);
|
||||||
|
}else {
|
||||||
|
// 只要保存就发送注册
|
||||||
|
commanderForPlatform.register(parentPlatform, null, null);
|
||||||
|
}
|
||||||
|
} else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销
|
||||||
|
commanderForPlatform.unregister(parentPlatformOld, null, null);
|
||||||
|
}
|
||||||
} else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销
|
} else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销
|
||||||
commanderForPlatform.unregister(parentPlatform, null, null);
|
commanderForPlatform.unregister(parentPlatform, null, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,24 +30,44 @@ spring:
|
||||||
poolMaxWait: 5
|
poolMaxWait: 5
|
||||||
# [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置
|
# [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置
|
||||||
datasource:
|
datasource:
|
||||||
# 使用mysql 打开23-28行注释, 删除29-36行
|
|
||||||
# name: wvp
|
|
||||||
# url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true
|
|
||||||
# username:
|
|
||||||
# password:
|
|
||||||
# type: com.alibaba.druid.pool.DruidDataSource
|
|
||||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
|
||||||
name: eiot
|
|
||||||
url: jdbc:sqlite::resource:wvp.sqlite
|
|
||||||
username:
|
|
||||||
password:
|
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driver-class-name: org.sqlite.JDBC
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
journal_mode: WAL
|
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false
|
||||||
synchronous: NORMAL
|
username: root
|
||||||
transaction_mode: IMMEDIATE
|
password: root123
|
||||||
max-active: 1
|
druid:
|
||||||
min-idle: 1
|
initialSize: 10 # 连接池初始化连接数
|
||||||
|
maxActive: 200 # 连接池最大连接数
|
||||||
|
minIdle: 5 # 连接池最小空闲连接数
|
||||||
|
maxWait: 60000 # 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁。
|
||||||
|
keepAlive: true # 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作。
|
||||||
|
validationQuery: select 1 # 检测连接是否有效sql,要求是查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。
|
||||||
|
testWhileIdle: true # 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
|
||||||
|
testOnBorrow: false # 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
|
||||||
|
testOnReturn: false # 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
|
||||||
|
poolPreparedStatements: false # 是否開啟PSCache,並且指定每個連線上PSCache的大小
|
||||||
|
timeBetweenEvictionRunsMillis: 60000 # 配置間隔多久才進行一次檢測,檢測需要關閉的空閒連線,單位是毫秒
|
||||||
|
minEvictableIdleTimeMillis: 300000 # 配置一個連線在池中最小生存的時間,單位是毫秒
|
||||||
|
filters: stat,wall,slf4j # 配置监控统计拦截的filters,监控统计用的filter:sta, 日志用的filter:log4j, 防御sql注入的filter:wall
|
||||||
|
useGlobalDataSourceStat: true # 合并多个DruidDataSource的监控数据
|
||||||
|
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||||
|
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=1000
|
||||||
|
#stat-view-servlet.url-pattern: /admin/druid/*
|
||||||
|
|
||||||
|
# druid管理监控页面的一些配置
|
||||||
|
rj-druid-manage:
|
||||||
|
allow: # 访问druid监控页面的IP白名单
|
||||||
|
deny: 192.168.1.100 # 访问druid监控页面IP黑名单
|
||||||
|
loginUsername: rjAdmin # 访问druid监控页面账号
|
||||||
|
loginPassword: rj@2022 # 访问druid监控页面密码
|
||||||
|
|
||||||
|
#mybatis:
|
||||||
|
# configuration:
|
||||||
|
# # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
||||||
|
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
# # 返回类型为Map,显示null对应的字段
|
||||||
|
# call-setters-on-nulls: true
|
||||||
|
## [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
|
||||||
|
|
||||||
# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
|
# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
|
||||||
server:
|
server:
|
||||||
|
@ -136,15 +156,8 @@ media:
|
||||||
|
|
||||||
# [可选] 日志配置, 一般不需要改
|
# [可选] 日志配置, 一般不需要改
|
||||||
logging:
|
logging:
|
||||||
file:
|
config: classpath:logback-spring-local.xml
|
||||||
name: logs/wvp.log
|
|
||||||
max-history: 30
|
|
||||||
max-size: 10MB
|
|
||||||
total-size-cap: 300MB
|
|
||||||
level:
|
|
||||||
com.genersoft.iot: debug
|
|
||||||
com.genersoft.iot.vmp.storager.dao: info
|
|
||||||
com.genersoft.iot.vmp.gb28181: debug
|
|
||||||
# [根据业务需求配置]
|
# [根据业务需求配置]
|
||||||
user-settings:
|
user-settings:
|
||||||
# [可选] 服务ID,不写则为000000
|
# [可选] 服务ID,不写则为000000
|
||||||
|
|
|
@ -16,24 +16,41 @@ spring:
|
||||||
password:
|
password:
|
||||||
# [可选] 超时时间
|
# [可选] 超时时间
|
||||||
timeout: 10000
|
timeout: 10000
|
||||||
# [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置
|
# [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置
|
||||||
|
# mysql数据源
|
||||||
datasource:
|
datasource:
|
||||||
# 使用mysql 打开23-28行注释, 删除29-36行
|
|
||||||
name: wvp
|
|
||||||
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false
|
|
||||||
username:
|
|
||||||
password:
|
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false
|
||||||
|
username: root
|
||||||
|
password: root123
|
||||||
|
druid:
|
||||||
|
initialSize: 10 # 连接池初始化连接数
|
||||||
|
maxActive: 200 # 连接池最大连接数
|
||||||
|
minIdle: 5 # 连接池最小空闲连接数
|
||||||
|
maxWait: 60000 # 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁。
|
||||||
|
keepAlive: true # 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作。
|
||||||
|
validationQuery: select 1 # 检测连接是否有效sql,要求是查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。
|
||||||
|
testWhileIdle: true # 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
|
||||||
|
testOnBorrow: false # 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
|
||||||
|
testOnReturn: false # 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
|
||||||
|
poolPreparedStatements: false # 是否開啟PSCache,並且指定每個連線上PSCache的大小
|
||||||
|
timeBetweenEvictionRunsMillis: 60000 # 配置間隔多久才進行一次檢測,檢測需要關閉的空閒連線,單位是毫秒
|
||||||
|
minEvictableIdleTimeMillis: 300000 # 配置一個連線在池中最小生存的時間,單位是毫秒
|
||||||
|
filters: stat,wall,slf4j # 配置监控统计拦截的filters,监控统计用的filter:sta, 日志用的filter:log4j, 防御sql注入的filter:wall
|
||||||
|
useGlobalDataSourceStat: true # 合并多个DruidDataSource的监控数据
|
||||||
|
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||||
|
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=1000
|
||||||
|
#stat-view-servlet.url-pattern: /admin/druid/*
|
||||||
|
|
||||||
# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
|
#[可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
|
||||||
server:
|
server:
|
||||||
port: 18080
|
port: 18080
|
||||||
|
|
||||||
# 作为28181服务器的配置
|
# 作为28181服务器的配置
|
||||||
sip:
|
sip:
|
||||||
# [必须修改] 本机的IP
|
# [必须修改] 本机的IP
|
||||||
ip:
|
ip: 192.168.118.70
|
||||||
# [可选] 28181服务监听的端口
|
# [可选] 28181服务监听的端口
|
||||||
port: 5060
|
port: 5060
|
||||||
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
|
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
|
||||||
|
@ -48,10 +65,9 @@ sip:
|
||||||
|
|
||||||
#zlm 默认服务器配置
|
#zlm 默认服务器配置
|
||||||
media:
|
media:
|
||||||
# [必须修改] zlm服务器唯一id,用于触发hook时区别是哪台服务器,general.mediaServerId
|
id: FQ3TF8yT83wh5Wvz
|
||||||
id:
|
|
||||||
# [必须修改] zlm服务器的内网IP
|
# [必须修改] zlm服务器的内网IP
|
||||||
ip:
|
ip: 192.168.118.70
|
||||||
# [必须修改] zlm服务器的http.port
|
# [必须修改] zlm服务器的http.port
|
||||||
http-port: 80
|
http-port: 80
|
||||||
# [可选] zlm服务器的hook.admin_params=secret
|
# [可选] zlm服务器的hook.admin_params=secret
|
||||||
|
@ -68,25 +84,7 @@ media:
|
||||||
record-assist-port: 18081
|
record-assist-port: 18081
|
||||||
# [可选] 日志配置, 一般不需要改
|
# [可选] 日志配置, 一般不需要改
|
||||||
logging:
|
logging:
|
||||||
file:
|
config: classpath:logback-spring-local.xml
|
||||||
name: logs/wvp.log
|
|
||||||
max-history: 30
|
|
||||||
max-size: 10MB
|
|
||||||
total-size-cap: 300MB
|
|
||||||
level:
|
|
||||||
com.genersoft.iot: debug
|
|
||||||
com.genersoft.iot.vmp.storager.dao: info
|
|
||||||
com.genersoft.iot.vmp.gb28181: info
|
|
||||||
|
|
||||||
# [根据业务需求配置]
|
|
||||||
user-settings:
|
|
||||||
# 推流直播是否录制
|
|
||||||
record-push-live: true
|
|
||||||
auto-apply-play: false
|
|
||||||
|
|
||||||
# 在线文档: swagger-ui(生产环境建议关闭)
|
|
||||||
swagger-ui:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
# 版本信息, 不需修改
|
# 版本信息, 不需修改
|
||||||
version:
|
version:
|
||||||
|
|
|
@ -69,16 +69,9 @@ media:
|
||||||
sdp-ip: ${sip.ip}
|
sdp-ip: ${sip.ip}
|
||||||
stream-ip: ${sip.ip}
|
stream-ip: ${sip.ip}
|
||||||
# [可选] 日志配置, 一般不需要改
|
# [可选] 日志配置, 一般不需要改
|
||||||
|
# [可选] 日志配置, 一般不需要改
|
||||||
logging:
|
logging:
|
||||||
file:
|
config: classpath:logback-spring-local.xml
|
||||||
name: logs/wvp.log
|
|
||||||
max-history: 30
|
|
||||||
max-size: 10MB
|
|
||||||
total-size-cap: 300MB
|
|
||||||
level:
|
|
||||||
com.genersoft.iot: debug
|
|
||||||
com.genersoft.iot.vmp.storager.dao: info
|
|
||||||
com.genersoft.iot.vmp.gb28181: info
|
|
||||||
|
|
||||||
# [根据业务需求配置]
|
# [根据业务需求配置]
|
||||||
user-settings:
|
user-settings:
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: local
|
active: dev
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration debug="false">
|
||||||
|
<!--定义日志文件的存储地址 -->
|
||||||
|
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
||||||
|
<property name="LOG_HOME" value="logs/${spring.application.name}" />
|
||||||
|
|
||||||
|
<!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 按照每天生成日志文件 DEBUG以上级别的日志,仅用于测试环境,正式环境为info级别以上的日志-->
|
||||||
|
<appender name="RollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
|
||||||
|
<!-- 文件路径 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--历史日志文件输出的文件名 -->
|
||||||
|
<FileNamePattern>${LOG_HOME}/wvp-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||||
|
<!--日志文件保留天数 -->
|
||||||
|
<MaxHistory>30</MaxHistory>
|
||||||
|
<maxFileSize>20MB</maxFileSize>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
|
<!--与ThresholdFilter的区别,允许onmatch-->
|
||||||
|
<!--设置日志级别 接收info级别的日志-->
|
||||||
|
<level>DEBUG</level>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 生成 error格式日志开始 -->
|
||||||
|
<appender name="RollingFileError" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--历史日志文件输出的文件名 -->
|
||||||
|
<FileNamePattern>${LOG_HOME}/error-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||||
|
<!--日志文件保留天数 -->
|
||||||
|
<MaxHistory>30</MaxHistory>
|
||||||
|
<maxFileSize>20MB</maxFileSize>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
|
<!--设置日志级别,过滤掉info日志,只输入error日志-->
|
||||||
|
<level>WARN</level>
|
||||||
|
<!-- <onMatch>ACCEPT</onMatch> <!– 用过滤器,只接受ERROR级别的日志信息,其余全部过滤掉 –>-->
|
||||||
|
<!-- <onMismatch>DENY</onMismatch>-->
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 生成 druid日志追加 -->
|
||||||
|
<appender name="druidSqlRollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--历史日志文件输出的文件名 -->
|
||||||
|
<FileNamePattern>${LOG_HOME}/druid-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||||
|
<!--日志文件保留天数 -->
|
||||||
|
<MaxHistory>30</MaxHistory>
|
||||||
|
<maxFileSize>50MB</maxFileSize>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 日志输出级别 -->
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
<appender-ref ref="RollingFile" />
|
||||||
|
<appender-ref ref="RollingFileError" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<logger name="com.genersoft.iot.vmp.storager.dao" level="INFO">
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.genersoft.iot.vmp.gb28181" level="DEBUG">
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<!--记录druid-sql的记录-->
|
||||||
|
<logger name="druid.sql.Statement" level="debug" additivity="true">
|
||||||
|
<!--AppenderRef ref="Console"/-->
|
||||||
|
<!-- <appender-ref ref="RollingFile"/>-->
|
||||||
|
<appender-ref ref="RollingFileError"/>
|
||||||
|
<appender-ref ref="druidSqlRollingFile"/>
|
||||||
|
</logger>
|
||||||
|
</configuration>
|
|
@ -55,14 +55,14 @@
|
||||||
<el-table-column prop="createTime" label="创建时间" align="center" width="140">
|
<el-table-column prop="createTime" label="创建时间" align="center" width="140">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="操作" width="360" align="center" fixed="right">
|
<el-table-column label="操作" width="450" align="center" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" :ref="scope.row.deviceId + 'refbtn' " v-if="scope.row.online!=0" icon="el-icon-refresh" @click="refDevice(scope.row)">刷新</el-button>
|
<el-button size="mini" :ref="scope.row.deviceId + 'refbtn' " v-if="scope.row.online!=0" icon="el-icon-refresh" @click="refDevice(scope.row)">刷新</el-button>
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button size="mini" icon="el-icon-video-camera-solid" v-bind:disabled="scope.row.online==0" type="primary" @click="showChannelList(scope.row)">通道</el-button>
|
<el-button size="mini" icon="el-icon-video-camera-solid" v-bind:disabled="scope.row.online==0" type="primary" @click="showChannelList(scope.row)">通道</el-button>
|
||||||
<el-button size="mini" icon="el-icon-location" v-bind:disabled="scope.row.online==0" type="primary" @click="showDevicePosition(scope.row)">定位</el-button>
|
<el-button size="mini" icon="el-icon-location" v-bind:disabled="scope.row.online==0" type="primary" @click="showDevicePosition(scope.row)">定位</el-button>
|
||||||
<el-button size="mini" icon="el-icon-edit" type="primary" @click="edit(scope.row)">编辑</el-button>
|
<el-button size="mini" icon="el-icon-edit" type="primary" @click="edit(scope.row)">编辑</el-button>
|
||||||
<el-button size="mini" icon="el-icon-delete" type="danger" v-if="scope.row.online==0" @click="deleteDevice(scope.row)">删除</el-button>
|
<el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteDevice(scope.row)">删除</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -165,15 +165,29 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
deleteDevice: function(row) {
|
deleteDevice: function(row) {
|
||||||
let that = this;
|
let msg = "确定删除此设备?"
|
||||||
this.$axios({
|
if (row.online !== 0) {
|
||||||
method: 'delete',
|
msg = "在线设备删除后仍可通过注册再次上线。<br/>如需彻底删除请先将设备离线。<br/><strong>确定删除此设备?</strong>"
|
||||||
url:`/api/device/query/devices/${row.deviceId}/delete`
|
}
|
||||||
}).then((res)=>{
|
this.$confirm(msg, '提示', {
|
||||||
this.getDeviceList();
|
dangerouslyUseHTMLString : true,
|
||||||
}).catch((error) =>{
|
confirmButtonText: '确定',
|
||||||
console.log(error);
|
cancelButtonText: '取消',
|
||||||
});
|
center: true,
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$axios({
|
||||||
|
method: 'delete',
|
||||||
|
url:`/api/device/query/devices/${row.deviceId}/delete`
|
||||||
|
}).then((res)=>{
|
||||||
|
this.getDeviceList();
|
||||||
|
}).catch((error) =>{
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
showChannelList: function(row) {
|
showChannelList: function(row) {
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
<div style="position: absolute; right: 1rem; top: 0.3rem;">
|
<div style="position: absolute; right: 1rem; top: 0.3rem;">
|
||||||
<el-popover placement="bottom" width="900" height="300" trigger="click">
|
<el-popover placement="bottom" width="900" height="300" trigger="click">
|
||||||
<div style="height: 600px; overflow:auto; padding: 20px">
|
<div style="height: 600px; overflow:auto; padding: 20px">
|
||||||
<el-descriptions v-for="(value, key, index) in serverConfig" border column="1" style="margin-bottom: 1rem">
|
<el-descriptions v-for="(value, key, index) in serverConfig" :key="key" border column="1" style="margin-bottom: 1rem">
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
{{key}}
|
{{key}}
|
||||||
</template>
|
</template>
|
||||||
<el-descriptions-item v-for="(value1, key1, index1) in serverConfig[key]">
|
<el-descriptions-item v-for="(value1, key1, index1) in serverConfig[key]" :key="key1">
|
||||||
<template slot="label" >
|
<template slot="label" >
|
||||||
{{ getMediaKeyNameFromKey(key1) }}
|
{{ getMediaKeyNameFromKey(key1) }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
<template slot="extra">
|
<template slot="extra">
|
||||||
<el-button style="float: right;" type="primary" size="mini" icon="el-icon-document-copy" title="点击拷贝" v-clipboard="JSON.stringify(wvpServerConfig.base)" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></el-button>
|
<el-button style="float: right;" type="primary" size="mini" icon="el-icon-document-copy" title="点击拷贝" v-clipboard="JSON.stringify(wvpServerConfig.base)" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></el-button>
|
||||||
</template>
|
</template>
|
||||||
<el-descriptions-item v-for="(value, key, index) in wvpServerConfig.base" >
|
<el-descriptions-item v-for="(value, key, index) in wvpServerConfig.base" :key="key">
|
||||||
<template slot="label" >
|
<template slot="label" >
|
||||||
{{ getNameFromKey(key) }}
|
{{ getNameFromKey(key) }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
查看<i class="el-icon-arrow-down el-icon--right"></i>
|
查看<i class="el-icon-arrow-down el-icon--right"></i>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item v-for="(value, key, index) in wvpServerConfig.base.interfaceAuthenticationExcludes">{{value}}</el-dropdown-item>
|
<el-dropdown-item v-for="(value, key, index) in wvpServerConfig.base.interfaceAuthenticationExcludes" :key="key">{{value}}</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
<template slot="extra">
|
<template slot="extra">
|
||||||
<el-button style="float: right;" type="primary" size="mini" icon="el-icon-document-copy" title="点击拷贝" v-clipboard="JSON.stringify(wvpServerVersion)" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></el-button>
|
<el-button style="float: right;" type="primary" size="mini" icon="el-icon-document-copy" title="点击拷贝" v-clipboard="JSON.stringify(wvpServerVersion)" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></el-button>
|
||||||
</template>
|
</template>
|
||||||
<el-descriptions-item v-for="(value, key, index) in wvpServerVersion">
|
<el-descriptions-item v-for="(value, key, index) in wvpServerVersion" :key="key">
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
{{ getNameFromKey(key) }}
|
{{ getNameFromKey(key) }}
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue