重构INVITE消息处理中的上级点播请求

This commit is contained in:
648540858
2024-08-14 17:19:19 +08:00
parent d5621f9489
commit cce1d1de40
28 changed files with 489 additions and 406 deletions

View File

@@ -1,8 +1,9 @@
package com.genersoft.iot.vmp.storager;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
import java.util.List;
@@ -76,13 +77,6 @@ public interface IVideoManagerStorage {
*/
public MobilePosition queryLatestPosition(String deviceId);
/**
* 根据国标ID获取平台关联的直播流
* @param platformId
* @param channelId
* @return
*/
GbStream queryStreamInParentPlatform(String platformId, String channelId);
/**
* 根据通道ID获取其所在设备
@@ -91,16 +85,8 @@ public interface IVideoManagerStorage {
*/
Device queryVideoDeviceByChannelId(String channelId);
int delRelation(PlatformCatalog platformCatalog);
int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo);
List<Platform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
void delRelationByPlatformId(String serverGBId);
List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
List<Platform> queryEnablePlatformListWithAsMessageChannel();
}

View File

@@ -1,21 +1,14 @@
package com.genersoft.iot.vmp.storager.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
import com.genersoft.iot.vmp.gb28181.dao.*;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Component;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
@@ -33,19 +26,6 @@ import java.util.List;
public class VideoManagerStorageImpl implements IVideoManagerStorage {
@Autowired
EventPublisher eventPublisher;
@Autowired
SipConfig sipConfig;
@Autowired
TransactionDefinition transactionDefinition;
@Autowired
DataSourceTransactionManager dataSourceTransactionManager;
@Autowired
private DeviceMapper deviceMapper;
@@ -64,20 +44,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
@Autowired
private PlatformChannelMapper platformChannelMapper;
@Autowired
private PlatformCatalogMapper platformCatalogMapper;
@Autowired
private GbStreamMapper gbStreamMapper;
@Autowired
private PlatformCatalogMapper catalogMapper;
@Autowired
private PlatformGbStreamMapper platformGbStreamMapper;
/**
* 查询移动位置轨迹
@@ -98,9 +64,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
}
PlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId()); // .getDeviceGBId());
if (parentPlatform.getId() == null ) {
if (parentPlatform.getCatalogId() == null) {
parentPlatform.setCatalogId(parentPlatform.getServerGBId());
}
result = platformMapper.addParentPlatform(parentPlatform);
if (parentPlatformCatch == null) {
parentPlatformCatch = new PlatformCatch();
@@ -218,17 +181,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
return deviceMobilePositionMapper.queryLatestPositionByDevice(deviceId);
}
/**
* 根据国标ID获取平台关联的直播流
* @param platformId
* @param gbId
* @return
*/
@Override
public GbStream queryStreamInParentPlatform(String platformId, String gbId) {
return gbStreamMapper.queryStreamInPlatform(platformId, gbId);
}
@Override
public Device queryVideoDeviceByChannelId( String channelId) {
@@ -240,46 +192,8 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
return result;
}
@Override
public int delRelation(PlatformCatalog platformCatalog) {
if (platformCatalog.getType() == 1) {
CommonGBChannel deviceChannel = new CommonGBChannel();
deviceChannel.setGbDeviceId(platformCatalog.getId());
// eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.DEL);
return platformChannelMapper.delByCatalogIdAndChannelIdAndPlatformId(platformCatalog);
}else if (platformCatalog.getType() == 2) {
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformCatalog.getPlatformId(), platformCatalog.getParentId());
for (GbStream gbStream : gbStreams) {
if (gbStream.getGbId().equals(platformCatalog.getId())) {
CommonGBChannel deviceChannel = new CommonGBChannel();
deviceChannel.setGbDeviceId(gbStream.getGbId());
// eventPublisher.catalogEventPublish(platformCatalog.getPlatformId(), deviceChannel, CatalogEvent.DEL);
return platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream());
}
}
}
return 0;
}
@Override
public int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos) {
return gbStreamMapper.updateStreamGPS(gpsMsgInfos);
}
@Override
public List<Platform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms) {
return platformChannelMapper.queryPlatFormListForGBWithGBId(channelId, platforms);
}
@Override
public void delRelationByPlatformId(String serverGBId) {
platformGbStreamMapper.delByPlatformId(serverGBId);
platformChannelMapper.delByPlatformId(serverGBId);
}
@Override
public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) {
return platformMapper.getChannelSource(platformId, gbId);
}
}