修复国标级联转发下级UPDATE丢失catalog消息的问题
parent
c2958d1fec
commit
a15454fa1c
|
@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.genersoft.iot.vmp.service.IPlatformChannelService;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -43,6 +44,9 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
|||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
@Autowired
|
||||
private IPlatformChannelService platformChannelService;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(CatalogEvent event) {
|
||||
SubscribeInfo subscribe = null;
|
||||
|
@ -177,6 +181,13 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
|
|||
logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId);
|
||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
||||
DeviceChannel deviceChannel = channelMap.get(gbId);
|
||||
// 查询通道的关联信息
|
||||
DeviceChannel deviceChannelInDb = platformChannelService.queryChannel(platform.getServerGBId(), deviceChannel.getDeviceId(), deviceChannel.getChannelId());
|
||||
if (deviceChannelInDb != null) {
|
||||
deviceChannel.setCivilCode(deviceChannelInDb.getCivilCode());
|
||||
deviceChannel.setParentId(deviceChannelInDb.getParentId());
|
||||
deviceChannel.setBusinessGroupId(deviceChannelInDb.getBusinessGroupId());
|
||||
}
|
||||
deviceChannelList.add(deviceChannel);
|
||||
GbStream gbStream = storager.queryStreamInParentPlatform(platform.getServerGBId(), gbId);
|
||||
if(gbStream != null){
|
||||
|
|
|
@ -663,8 +663,6 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
|||
.append("<Owner> " + channel.getOwner()+ "</Owner>\r\n");
|
||||
if (channel.getCivilCode() != null) {
|
||||
catalogXml.append("<CivilCode>" + channel.getCivilCode() + "</CivilCode>\r\n");
|
||||
}else {
|
||||
catalogXml.append("<CivilCode>" + parentPlatform.getAdministrativeDivision() + "</CivilCode>\r\n");
|
||||
}
|
||||
|
||||
catalogXml.append("<Address>" + channel.getAddress() + "</Address>\r\n");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.genersoft.iot.vmp.service;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -26,4 +27,6 @@ public interface IPlatformChannelService {
|
|||
* @return
|
||||
*/
|
||||
int delAllChannelForGB(String platformId, String catalogId);
|
||||
|
||||
DeviceChannel queryChannel(String serverGBId, String deviceId, String channelId);
|
||||
}
|
||||
|
|
|
@ -172,4 +172,9 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
|||
|
||||
return platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceChannel queryChannel(String serverGBId, String deviceId, String channelId) {
|
||||
return platformChannelMapper.queryChannel(serverGBId, deviceId, channelId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -486,10 +486,10 @@ public interface DeviceChannelMapper {
|
|||
@Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}")
|
||||
List<DeviceChannel> getBusinessGroups(@Param("deviceId") String deviceId, @Param("typeCode") String typeCode);
|
||||
|
||||
@Select("select dc.id, dc.channel_id, dc.device_id, COALESCE(dc.custom_name, dc.name) AS name, dc.manufacture,dc.model,dc.owner, pc.civil_code_for_channel as civil_code,dc.block, " +
|
||||
@Select("select dc.id, dc.channel_id, dc.device_id, COALESCE(dc.custom_name, dc.name) AS name, dc.manufacture,dc.model,dc.owner, pc.civil_code_for_channel as civil_code, dc.block, " +
|
||||
" dc.address, '0' as parental,'0' as channel_type, pc.id as parent_id, dc.safety_way, dc.register_way,dc.cert_num, dc.certifiable, " +
|
||||
" dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, dc.password, dc.status, " +
|
||||
" COALESCE(dc.custom_longitude, dc.longitude) A S longitude, COALESCE(dc.custom_latitude, dc.latitude) AS latitude, pc.business_group_id " +
|
||||
" COALESCE(dc.custom_longitude, dc.longitude) AS longitude, COALESCE(dc.custom_latitude, dc.latitude) AS latitude, pc.business_group_id " +
|
||||
" from wvp_device_channel dc" +
|
||||
" LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" +
|
||||
" LEFT JOIN wvp_platform_catalog pc on pgc.catalog_id = pc.id and pgc.platform_id = pc.platform_id" +
|
||||
|
|
|
@ -27,9 +27,9 @@ public interface PlatformCatalogMapper {
|
|||
value = {" <script>" +
|
||||
"SELECT pc.*, count(pc2.id) as children_count from wvp_platform_catalog pc " +
|
||||
"left join wvp_platform_catalog pc2 on pc.id = pc2.parent_id " +
|
||||
"WHERE pc.platform_id=#{platformId} " +
|
||||
"group by pc.id, pc.name, pc.platform_id, pc.business_group_id, pc.civil_code, pc.parent_id, pc.civil_code_for_channel"
|
||||
"</script>"})
|
||||
"WHERE pc.parent_id=#{parentId} AND pc.platform_id=#{platformId} " +
|
||||
"group by pc.id, pc.name, pc.platform_id, pc.business_group_id, pc.civil_code, pc.parent_id, pc.civil_code_for_channel" +
|
||||
"</script>"})
|
||||
List<PlatformCatalog> selectByParentId(@Param("platformId") String platformId, @Param("parentId") String parentId);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
|
|
|
@ -122,4 +122,14 @@ public interface PlatformChannelMapper {
|
|||
|
||||
@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}")
|
||||
List<String> queryParentPlatformByChannelId(@Param("channelId") String channelId);
|
||||
|
||||
@Select("select dc.id, dc.channel_id, dc.device_id, COALESCE(dc.custom_name, dc.name) AS name, dc.manufacture,dc.model,dc.owner, pc.civil_code_for_channel as civil_code, dc.block, " +
|
||||
" dc.address, '0' as parental,'0' as channel_type, pc.id as parent_id, dc.safety_way, dc.register_way,dc.cert_num, dc.certifiable, " +
|
||||
" dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, dc.password, dc.status, " +
|
||||
" COALESCE(dc.custom_longitude, dc.longitude) AS longitude, COALESCE(dc.custom_latitude, dc.latitude) AS latitude, pc.business_group_id " +
|
||||
" from wvp_device_channel dc" +
|
||||
" LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" +
|
||||
" LEFT JOIN wvp_platform_catalog pc on pgc.catalog_id = pc.id and pgc.platform_id = pc.platform_id" +
|
||||
" where pgc.platform_id=#{serverGBId} and dc.device_id = #{deviceId} and dc.channel_id = #{channelId}")
|
||||
DeviceChannel queryChannel(@Param("serverGBId") String serverGBId, @Param("deviceId") String deviceId, @Param("channelId") String channelId);
|
||||
}
|
||||
|
|
|
@ -814,11 +814,8 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||
if (platform == null) {
|
||||
return 0;
|
||||
}
|
||||
if (platformCatalog.getParentId().equals(platform.getDeviceGBId())) {
|
||||
platformCatalog.setParentId(null);
|
||||
}
|
||||
if (platformCatalog.getId().length() <= 8) {
|
||||
if (platformCatalog.getParentId() != null) {
|
||||
if (platformCatalog.getParentId() != null && platformCatalog.getParentId().length() <= 8) {
|
||||
platformCatalog.setCivilCode(platformCatalog.getParentId());
|
||||
}
|
||||
platformCatalog.setCivilCodeForChannel(platformCatalog.getId());
|
||||
|
@ -1021,7 +1018,11 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||
deviceChannel.setManufacture("wvp-pro");
|
||||
deviceChannel.setStatus(true);
|
||||
deviceChannel.setParental(1);
|
||||
|
||||
if (catalog.getId().length() <= 8) {
|
||||
deviceChannel.setCivilCode(catalog.getId());
|
||||
}else {
|
||||
deviceChannel.setCivilCode(catalog.getCivilCode());
|
||||
}
|
||||
deviceChannel.setRegisterWay(1);
|
||||
deviceChannel.setParentId(catalog.getParentId());
|
||||
deviceChannel.setBusinessGroupId(catalog.getBusinessGroupId());
|
||||
|
|
|
@ -407,9 +407,6 @@ public class PlatformController {
|
|||
if (platform == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台未找到");
|
||||
}
|
||||
// if (platformId.equals(parentId)) {
|
||||
// parentId = platform.getDeviceGBId();
|
||||
// }
|
||||
|
||||
return storager.getChildrenCatalogByPlatform(platformId, parentId);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue