临时提交

pull/1642/head
648540858 2024-07-01 17:59:14 +08:00
parent 2c7dfa03a8
commit 324fef2908
3 changed files with 24 additions and 7 deletions

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.bean;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -202,5 +203,19 @@ public class CommonGBChannel {
@Schema(description = "关联的拉流代理Id流来源是拉流代理时有效")
private Integer streamProxyId;
public String encode(CatalogEvent event){
String content;
if (event.getType().equals(CatalogEvent.DEL)
|| event.getType().equals(CatalogEvent.DEFECT)
|| event.getType().equals(CatalogEvent.VLOST)) {
content = "<Item>\n" +
"<DeviceID>" + this.getGbDeviceId() + "</DeviceID>\n" +
"<Event>" + event + "</Event>\r\n" +
"</Item>";
}
return content;
}
}

View File

@ -230,4 +230,6 @@ public class DeviceChannel extends CommonGBChannel {
deviceChannel.setDeviceId(deviceElement.getText());
return deviceChannel;
}
}

View File

@ -223,19 +223,19 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
}
catalogXml.append("<Item>\r\n");
// 行政区划分组只需要这两项就可以
catalogXml.append("<DeviceID>" + channel.getChannelId() + "</DeviceID>\r\n");
catalogXml.append("<DeviceID>" + channel.getGbDeviceId() + "</DeviceID>\r\n");
catalogXml.append("<Name>" + channel.getName() + "</Name>\r\n");
if (channel.getChannelId().length() <= 8) {
if (channel.getGbDeviceId().length() <= 8) {
catalogXml.append("</Item>\r\n");
continue;
}else {
if (channel.getChannelId().length() != 20) {
if (channel.getGbDeviceId().length() != 20) {
catalogXml.append("</Item>\r\n");
logger.warn("[编号长度异常] {} 长度错误请使用20位长度的国标编号,当前长度:{}", channel.getChannelId(), channel.getChannelId().length());
logger.warn("[编号长度异常] {} 长度错误请使用20位长度的国标编号,当前长度:{}", channel.getGbDeviceId(), channel.getChannelId().length());
catalogXml.append("</Item>\r\n");
continue;
}
switch (Integer.parseInt(channel.getChannelId().substring(10, 13))){
switch (Integer.parseInt(channel.getGbDeviceId().substring(10, 13))){
case 200:
// catalogXml.append("<Manufacturer>三永华通</Manufacturer>\r\n");
// GitUtil gitUtil = SpringBeanFactory.getBean("gitUtil");
@ -271,8 +271,8 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
break;
default:
// 通道项
if (channel.getManufacture() != null) {
catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n");
if (channel.getManufacturer() != null) {
catalogXml.append("<Manufacturer>" + channel.getManufacturer() + "</Manufacturer>\r\n");
}else {
catalogXml.append("<Manufacturer></Manufacturer>\r\n");
}