From 724b288232e1614de1b789d0910fe3e3db765e52 Mon Sep 17 00:00:00 2001 From: 648540858 <18010473990@163.com> Date: 星期三, 04 八月 2021 18:00:22 +0800 Subject: [PATCH] 优化内存溢出的问题 优化zlm集群默认zlm的存储 添加报警的存储以及相关接口 添加单元测试 --- src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 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 bbe8c2b..82d9bdb 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 @@ -5,6 +5,7 @@ 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; @@ -69,6 +70,9 @@ @Autowired private VideoStreamSessionManager streamSession; + + @Autowired + private MediaServerMapper mediaServerMapper; private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -459,6 +463,8 @@ boolean result = false; streamProxyItem.setStreamType("proxy"); streamProxyItem.setStatus(true); + String now = this.format.format(new Date(System.currentTimeMillis())); + streamProxyItem.setCreateTime(now); try { if (gbStreamMapper.add(streamProxyItem)<0 || streamProxyMapper.add(streamProxyItem) < 0) { //浜嬪姟鍥炴粴 @@ -467,6 +473,7 @@ result = true; dataSourceTransactionManager.commit(transactionStatus); //鎵嬪姩鎻愪氦 }catch (Exception e) { + logger.error("鍚戞暟鎹簱娣诲姞娴佷唬鐞嗗け璐ワ細", e); dataSourceTransactionManager.rollback(transactionStatus); } return result; @@ -599,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(new Date(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