catqlog查询支持回复平台信息

结构优化
648540858 2024-01-30 00:00:49 +08:00
parent 8402edaf01
commit 398e0930ae
8 changed files with 45 additions and 36 deletions

View File

@ -444,4 +444,12 @@ public class ParentPlatform {
public void setShareRegion(boolean shareRegion) {
this.shareRegion = shareRegion;
}
public boolean isSystemCatalog() {
return systemCatalog;
}
public void setSystemCatalog(boolean systemCatalog) {
this.systemCatalog = systemCatalog;
}
}

View File

@ -67,8 +67,13 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
String channelId = XmlUtil.getText(rootElement, "DeviceID");
// 远程启动功能
if (!ObjectUtils.isEmpty(XmlUtil.getText(rootElement, "TeleBoot"))) {
// TODO 拒绝远程启动命令
logger.warn("[国标级联]收到平台的远程启动命令, 不处理");
try {
responseAck(request, Response.OK);
} catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[命令发送失败] 错误信息: {}", e.getMessage());
}
return;
}
DeviceControlType deviceControlType = DeviceControlType.typeOf(rootElement);
logger.info("[接受deviceControl命令] 命令: {}", deviceControlType);

View File

@ -1,18 +1,13 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd;
import com.genersoft.iot.vmp.common.CommonGbChannel;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler;
import com.genersoft.iot.vmp.service.IPlatformChannelService;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import gov.nist.javax.sip.message.SIPRequest;
import org.dom4j.Element;
import org.slf4j.Logger;
@ -27,7 +22,6 @@ import javax.sip.SipException;
import javax.sip.header.FromHeader;
import javax.sip.message.Response;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
@Component
@ -39,21 +33,12 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
@Autowired
private QueryMessageHandler queryMessageHandler;
@Autowired
private IVideoManagerStorage storager;
@Autowired
private ISIPCommanderForPlatform cmderFroPlatform;
@Autowired
private IPlatformChannelService platformChannelService;
@Autowired
private EventPublisher publisher;
@Autowired
private IVideoManagerStorage storage;
@Override
public void afterPropertiesSet() throws Exception {
queryMessageHandler.addHandler(cmdType, this);
@ -78,7 +63,6 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
String sn = snElement.getText();
// 准备回复通道信息
List<CommonGbChannel> commonGbChannelList = platformChannelService.queryChannelList(parentPlatform);
try {
if (!commonGbChannelList.isEmpty()) {
cmderFroPlatform.catalogQuery(commonGbChannelList, parentPlatform, sn, fromHeader.getTag());
@ -89,22 +73,5 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
} catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[命令发送失败] 国标级联 目录查询回复: {}", e.getMessage());
}
}
private DeviceChannel getChannelForPlatform(ParentPlatform platform) {
DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setChannelId(platform.getDeviceGBId());
deviceChannel.setName(platform.getName());
deviceChannel.setManufacture("wvp-pro");
deviceChannel.setOwner("wvp-pro");
deviceChannel.setAddress("wvp-pro");
deviceChannel.setRegisterWay(0);
deviceChannel.setSecrecy("0");
return deviceChannel;
}
}

View File

@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.service.impl;
import com.genersoft.iot.vmp.common.BatchLimit;
import com.genersoft.iot.vmp.common.CommonGbChannel;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.gb28181.bean.*;
@ -55,6 +56,9 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
@Autowired
EventPublisher eventPublisher;
@Autowired
private SipConfig sipConfig;
@Override
@Transactional
public int addChannelForGB(ParentPlatform platform, List<Integer> commonGbChannelIds) {
@ -137,6 +141,9 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
@Override
public List<CommonGbChannel> queryChannelList(ParentPlatform platform) {
List<CommonGbChannel> result = new ArrayList<>();
if (platform.isSystemCatalog()) {
result.add(0, getChannelForPlatform(platform));
}
if (platform.isShareAllChannel()) {
// 获取所有地区
List<CommonGbChannel> allRegionList = regionMapper.queryAllForCommonChannel();
@ -181,6 +188,22 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
return result;
}
private CommonGbChannel getChannelForPlatform(ParentPlatform platform) {
CommonGbChannel channel = new CommonGbChannel();
channel.setCommonGbDeviceID(platform.getDeviceGBId());
channel.setCommonGbName(platform.getName());
channel.setCommonGbManufacturer(sipConfig.getManufacturer());
channel.setCommonGbModel(sipConfig.getModel());
channel.setCommonGbOwner(sipConfig.getOwner());
channel.setCommonGbCivilCode(sipConfig.getCivilCode());
channel.setCommonGbAddress(sipConfig.getAddress());
channel.setCommonGbRegisterWay(1);
channel.setCommonGbSecrecy(0);
return channel;
}
private Map<String, Group> getAllDependenceGroup(List<CommonGbChannel> commonGbChannelList) {
Map<String, Group> result = new HashMap<>();
// 查询这些ID对应的分组信息

View File

@ -18,11 +18,11 @@ 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,"+
"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,"+
"share_all_channel,share_group,share_region,system_catalog,"+
"status,start_offline_push,catalog_group,create_time,update_time) " +
" VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " +
" #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, " +
" #{rtcp}, #{asMessageChannel}, #{autoPushChannel}, #{shareAllChannel}, #{shareGroup}, #{shareRegion}, " +
" #{rtcp}, #{asMessageChannel}, #{autoPushChannel}, #{shareAllChannel}, #{shareGroup}, #{shareRegion, #{systemCatalog}, " +
" #{status}, #{startOfflinePush}, #{catalogGroup}, #{createTime}, #{updateTime})")
int addParentPlatform(ParentPlatform parentPlatform);
@ -49,6 +49,7 @@ public interface ParentPlatformMapper {
"share_all_channel=#{shareAllChannel}, " +
"share_group=#{shareGroup}, " +
"share_region=#{shareRegion}, " +
"system_catalog=#{systemCatalog}, " +
"status=#{status}, " +
"start_offline_push=#{startOfflinePush}, " +
"catalog_group=#{catalogGroup}, " +

View File

@ -163,6 +163,9 @@ alter table wvp_platform
alter table wvp_platform
drop column catalog_id;
alter table wvp_platform
add column system_catalog bool default false;

View File

@ -195,6 +195,7 @@ create table wvp_platform (
update_time character varying(50),
as_message_channel bool default false,
auto_push_channel bool default false,
system_catalog bool default false,
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);

View File

@ -182,6 +182,7 @@ create table wvp_platform (
update_time character varying(50),
as_message_channel bool default false,
auto_push_channel bool default false,
system_catalog bool default false,
constraint uk_platform_unique_server_gb_id unique (server_gb_id)
);