Merge pull request #113 from lawrencehj/wvp-28181-2.0

修正SSE、jar路径和API代理部分错误
pull/115/head
648540858 2021-06-22 13:13:31 +08:00 committed by GitHub
commit 11e8fad2e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 44 additions and 66 deletions

View File

@ -3,7 +3,6 @@ package com.genersoft.iot.vmp;
import java.util.logging.LogManager;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import springfox.documentation.oas.annotations.EnableOpenApi;

View File

@ -16,7 +16,7 @@ public class VideoManagerConstants {
public static final String CACHEKEY_PREFIX = "VMP_channel_";
public static final String KEEPLIVEKEY_PREFIX = "VMP_KEEPLIVE_";
public static final String KEEPLIVEKEY_PREFIX = "VMP_keeplive_";
public static final String PLAYER_PREFIX = "VMP_player_";

View File

@ -1,6 +1,5 @@
package com.genersoft.iot.vmp.conf;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;

View File

@ -2,8 +2,7 @@ package com.genersoft.iot.vmp.conf;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.catalina.connector.ClientAbortException;
import org.mitre.dsmiley.httpproxy.ProxyServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -14,16 +13,11 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.ConnectException;
import java.util.Locale;
import java.util.Map;
@SuppressWarnings(value = {"rawtypes", "unchecked"})
@Configuration
public class ProxyServletConfig {
@ -61,7 +55,7 @@ public class ProxyServletConfig {
@Override
protected void handleRequestException(HttpRequest proxyRequest, HttpResponse proxyResonse, Exception e){
System.out.println(e.getMessage());
//System.out.println(e.getMessage());
try {
super.handleRequestException(proxyRequest, proxyResonse, e);
} catch (ServletException servletException) {
@ -69,7 +63,9 @@ public class ProxyServletConfig {
} catch (IOException ioException) {
if (ioException instanceof ConnectException) {
logger.error("zlm 连接失败");
}else {
} else if (ioException instanceof ClientAbortException) {
logger.error("用户已中断连接,代理终止");
} else {
logger.error("zlm 代理失败: ", e);
}
} catch (RuntimeException exception){

View File

@ -1,8 +1,5 @@
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;
@ -10,7 +7,6 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 线

View File

@ -2,7 +2,6 @@ package com.genersoft.iot.vmp.conf.security;
import com.genersoft.iot.vmp.conf.UserSetup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;

View File

@ -5,7 +5,6 @@ import java.util.List;
import java.util.Random;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,6 +1,5 @@
package com.genersoft.iot.vmp.gb28181.transmit.cmd.impl;
import com.genersoft.iot.vmp.conf.MediaConfig;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
@ -12,7 +11,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Lazy;
import org.springframework.lang.Nullable;
@ -23,8 +21,6 @@ import javax.sip.header.CallIdHeader;
import javax.sip.header.WWWAuthenticateHeader;
import javax.sip.message.Request;
import java.text.ParseException;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
@Component

View File

@ -2,10 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.request.impl;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import javax.sip.InvalidArgumentException;
@ -22,7 +19,6 @@ import javax.sip.message.Response;
import com.genersoft.iot.vmp.gb28181.bean.WvpSipDate;
import gov.nist.javax.sip.RequestEventExt;
import gov.nist.javax.sip.header.SIPDateHeader;
import gov.nist.javax.sip.message.SIPRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;

View File

@ -5,7 +5,6 @@ import com.genersoft.iot.vmp.gb28181.SipLayer;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.request.impl.RegisterRequestProcessor;
import com.genersoft.iot.vmp.gb28181.transmit.response.ISIPResponseProcessor;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;

View File

@ -15,10 +15,8 @@ import com.genersoft.iot.vmp.service.IPlayService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -8,7 +8,6 @@ import com.genersoft.iot.vmp.gb28181.session.SsrcUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.HashMap;

View File

@ -1,7 +1,6 @@
package com.genersoft.iot.vmp.media.zlm;
import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.util.StringUtils;
public class ZLMServerConfig {

View File

@ -1,6 +1,5 @@
package com.genersoft.iot.vmp.media.zlm;
import com.alibaba.fastjson.annotation.JSONField;
import com.genersoft.iot.vmp.conf.MediaConfig;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -12,8 +12,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

View File

@ -1,7 +1,6 @@
package com.genersoft.iot.vmp.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
/**

View File

@ -24,7 +24,6 @@ import gov.nist.javax.sip.stack.SIPDialog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@ -32,13 +31,11 @@ import org.springframework.util.ResourceUtils;
import org.springframework.web.context.request.async.DeferredResult;
import javax.sip.ClientTransaction;
import javax.sip.Dialog;
import javax.sip.header.CallIdHeader;
import javax.sip.message.Response;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.UUID;
@SuppressWarnings(value = {"rawtypes", "unchecked"})
@Service
public class PlayServiceImpl implements IPlayService {
@ -97,7 +94,20 @@ public class PlayServiceImpl implements IPlayService {
result.onCompletion(()->{
// 点播结束时调用截图接口
try {
String path = ResourceUtils.getURL("classpath:").getPath()+"static/static/snap/";
String classPath = ResourceUtils.getURL("classpath:").getPath();
// System.out.println(classPath);
String path = classPath + "static/static/snap/";
if(classPath.contains("jar")) {
classPath = classPath.substring(0, classPath.lastIndexOf("."));
classPath = classPath.substring(0, classPath.lastIndexOf("/"));
path = classPath + "/snap/";
}
if (path.startsWith("file:")) {
path = path.substring(path.indexOf(":") + 1, path.length());
}
if(System.getProperty("os.name").contains("indows")) {
path = path.substring(1, path.length());
}
String fileName = deviceId + "_" + channelId + ".jpg";
ResponseEntity responseEntity = (ResponseEntity)result.getResult();
if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) {
@ -109,7 +119,6 @@ public class PlayServiceImpl implements IPlayService {
zlmresTfulUtils.getSnap(flvUrl, 5, 1, path, fileName);
}
}
System.out.println(path);
} catch (FileNotFoundException e) {
e.printStackTrace();

View File

@ -1,6 +1,5 @@
package com.genersoft.iot.vmp.service.impl;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
import com.genersoft.iot.vmp.service.IRecordInfoServer;
import com.genersoft.iot.vmp.storager.dao.RecordInfoDao;
import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo;

View File

@ -1,7 +1,6 @@
package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo;
import com.genersoft.iot.vmp.storager.dao.dto.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

View File

@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.storager.impl;
import java.text.SimpleDateFormat;
import java.util.*;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;

View File

@ -8,7 +8,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
@ -30,7 +30,7 @@ public class SseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "browserId", value = "浏览器ID", dataTypeClass = String.class),
})
@PostMapping("/emit")
@GetMapping("/emit")
public SseEmitter emit(@RequestParam String browserId) {
final SseEmitter sseEmitter = new SseEmitter(0L);
try {

View File

@ -120,7 +120,7 @@ public class DeviceControl {
* @param deviceId ID
* @param guardCmdStr SetGuardResetGuard
*/
@ApiOperation("录像控制命令")
@ApiOperation("布防/撤防命令")
@ApiImplicitParams({
@ApiImplicitParam(name = "deviceId", value = "设备ID", required = true, dataTypeClass = String.class),
@ApiImplicitParam(name = "guardCmdStr", value ="命令, 可选值SetGuard布防ResetGuard撤防", required = true,

View File

@ -19,7 +19,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -32,7 +31,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import org.springframework.web.context.request.async.DeferredResult;
import java.io.FileNotFoundException;
import java.util.UUID;
import javax.sip.message.Response;

View File

@ -17,6 +17,7 @@ import org.springframework.web.context.request.async.DeferredResult;
import java.util.List;
import java.util.UUID;
@SuppressWarnings(value = {"rawtypes", "unchecked"})
@Api(tags = "onvif设备")
@CrossOrigin
@RestController

View File

@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.vmanager.server;
import com.genersoft.iot.vmp.VManageBootstrap;
import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.impl.RedisCatchStorageImpl;
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
import gov.nist.javax.sip.SipStackImpl;
import io.swagger.annotations.Api;

View File

@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@SuppressWarnings("rawtypes")
/**
*
*/

View File

@ -15,6 +15,8 @@ spring:
datasource:
name: eiot
url: jdbc:sqlite::resource:wvp.sqlite
# 打包为jar运行时把wvp.sqlite发到jar同级文件夹同时url改为
# url: jdbc:sqlite:wvp.sqlite
username:
password:
type: com.alibaba.druid.pool.DruidDataSource
@ -59,6 +61,18 @@ media:
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载 0 表示不使用
recordAssistPort: 0
# [可选] 日志配置, 一般不需要改
logging:
file:
name: logs/wvp.log
max-history: 30
max-size: 10MB
total-size-cap: 300MB
level:
com:
genersoft:
iot: info
# [根据业务需求配置]
userSettings:
# [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true
@ -73,15 +87,3 @@ springfox:
documentation:
swagger-ui:
enabled: true
# [可选] 日志配置, 一般不需要改
logging:
file:
name: logs/wvp.log
max-history: 30
max-size: 10MB
total-size-cap: 300MB
level:
com:
genersoft:
iot: info

View File

@ -80,7 +80,7 @@ export default {
this.$axios({
method: 'get',
url:"/api/user/login",
url:"/api/user/login",
params: loginParam
}).then(function (res) {
console.log(JSON.stringify(res));

View File

@ -156,7 +156,7 @@ export default {
this.$axios({
method: 'get',
url:`/api/platform/query/${that.count}/${that.currentPage}`
url:`/api/platform/query/${that.count}/${that.currentPage}`
}).then(function (res) {
that.total = res.data.total;
that.platformList = res.data.list;

View File

@ -47,7 +47,7 @@ axios.interceptors.response.use(function (response) {
}, function (error) {
// 对响应错误做点什么
if (error.response.status === 401) {
console.log((1111))
console.log("Received 401 Response")
router.push('/login');
}
return Promise.reject(error);