Commit 0781d9bc2803713d227d8a1965298dde6d96d838
1 parent
a030d00c
修复缺失的设备时间
Showing
3 changed files
with
4 additions
and
6 deletions
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 | @@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | ||
| 12 | import com.genersoft.iot.vmp.service.IDeviceService; | 12 | import com.genersoft.iot.vmp.service.IDeviceService; |
| 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 14 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 15 | +import com.genersoft.iot.vmp.utils.DateUtil; | ||
| 15 | import gov.nist.javax.sip.RequestEventExt; | 16 | import gov.nist.javax.sip.RequestEventExt; |
| 16 | import gov.nist.javax.sip.address.AddressImpl; | 17 | import gov.nist.javax.sip.address.AddressImpl; |
| 17 | import gov.nist.javax.sip.address.SipUri; | 18 | import gov.nist.javax.sip.address.SipUri; |
| @@ -176,6 +177,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen | @@ -176,6 +177,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen | ||
| 176 | // 保存到redis | 177 | // 保存到redis |
| 177 | if (registerFlag) { | 178 | if (registerFlag) { |
| 178 | logger.info("[{}] 注册成功! deviceId:" + deviceId, requestAddress); | 179 | logger.info("[{}] 注册成功! deviceId:" + deviceId, requestAddress); |
| 180 | + device.setRegisterTime(DateUtil.getNow()); | ||
| 179 | deviceService.online(device); | 181 | deviceService.online(device); |
| 180 | } else { | 182 | } else { |
| 181 | logger.info("[{}] 注销成功! deviceId:" + deviceId, requestAddress); | 183 | logger.info("[{}] 注销成功! deviceId:" + deviceId, requestAddress); |
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 | @@ -72,6 +72,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp | ||
| 72 | device.setPort(rPort); | 72 | device.setPort(rPort); |
| 73 | device.setHostAddress(received.concat(":").concat(String.valueOf(rPort))); | 73 | device.setHostAddress(received.concat(":").concat(String.valueOf(rPort))); |
| 74 | } | 74 | } |
| 75 | + device.setKeepaliveTime(DateUtil.getNow()); | ||
| 75 | deviceService.online(device); | 76 | deviceService.online(device); |
| 76 | // 回复200 OK | 77 | // 回复200 OK |
| 77 | responseAck(evt, Response.OK); | 78 | responseAck(evt, Response.OK); |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| @@ -76,12 +76,7 @@ public class DeviceServiceImpl implements IDeviceService { | @@ -76,12 +76,7 @@ public class DeviceServiceImpl implements IDeviceService { | ||
| 76 | redisCatchStorage.clearCatchByDeviceId(device.getDeviceId()); | 76 | redisCatchStorage.clearCatchByDeviceId(device.getDeviceId()); |
| 77 | 77 | ||
| 78 | } | 78 | } |
| 79 | - if (device.getRegisterTime() == null) { | ||
| 80 | - device.setRegisterTime(now); | ||
| 81 | - } | ||
| 82 | - if(device.getUpdateTime() == null) { | ||
| 83 | - device.setUpdateTime(now); | ||
| 84 | - } | 79 | + device.setUpdateTime(now); |
| 85 | device.setOnline(1); | 80 | device.setOnline(1); |
| 86 | 81 | ||
| 87 | // 第一次上线 | 82 | // 第一次上线 |