重构以适配postgresql
This commit is contained in:
@@ -77,8 +77,8 @@ public class Device {
|
||||
/**
|
||||
* 在线
|
||||
*/
|
||||
@Schema(description = "是否在线,1为在线,0为离线")
|
||||
private int online;
|
||||
@Schema(description = "是否在线,true为在线,false为离线")
|
||||
private boolean online;
|
||||
|
||||
|
||||
/**
|
||||
@@ -140,7 +140,7 @@ public class Device {
|
||||
/**
|
||||
* 目录订阅周期,0为不订阅
|
||||
*/
|
||||
@Schema(description = "目录订阅周期,0为不订阅")
|
||||
@Schema(description = "目录订阅周期,o为不订阅")
|
||||
private int subscribeCycleForCatalog;
|
||||
|
||||
/**
|
||||
@@ -286,11 +286,11 @@ public class Device {
|
||||
this.hostAddress = hostAddress;
|
||||
}
|
||||
|
||||
public int getOnline() {
|
||||
public boolean isOnline() {
|
||||
return online;
|
||||
}
|
||||
|
||||
public void setOnline(int online) {
|
||||
public void setOnline(boolean online) {
|
||||
this.online = online;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
public class GbStream extends PlatformGbStream{
|
||||
|
||||
@Schema(description = "ID")
|
||||
private Integer gbStreamId;
|
||||
private int gbStreamId;
|
||||
@Schema(description = "应用名")
|
||||
private String app;
|
||||
@Schema(description = "流ID")
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
public class PlatformGbStream {
|
||||
|
||||
@Schema(description = "ID")
|
||||
private Integer gbStreamId;
|
||||
private int gbStreamId;
|
||||
|
||||
@Schema(description = "平台ID")
|
||||
private String platformId;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
||||
String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
|
||||
|
||||
Device device = redisCatchStorage.getDevice(deviceId);
|
||||
if (device == null || device.getOnline() == 0) {
|
||||
if (device == null || !device.isOnline()) {
|
||||
logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" ));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader);
|
||||
|
||||
Device device = redisCatchStorage.getDevice(deviceId);
|
||||
if (device == null || device.getOnline() == 0) {
|
||||
if (device == null || !device.isOnline()) {
|
||||
logger.warn("[收到目录订阅]:{}, 但是设备已经离线", (device != null ? device.getDeviceId():"" ));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
||||
device.setGeoCoordSys("WGS84");
|
||||
device.setTreeType("CivilCode");
|
||||
device.setDeviceId(deviceId);
|
||||
device.setOnline(0);
|
||||
device.setOnline(false);
|
||||
}
|
||||
device.setIp(remoteAddressInfo.getIp());
|
||||
device.setPort(remoteAddressInfo.getPort());
|
||||
|
||||
@@ -83,12 +83,12 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||
|
||||
device.setKeepaliveTime(DateUtil.getNow());
|
||||
|
||||
if (device.getOnline() == 1) {
|
||||
if (device.isOnline()) {
|
||||
deviceService.updateDevice(device);
|
||||
}else {
|
||||
// 对于已经离线的设备判断他的注册是否已经过期
|
||||
if (!deviceService.expire(device)){
|
||||
device.setOnline(0);
|
||||
device.setOnline(false);
|
||||
deviceService.online(device, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
|
||||
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||
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.response.ResponseMessageHandler;
|
||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.Element;
|
||||
@@ -59,7 +54,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent
|
||||
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
|
||||
logger.debug("接收到DeviceInfo应答消息");
|
||||
// 检查设备是否存在, 不存在则不回复
|
||||
if (device == null || device.getOnline() == 0) {
|
||||
if (device == null || !device.isOnline()) {
|
||||
logger.warn("[接收到DeviceInfo应答消息,但是设备已经离线]:" + (device != null ? device.getDeviceId():"" ));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user