Merge branch 'wvp-28181-2.0' into wvp-pro-record
# Conflicts: # src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java # web_src/src/components/control.vue
This commit is contained in:
@@ -103,7 +103,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
||||
deviceChannel.setStatus(gbStream.isStatus()?1:0);
|
||||
deviceChannel.setParentId(catalogId ==null?gbStream.getCatalogId():catalogId);
|
||||
deviceChannel.setRegisterWay(1);
|
||||
deviceChannel.setCivilCode(sipConfig.getDomain());
|
||||
deviceChannel.setCivilCode(sipConfig.getDomain().substring(0, sipConfig.getDomain().length() - 2));
|
||||
deviceChannel.setModel("live");
|
||||
deviceChannel.setOwner("wvp-pro");
|
||||
deviceChannel.setParental(0);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.conf.MediaConfig;
|
||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
import com.genersoft.iot.vmp.conf.UserSetup;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
@@ -278,6 +279,7 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
|
||||
|
||||
@Override
|
||||
public MediaServerItem getDefaultMediaServer() {
|
||||
|
||||
return mediaServerMapper.queryDefault();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.MediaConfig;
|
||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
@@ -26,6 +27,10 @@ public class MediaServiceImpl implements IMediaService {
|
||||
@Autowired
|
||||
private IMediaServerService mediaServerService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private MediaConfig mediaConfig;
|
||||
|
||||
@Autowired
|
||||
private ZLMRESTfulUtils zlmresTfulUtils;
|
||||
|
||||
@@ -39,15 +44,12 @@ public class MediaServiceImpl implements IMediaService {
|
||||
@Override
|
||||
public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, String addr) {
|
||||
StreamInfo streamInfo = null;
|
||||
|
||||
MediaServerItem mediaInfo;
|
||||
if (mediaServerId == null) {
|
||||
mediaInfo = mediaServerService.getDefaultMediaServer();
|
||||
}else {
|
||||
mediaInfo = mediaServerService.getOne(mediaServerId);
|
||||
mediaServerId = mediaConfig.getId();
|
||||
}
|
||||
MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);;
|
||||
if (mediaInfo == null) {
|
||||
return streamInfo;
|
||||
return null;
|
||||
}
|
||||
JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaInfo, app, stream);
|
||||
if (mediaList != null) {
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.service.impl;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.Message;
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
@@ -11,11 +13,14 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class RedisGPSMsgListener implements MessageListener {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(RedisGPSMsgListener.class);
|
||||
|
||||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, byte[] bytes) {
|
||||
logger.debug("收到来自REDIS的GPS通知: {}", new String(message.getBody()));
|
||||
GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class);
|
||||
redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo);
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
|
||||
if (streamPushItemsForPlatform.size() > 0) {
|
||||
List<StreamPushItem> streamPushItemListFroPlatform = new ArrayList<>();
|
||||
Map<String, List<StreamPushItem>> platformForEvent = new HashMap<>();
|
||||
Map<String, List<GbStream>> platformForEvent = new HashMap<>();
|
||||
// 遍历存储结果,查找app+Stream->platformId+catalogId的对应关系,然后执行批量写入
|
||||
for (StreamPushItem streamPushItem : streamPushItemsForPlatform) {
|
||||
List<String[]> platFormInfoList = streamPushItemsForAll.get(streamPushItem.getApp() + streamPushItem.getStream());
|
||||
@@ -390,16 +390,17 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
// 数组 platFormInfoArray 0 为平台ID。 1为目录ID
|
||||
streamPushItemForPlatform.setPlatformId(platFormInfoArray[0]);
|
||||
|
||||
List<StreamPushItem> streamPushItemsInPlatform = platformForEvent.get(streamPushItem.getPlatformId());
|
||||
if (streamPushItemsInPlatform == null) {
|
||||
streamPushItemsInPlatform = new ArrayList<>();
|
||||
platformForEvent.put(platFormInfoArray[0], streamPushItemsInPlatform);
|
||||
List<GbStream> gbStreamList = platformForEvent.get(streamPushItem.getPlatformId());
|
||||
if (gbStreamList == null) {
|
||||
gbStreamList = new ArrayList<>();
|
||||
platformForEvent.put(platFormInfoArray[0], gbStreamList);
|
||||
}
|
||||
// 为发送通知整理数据
|
||||
streamPushItemForPlatform.setName(streamPushItem.getName());
|
||||
streamPushItemForPlatform.setApp(streamPushItem.getApp());
|
||||
streamPushItemForPlatform.setStream(streamPushItem.getStream());
|
||||
streamPushItemForPlatform.setGbId(streamPushItem.getGbId());
|
||||
streamPushItemsInPlatform.add(streamPushItemForPlatform);
|
||||
gbStreamList.add(streamPushItemForPlatform);
|
||||
}
|
||||
if (platFormInfoArray.length > 1) {
|
||||
streamPushItemForPlatform.setCatalogId(platFormInfoArray[1]);
|
||||
@@ -416,7 +417,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
// 发送通知
|
||||
for (String platformId : platformForEvent.keySet()) {
|
||||
eventPublisher.catalogEventPublishForStream(
|
||||
platformId, platformForEvent.get(platformId).toArray(new GbStream[0]), CatalogEvent.ADD);
|
||||
platformId, platformForEvent.get(platformId), CatalogEvent.ADD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user