From 2127cbeca3c2f2de31b7f70b2841cdb2ee259e1a Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 5 Jun 2024 22:45:13 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=94=B6=E5=88=B0?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E4=BD=8D=E7=BD=AE=E8=AE=A2=E9=98=85=E5=90=8E?= =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/gb28181/bean/SubscribeHolder.java | 9 +++-- .../MobilePositionSubscribeHandlerTask.java | 33 ------------------- 2 files changed, 7 insertions(+), 35 deletions(-) delete mode 100755 src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java index 6557bbaa5..6621276c7 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java @@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants; import com.genersoft.iot.vmp.conf.DynamicTask; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask; -import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeHandlerTask; +import com.genersoft.iot.vmp.service.IPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -24,6 +24,9 @@ public class SubscribeHolder { @Autowired private UserSetting userSetting; + @Autowired + private IPlatformService platformService; + private final String taskOverduePrefix = "subscribe_overdue_"; private static ConcurrentHashMap catalogMap = new ConcurrentHashMap<>(); @@ -62,7 +65,9 @@ public class SubscribeHolder { mobilePositionMap.put(platformId, subscribeInfo); String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "MobilePosition_" + platformId; // 添加任务处理GPS定时推送 - dynamicTask.startCron(key, new MobilePositionSubscribeHandlerTask(platformId), + dynamicTask.startCron(key, ()->{ + platformService.sendNotifyMobilePosition(platformId); + }, subscribeInfo.getGpsInterval() * 1000); String taskOverdueKey = taskOverduePrefix + "MobilePosition_" + platformId; if (subscribeInfo.getExpires() > 0) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java b/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java deleted file mode 100755 index a4512f35b..000000000 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.genersoft.iot.vmp.gb28181.task.impl; - -import com.genersoft.iot.vmp.common.CommonCallback; -import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask; -import com.genersoft.iot.vmp.service.IPlatformService; -import com.genersoft.iot.vmp.utils.SpringBeanFactory; - -/** - * 向已经订阅(移动位置)的上级发送MobilePosition消息 - * @author lin - */ -public class MobilePositionSubscribeHandlerTask implements ISubscribeTask { - - - private IPlatformService platformService; - private String platformId; - - - public MobilePositionSubscribeHandlerTask(String platformId) { - this.platformService = SpringBeanFactory.getBean("platformServiceImpl"); - this.platformId = platformId; - } - - @Override - public void run() { - platformService.sendNotifyMobilePosition(this.platformId); - } - - @Override - public void stop(CommonCallback callback) { - - } -} From 2226d34898b79b93b1fa9ad36dde12517f13ca15 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 6 Jun 2024 00:29:52 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E6=8C=87?= =?UTF-8?q?=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/gb28181/event/EventPublisher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java index 299d59ac5..b87684a87 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java @@ -79,7 +79,7 @@ public class EventPublisher { // 数据去重 Set gbIdSet = new HashSet<>(); for (DeviceChannel deviceChannel : deviceChannels) { - if (!gbIdSet.contains(deviceChannel.getChannelId())) { + if (deviceChannel != null && deviceChannel.getChannelId() != null && !gbIdSet.contains(deviceChannel.getChannelId())) { gbIdSet.add(deviceChannel.getChannelId()); channels.add(deviceChannel); } From 619a86e0ed6cdda88e2458b9ec4302d202d2215f Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 6 Jun 2024 19:59:48 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java | 9 ++------- .../event/request/impl/SubscribeRequestProcessor.java | 4 +++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java index 6621276c7..8c00c49ce 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java @@ -24,9 +24,6 @@ public class SubscribeHolder { @Autowired private UserSetting userSetting; - @Autowired - private IPlatformService platformService; - private final String taskOverduePrefix = "subscribe_overdue_"; private static ConcurrentHashMap catalogMap = new ConcurrentHashMap<>(); @@ -61,13 +58,11 @@ public class SubscribeHolder { dynamicTask.stop(taskOverdueKey); } - public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo) { + public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo, Runnable gpsTask) { mobilePositionMap.put(platformId, subscribeInfo); String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "MobilePosition_" + platformId; // 添加任务处理GPS定时推送 - dynamicTask.startCron(key, ()->{ - platformService.sendNotifyMobilePosition(platformId); - }, + dynamicTask.startCron(key, gpsTask, subscribeInfo.getGpsInterval() * 1000); String taskOverdueKey = taskOverduePrefix + "MobilePosition_" + platformId; if (subscribeInfo.getExpires() > 0) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java index 1580bafbf..c392a129d 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java @@ -147,7 +147,9 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme subscribeHolder.removeMobilePositionSubscribe(platformId); }else { subscribeInfo.setResponse(response); - subscribeHolder.putMobilePositionSubscribe(platformId, subscribeInfo); + subscribeHolder.putMobilePositionSubscribe(platformId, subscribeInfo, ()->{ + platformService.sendNotifyMobilePosition(platformId); + }); } } catch (SipException | InvalidArgumentException | ParseException e) { From 208e03482281f2b901d507b1f890aa01ea6f8456 Mon Sep 17 00:00:00 2001 From: wangxinlong Date: Fri, 7 Jun 2024 18:13:45 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=BD=95=E5=83=8F=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=9C=AA=E6=AD=A3=E5=B8=B8=E9=87=8A=E6=94=BE?= =?UTF-8?q?ssrc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index 43b4d66c4..bc85ecf94 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -1003,6 +1003,7 @@ public class PlayServiceImpl implements IPlayService { dynamicTask.stop(downLoadTimeOutTaskKey); callback.run(InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode(), String.format("录像下载失败, 错误码: %s, %s", event.statusCode, event.msg), null); + mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); inviteStreamService.removeInviteInfo(inviteInfo); }; From f8ef14bfea43abd8716aab15f5e302e7c1f23f79 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Tue, 11 Jun 2024 10:08:13 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E4=BD=8D=E7=BD=AE=E8=AE=A2=E9=98=85=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5=E9=97=B4=E9=9A=94=E4=B8=BA0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/gb28181/bean/SubscribeHolder.java | 10 ++++++++-- .../vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 7 ++----- .../iot/vmp/vmanager/gb28181/device/DeviceQuery.java | 3 +++ web_src/src/components/dialog/deviceEdit.vue | 3 +++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java index 8c00c49ce..a15de224a 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java @@ -4,7 +4,6 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants; import com.genersoft.iot.vmp.conf.DynamicTask; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask; -import com.genersoft.iot.vmp.service.IPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -62,8 +61,15 @@ public class SubscribeHolder { mobilePositionMap.put(platformId, subscribeInfo); String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "MobilePosition_" + platformId; // 添加任务处理GPS定时推送 + + int cycleForCatalog; + if (subscribeInfo.getGpsInterval() <= 0) { + cycleForCatalog = 5; + }else { + cycleForCatalog = subscribeInfo.getGpsInterval(); + } dynamicTask.startCron(key, gpsTask, - subscribeInfo.getGpsInterval() * 1000); + cycleForCatalog * 1000); String taskOverdueKey = taskOverduePrefix + "MobilePosition_" + platformId; if (subscribeInfo.getExpires() > 0) { // 添加任务处理订阅过期 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index 723c715fa..c66eb0dd4 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -7,10 +7,6 @@ import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; import com.genersoft.iot.vmp.gb28181.SipLayer; import com.genersoft.iot.vmp.gb28181.bean.*; -import com.genersoft.iot.vmp.gb28181.bean.Device; -import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; -import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; import com.genersoft.iot.vmp.gb28181.transmit.SIPSender; @@ -44,7 +40,6 @@ import javax.sip.SipFactory; import javax.sip.header.CallIdHeader; import javax.sip.message.Request; import java.text.ParseException; -import java.util.ArrayList; import java.util.List; /** @@ -1249,6 +1244,8 @@ public class SIPCommander implements ISIPCommander { subscribePostitionXml.append("" + device.getDeviceId() + "\r\n"); if (device.getSubscribeCycleForMobilePosition() > 0) { subscribePostitionXml.append("" + device.getMobilePositionSubmissionInterval() + "\r\n"); + }else { + subscribePostitionXml.append("5\r\n"); } subscribePostitionXml.append("\r\n"); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java index 9dd4c3d89..8a2618bbd 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java @@ -322,6 +322,9 @@ public class DeviceQuery { public void updateDevice(Device device){ if (device != null && device.getDeviceId() != null) { + if (device.getSubscribeCycleForMobilePosition() > 0 && device.getMobilePositionSubmissionInterval() <= 0) { + device.setMobilePositionSubmissionInterval(5); + } deviceService.updateCustomDevice(device); } } diff --git a/web_src/src/components/dialog/deviceEdit.vue b/web_src/src/components/dialog/deviceEdit.vue index d8e0b43bb..d8092faea 100755 --- a/web_src/src/components/dialog/deviceEdit.vue +++ b/web_src/src/components/dialog/deviceEdit.vue @@ -128,6 +128,9 @@ export default { this.form.subscribeCycleForCatalog = this.form.subscribeCycleForCatalog||0 this.form.subscribeCycleForMobilePosition = this.form.subscribeCycleForMobilePosition||0 this.form.mobilePositionSubmissionInterval = this.form.mobilePositionSubmissionInterval||0 + if (this.form.mobilePositionSubmissionInterval === 0) { + this.form.mobilePositionSubmissionInterval = 5 + } this.$axios({ method: 'post', url:`/api/device/query/device/${this.isEdit?'update':'add'}/`, From b070b57259fa0cf383009e6cedf314d6320509ec Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: Tue, 11 Jun 2024 23:10:12 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=8B=89=E6=B5=81=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=8F=98=E5=8C=96=E6=97=B6=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=8E=A8=E9=80=81=E5=88=B0=E5=9B=BD=E6=A0=87=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/service/impl/StreamProxyServiceImpl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java index d3f69d676..920228dfd 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java @@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.conf.DynamicTask; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.exception.ControllerException; +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.media.bean.MediaInfo; import com.genersoft.iot.vmp.media.bean.MediaServer; @@ -531,7 +532,16 @@ public class StreamProxyServiceImpl implements IStreamProxyService { @Override public int updateStatus(boolean status, String app, String stream) { - return streamProxyMapper.updateStatus(app, stream, status); + // 状态变化时推送到国标上级 + StreamProxyItem streamProxyItem = streamProxyMapper.selectOne(app, stream); + if (streamProxyItem == null) { + return 0; + } + int result = streamProxyMapper.updateStatus(app, stream, status); + if (!ObjectUtils.isEmpty(streamProxyItem.getGbId())) { + gbStreamService.sendCatalogMsg(streamProxyItem, status?CatalogEvent.ON:CatalogEvent.OFF); + } + return result; } private void syncPullStream(String mediaServerId){ From 0ac27b03ffd13370e2beec83ce7cb394091ae889 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 12 Jun 2024 11:10:10 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E4=B8=8A=E7=BA=BF=E5=88=A4=E6=96=AD=E5=8F=8C=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=85=BC=E5=AE=B9=E5=A4=A7=E5=8D=8E=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=90=8E=E4=B8=8D=E5=86=8D=E5=8F=91=E9=80=81=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E7=9A=84=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/genersoft/iot/vmp/conf/UserSetting.java | 10 ++++++++++ .../notify/cmd/KeepaliveNotifyMessageHandler.java | 12 ++++++++---- src/main/resources/all-application.yml | 4 ++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java index 96253d6e1..cce914594 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java @@ -74,6 +74,8 @@ public class UserSetting { private boolean registerKeepIntDialog = false; + private int gbDeviceOnline = 0; + public Boolean getSavePositionHistory() { return savePositionHistory; } @@ -325,4 +327,12 @@ public class UserSetting { public void setDocEnable(Boolean docEnable) { this.docEnable = docEnable; } + + public int getGbDeviceOnline() { + return gbDeviceOnline; + } + + public void setGbDeviceOnline(int gbDeviceOnline) { + this.gbDeviceOnline = gbDeviceOnline; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java index 034e24f96..bfc42f5ad 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java @@ -62,7 +62,10 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp } SIPRequest request = (SIPRequest) evt.getRequest(); logger.info("[收到心跳] device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId()); - + if (userSetting.getGbDeviceOnline() == 0 && !device.isOnLine()) { + logger.warn("[收到心跳] 设备离线,心跳不进行回复, device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId()); + return; + } // 回复200 OK try { responseAck(request, Response.OK); @@ -101,9 +104,10 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp if (device.isOnLine()) { deviceService.updateDevice(device); }else { - // 对于已经离线的设备判断他的注册是否已经过期 - if (!deviceService.expire(device)){ - device.setOnLine(false); + if (userSetting.getGbDeviceOnline() == 1) { + // 对于已经离线的设备判断他的注册是否已经过期 + device.setOnLine(true); + device.setRegisterTime(DateUtil.getNow()); deviceService.online(device, null); } } diff --git a/src/main/resources/all-application.yml b/src/main/resources/all-application.yml index f2fd504a0..ef5b244ce 100644 --- a/src/main/resources/all-application.yml +++ b/src/main/resources/all-application.yml @@ -247,6 +247,10 @@ user-settings: allowed-origins: - http://localhost:8008 - http://192.168.1.3:8008 + # 国标设备离线后的上线策略, + # 0: 国标标准实现,设备离线后不回复心跳,知道设备重新注册上线, + # 1: 对于离线设备,收到心跳就把设备设置为上线,并更新注册时间为上次这次心跳的时间。防止过期时间判断u异常 + gb-device-online: 0 # 关闭在线文档(生产环境建议关闭) springdoc: From c1b0365b02bc8d5919ca08053eb8a961c1923418 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 12 Jun 2024 11:16:21 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E4=B8=8A=E7=BA=BF=E5=88=A4=E6=96=AD=E5=8F=8C=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=85=BC=E5=AE=B9=E5=8D=8E=E4=B8=BA=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=EF=BC=88=E5=89=8D=E4=B8=80=E6=9D=A1=E7=9A=84=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E5=A4=A7=E5=8D=8E=E6=98=AF=E9=94=99=E8=AF=AF=E7=9A=84=EF=BC=8C?= =?UTF-8?q?=E5=A4=A7=E5=8D=8E=E6=B2=A1=E6=9C=89=E8=BF=99=E4=B8=AA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=89=E6=B3=A8=E5=86=8C=E5=90=8E=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=8F=91=E9=80=81=E6=B3=A8=E5=86=8C=E7=9A=84=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/all-application.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/all-application.yml b/src/main/resources/all-application.yml index ef5b244ce..5c46d5202 100644 --- a/src/main/resources/all-application.yml +++ b/src/main/resources/all-application.yml @@ -248,8 +248,8 @@ user-settings: - http://localhost:8008 - http://192.168.1.3:8008 # 国标设备离线后的上线策略, - # 0: 国标标准实现,设备离线后不回复心跳,知道设备重新注册上线, - # 1: 对于离线设备,收到心跳就把设备设置为上线,并更新注册时间为上次这次心跳的时间。防止过期时间判断u异常 + # 0: 国标标准实现,设备离线后不回复心跳,直到设备重新注册上线, + # 1: 对于离线设备,收到心跳就把设备设置为上线,并更新注册时间为上次这次心跳的时间。防止过期时间判断异常 gb-device-online: 0 # 关闭在线文档(生产环境建议关闭)