From 937e59143004b11a808eb93eb894ffe53871a19a Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: Thu, 15 Apr 2021 17:48:52 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=B2=E6=B5=81=EF=BC=8C?=
=?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BC=96=E8=BE=91=E4=B8=8A=E7=BA=A7=E5=B9=B3?=
=?UTF-8?q?=E5=8F=B0=E5=8D=B4=E6=96=B0=E5=BB=BA=E4=BA=86=E7=9A=84=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../genersoft/iot/vmp/gb28181/SipLayer.java | 4 +-
.../iot/vmp/gb28181/bean/ParentPlatform.java | 12 +
.../PlatformKeepaliveExpireEventLister.java | 2 +-
.../PlatformNotRegisterEventLister.java | 2 +-
.../transmit/cmd/impl/SIPCommander.java | 22 +-
.../request/impl/InviteRequestProcessor.java | 2 +-
.../request/impl/MessageRequestProcessor.java | 8 +-
.../impl/RegisterResponseProcessor.java | 2 +-
.../vmp/media/zlm/ZLMHttpHookListener.java | 4 +
.../iot/vmp/media/zlm/ZLMRESTfulUtils.java | 4 +
.../vmp/media/zlm/ZLMRTPServerFactory.java | 28 +-
.../iot/vmp/service/IMediaService.java | 4 +-
.../vmp/service/impl/MediaServiceImpl.java | 15 +-
.../iot/vmp/service/impl/PlayServiceImpl.java | 13 +-
.../vmp/storager/IVideoManagerStorager.java | 2 +-
.../storager/dao/ParentPlatformMapper.java | 8 +-
.../impl/VideoManagerStoragerImpl.java | 14 +-
.../gb28181/platform/PlatformController.java | 8 +-
.../vmanager/gb28181/play/PlayController.java | 3 +-
.../gb28181/playback/PlaybackController.java | 2 +-
.../iot/vmp/vmanager/user/UserController.java | 6 +-
src/main/resources/wvp.sqlite | Bin 98304 -> 102400 bytes
web_src/index.html | 2 +
web_src/src/components/Login.vue | 122 ++----
.../src/components/dialog/devicePlayer.vue | 1 +
.../src/components/dialog/platformEdit.vue | 41 +-
web_src/static/css/font-awesome.min.css | 4 +
web_src/static/css/login.css | 396 ++++++++++++++++++
web_src/static/fonts/poppins/Poppins-Bold.ttf | Bin 0 -> 141260 bytes
.../static/fonts/poppins/Poppins-Medium.ttf | Bin 0 -> 143516 bytes
.../static/fonts/poppins/Poppins-Regular.ttf | Bin 0 -> 145312 bytes
.../static/fonts/poppins/Poppins-SemiBold.ttf | Bin 0 -> 142148 bytes
32 files changed, 576 insertions(+), 155 deletions(-)
create mode 100644 web_src/static/css/font-awesome.min.css
create mode 100755 web_src/static/css/login.css
create mode 100755 web_src/static/fonts/poppins/Poppins-Bold.ttf
create mode 100755 web_src/static/fonts/poppins/Poppins-Medium.ttf
create mode 100755 web_src/static/fonts/poppins/Poppins-Regular.ttf
create mode 100755 web_src/static/fonts/poppins/Poppins-SemiBold.ttf
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
index 7c767ba7..34a1bde2 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
@@ -118,7 +118,7 @@ public class SipLayer implements SipListener {
*/
@Override
public void processRequest(RequestEvent evt) {
- logger.debug(evt.getRequest().toString());
+// logger.debug(evt.getRequest().toString());
// 由于jainsip是单线程程序,为提高性能并发处理
processThreadPool.execute(() -> {
if (processorFactory != null) {
@@ -130,7 +130,7 @@ public class SipLayer implements SipListener {
@Override
public void processResponse(ResponseEvent evt) {
Response response = evt.getResponse();
- logger.debug(evt.getResponse().toString());
+// logger.debug(evt.getResponse().toString());
int status = response.getStatusCode();
if (((status >= 200) && (status < 300)) || status == 401) { // Success!
ISIPResponseProcessor processor = processorFactory.createResponseProcessor(evt);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
index 56d5e9ce..96fcd36d 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
@@ -2,6 +2,11 @@ package com.genersoft.iot.vmp.gb28181.bean;
public class ParentPlatform {
+ /**
+ * id
+ */
+ private Integer id;
+
/**
* 是否启用
*/
@@ -99,6 +104,13 @@ public class ParentPlatform {
*/
private int channelCount;
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
public boolean isEnable() {
return enable;
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java
index a52a9256..4e2561c7 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java
@@ -49,7 +49,7 @@ public class PlatformKeepaliveExpireEventLister implements ApplicationListener
{
+ if (json.getJSONArray("tracks") == null) return;
+ event.response(json);
+ subscribe.removeSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey);
+ });
//
StringBuffer content = new StringBuffer(200);
content.append("v=0\r\n");
@@ -465,9 +470,14 @@ public class SIPCommander implements ISIPCommander {
// 添加订阅
JSONObject subscribeKey = new JSONObject();
subscribeKey.put("app", "rtp");
- subscribeKey.put("id", streamId);
-
- subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, subscribeKey, event);
+ subscribeKey.put("stream", streamId);
+ subscribeKey.put("regist", true);
+
+ subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, json->{
+ if (json.getJSONArray("tracks") == null) return;
+ event.response(json);
+ subscribe.removeSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey);
+ });
StringBuffer content = new StringBuffer(200);
content.append("v=0\r\n");
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
index e9691be6..91b6ecc6 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
@@ -86,7 +86,7 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
}
// 查询请求方是否上级平台
- ParentPlatform platform = storager.queryParentPlatById(requesterId);
+ ParentPlatform platform = storager.queryParentPlatByServerGBId(requesterId);
if (platform != null) {
// 查询平台下是否有该通道
DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
index a73bc511..6341fb27 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
@@ -238,7 +238,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
// 回复200 OK
responseAck(evt);
String sn = rootElement.element("SN").getText();
- ParentPlatform parentPlatform = storager.queryParentPlatById(platformId);
+ ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
cmderFroPlatform.deviceStatusResponse(parentPlatform, sn, fromHeader.getTag());
}
} else {
@@ -303,7 +303,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
if (deviceId.equals(targetGBId)) {
// 远程启动本平台:需要在重新启动程序后先对SipStack解绑
logger.info("执行远程启动本平台命令");
- ParentPlatform parentPlatform = storager.queryParentPlatById(platformId);
+ ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
cmderFroPlatform.unregister(parentPlatform, null, null);
Thread restartThread = new Thread(new Runnable() {
@@ -463,7 +463,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
// 回复200 OK
responseAck(evt);
String sn = rootElement.element("SN").getText();
- ParentPlatform parentPlatform = storager.queryParentPlatById(platformId);
+ ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag());
}
} else {
@@ -517,7 +517,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
// if (deviceListElement == null) { // 存在DeviceList则为响应 catalog, 不存在DeviceList则为查询请求
if (name.equalsIgnoreCase("Query")) { // 区分是Response——查询响应,还是Query——查询请求
// TODO 后续将代码拆分
- ParentPlatform parentPlatform = storager.queryParentPlatById(platformId);
+ ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
if (parentPlatform == null) {
response404Ack(evt);
return;
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java
index 38b0f079..9361e340 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java
@@ -82,7 +82,7 @@ public class RegisterResponseProcessor implements ISIPResponseProcessor {
redisCatchStorage.delPlatformRegisterInfo(callId);
parentPlatform.setStatus(true);
// 取回Expires设置,避免注销过程中被置为0
- ParentPlatform parentPlatformTmp = storager.queryParentPlatById(platformGBId);
+ ParentPlatform parentPlatformTmp = storager.queryParentPlatByServerGBId(platformGBId);
String expires = parentPlatformTmp.getExpires();
parentPlatform.setExpires(expires);
storager.updateParentPlatform(parentPlatform);
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
index 940a4550..7db57148 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -240,6 +240,10 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_stream_changed API调用,参数:" + json.toString());
}
+
+ ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, json);
+ if (subscribe != null) subscribe.response(json);
+
// 流消失移除redis play
String app = json.getString("app");
String streamId = json.getString("stream");
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
index 0265815d..f62ad320 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
@@ -163,6 +163,10 @@ public class ZLMRESTfulUtils {
return sendPost("closeRtpServer",param, null);
}
+ public JSONObject listRtpServer() {
+ return sendPost("listRtpServer",null, null);
+ }
+
public JSONObject startSendRtp(Map param) {
return sendPost("startSendRtp",param, null);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
index 02fb742e..e76a2d8b 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.media.zlm;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import com.genersoft.iot.vmp.gb28181.session.SsrcUtil;
@@ -27,7 +28,28 @@ public class ZLMRTPServerFactory {
private int currentPort = 0;
+ private Map currentStreams = null;
+
public int createRTPServer(String streamId) {
+ if (currentStreams == null) {
+ currentStreams = new HashMap<>();
+ JSONObject jsonObject = zlmresTfulUtils.listRtpServer();
+ JSONArray data = jsonObject.getJSONArray("data");
+ if (data != null) {
+ for (int i = 0; i < data.size(); i++) {
+ JSONObject dataItem = data.getJSONObject(i);
+ currentStreams.put(dataItem.getString("stream_id"), dataItem.getInteger("port"));
+ }
+ }
+ }
+ // 已经在推流
+ if (currentStreams.get(streamId) != null) {
+ Map closeRtpServerParam = new HashMap<>();
+ closeRtpServerParam.put("stream_id", streamId);
+ zlmresTfulUtils.closeRtpServer(closeRtpServerParam);
+ currentStreams.remove(streamId);
+ }
+
Map param = new HashMap<>();
int result = -1;
int newPort = getPortFromUdpPortRange();
@@ -35,14 +57,16 @@ public class ZLMRTPServerFactory {
param.put("enable_tcp", 1);
param.put("stream_id", streamId);
JSONObject jsonObject = zlmresTfulUtils.openRtpServer(param);
- System.out.println(jsonObject);
if (jsonObject != null) {
switch (jsonObject.getInteger("code")){
case 0:
result= newPort;
break;
- case -300: // id已经存在
+ case -300: // id已经存在, 可能已经在其他端口推流
+ Map closeRtpServerParam = new HashMap<>();
+ closeRtpServerParam.put("stream_id", streamId);
+ zlmresTfulUtils.closeRtpServer(closeRtpServerParam);
result = newPort;
break;
case -400: // 端口占用
diff --git a/src/main/java/com/genersoft/iot/vmp/service/IMediaService.java b/src/main/java/com/genersoft/iot/vmp/service/IMediaService.java
index f6b40fcc..3bb0f9e4 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/IMediaService.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/IMediaService.java
@@ -1,5 +1,7 @@
package com.genersoft.iot.vmp.service;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
/**
@@ -21,6 +23,6 @@ public interface IMediaService {
* @param stream
* @return
*/
- StreamInfo getStreamInfoByAppAndStream(String app, String stream);
+ StreamInfo getStreamInfoByAppAndStream(String app, String stream, JSONArray tracks);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
index a1a4300d..9154c09a 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
@@ -1,5 +1,7 @@
package com.genersoft.iot.vmp.service.impl;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.MediaServerConfig;
@@ -25,7 +27,7 @@ public class MediaServiceImpl implements IMediaService {
@Override
- public StreamInfo getStreamInfoByAppAndStream(String app, String stream) {
+ public StreamInfo getStreamInfoByAppAndStream(String app, String stream, JSONArray tracks) {
MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
StreamInfo streamInfoResult = new StreamInfo();
streamInfoResult.setStreamId(stream);
@@ -41,7 +43,7 @@ public class MediaServiceImpl implements IMediaService {
streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play", mediaInfo.getWanIp(), mediaInfo.getHttpPort(), app, stream));
-
+ streamInfoResult.setTracks(tracks);
return streamInfoResult;
}
@@ -50,7 +52,14 @@ public class MediaServiceImpl implements IMediaService {
StreamInfo streamInfo = null;
JSONObject mediaList = zlmresTfulUtils.getMediaList(app, stream);
if (mediaList != null) {
- streamInfo = getStreamInfoByAppAndStream(app, stream);
+ if (mediaList.getInteger("code") == 0) {
+ JSONArray data = mediaList.getJSONArray("data");
+ if (data == null) return null;
+ JSONObject mediaJSON = JSON.parseObject(JSON.toJSONString(data.get(0)), JSONObject.class);
+ JSONArray tracks = mediaJSON.getJSONArray("tracks");
+ streamInfo = getStreamInfoByAppAndStream(app, stream, tracks);
+ }
+
}
return streamInfo;
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
index 93466b32..f2579cdd 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.service.impl;
import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.gb28181.bean.Device;
@@ -83,6 +84,13 @@ public class PlayServiceImpl implements IPlayService {
});
} else {
String streamId = streamInfo.getStreamId();
+ if (streamId == null) {
+ RequestMessage msg = new RequestMessage();
+ msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid);
+ msg.setData(String.format("点播失败, redis缓存streamId等于null"));
+ resultHolder.invokeResult(msg);
+ return playResult;
+ }
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(streamId);
if (rtpInfo != null && rtpInfo.getBoolean("exist")) {
RequestMessage msg = new RequestMessage();
@@ -150,8 +158,9 @@ public class PlayServiceImpl implements IPlayService {
}
public StreamInfo onPublishHandler(JSONObject resonse, String deviceId, String channelId, String uuid) {
- String streamId = resonse.getString("id");
- StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream("rtp", streamId);
+ String streamId = resonse.getString("stream");
+ JSONArray tracks = resonse.getJSONArray("tracks");
+ StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream("rtp", streamId, tracks);
streamInfo.setDeviceID(deviceId);
streamInfo.setChannelId(channelId);
return streamInfo;
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java b/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
index 632d2437..3e001b07 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
@@ -194,7 +194,7 @@ public interface IVideoManagerStorager {
* @param platformGbId
* @return
*/
- ParentPlatform queryParentPlatById(String platformGbId);
+ ParentPlatform queryParentPlatByServerGBId(String platformGbId);
/**
* 所有平台离线
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
index 3049e5be..43be9572 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
@@ -25,6 +25,7 @@ public interface ParentPlatformMapper {
"SET enable=#{enable}, " +
"name=#{name}," +
"deviceGBId=#{deviceGBId}," +
+ "serverGBId=#{serverGBId}, " +
"serverGBDomain=#{serverGBDomain}, " +
"serverIP=#{serverIP}," +
"serverPort=#{serverPort}, " +
@@ -39,7 +40,7 @@ public interface ParentPlatformMapper {
"ptz=#{ptz}, " +
"rtcp=#{rtcp}, " +
"status=#{status} " +
- "WHERE serverGBId=#{serverGBId}")
+ "WHERE id=#{id}")
int updateParentPlatform(ParentPlatform parentPlatform);
@Delete("DELETE FROM parent_platform WHERE serverGBId=#{serverGBId}")
@@ -52,7 +53,10 @@ public interface ParentPlatformMapper {
List getEnableParentPlatformList(boolean enable);
@Select("SELECT * FROM parent_platform WHERE serverGBId=#{platformGbId}")
- ParentPlatform getParentPlatById(String platformGbId);
+ ParentPlatform getParentPlatByServerGBId(String platformGbId);
+
+ @Select("SELECT * FROM parent_platform WHERE id=#{id}")
+ ParentPlatform getParentPlatById(int id);
@Update("UPDATE parent_platform SET status=false" )
void outlineForAllParentPlatform();
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
index 5d1cfc89..472c7fda 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
@@ -271,15 +271,21 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
public boolean updateParentPlatform(ParentPlatform parentPlatform) {
int result = 0;
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId()); // .getDeviceGBId());
- if ( platformMapper.getParentPlatById(parentPlatform.getServerGBId()) == null) {
+ if (parentPlatform.getId() == null ) {
result = platformMapper.addParentPlatform(parentPlatform);
-
if (parentPlatformCatch == null) {
parentPlatformCatch = new ParentPlatformCatch();
parentPlatformCatch.setParentPlatform(parentPlatform);
parentPlatformCatch.setId(parentPlatform.getServerGBId());
}
}else {
+ if (parentPlatformCatch == null) { // serverGBId 已变化
+ ParentPlatform parentPlatById = platformMapper.getParentPlatById(parentPlatform.getId());
+ // 使用旧的查出缓存ID
+ parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatById.getServerGBId());
+ parentPlatformCatch.setId(parentPlatform.getServerGBId());
+ redisCatchStorage.delPlatformCatchInfo(parentPlatById.getServerGBId());
+ }
result = platformMapper.updateParentPlatform(parentPlatform);
}
// 更新缓存
@@ -305,8 +311,8 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
}
@Override
- public ParentPlatform queryParentPlatById(String platformGbId) {
- return platformMapper.getParentPlatById(platformGbId);
+ public ParentPlatform queryParentPlatByServerGBId(String platformGbId) {
+ return platformMapper.getParentPlatByServerGBId(platformGbId);
}
@Override
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
index ce476f7b..c692af49 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
@@ -111,7 +111,7 @@ public class PlatformController {
// TODO 检查是否已经存在,且注册成功, 如果注册成功,需要先注销之前再,修改并注册
// ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getDeviceGBId());
- ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getServerGBId());
+ ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
boolean updateResult = storager.updateParentPlatform(parentPlatform);
@@ -123,8 +123,6 @@ public class PlatformController {
} else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销
commanderForPlatform.unregister(parentPlatform, null, null);
}
-
-
return new ResponseEntity<>("success", HttpStatus.OK);
} else {
return new ResponseEntity<>("fail", HttpStatus.OK);
@@ -151,7 +149,7 @@ public class PlatformController {
){
return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST);
}
- ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId);
+ ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
if (parentPlatform == null) return new ResponseEntity<>("fail", HttpStatus.OK);
// 发送离线消息,无论是否成功都删除缓存
commanderForPlatform.unregister(parentPlatform, (event -> {
@@ -192,7 +190,7 @@ public class PlatformController {
if (logger.isDebugEnabled()) {
logger.debug("查询上级平台是否存在API调用:" + serverGBId);
}
- ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId);
+ ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
index 183b72a1..18f1a74c 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
@@ -73,7 +73,6 @@ public class PlayController {
public DeferredResult> play(@PathVariable String deviceId,
@PathVariable String channelId) {
-
PlayResult playResult = playService.play(deviceId, channelId, null, null);
// 超时处理
@@ -181,7 +180,7 @@ public class PlayController {
JSONObject data = jsonObject.getJSONObject("data");
if (data != null) {
result.put("key", data.getString("key"));
- StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStream("convert", streamId);
+ StreamInfo streamInfoResult = mediaService.getStreamInfoByAppAndStreamWithCheck("convert", streamId);
result.put("data", streamInfoResult);
}
}else {
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
index b24f5750..daa5557b 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
@@ -71,7 +71,7 @@ public class PlaybackController {
logger.debug(String.format("设备回放 API调用,deviceId:%s ,channelId:%s", deviceId, channelId));
}
UUID uuid = UUID.randomUUID();
- DeferredResult> result = new DeferredResult>();
+ DeferredResult> result = new DeferredResult>(30000L);
// 超时处理
result.onTimeout(()->{
logger.warn(String.format("设备回放超时,deviceId:%s ,channelId:%s", deviceId, channelId));
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
index 706f97e6..b552e1e8 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
@@ -21,10 +21,10 @@ import javax.security.sasl.AuthenticationException;
public class UserController {
@Autowired
- AuthenticationManager authenticationManager;
+ private AuthenticationManager authenticationManager;
@Autowired
- IUserService userService;
+ private IUserService userService;
@ApiOperation("登录")
@ApiImplicitParams({
@@ -33,7 +33,7 @@ public class UserController {
})
@GetMapping("/login")
public String login(String username, String password){
- LoginUser user = null;
+ LoginUser user;
try {
user = SecurityUtils.login(username, password, authenticationManager);
} catch (AuthenticationException e) {
diff --git a/src/main/resources/wvp.sqlite b/src/main/resources/wvp.sqlite
index eb4e08bb2b99d6ee259fa6064e0c8ccdac7253cc..7661a0f34fb040316dd58af843737330f0433379 100644
GIT binary patch
delta 356
zcmZo@U~5>wHbGkO69WT-BoGS$F%uB=P1G@F{IoG)i9Qz-|6>OJ@BEMX&ukV{ILOba
zJ<(BEM2MGJo1-AHC^fGnz91*DBrU%vck_39&I=O**jX8YhVX0_T=0c|k%GXY009WO
zErF3yK$-m?0}rb>1OFyIUp`?TEAB6xr+Dvk{pC8!ZpJFk*~MwiX}z)W3KI+aKNh=<
zjiO9~?Ejcl85mlmn^oAwwY3@BbEk7wFjfdC`1yw@_=WoTD1`cX28Oy$Z>(UHn7*x!
zk&ivKs4TU}Ghq6LIz|yTFehMod_JQjM@nj0W^$^#({#ZcMo}owvtaszEJn%czbhEI
zIN^p)?9GsXJ*E$6B{pXzhBF!$i&FCnNi_CKLCfHbGkOBLf421Q7E8F(U&5Q|3e+W5$mg6PD<6F!FzA;Q!A5aI>Jod43rU
zpaL+EhcOWJ=I{2L7ZwEwEK(4FliLy)83h!%HZkz9n=$Zj;`8Mb=CR`b!g-4KKG$Ea
zqwN29=d+u!d2DQCXJg^o#Jq5#qco6a+%~cC0u$G!$qMok)6L2mPjEMTG;^|xYil#M
zxldOrWvp=2;o?*(PAw`+Epm5q$MjJ+
国标28181
+
+
diff --git a/web_src/src/components/Login.vue b/web_src/src/components/Login.vue
index 6adf4a89..a507f597 100644
--- a/web_src/src/components/Login.vue
+++ b/web_src/src/components/Login.vue
@@ -1,19 +1,35 @@
-
-
-
-
-
-
+
+
+
+
WVP视频平台
+
+
+
-
Welcome!
-
-
-
+
@@ -24,6 +40,7 @@ export default {
data(){
return {
isLoging: false,
+ showPassword: false,
username: '',
password: ''
}
@@ -105,84 +122,3 @@ export default {
}
-
diff --git a/web_src/src/components/dialog/devicePlayer.vue b/web_src/src/components/dialog/devicePlayer.vue
index bd976a8c..f5c7d501 100644
--- a/web_src/src/components/dialog/devicePlayer.vue
+++ b/web_src/src/components/dialog/devicePlayer.vue
@@ -138,6 +138,7 @@