优化部分sql实现

This commit is contained in:
648540858
2023-05-15 15:29:39 +08:00
parent d849352441
commit 5d40080468
26 changed files with 191 additions and 115 deletions

View File

@@ -172,7 +172,7 @@ public class DeviceChannel {
* 遇到过NVR下的IPC下发信令可以推流 但是 Status 响应 OFF
*/
@Schema(description = "在线/离线, 1在线,0离线")
private int status;
private boolean status;
/**
* 经度
@@ -455,11 +455,11 @@ public class DeviceChannel {
this.PTZTypeText = PTZTypeText;
}
public int getStatus() {
public boolean isStatus() {
return status;
}
public void setStatus(int status) {
public void setStatus(boolean status) {
this.status = status;
}

View File

@@ -66,7 +66,7 @@ public interface ISIPCommanderForPlatform {
* @param fromTag
* @return
*/
void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,int status) throws SipException, InvalidArgumentException, ParseException;
void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,boolean status) throws SipException, InvalidArgumentException, ParseException;
/**
* 向上级回复移动位置订阅消息

View File

@@ -221,7 +221,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
if (!channel.getChannelId().equals(parentPlatform.getDeviceGBId())) {
catalogXml.append("<Parental>" + channel.getParental() + "</Parental>\r\n");
if (channel.getParental() == 0) {
catalogXml.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n");
catalogXml.append("<Status>" + (channel.isStatus() ? "ON" : "OFF") + "</Status>\r\n");
}
}
if (channel.getParental() == 0) {
@@ -250,7 +250,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
catalogXml.append("<Port>" + channel.getPort() + "</Port>\r\n");
catalogXml.append("<Password>" + channel.getPort() + "</Password>\r\n");
catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n");
catalogXml.append("<Status>" + (channel.getStatus() == 1?"ON":"OFF") + "</Status>\r\n");
catalogXml.append("<Status>" + (channel.isStatus() ? "ON":"OFF") + "</Status>\r\n");
catalogXml.append("<Longitude>" +
(channel.getLongitudeWgs84() != 0? channel.getLongitudeWgs84():channel.getLongitude())
+ "</Longitude>\r\n");
@@ -377,11 +377,11 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
* @return
*/
@Override
public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,int status) throws SipException, InvalidArgumentException, ParseException {
public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,boolean status) throws SipException, InvalidArgumentException, ParseException {
if (parentPlatform == null) {
return ;
}
String statusStr = (status==1)?"ONLINE":"OFFLINE";
String statusStr = (status)?"ONLINE":"OFFLINE";
String characterSet = parentPlatform.getCharacterSet();
StringBuffer deviceStatusXml = new StringBuffer(600);
deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n")
@@ -542,7 +542,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n")
.append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n")
.append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n")
.append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n");
.append("<Status>" + (channel.isStatus() ? "ON" : "OFF") + "</Status>\r\n");
if (channel.getChannelType() != 2) { // 业务分组/虚拟组织/行政区划 不设置以下属性
catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n")

View File

@@ -77,7 +77,7 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i
return;
}
try {
cmderFroPlatform.deviceStatusResponse(parentPlatform,channelId, sn, fromHeader.getTag(),deviceChannel.getStatus());
cmderFroPlatform.deviceStatusResponse(parentPlatform,channelId, sn, fromHeader.getTag(),deviceChannel.isStatus());
} catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[命令发送失败] 国标级联 DeviceStatus查询回复: {}", e.getMessage());
}

View File

@@ -255,7 +255,7 @@ public class XmlUtil {
}
if (channelType.equals(ChannelType.CivilCode)) {
// 行政区划其他字段没必要识别了,默认在线即可
deviceChannel.setStatus(1);
deviceChannel.setStatus(true);
deviceChannel.setParental(1);
deviceChannel.setCreateTime(DateUtil.getNow());
deviceChannel.setUpdateTime(DateUtil.getNow());
@@ -309,7 +309,7 @@ public class XmlUtil {
deviceChannel.setBusinessGroupId(businessGroupID);
if (channelType.equals(ChannelType.BusinessGroup) || channelType.equals(ChannelType.VirtualOrganization)) {
// 业务分组和虚拟组织 其他字段没必要识别了,默认在线即可
deviceChannel.setStatus(1);
deviceChannel.setStatus(true);
deviceChannel.setParental(1);
deviceChannel.setCreateTime(DateUtil.getNow());
deviceChannel.setUpdateTime(DateUtil.getNow());
@@ -322,13 +322,13 @@ public class XmlUtil {
String status = statusElement.getTextTrim().trim();
// ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理
if (status.equals("ON") || status.equals("On") || status.equals("ONLINE") || status.equals("OK")) {
deviceChannel.setStatus(1);
deviceChannel.setStatus(true);
}
if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) {
deviceChannel.setStatus(0);
deviceChannel.setStatus(false);
}
}else {
deviceChannel.setStatus(1);
deviceChannel.setStatus(true);
}
// 识别自带的目录标识
String parental = XmlUtil.getText(itemDevice, "Parental");