优化级联时的异常处理

This commit is contained in:
panlinlin
2021-04-26 18:38:57 +08:00
parent bc2b288547
commit 39078225f1
25 changed files with 226 additions and 31 deletions

View File

@@ -55,7 +55,7 @@ public class ApplicationCheckRunner implements CommandLineRunner {
System.exit(1);
}
if (mediaIp.equals("localhost") || mediaIp.equals("127.0.0.1")) {
if (mediaIp.equals("localhost") || (mediaIp.equals("127.0.0.1") && mediaWanIp == null)) {
logger.warn("mediaIp.ip使用 {} ,将无法收到网络内其他设备的推流!!!", mediaIp );
}

View File

@@ -0,0 +1,33 @@
package com.genersoft.iot.vmp.conf;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 系统启动时控制设备离线
*/
@Component
@Order(value=4)
public class SipDeviceRunner implements CommandLineRunner {
@Autowired
private IVideoManagerStorager storager;
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Override
public void run(String... args) throws Exception {
// 设置所有设备离线
storager.outlineForAll();
}
}

View File

@@ -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.ParentPlatformCatch;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,6 +29,10 @@ public class SipPlatformRunner implements CommandLineRunner {
@Autowired
private EventPublisher publisher;
@Autowired
private ZLMRTPServerFactory zlmrtpServerFactory;
@Override
public void run(String... args) throws Exception {
// 设置所有平台离线
@@ -36,6 +41,9 @@ public class SipPlatformRunner implements CommandLineRunner {
// 清理所有平台注册缓存
redisCatchStorage.cleanPlatformRegisterInfos();
// 停止所有推流
// zlmrtpServerFactory.closeAllSendRtpStream();
List<ParentPlatform> parentPlatforms = storager.queryEnableParentPlatformList(true);
for (ParentPlatform parentPlatform : parentPlatforms) {

View File

@@ -111,7 +111,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
http.headers().contentTypeOptions().disable();
http.authorizeRequests()
// 放行接口
.antMatchers("/api/user/login","/index/hook/**").permitAll()
.antMatchers("/#/**", "/api/user/login","/index/hook/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
// 异常处理(权限拒绝、登录失效等)