Browse Source

修复缺失的设备时间

pull/458/merge
648540858 3 years ago
parent
commit
0781d9bc28
  1. 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
  2. 1
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java
  3. 7
      src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java

2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java

@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP
import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import gov.nist.javax.sip.RequestEventExt;
import gov.nist.javax.sip.address.AddressImpl;
import gov.nist.javax.sip.address.SipUri;
@ -176,6 +177,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
// 保存到redis
if (registerFlag) {
logger.info("[{}] 注册成功! deviceId:" + deviceId, requestAddress);
device.setRegisterTime(DateUtil.getNow());
deviceService.online(device);
} else {
logger.info("[{}] 注销成功! deviceId:" + deviceId, requestAddress);

1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java

@ -72,6 +72,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
device.setPort(rPort);
device.setHostAddress(received.concat(":").concat(String.valueOf(rPort)));
}
device.setKeepaliveTime(DateUtil.getNow());
deviceService.online(device);
// 回复200 OK
responseAck(evt, Response.OK);

7
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java

@ -76,12 +76,7 @@ public class DeviceServiceImpl implements IDeviceService {
redisCatchStorage.clearCatchByDeviceId(device.getDeviceId());
}
if (device.getRegisterTime() == null) {
device.setRegisterTime(now);
}
if(device.getUpdateTime() == null) {
device.setUpdateTime(now);
}
device.setUpdateTime(now);
device.setOnline(1);
// 第一次上线

Loading…
Cancel
Save