From 407a5b77c3586fef44dc771e48f05c2354740795 Mon Sep 17 00:00:00 2001
From: 648540858 <18010473990@163.com>
Date: 星期二, 07 九月 2021 09:20:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/wvp-28181-2.0' into wvp-28181-2.0
---
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java | 39 ++++++++++++++++++++++++++++++++++++---
1 files changed, 36 insertions(+), 3 deletions(-)
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 6600a75..89c1d6c 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
@@ -3,9 +3,9 @@
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.MediaServerItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
@@ -71,6 +71,9 @@
@Autowired
private VideoStreamSessionManager streamSession;
+ @Autowired
+ private MediaServerMapper mediaServerMapper;
+
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -106,7 +109,7 @@
*/
@Override
public synchronized boolean updateDevice(Device device) {
- String now = this.format.format(new Date(System.currentTimeMillis()));
+ String now = this.format.format(System.currentTimeMillis());
device.setUpdateTime(now);
Device deviceByDeviceId = deviceMapper.getDeviceByDeviceId(device.getDeviceId());
if (deviceByDeviceId == null) {
@@ -123,7 +126,7 @@
String channelId = channel.getChannelId();
channel.setDeviceId(deviceId);
channel.setStreamId(streamSession.getStreamId(deviceId, channel.getChannelId()));
- String now = this.format.format(new Date(System.currentTimeMillis()));
+ String now = this.format.format(System.currentTimeMillis());
channel.setUpdateTime(now);
DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId);
if (deviceChannel == null) {
@@ -460,6 +463,8 @@
boolean result = false;
streamProxyItem.setStreamType("proxy");
streamProxyItem.setStatus(true);
+ String now = this.format.format(System.currentTimeMillis());
+ streamProxyItem.setCreateTime(now);
try {
if (gbStreamMapper.add(streamProxyItem)<0 || streamProxyMapper.add(streamProxyItem) < 0) {
//浜嬪姟鍥炴粴
@@ -468,6 +473,7 @@
result = true;
dataSourceTransactionManager.commit(transactionStatus); //鎵嬪姩鎻愪氦
}catch (Exception e) {
+ logger.error("鍚戞暟鎹簱娣诲姞娴佷唬鐞嗗け璐ワ細", e);
dataSourceTransactionManager.rollback(transactionStatus);
}
return result;
@@ -600,4 +606,31 @@
public void updateParentPlatformStatus(String platformGbID, boolean online) {
platformMapper.updateParentPlatformStatus(platformGbID, online);
}
+
+ @Override
+ public void updateMediaServer(MediaServerItem mediaServerItem) {
+ String now = this.format.format(System.currentTimeMillis());
+ mediaServerItem.setUpdateTime(now);
+ if (mediaServerMapper.queryOne(mediaServerItem.getId()) != null) {
+ mediaServerMapper.update(mediaServerItem);
+ }else {
+ mediaServerItem.setCreateTime(now);
+ mediaServerMapper.add(mediaServerItem);
+ }
+ }
+
+ @Override
+ public List<StreamProxyItem> getStreamProxyListForEnableInMediaServer(String id, boolean enable) {
+ return streamProxyMapper.selectForEnableInMediaServer(id, enable);
+ }
+
+ @Override
+ public Device queryVideoDeviceByChannelId(String channelId) {
+ Device result = null;
+ List<DeviceChannel> channelList = deviceChannelMapper.queryChannelByChannelId(channelId);
+ if (channelList.size() == 1) {
+ result = deviceMapper.getDeviceByDeviceId(channelList.get(0).getDeviceId());
+ }
+ return result;
+ }
}
--
Gitblit v1.8.0