国标级联->选择通道支持移除目前下所有以及全部添加到目录下
This commit is contained in:
@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.service;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,4 +39,11 @@ public interface IDeviceChannelService {
|
||||
* @return
|
||||
*/
|
||||
ResourceBaceInfo getOverview();
|
||||
|
||||
/**
|
||||
* 查询所有未分配的通道
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
List<ChannelReduce> queryAllChannelList(String platformId);
|
||||
}
|
||||
|
||||
@@ -55,4 +55,18 @@ public interface IGbStreamService {
|
||||
int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate);
|
||||
|
||||
DeviceChannel getDeviceChannelListByStreamWithStatus(GbStream gbStream, String catalogId, ParentPlatform platform);
|
||||
|
||||
/**
|
||||
* 查询所有未分配的通道
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
List<GbStream> getAllGBChannels(String platformId);
|
||||
|
||||
/**
|
||||
* 移除所有关联的通道
|
||||
* @param platformId
|
||||
* @param catalogId
|
||||
*/
|
||||
void delAllPlatformInfo(String platformId, String catalogId);
|
||||
}
|
||||
|
||||
@@ -19,4 +19,11 @@ public interface IPlatformChannelService {
|
||||
*/
|
||||
int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId);
|
||||
|
||||
/**
|
||||
* 移除目录下的所有通道
|
||||
* @param platformId
|
||||
* @param catalogId
|
||||
* @return
|
||||
*/
|
||||
int delAllChannelForGB(String platformId, String catalogId);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -168,4 +169,12 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
public ResourceBaceInfo getOverview() {
|
||||
return channelMapper.getOverview();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ChannelReduce> queryAllChannelList(String platformId) {
|
||||
return channelMapper.queryChannelListInAll(null, null, null, platformId, null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.slf4j.Logger;
|
||||
@@ -19,7 +19,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -230,4 +229,35 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
||||
deviceChannel.setSecrecy("0");
|
||||
return deviceChannel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GbStream> getAllGBChannels(String platformId) {
|
||||
|
||||
return gbStreamMapper.selectAll(platformId, null, null, null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delAllPlatformInfo(String platformId, String catalogId) {
|
||||
if (platformId == null) {
|
||||
return ;
|
||||
}
|
||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
||||
if (platform == null) {
|
||||
return ;
|
||||
}
|
||||
if (ObjectUtils.isEmpty(catalogId)) {
|
||||
catalogId = platform.getDeviceGBId();
|
||||
}
|
||||
if (platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId) > 0) {
|
||||
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId);
|
||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
||||
for (GbStream gbStream : gbStreams) {
|
||||
DeviceChannel deviceChannel = new DeviceChannel();
|
||||
deviceChannel.setChannelId(gbStream.getGbId());
|
||||
deviceChannelList.add(deviceChannel);
|
||||
}
|
||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -105,4 +106,26 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||
}
|
||||
return deviceChannelList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delAllChannelForGB(String platformId, String catalogId) {
|
||||
|
||||
int result;
|
||||
if (platformId == null) {
|
||||
return 0;
|
||||
}
|
||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
||||
if (platform == null) {
|
||||
return 0;
|
||||
}
|
||||
if (ObjectUtils.isEmpty(catalogId)) {
|
||||
catalogId = platform.getDeviceGBId();
|
||||
}
|
||||
|
||||
if ((result = platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId)) > 0) {
|
||||
List<DeviceChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId);
|
||||
eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user