修复缺失的设备时间

This commit is contained in:
648540858 2022-05-12 17:48:52 +08:00
parent 277c6ea039
commit 9c1bb14286
3 changed files with 4 additions and 6 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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.setOnline(1);
// 第一次上线