Merge remote-tracking branch 'origin/database-structure-optimization' into database-structure-optimization
# Conflicts: # sql/common.sql结构优化
commit
2199db079a
|
@ -1,4 +1,4 @@
|
||||||
CREATE TABLE `wvp_common_gb_channel`
|
CREATE TABLE `wvp_common_channel`
|
||||||
(
|
(
|
||||||
`common_gb_id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
`common_gb_id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`common_gb_device_id` varchar(50) NOT NULL,
|
`common_gb_device_id` varchar(50) NOT NULL,
|
||||||
|
@ -67,7 +67,7 @@ CREATE TABLE `wvp_common_region`
|
||||||
UNIQUE KEY `common_region_device_id` (`common_region_device_id`)
|
UNIQUE KEY `common_region_device_id` (`common_region_device_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
|
||||||
CREATE TABLE `wvp_common_platform_channel`
|
CREATE TABLE `wvp_common_channel_platform`
|
||||||
(
|
(
|
||||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`platform_id` bigint unsigned NOT NULL,
|
`platform_id` bigint unsigned NOT NULL,
|
||||||
|
@ -79,10 +79,21 @@ CREATE TABLE `wvp_common_platform_channel`
|
||||||
DEFAULT CHARSET = utf8mb4
|
DEFAULT CHARSET = utf8mb4
|
||||||
COLLATE = utf8mb4_0900_ai_ci;
|
COLLATE = utf8mb4_0900_ai_ci;
|
||||||
|
|
||||||
drop table `wvp_platform_catalog`;
|
|
||||||
drop table `wvp_platform_gb_channel`;
|
drop table wvp_platform_gb_stream;
|
||||||
drop table `wvp_platform_gb_stream`;
|
drop table wvp_platform_gb_channel;
|
||||||
drop table `wvp_resources_tree`;
|
drop table wvp_platform_catalog;
|
||||||
|
drop table wvp_platform_gb_channel;
|
||||||
|
drop table wvp_resources_tree;
|
||||||
|
|
||||||
|
alter table wvp_platform
|
||||||
|
add share_all_channel bool default false;
|
||||||
|
|
||||||
|
alter table wvp_platform
|
||||||
|
add share_group bool default true;
|
||||||
|
|
||||||
|
alter table wvp_platform
|
||||||
|
add share_region bool default false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -186,9 +186,18 @@ public class ParentPlatform {
|
||||||
@Schema(description = "是否作为消息通道")
|
@Schema(description = "是否作为消息通道")
|
||||||
private boolean asMessageChannel;
|
private boolean asMessageChannel;
|
||||||
|
|
||||||
@Schema(description = "是否作为消息通道")
|
@Schema(description = "通道自动推送")
|
||||||
private boolean autoPushChannel;
|
private boolean autoPushChannel;
|
||||||
|
|
||||||
|
@Schema(description = "是否共享所有通道")
|
||||||
|
private boolean shareAllChannel;
|
||||||
|
|
||||||
|
@Schema(description = "是否共享分组")
|
||||||
|
private boolean shareGroup;
|
||||||
|
|
||||||
|
@Schema(description = "是否共享区域")
|
||||||
|
private boolean shareRegion;
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -436,4 +445,28 @@ public class ParentPlatform {
|
||||||
public void setAutoPushChannel(boolean autoPushChannel) {
|
public void setAutoPushChannel(boolean autoPushChannel) {
|
||||||
this.autoPushChannel = autoPushChannel;
|
this.autoPushChannel = autoPushChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShareAllChannel() {
|
||||||
|
return shareAllChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareAllChannel(boolean shareAllChannel) {
|
||||||
|
this.shareAllChannel = shareAllChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isShareGroup() {
|
||||||
|
return shareGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareGroup(boolean shareGroup) {
|
||||||
|
this.shareGroup = shareGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isShareRegion() {
|
||||||
|
return shareRegion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareRegion(boolean shareRegion) {
|
||||||
|
this.shareRegion = shareRegion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.event;
|
package com.genersoft.iot.vmp.gb28181.event;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.device.RequestTimeoutEvent;
|
import com.genersoft.iot.vmp.gb28181.event.device.RequestTimeoutEvent;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEvent;
|
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEvent;
|
||||||
|
@ -52,10 +53,10 @@ public class EventPublisher {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void catalogEventPublish(String platformId, DeviceChannel deviceChannel, String type) {
|
public void catalogEventPublish(String platformId, CommonGbChannel channel, String type) {
|
||||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
List<CommonGbChannel> channelList = new ArrayList<>();
|
||||||
deviceChannelList.add(deviceChannel);
|
channelList.add(channel);
|
||||||
catalogEventPublish(platformId, deviceChannelList, type);
|
catalogEventPublish(platformId, channelList, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,25 +70,12 @@ public class EventPublisher {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param platformId
|
* @param platformId
|
||||||
* @param deviceChannels
|
* @param channels
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
public void catalogEventPublish(String platformId, List<DeviceChannel> deviceChannels, String type) {
|
public void catalogEventPublish(String platformId, List<CommonGbChannel> channels, String type) {
|
||||||
CatalogEvent outEvent = new CatalogEvent(this);
|
CatalogEvent outEvent = new CatalogEvent(this);
|
||||||
List<DeviceChannel> channels = new ArrayList<>();
|
outEvent.setChannels(channels);
|
||||||
if (deviceChannels.size() > 1) {
|
|
||||||
// 数据去重
|
|
||||||
Set<String> gbIdSet = new HashSet<>();
|
|
||||||
for (DeviceChannel deviceChannel : deviceChannels) {
|
|
||||||
if (!gbIdSet.contains(deviceChannel.getChannelId())) {
|
|
||||||
gbIdSet.add(deviceChannel.getChannelId());
|
|
||||||
channels.add(deviceChannel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
channels = deviceChannels;
|
|
||||||
}
|
|
||||||
outEvent.setDeviceChannels(channels);
|
|
||||||
outEvent.setType(type);
|
outEvent.setType(type);
|
||||||
outEvent.setPlatformId(platformId);
|
outEvent.setPlatformId(platformId);
|
||||||
applicationEventPublisher.publishEvent(outEvent);
|
applicationEventPublisher.publishEvent(outEvent);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.event.subscribe.catalog;
|
package com.genersoft.iot.vmp.gb28181.event.subscribe.catalog;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
@ -46,17 +47,17 @@ public class CatalogEvent extends ApplicationEvent {
|
||||||
*/
|
*/
|
||||||
public static final String UPDATE = "UPDATE";
|
public static final String UPDATE = "UPDATE";
|
||||||
|
|
||||||
private List<DeviceChannel> deviceChannels;
|
private List<CommonGbChannel> channels;
|
||||||
private List<GbStream> gbStreams;
|
private List<GbStream> gbStreams;
|
||||||
private String type;
|
private String type;
|
||||||
private String platformId;
|
private String platformId;
|
||||||
|
|
||||||
public List<DeviceChannel> getDeviceChannels() {
|
public List<CommonGbChannel> getChannels() {
|
||||||
return deviceChannels;
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeviceChannels(List<DeviceChannel> deviceChannels) {
|
public void setChannels(List<CommonGbChannel> channels) {
|
||||||
this.deviceChannels = deviceChannels;
|
this.channels = channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.genersoft.iot.vmp.service;
|
package com.genersoft.iot.vmp.service;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -11,19 +13,12 @@ import java.util.List;
|
||||||
public interface IPlatformChannelService {
|
public interface IPlatformChannelService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新目录下的通道
|
* 添加共享通道
|
||||||
* @param platformId 平台编号
|
|
||||||
* @param channelReduces 通道信息
|
|
||||||
* @param catalogId 目录编号
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId);
|
int addChannelForGB(ParentPlatform platform, List<Integer> commonGbChannelIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除目录下的所有通道
|
* 移除共享通道
|
||||||
* @param platformId
|
|
||||||
* @param catalogId
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
int delAllChannelForGB(String platformId, String catalogId);
|
int removeChannelForGB(ParentPlatform platform, List<Integer> commonGbChannelIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package com.genersoft.iot.vmp.service.impl;
|
package com.genersoft.iot.vmp.service.impl;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.BatchLimit;
|
import com.genersoft.iot.vmp.common.BatchLimit;
|
||||||
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||||
import com.genersoft.iot.vmp.service.IPlatformChannelService;
|
import com.genersoft.iot.vmp.service.IPlatformChannelService;
|
||||||
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
import com.genersoft.iot.vmp.storager.dao.*;
|
||||||
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper;
|
|
||||||
import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper;
|
|
||||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -17,6 +17,7 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
import org.springframework.transaction.TransactionDefinition;
|
||||||
import org.springframework.transaction.TransactionStatus;
|
import org.springframework.transaction.TransactionStatus;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -35,6 +36,9 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlatformChannelMapper platformChannelMapper;
|
private PlatformChannelMapper platformChannelMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CommonGbChannelMapper commonGbChannelMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TransactionDefinition transactionDefinition;
|
TransactionDefinition transactionDefinition;
|
||||||
|
|
||||||
|
@ -58,117 +62,50 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
EventPublisher eventPublisher;
|
EventPublisher eventPublisher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId) {
|
@Transactional
|
||||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
public int addChannelForGB(ParentPlatform platform, List<Integer> commonGbChannelIds) {
|
||||||
if (platform == null) {
|
assert platform != null;
|
||||||
logger.warn("更新级联通道信息时未找到平台{}的信息", platformId);
|
// 检查通道Id数据是否都是在数据库中存在的数据
|
||||||
return 0;
|
List<Integer> commonGbChannelIdsForSave = commonGbChannelMapper.getChannelIdsByIds(commonGbChannelIds);
|
||||||
|
if (commonGbChannelIdsForSave.isEmpty()) {
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "有效待关联通道Id为空");
|
||||||
}
|
}
|
||||||
Map<Integer, ChannelReduce> deviceAndChannels = new HashMap<>();
|
// 去除已经关联的部分通道
|
||||||
for (ChannelReduce channelReduce : channelReduces) {
|
List<Integer> commonGbChannelIdsInDb = platformChannelMapper.findChannelsInDb(platform.getId(),
|
||||||
channelReduce.setCatalogId(catalogId);
|
commonGbChannelIdsForSave);
|
||||||
deviceAndChannels.put(channelReduce.getId(), channelReduce);
|
if (!commonGbChannelIdsInDb.isEmpty()) {
|
||||||
|
commonGbChannelIdsForSave.removeAll(commonGbChannelIdsInDb);
|
||||||
}
|
}
|
||||||
List<Integer> deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet());
|
if (commonGbChannelIdsForSave.isEmpty()) {
|
||||||
// 查询当前已经存在的
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "有效待关联通道Id为空");
|
||||||
List<Integer> channelIds = platformChannelMapper.findChannelRelatedPlatform(platformId, channelReduces);
|
|
||||||
if (deviceAndChannelList != null) {
|
|
||||||
deviceAndChannelList.removeAll(channelIds);
|
|
||||||
}
|
}
|
||||||
for (Integer channelId : channelIds) {
|
|
||||||
deviceAndChannels.remove(channelId);
|
|
||||||
}
|
|
||||||
List<ChannelReduce> channelReducesToAdd = new ArrayList<>(deviceAndChannels.values());
|
|
||||||
// 对剩下的数据进行存储
|
|
||||||
int allCount = 0;
|
int allCount = 0;
|
||||||
boolean result = false;
|
if (commonGbChannelIdsForSave.size() > BatchLimit.count) {
|
||||||
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
|
for (int i = 0; i < commonGbChannelIdsForSave.size(); i += BatchLimit.count) {
|
||||||
if (!channelReducesToAdd.isEmpty()) {
|
|
||||||
if (channelReducesToAdd.size() > BatchLimit.count) {
|
|
||||||
for (int i = 0; i < channelReducesToAdd.size(); i += BatchLimit.count) {
|
|
||||||
int toIndex = i + BatchLimit.count;
|
int toIndex = i + BatchLimit.count;
|
||||||
if (i + BatchLimit.count > channelReducesToAdd.size()) {
|
if (i + BatchLimit.count > commonGbChannelIdsForSave.size()) {
|
||||||
toIndex = channelReducesToAdd.size();
|
toIndex = commonGbChannelIdsForSave.size();
|
||||||
}
|
}
|
||||||
int count = platformChannelMapper.addChannels(platformId, channelReducesToAdd.subList(i, toIndex));
|
int count = platformChannelMapper.addChannels(platform.getId(), commonGbChannelIdsForSave.subList(i, toIndex));
|
||||||
result = result || count < 0;
|
|
||||||
allCount += count;
|
allCount += count;
|
||||||
logger.info("[关联通道]国标通道 平台:{}, 共需关联通道数:{}, 已关联:{}", platformId, channelReducesToAdd.size(), toIndex);
|
logger.info("[关联通道]国标通道 平台:{}, 共需关联通道数:{}, 已关联:{}", platform.getServerGBId(), commonGbChannelIdsForSave.size(), allCount);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
allCount = platformChannelMapper.addChannels(platformId, channelReducesToAdd);
|
allCount = platformChannelMapper.addChannels(platform.getId(), commonGbChannelIdsForSave);
|
||||||
result = result || allCount < 0;
|
logger.info("[关联通道]国标通道 平台:{}, 关联通道数:{}", platform.getServerGBId(), commonGbChannelIdsForSave.size());
|
||||||
logger.info("[关联通道]国标通道 平台:{}, 关联通道数:{}", platformId, channelReducesToAdd.size());
|
|
||||||
}
|
}
|
||||||
|
SubscribeInfo catalogSubscribe = subscribeHolder.getCatalogSubscribe(platform.getServerGBId());
|
||||||
if (result) {
|
|
||||||
//事务回滚
|
|
||||||
dataSourceTransactionManager.rollback(transactionStatus);
|
|
||||||
allCount = 0;
|
|
||||||
}else {
|
|
||||||
logger.info("[关联通道]国标通道 平台:{}, 正在存入数据库", platformId);
|
|
||||||
dataSourceTransactionManager.commit(transactionStatus);
|
|
||||||
|
|
||||||
}
|
|
||||||
SubscribeInfo catalogSubscribe = subscribeHolder.getCatalogSubscribe(platformId);
|
|
||||||
if (catalogSubscribe != null) {
|
if (catalogSubscribe != null) {
|
||||||
List<DeviceChannel> deviceChannelList = getDeviceChannelListByChannelReduceList(channelReducesToAdd, catalogId, platform);
|
List<CommonGbChannel> channelList = commonGbChannelMapper.queryInIdList(commonGbChannelIdsForSave);
|
||||||
if (deviceChannelList != null) {
|
if (channelList != null) {
|
||||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.ADD);
|
eventPublisher.catalogEventPublish(platform.getServerGBId(), channelList, CatalogEvent.ADD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info("[关联通道]国标通道 平台:{}, 存入数据库成功", platformId);
|
|
||||||
}
|
|
||||||
return allCount;
|
return allCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DeviceChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId, ParentPlatform platform) {
|
|
||||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
|
||||||
if (channelReduces.size() > 0){
|
|
||||||
PlatformCatalog catalog = catalogManager.selectByPlatFormAndCatalogId(platform.getServerGBId(),catalogId);
|
|
||||||
if (catalog == null && catalogId.equals(platform.getDeviceGBId())) {
|
|
||||||
for (ChannelReduce channelReduce : channelReduces) {
|
|
||||||
DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
|
|
||||||
deviceChannel.setParental(0);
|
|
||||||
deviceChannel.setCivilCode(platform.getServerGBDomain());
|
|
||||||
deviceChannelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
return deviceChannelList;
|
|
||||||
} else if (catalog == null || !catalogId.equals(platform.getDeviceGBId())) {
|
|
||||||
logger.warn("未查询到目录{}的信息", catalogId);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (ChannelReduce channelReduce : channelReduces) {
|
|
||||||
DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
|
|
||||||
deviceChannel.setParental(0);
|
|
||||||
deviceChannel.setCivilCode(catalog.getCivilCode());
|
|
||||||
deviceChannel.setParentId(catalog.getParentId());
|
|
||||||
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
|
||||||
deviceChannelList.add(deviceChannel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return deviceChannelList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delAllChannelForGB(String platformId, String catalogId) {
|
public int removeChannelForGB(ParentPlatform platform, List<Integer> commonGbChannelIds) {
|
||||||
|
|
||||||
int result;
|
|
||||||
if (platformId == null) {
|
|
||||||
return 0;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,12 @@ import java.util.Map;
|
||||||
@Repository
|
@Repository
|
||||||
public interface CommonGbChannelMapper {
|
public interface CommonGbChannelMapper {
|
||||||
|
|
||||||
@Select(value = "select * from wvp_common_gb_channel where common_gb_business_group_id = '#{commonGroupId}'")
|
@Select(value = "select * from wvp_common_channel where common_gb_business_group_id = '#{commonGroupId}'")
|
||||||
List<CommonGbChannel> getChannels(String commonGroupId);
|
List<CommonGbChannel> getChannels(String commonGroupId);
|
||||||
|
|
||||||
@Update(value = "<script>" +
|
@Update(value = "<script>" +
|
||||||
"<foreach collection='channels' item='item' separator=';'>" +
|
"<foreach collection='channels' item='item' separator=';'>" +
|
||||||
"UPDATE wvp_common_gb_channel SET " +
|
"UPDATE wvp_common_channel SET " +
|
||||||
"update_time= #{ item.updateTime} " +
|
"update_time= #{ item.updateTime} " +
|
||||||
" <if test='item.commonGbDeviceID != null' > ,common_gb_device_id= #{ item.commonGbDeviceID} </if>" +
|
" <if test='item.commonGbDeviceID != null' > ,common_gb_device_id= #{ item.commonGbDeviceID} </if>" +
|
||||||
" <if test='item.commonGbName != null' > ,common_gb_name= #{ item.commonGbName} </if>" +
|
" <if test='item.commonGbName != null' > ,common_gb_name= #{ item.commonGbName} </if>" +
|
||||||
|
@ -65,16 +65,16 @@ public interface CommonGbChannelMapper {
|
||||||
|
|
||||||
@Delete(value = "<script>" +
|
@Delete(value = "<script>" +
|
||||||
"<foreach collection='channels' item='item' separator=';'>" +
|
"<foreach collection='channels' item='item' separator=';'>" +
|
||||||
"delete from wvp_common_gb_channel WHERE common_gb_id=#{item.commonGbId}" +
|
"delete from wvp_common_channel WHERE common_gb_id=#{item.commonGbId}" +
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int removeChannelsForGroup(List<CommonGbChannel> channels);
|
int removeChannelsForGroup(List<CommonGbChannel> channels);
|
||||||
|
|
||||||
@Select("select * from wvp_common_gb_channel where common_gb_device_id=#{channelId}")
|
@Select("select * from wvp_common_channel where common_gb_device_id=#{channelId}")
|
||||||
CommonGbChannel queryByDeviceID(String channelId);
|
CommonGbChannel queryByDeviceID(String channelId);
|
||||||
|
|
||||||
@Insert(value = "<script>" +
|
@Insert(value = "<script>" +
|
||||||
"insert into wvp_common_gb_channel ( " +
|
"insert into wvp_common_channel ( " +
|
||||||
"common_gb_device_id" +
|
"common_gb_device_id" +
|
||||||
" <if test='common_gb_name != null' > ,common_gb_name </if>" +
|
" <if test='common_gb_name != null' > ,common_gb_name </if>" +
|
||||||
" <if test='common_gb_manufacturer != null' > ,common_gb_manufacturer </if>" +
|
" <if test='common_gb_manufacturer != null' > ,common_gb_manufacturer </if>" +
|
||||||
|
@ -152,11 +152,11 @@ public interface CommonGbChannelMapper {
|
||||||
"</script>")
|
"</script>")
|
||||||
int add(CommonGbChannel channel);
|
int add(CommonGbChannel channel);
|
||||||
|
|
||||||
@Delete("delete from wvp_common_gb_channel where common_gb_device_id = #{channelId}")
|
@Delete("delete from wvp_common_channel where common_gb_device_id = #{channelId}")
|
||||||
int deleteByDeviceID(String channelId);
|
int deleteByDeviceID(String channelId);
|
||||||
|
|
||||||
@Update(value = "<script>" +
|
@Update(value = "<script>" +
|
||||||
"UPDATE wvp_common_gb_channel SET " +
|
"UPDATE wvp_common_channel SET " +
|
||||||
"update_time= #{ updateTime} " +
|
"update_time= #{ updateTime} " +
|
||||||
" <if test='commonGbDeviceID != null' > ,common_gb_device_id= #{ commonGbDeviceID} </if>" +
|
" <if test='commonGbDeviceID != null' > ,common_gb_device_id= #{ commonGbDeviceID} </if>" +
|
||||||
" <if test='commonGbName != null' > ,common_gb_name= #{ commonGbName} </if>" +
|
" <if test='commonGbName != null' > ,common_gb_name= #{ commonGbName} </if>" +
|
||||||
|
@ -197,14 +197,14 @@ public interface CommonGbChannelMapper {
|
||||||
int update(CommonGbChannel channel);
|
int update(CommonGbChannel channel);
|
||||||
|
|
||||||
@Select("select count(1)\n" +
|
@Select("select count(1)\n" +
|
||||||
"from wvp_common_gb_channel gc " +
|
"from wvp_common_channel gc " +
|
||||||
"right join wvp_common_platform_channel pc " +
|
"right join wvp_common_platform_channel pc " +
|
||||||
"on gc.common_gb_device_id = pc.common_gb_channel_id" +
|
"on gc.common_gb_device_id = pc.common_gb_channel_id" +
|
||||||
"where gc.common_gb_device_id=#{channelId} and pc.platform_id=#{platformServerId}")
|
"where gc.common_gb_device_id=#{channelId} and pc.platform_id=#{platformServerId}")
|
||||||
int checkChannelInPlatform(String channelId, String platformServerId);
|
int checkChannelInPlatform(String channelId, String platformServerId);
|
||||||
|
|
||||||
@Insert(value = "<script>" +
|
@Insert(value = "<script>" +
|
||||||
"insert into wvp_common_gb_channel ( " +
|
"insert into wvp_common_channel ( " +
|
||||||
"common_gb_device_id, " +
|
"common_gb_device_id, " +
|
||||||
"common_gb_name, " +
|
"common_gb_name, " +
|
||||||
"common_gb_manufacturer, " +
|
"common_gb_manufacturer, " +
|
||||||
|
@ -286,65 +286,65 @@ public interface CommonGbChannelMapper {
|
||||||
int addAll(List<CommonGbChannel> commonGbChannelList);
|
int addAll(List<CommonGbChannel> commonGbChannelList);
|
||||||
|
|
||||||
@Delete("<script> "+
|
@Delete("<script> "+
|
||||||
"DELETE from wvp_common_gb_channel WHERE common_gb_device_id in (" +
|
"DELETE from wvp_common_channel WHERE common_gb_device_id in (" +
|
||||||
"<foreach collection='clearChannels' item='item' separator=',' > #{item}</foreach>" +
|
"<foreach collection='clearChannels' item='item' separator=',' > #{item}</foreach>" +
|
||||||
" )"+
|
" )"+
|
||||||
"</script>")
|
"</script>")
|
||||||
int deleteByDeviceIDs(List<String> clearChannels);
|
int deleteByDeviceIDs(List<String> clearChannels);
|
||||||
|
|
||||||
@Update("<script> "+
|
@Update("<script> "+
|
||||||
"UPDATE wvp_common_gb_channel SET commonGbStatus = true WHERE common_gb_id in" +
|
"UPDATE wvp_common_channel SET commonGbStatus = true WHERE common_gb_id in" +
|
||||||
"<foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.commonGbChannelId}</foreach>" +
|
"<foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.commonGbChannelId}</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void channelsOnlineFromList(List<DeviceChannel> channelList);
|
void channelsOnlineFromList(List<DeviceChannel> channelList);
|
||||||
|
|
||||||
|
|
||||||
@Update("<script> "+
|
@Update("<script> "+
|
||||||
"UPDATE wvp_common_gb_channel SET commonGbStatus = false WHERE common_gb_id in" +
|
"UPDATE wvp_common_channel SET commonGbStatus = false WHERE common_gb_id in" +
|
||||||
"<foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.commonGbChannelId}</foreach>" +
|
"<foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.commonGbChannelId}</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void channelsOfflineFromList(List<DeviceChannel> channelList);
|
void channelsOfflineFromList(List<DeviceChannel> channelList);
|
||||||
|
|
||||||
@Update("<script> "+
|
@Update("<script> "+
|
||||||
"UPDATE wvp_common_gb_channel SET common_gb_parent_id = null WHERE common_gb_id in" +
|
"UPDATE wvp_common_channel SET common_gb_parent_id = null WHERE common_gb_id in" +
|
||||||
"<foreach collection='errorParentIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
"<foreach collection='errorParentIdList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int clearParentIds(List<String> errorParentIdList);
|
int clearParentIds(List<String> errorParentIdList);
|
||||||
|
|
||||||
@Update("<script> "+
|
@Update("<script> "+
|
||||||
"UPDATE wvp_common_gb_channel SET common_gb_civilCode = null WHERE common_gb_civilCode in" +
|
"UPDATE wvp_common_channel SET common_gb_civilCode = null WHERE common_gb_civilCode in" +
|
||||||
"<foreach collection='errorCivilCodeList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
"<foreach collection='errorCivilCodeList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void clearCivilCodes(List<String> errorCivilCodeList);
|
void clearCivilCodes(List<String> errorCivilCodeList);
|
||||||
|
|
||||||
@Select("<script> "+
|
@Select("<script> "+
|
||||||
"SELECT * FROM wvp_common_gb_channel WHERE common_gb_device_id in" +
|
"SELECT * FROM wvp_common_channel WHERE common_gb_device_id in" +
|
||||||
"<foreach collection='commonGbChannelList' item='item' open='(' separator=',' close=')' > #{item.commonGbDeviceID}</foreach>" +
|
"<foreach collection='commonGbChannelList' item='item' open='(' separator=',' close=')' > #{item.commonGbDeviceID}</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
List<CommonGbChannel> queryInList(List<CommonGbChannel> commonGbChannelList);
|
List<CommonGbChannel> queryInList(List<CommonGbChannel> commonGbChannelList);
|
||||||
|
|
||||||
@Update("<script> "+
|
@Update("<script> "+
|
||||||
"UPDATE wvp_common_gb_channel SET common_gb_civilCode = #{commonRegionDeviceIdForNew} WHERE common_gb_civilCode = #{commonRegionDeviceIdForOld}" +
|
"UPDATE wvp_common_channel SET common_gb_civilCode = #{commonRegionDeviceIdForNew} WHERE common_gb_civilCode = #{commonRegionDeviceIdForOld}" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void updateChanelRegion(@Param("commonRegionDeviceIdForOld") String commonRegionDeviceIdForOld,
|
void updateChanelRegion(@Param("commonRegionDeviceIdForOld") String commonRegionDeviceIdForOld,
|
||||||
@Param("commonRegionDeviceIdForNew") String commonRegionDeviceIdForNew);
|
@Param("commonRegionDeviceIdForNew") String commonRegionDeviceIdForNew);
|
||||||
|
|
||||||
@Update("<script> "+
|
@Update("<script> "+
|
||||||
"UPDATE wvp_common_gb_channel SET common_gb_business_group_id = #{groupDeviceIdForNew} WHERE common_gb_business_group_id = #{groupDeviceIdForOld}" +
|
"UPDATE wvp_common_channel SET common_gb_business_group_id = #{groupDeviceIdForNew} WHERE common_gb_business_group_id = #{groupDeviceIdForOld}" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void updateChanelGroup(
|
void updateChanelGroup(
|
||||||
@Param("groupDeviceIdForOld") String groupDeviceIdForOld,
|
@Param("groupDeviceIdForOld") String groupDeviceIdForOld,
|
||||||
@Param("groupDeviceIdForNew") String groupDeviceIdForNew);
|
@Param("groupDeviceIdForNew") String groupDeviceIdForNew);
|
||||||
|
|
||||||
@Select("<script> "+
|
@Select("<script> "+
|
||||||
"select * from wvp_common_gb_channel where common_gb_civilCode = #{regionDeviceId}" +
|
"select * from wvp_common_channel where common_gb_civilCode = #{regionDeviceId}" +
|
||||||
"<if test='query != null'> and ( common_gb_device_id LIKE concat('%',#{query},'%') or common_gb_name LIKE concat('%',#{query},'%') ) </if>" +
|
"<if test='query != null'> and ( common_gb_device_id LIKE concat('%',#{query},'%') or common_gb_name LIKE concat('%',#{query},'%') ) </if>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
List<CommonGbChannel> getChannelsInRegion(@Param("regionDeviceId") String regionDeviceId,
|
List<CommonGbChannel> getChannelsInRegion(@Param("regionDeviceId") String regionDeviceId,
|
||||||
@Param("query") String query);
|
@Param("query") String query);
|
||||||
|
|
||||||
@Select("<script> "+
|
@Select("<script> "+
|
||||||
"select * from wvp_common_gb_channel where 1=1 " +
|
"select * from wvp_common_channel where 1=1 " +
|
||||||
"<if test='groupDeviceId != null'> and common_gb_business_group_id = #{groupDeviceId} </if>" +
|
"<if test='groupDeviceId != null'> and common_gb_business_group_id = #{groupDeviceId} </if>" +
|
||||||
"<if test='regionDeviceId != null'> and common_gb_civilCode = #{regionDeviceId} </if>" +
|
"<if test='regionDeviceId != null'> and common_gb_civilCode = #{regionDeviceId} </if>" +
|
||||||
"<if test='inGroup != null & inGroup'> and common_gb_business_group_id is not null </if>" +
|
"<if test='inGroup != null & inGroup'> and common_gb_business_group_id is not null </if>" +
|
||||||
|
@ -365,13 +365,13 @@ public interface CommonGbChannelMapper {
|
||||||
|
|
||||||
|
|
||||||
@Select("<script> "+
|
@Select("<script> "+
|
||||||
"select * from wvp_common_gb_channel where 1=1 " +
|
"select * from wvp_common_channel where 1=1 " +
|
||||||
"<if test='query != null'> and ( common_gb_device_id LIKE concat('%',#{query},'%') or common_gb_name LIKE concat('%',#{query},'%') ) </if>" +
|
"<if test='query != null'> and ( common_gb_device_id LIKE concat('%',#{query},'%') or common_gb_name LIKE concat('%',#{query},'%') ) </if>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
List<CommonGbChannel> query(@Param("query") String query);
|
List<CommonGbChannel> query(@Param("query") String query);
|
||||||
|
|
||||||
@Select("<script> "+
|
@Select("<script> "+
|
||||||
"UPDATE wvp_common_gb_channel SET common_gb_business_group_id = null WHERE common_gb_business_group_id in" +
|
"UPDATE wvp_common_channel SET common_gb_business_group_id = null WHERE common_gb_business_group_id in" +
|
||||||
"<foreach collection='groupList' item='item' open='(' separator=',' close=')' > #{item.commonGroupDeviceId}</foreach>" +
|
"<foreach collection='groupList' item='item' open='(' separator=',' close=')' > #{item.commonGroupDeviceId}</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void removeGroupInfo(@Param("groupList") List<Group> groupList);
|
void removeGroupInfo(@Param("groupList") List<Group> groupList);
|
||||||
|
@ -379,7 +379,7 @@ public interface CommonGbChannelMapper {
|
||||||
@Update({"<script>" +
|
@Update({"<script>" +
|
||||||
"<foreach collection='param.commonGbIds' item='item' separator=';'>" +
|
"<foreach collection='param.commonGbIds' item='item' separator=';'>" +
|
||||||
" UPDATE" +
|
" UPDATE" +
|
||||||
" wvp_common_gb_channel" +
|
" wvp_common_channel" +
|
||||||
" SET common_gb_business_group_id = #{param.commonGbBusinessGroupID}" +
|
" SET common_gb_business_group_id = #{param.commonGbBusinessGroupID}" +
|
||||||
" WHERE common_gb_id = #{item}" +
|
" WHERE common_gb_id = #{item}" +
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
|
@ -389,7 +389,7 @@ public interface CommonGbChannelMapper {
|
||||||
@Update({"<script>" +
|
@Update({"<script>" +
|
||||||
"<foreach collection='commonGbIds' item='item' separator=';'>" +
|
"<foreach collection='commonGbIds' item='item' separator=';'>" +
|
||||||
" UPDATE" +
|
" UPDATE" +
|
||||||
" wvp_common_gb_channel" +
|
" wvp_common_channel" +
|
||||||
" SET common_gb_business_group_id = null" +
|
" SET common_gb_business_group_id = null" +
|
||||||
" WHERE common_gb_id = #{item}" +
|
" WHERE common_gb_id = #{item}" +
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
|
@ -398,14 +398,14 @@ public interface CommonGbChannelMapper {
|
||||||
|
|
||||||
@Update({"<script>" +
|
@Update({"<script>" +
|
||||||
" UPDATE" +
|
" UPDATE" +
|
||||||
" wvp_common_gb_channel" +
|
" wvp_common_channel" +
|
||||||
" SET common_gb_business_group_id = null" +
|
" SET common_gb_business_group_id = null" +
|
||||||
" WHERE common_gb_business_group_id = #{commonGbBusinessGroupID}" +
|
" WHERE common_gb_business_group_id = #{commonGbBusinessGroupID}" +
|
||||||
"</script>"})
|
"</script>"})
|
||||||
void removeFromGroupByGroupId(@Param("commonGbBusinessGroupID") String commonGbBusinessGroupID);
|
void removeFromGroupByGroupId(@Param("commonGbBusinessGroupID") String commonGbBusinessGroupID);
|
||||||
|
|
||||||
@Select("<script> "+
|
@Select("<script> "+
|
||||||
"UPDATE wvp_common_gb_channel SET common_gb_civilCode = null WHERE common_gb_civilCode in" +
|
"UPDATE wvp_common_channel SET common_gb_civilCode = null WHERE common_gb_civilCode in" +
|
||||||
"<foreach collection='regionList' item='item' open='(' separator=',' close=')' > #{item.commonRegionDeviceId}</foreach>" +
|
"<foreach collection='regionList' item='item' open='(' separator=',' close=')' > #{item.commonRegionDeviceId}</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void removeRegionInfo(@Param("regionList") List<Region> regionList);
|
void removeRegionInfo(@Param("regionList") List<Region> regionList);
|
||||||
|
@ -413,7 +413,7 @@ public interface CommonGbChannelMapper {
|
||||||
@Update({"<script>" +
|
@Update({"<script>" +
|
||||||
"<foreach collection='commonGbIds' item='item' separator=';'>" +
|
"<foreach collection='commonGbIds' item='item' separator=';'>" +
|
||||||
" UPDATE" +
|
" UPDATE" +
|
||||||
" wvp_common_gb_channel" +
|
" wvp_common_channel" +
|
||||||
" SET common_gb_civilCode = null" +
|
" SET common_gb_civilCode = null" +
|
||||||
" WHERE common_gb_id = #{item}" +
|
" WHERE common_gb_id = #{item}" +
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
|
@ -422,7 +422,7 @@ public interface CommonGbChannelMapper {
|
||||||
|
|
||||||
@Update({"<script>" +
|
@Update({"<script>" +
|
||||||
" UPDATE" +
|
" UPDATE" +
|
||||||
" wvp_common_gb_channel" +
|
" wvp_common_channel" +
|
||||||
" SET common_gb_civilCode = null" +
|
" SET common_gb_civilCode = null" +
|
||||||
" WHERE common_gb_civilCode = #{commonGbCivilCode}" +
|
" WHERE common_gb_civilCode = #{commonGbCivilCode}" +
|
||||||
"</script>"})
|
"</script>"})
|
||||||
|
@ -431,7 +431,7 @@ public interface CommonGbChannelMapper {
|
||||||
@Update({"<script>" +
|
@Update({"<script>" +
|
||||||
"<foreach collection='param.commonGbIds' item='item' separator=';'>" +
|
"<foreach collection='param.commonGbIds' item='item' separator=';'>" +
|
||||||
" UPDATE" +
|
" UPDATE" +
|
||||||
" wvp_common_gb_channel" +
|
" wvp_common_channel" +
|
||||||
" SET common_gb_civilCode = #{param.commonGbCivilCode}" +
|
" SET common_gb_civilCode = #{param.commonGbCivilCode}" +
|
||||||
" WHERE common_gb_id = #{item}" +
|
" WHERE common_gb_id = #{item}" +
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
|
@ -439,7 +439,7 @@ public interface CommonGbChannelMapper {
|
||||||
void updateChannelToRegion(@Param("param") UpdateCommonChannelToRegion param);
|
void updateChannelToRegion(@Param("param") UpdateCommonChannelToRegion param);
|
||||||
|
|
||||||
@Insert("<script> " +
|
@Insert("<script> " +
|
||||||
"insert into wvp_common_gb_channel " +
|
"insert into wvp_common_channel " +
|
||||||
"( common_gb_device_id, " +
|
"( common_gb_device_id, " +
|
||||||
" common_gb_name, " +
|
" common_gb_name, " +
|
||||||
" common_gb_manufacturer, " +
|
" common_gb_manufacturer, " +
|
||||||
|
@ -522,7 +522,7 @@ public interface CommonGbChannelMapper {
|
||||||
@Update({"<script>" +
|
@Update({"<script>" +
|
||||||
"<foreach collection='commonGbChannels' item='item' separator=';'>" +
|
"<foreach collection='commonGbChannels' item='item' separator=';'>" +
|
||||||
" UPDATE" +
|
" UPDATE" +
|
||||||
" wvp_common_gb_channel" +
|
" wvp_common_channel" +
|
||||||
" SET update_time=#{item.updateTime}" +
|
" SET update_time=#{item.updateTime}" +
|
||||||
" <if test='item.commonGbDeviceID != null' > ,common_gb_device_id = #{item.commonGbDeviceID} </if>" +
|
" <if test='item.commonGbDeviceID != null' > ,common_gb_device_id = #{item.commonGbDeviceID} </if>" +
|
||||||
" <if test='item.commonGbName != null' > ,common_gb_name = #{item.commonGbName} </if>" +
|
" <if test='item.commonGbName != null' > ,common_gb_name = #{item.commonGbName} </if>" +
|
||||||
|
@ -567,14 +567,25 @@ public interface CommonGbChannelMapper {
|
||||||
@Delete(value = {" <script>" +
|
@Delete(value = {" <script>" +
|
||||||
"DELETE " +
|
"DELETE " +
|
||||||
"from " +
|
"from " +
|
||||||
"wvp_common_gb_channel " +
|
"wvp_common_channel " +
|
||||||
"WHERE common_gb_id IN " +
|
"WHERE common_gb_id IN " +
|
||||||
"<foreach collection='ids' item='item' open='(' separator=',' close=')' >#{item}</foreach>" +
|
"<foreach collection='ids' item='item' open='(' separator=',' close=')' >#{item}</foreach>" +
|
||||||
" </script>"})
|
" </script>"})
|
||||||
int batchDelete(@Param("ids") List<Integer> ids);
|
int batchDelete(@Param("ids") List<Integer> ids);
|
||||||
|
|
||||||
@MapKey("commonGbDeviceID")
|
@MapKey("commonGbDeviceID")
|
||||||
@Select("select * from wvp_common_gb_channel")
|
@Select("select * from wvp_common_channel")
|
||||||
Map<String, CommonGbChannel> queryAllChannelsForMap();
|
Map<String, CommonGbChannel> queryAllChannelsForMap();
|
||||||
|
|
||||||
|
@Select("<script> "+
|
||||||
|
"SELECT * FROM wvp_common_channel WHERE common_gb_id in" +
|
||||||
|
"<foreach collection='channelIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||||
|
"</script>")
|
||||||
|
List<CommonGbChannel> queryInIdList(@Param("channelIds") List<Integer> channelIds);
|
||||||
|
|
||||||
|
@Select("<script> "+
|
||||||
|
"SELECT common_gb_id FROM wvp_common_channel WHERE common_gb_id in" +
|
||||||
|
"<foreach collection='channelIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||||
|
"</script>")
|
||||||
|
List<Integer> getChannelIdsByIds(@Param("channelIds") List<Integer> channelIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -476,7 +476,7 @@ public interface DeviceChannelMapper {
|
||||||
@Update(" update wvp_device_channel wdc " +
|
@Update(" update wvp_device_channel wdc " +
|
||||||
" set " +
|
" set " +
|
||||||
" common_gb_channel_id=" +
|
" common_gb_channel_id=" +
|
||||||
" (select wcgc.common_gb_id from wvp_common_gb_channel wcgc where wdc.channel_id = wcgc.common_gb_device_id) " +
|
" (select wcgc.common_gb_id from wvp_common_channel wcgc where wdc.channel_id = wcgc.common_gb_device_id) " +
|
||||||
" where wdc.device_id = #{deviceId}")
|
" where wdc.device_id = #{deviceId}")
|
||||||
int updateCommonChannelId(@Param("deviceId") String deviceId);
|
int updateCommonChannelId(@Param("deviceId") String deviceId);
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,12 @@ import java.util.List;
|
||||||
public interface ParentPlatformMapper {
|
public interface ParentPlatformMapper {
|
||||||
|
|
||||||
@Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+
|
@Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+
|
||||||
"device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,as_message_channel,auto_push_channel,"+
|
"device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,as_message_channel,auto_push_channel," +
|
||||||
|
"share_all_channel,share_group,share_region,"+
|
||||||
"status,start_offline_push,catalog_id,administrative_division,catalog_group,create_time,update_time) " +
|
"status,start_offline_push,catalog_id,administrative_division,catalog_group,create_time,update_time) " +
|
||||||
" VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " +
|
" VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " +
|
||||||
" #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, #{autoPushChannel}, " +
|
" #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, " +
|
||||||
|
" #{rtcp}, #{asMessageChannel}, #{autoPushChannel}, #{shareAllChannel}, #{shareGroup}, #{shareRegion}, " +
|
||||||
" #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime})")
|
" #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime})")
|
||||||
int addParentPlatform(ParentPlatform parentPlatform);
|
int addParentPlatform(ParentPlatform parentPlatform);
|
||||||
|
|
||||||
|
@ -43,6 +45,9 @@ public interface ParentPlatformMapper {
|
||||||
"rtcp=#{rtcp}, " +
|
"rtcp=#{rtcp}, " +
|
||||||
"as_message_channel=#{asMessageChannel}, " +
|
"as_message_channel=#{asMessageChannel}, " +
|
||||||
"auto_push_channel=#{autoPushChannel}, " +
|
"auto_push_channel=#{autoPushChannel}, " +
|
||||||
|
"share_all_channel=#{shareAllChannel}, " +
|
||||||
|
"share_group=#{shareGroup}, " +
|
||||||
|
"share_region=#{shareRegion}, " +
|
||||||
"status=#{status}, " +
|
"status=#{status}, " +
|
||||||
"start_offline_push=#{startOfflinePush}, " +
|
"start_offline_push=#{startOfflinePush}, " +
|
||||||
"catalog_group=#{catalogGroup}, " +
|
"catalog_group=#{catalogGroup}, " +
|
||||||
|
|
|
@ -22,64 +22,64 @@ public interface PlatformChannelMapper {
|
||||||
* 查询列表里已经关联的
|
* 查询列表里已经关联的
|
||||||
*/
|
*/
|
||||||
@Select("<script> "+
|
@Select("<script> "+
|
||||||
"SELECT device_channel_id from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
|
"SELECT device_channel_id from wvp_common_channel_platform WHERE platform_id=#{platformId} AND device_channel_id in" +
|
||||||
"<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" +
|
"<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
List<Integer> findChannelRelatedPlatform(@Param("platformId") String platformId, @Param("channelReduces") List<ChannelReduce> channelReduces);
|
List<Integer> findChannelRelatedPlatform(@Param("platformId") String platformId, @Param("channelReduces") List<ChannelReduce> channelReduces);
|
||||||
|
|
||||||
@Insert("<script> "+
|
@Insert("<script> "+
|
||||||
"INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id, catalog_id) VALUES" +
|
"INSERT INTO wvp_common_channel_platform (platform_id, common_gb_channel_id) VALUES" +
|
||||||
"<foreach collection='channelReducesToAdd' item='item' separator=','>" +
|
"<foreach collection='channelIds' item='item' separator=','>" +
|
||||||
" (#{platformId}, #{item.id} , #{item.catalogId} )" +
|
" (#{platformId}, #{item})" +
|
||||||
"</foreach>" +
|
"</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int addChannels(@Param("platformId") String platformId, @Param("channelReducesToAdd") List<ChannelReduce> channelReducesToAdd);
|
int addChannels(@Param("platformId") Integer platformId, @Param("channelIds") List<Integer> channelIds);
|
||||||
|
|
||||||
@Delete("<script> "+
|
@Delete("<script> "+
|
||||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
|
"DELETE from wvp_common_channel_platform WHERE platform_id=#{platformId} AND device_channel_id in" +
|
||||||
"<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
"<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int delChannelForGB(@Param("platformId") String platformId, @Param("channelReducesToDel") List<ChannelReduce> channelReducesToDel);
|
int delChannelForGB(@Param("platformId") String platformId, @Param("channelReducesToDel") List<ChannelReduce> channelReducesToDel);
|
||||||
|
|
||||||
@Delete("<script> "+
|
@Delete("<script> "+
|
||||||
"DELETE from wvp_platform_gb_channel WHERE device_channel_id in " +
|
"DELETE from wvp_common_channel_platform WHERE device_channel_id in " +
|
||||||
"( select temp.device_channel_id from " +
|
"( select temp.device_channel_id from " +
|
||||||
"(select pgc.device_channel_id from wvp_platform_gb_channel pgc " +
|
"(select pgc.device_channel_id from wvp_common_channel_platform pgc " +
|
||||||
"left join wvp_device_channel dc on dc.id = pgc.device_channel_id where dc.device_id =#{deviceId} " +
|
"left join wvp_device_channel dc on dc.id = pgc.device_channel_id where dc.device_id =#{deviceId} " +
|
||||||
") temp)" +
|
") temp)" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int delChannelForDeviceId(String deviceId);
|
int delChannelForDeviceId(String deviceId);
|
||||||
|
|
||||||
@Delete("<script> "+
|
@Delete("<script> "+
|
||||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId}" +
|
"DELETE from wvp_common_channel_platform WHERE platform_id=#{platformId}" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int cleanChannelForGB(String platformId);
|
int cleanChannelForGB(String platformId);
|
||||||
|
|
||||||
@Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}")
|
@Select("SELECT dc.* from wvp_common_channel_platform pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}")
|
||||||
List<DeviceChannel> queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
List<DeviceChannel> queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
||||||
|
|
||||||
@Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
|
@Select("SELECT dc.* from wvp_common_channel_platform pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
|
||||||
List<DeviceChannel> queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
|
List<DeviceChannel> queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
|
||||||
|
|
||||||
@Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " +
|
@Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " +
|
||||||
" from wvp_device_channel dc left join wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id " +
|
" from wvp_device_channel dc left join wvp_common_channel_platform pgc on dc.id = pgc.device_channel_id " +
|
||||||
" where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
|
" where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
|
||||||
List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
|
List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
|
||||||
|
|
||||||
@Select("select d.*\n" +
|
@Select("select d.*\n" +
|
||||||
"from wvp_platform_gb_channel pgc\n" +
|
"from wvp_common_channel_platform pgc\n" +
|
||||||
" left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
|
" left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
|
||||||
" left join wvp_device d on dc.device_id = d.device_id\n" +
|
" left join wvp_device d on dc.device_id = d.device_id\n" +
|
||||||
"where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
|
"where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
|
||||||
List<Device> queryVideoDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
List<Device> queryVideoDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
||||||
|
|
||||||
@Delete("<script> "+
|
@Delete("<script> "+
|
||||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{id}" +
|
"DELETE from wvp_common_channel_platform WHERE platform_id=#{platformId} and catalog_id=#{id}" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int delByCatalogId(@Param("platformId") String platformId, @Param("id") String id);
|
int delByCatalogId(@Param("platformId") String platformId, @Param("id") String id);
|
||||||
|
|
||||||
@Delete("<script> "+
|
@Delete("<script> "+
|
||||||
"DELETE from wvp_platform_gb_channel WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" +
|
"DELETE from wvp_common_channel_platform WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog);
|
int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public interface PlatformChannelMapper {
|
||||||
"pp.* " +
|
"pp.* " +
|
||||||
"FROM " +
|
"FROM " +
|
||||||
"wvp_platform pp " +
|
"wvp_platform pp " +
|
||||||
"left join wvp_platform_gb_channel pgc on " +
|
"left join wvp_common_channel_platform pgc on " +
|
||||||
"pp.server_gb_id = pgc.platform_id " +
|
"pp.server_gb_id = pgc.platform_id " +
|
||||||
"left join wvp_device_channel dc on " +
|
"left join wvp_device_channel dc on " +
|
||||||
"dc.id = pgc.device_channel_id " +
|
"dc.id = pgc.device_channel_id " +
|
||||||
|
@ -100,22 +100,28 @@ public interface PlatformChannelMapper {
|
||||||
List<ParentPlatform> queryPlatFormListForGBWithGBId(@Param("channelId") String channelId, @Param("platforms") List<String> platforms);
|
List<ParentPlatform> queryPlatFormListForGBWithGBId(@Param("channelId") String channelId, @Param("platforms") List<String> platforms);
|
||||||
|
|
||||||
@Delete("<script> " +
|
@Delete("<script> " +
|
||||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{serverGBId}" +
|
"DELETE from wvp_common_channel_platform WHERE platform_id=#{serverGBId}" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void delByPlatformId(String serverGBId);
|
void delByPlatformId(String serverGBId);
|
||||||
|
|
||||||
@Delete("<script> " +
|
@Delete("<script> " +
|
||||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{catalogId}" +
|
"DELETE from wvp_common_channel_platform WHERE platform_id=#{platformId} and catalog_id=#{catalogId}" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int delChannelForGBByCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
|
int delChannelForGBByCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
|
||||||
|
|
||||||
@Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" +
|
@Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" +
|
||||||
"from wvp_platform_gb_channel pgc\n" +
|
"from wvp_common_channel_platform pgc\n" +
|
||||||
" left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
|
" left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
|
||||||
" left join wvp_device d on dc.device_id = d.device_id\n" +
|
" left join wvp_device d on dc.device_id = d.device_id\n" +
|
||||||
"where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
|
"where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
|
||||||
List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
||||||
|
|
||||||
@Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id='${channelId}'")
|
@Select("SELECT pgc.platform_id from wvp_common_channel_platform pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id='${channelId}'")
|
||||||
List<String> queryParentPlatformByChannelId(String channelId);
|
List<String> queryParentPlatformByChannelId(String channelId);
|
||||||
|
|
||||||
|
@Select("<script> "+
|
||||||
|
"select common_gb_channel_id from wvp_common_channel_platform WHERE platform_id=#{platformId} AND common_gb_channel_id in" +
|
||||||
|
"<foreach collection='channelIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||||
|
"</script>")
|
||||||
|
List<Integer> findChannelsInDb(@Param("platformId") Integer platformId, @Param("channelIds") List<Integer> channelIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,6 @@ public class PlatformController {
|
||||||
throw new ControllerException(ErrorCode.ERROR400.getCode(), "error severPort");
|
throw new ControllerException(ErrorCode.ERROR400.getCode(), "error severPort");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
|
ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
|
||||||
if (parentPlatformOld != null) {
|
if (parentPlatformOld != null) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台 " + parentPlatform.getServerGBId() + " 已存在");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台 " + parentPlatform.getServerGBId() + " 已存在");
|
||||||
|
@ -283,73 +282,28 @@ public class PlatformController {
|
||||||
return parentPlatform != null;
|
return parentPlatform != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询级联平台的所有所有通道
|
|
||||||
*
|
|
||||||
* @param page 当前页
|
|
||||||
* @param count 每页条数
|
|
||||||
* @param platformId 上级平台ID
|
|
||||||
* @param query 查询内容
|
|
||||||
* @param online 是否在线
|
|
||||||
* @param channelType 通道类型
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Operation(summary = "查询上级平台是否存在")
|
|
||||||
@Parameter(name = "page", description = "当前页", required = true)
|
|
||||||
@Parameter(name = "count", description = "每页条数", required = true)
|
|
||||||
@Parameter(name = "platformId", description = "上级平台的国标编号")
|
|
||||||
@Parameter(name = "catalogId", description = "目录ID")
|
|
||||||
@Parameter(name = "query", description = "查询内容")
|
|
||||||
@Parameter(name = "online", description = "是否在线")
|
|
||||||
@Parameter(name = "channelType", description = "通道类型")
|
|
||||||
@GetMapping("/channel_list")
|
|
||||||
@ResponseBody
|
|
||||||
public PageInfo<ChannelReduce> channelList(int page, int count,
|
|
||||||
@RequestParam(required = false) String platformId,
|
|
||||||
@RequestParam(required = false) String catalogId,
|
|
||||||
@RequestParam(required = false) String query,
|
|
||||||
@RequestParam(required = false) Boolean online,
|
|
||||||
@RequestParam(required = false) Boolean channelType) {
|
|
||||||
|
|
||||||
if (ObjectUtils.isEmpty(platformId)) {
|
|
||||||
platformId = null;
|
|
||||||
}
|
|
||||||
if (ObjectUtils.isEmpty(query)) {
|
|
||||||
query = null;
|
|
||||||
}
|
|
||||||
if (ObjectUtils.isEmpty(platformId) || ObjectUtils.isEmpty(catalogId)) {
|
|
||||||
catalogId = null;
|
|
||||||
}
|
|
||||||
PageInfo<ChannelReduce> channelReduces = storager.queryAllChannelList(page, count, query, online, channelType, platformId, catalogId);
|
|
||||||
|
|
||||||
return channelReduces;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向上级平台添加国标通道
|
* 向上级平台添加国标通道
|
||||||
*
|
|
||||||
* @param param 通道关联参数
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "向上级平台添加国标通道")
|
@Operation(summary = "向上级平台添加国标通道")
|
||||||
@PostMapping("/update_channel_for_gb")
|
@PostMapping("/channel/add")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public void updateChannelForGB(@RequestBody UpdateChannelParam param) {
|
public void addChannelForGB(@RequestBody UpdateChannelParam param) {
|
||||||
|
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("给上级平台添加国标通道API调用");
|
logger.debug("给上级平台添加国标通道API调用");
|
||||||
}
|
}
|
||||||
int result = 0;
|
ParentPlatform platform = platformService.queryPlatformByServerGBId(param.getPlatformId());
|
||||||
if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
|
if (platform == null) {
|
||||||
if (param.isAll()) {
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台不存在");
|
||||||
logger.info("[国标级联]添加所有通道到上级平台, {}", param.getPlatformId());
|
|
||||||
List<ChannelReduce> allChannelForDevice = deviceChannelService.queryAllChannelList(param.getPlatformId());
|
|
||||||
result = platformChannelService.updateChannelForGB(param.getPlatformId(), allChannelForDevice, param.getCatalogId());
|
|
||||||
}
|
}
|
||||||
}else {
|
if (platform.isShareAllChannel()) {
|
||||||
result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId());
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "已开启共享所有通道,不需要添加了");
|
||||||
}
|
}
|
||||||
if (result <= 0) {
|
if (param.getCommonGbChannelIds() == null || param.getCommonGbChannelIds().isEmpty()) {
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
|
}
|
||||||
|
if (platformChannelService.addChannelForGB(platform,param.getCommonGbChannelIds()) <= 0) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,23 +315,24 @@ public class PlatformController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "从上级平台移除国标通道")
|
@Operation(summary = "从上级平台移除国标通道")
|
||||||
@DeleteMapping("/del_channel_for_gb")
|
@DeleteMapping("/channel/delete")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public void delChannelForGB(@RequestBody UpdateChannelParam param) {
|
public void delChannelForGB(@RequestBody UpdateChannelParam param) {
|
||||||
|
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("给上级平台删除国标通道API调用");
|
logger.debug("给上级平台删除国标通道API调用");
|
||||||
}
|
}
|
||||||
int result = 0;
|
ParentPlatform platform = platformService.queryPlatformByServerGBId(param.getPlatformId());
|
||||||
if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
|
if (platform == null) {
|
||||||
if (param.isAll()) {
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台不存在");
|
||||||
logger.info("[国标级联]移除所有通道,上级平台, {}", param.getPlatformId());
|
|
||||||
result = platformChannelService.delAllChannelForGB(param.getPlatformId(), param.getCatalogId());
|
|
||||||
}
|
}
|
||||||
}else {
|
if (platform.isShareAllChannel()) {
|
||||||
result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces());
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "已开启共享所有通道,不支持部分移除");
|
||||||
}
|
}
|
||||||
if (result <= 0) {
|
if (param.getCommonGbChannelIds() == null || param.getCommonGbChannelIds().isEmpty()) {
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
|
}
|
||||||
|
if (platformChannelService.removeChannelForGB(platform,param.getCommonGbChannelIds()) <= 0) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100);
|
throw new ControllerException(ErrorCode.ERROR100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean;
|
package com.genersoft.iot.vmp.vmanager.gb28181.platform.bean;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -14,14 +15,8 @@ public class UpdateChannelParam {
|
||||||
@Schema(description = "上级平台的国标编号")
|
@Schema(description = "上级平台的国标编号")
|
||||||
private String platformId;
|
private String platformId;
|
||||||
|
|
||||||
@Schema(description = "目录的国标编号")
|
@Schema(description = "待关联的通道ID")
|
||||||
private String catalogId;
|
private List<Integer> commonGbChannelIds;
|
||||||
|
|
||||||
@Schema(description = "处理所有通道")
|
|
||||||
private boolean all;
|
|
||||||
|
|
||||||
@Schema(description = "")
|
|
||||||
private List<ChannelReduce> channelReduces;
|
|
||||||
|
|
||||||
public String getPlatformId() {
|
public String getPlatformId() {
|
||||||
return platformId;
|
return platformId;
|
||||||
|
@ -31,27 +26,11 @@ public class UpdateChannelParam {
|
||||||
this.platformId = platformId;
|
this.platformId = platformId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ChannelReduce> getChannelReduces() {
|
public List<Integer> getCommonGbChannelIds() {
|
||||||
return channelReduces;
|
return commonGbChannelIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChannelReduces(List<ChannelReduce> channelReduces) {
|
public void setCommonGbChannelIds(List<Integer> commonGbChannelIds) {
|
||||||
this.channelReduces = channelReduces;
|
this.commonGbChannelIds = commonGbChannelIds;
|
||||||
}
|
|
||||||
|
|
||||||
public String getCatalogId() {
|
|
||||||
return catalogId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCatalogId(String catalogId) {
|
|
||||||
this.catalogId = catalogId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAll() {
|
|
||||||
return all;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAll(boolean all) {
|
|
||||||
this.all = all;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue