mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-23 21:47:49 +08:00
Compare commits
3 Commits
2bdced8b9c
...
83057d81d8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83057d81d8 | ||
|
|
7dea67b472 | ||
|
|
7f2db96ac1 |
5
pom.xml
5
pom.xml
@ -406,6 +406,11 @@
|
||||
<version>1.18.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
||||
@ -219,4 +219,11 @@ public class UserSetting {
|
||||
*/
|
||||
private boolean useAliasForGroupSync = false;
|
||||
|
||||
/**
|
||||
* 对于识别为设备的国标设备的,是否默认开启位置订阅
|
||||
*/
|
||||
private boolean subscribeMobilePosition = false;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -150,6 +150,15 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
|
||||
// 重置 cseq 计数
|
||||
redisCatchStorage.resetAllCSEQ();
|
||||
// 处理设备状态
|
||||
dbStatusCheck();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据库状态检查, 每6小时检查一次
|
||||
*/
|
||||
@Scheduled(fixedDelay = 6, initialDelay = 6, timeUnit = TimeUnit.HOURS)
|
||||
public void dbStatusCheck(){
|
||||
// 处理设备状态
|
||||
Set<String> allDeviceIds = deviceStatusManager.getAll();
|
||||
if (!allDeviceIds.isEmpty()) {
|
||||
@ -210,6 +219,7 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void offlineByIds(List<Device> offlineDevices) {
|
||||
@ -318,6 +328,14 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
log.error("[命令发送失败] 查询设备信息: {}", e.getMessage());
|
||||
}
|
||||
// 上线添加订阅
|
||||
if (userSetting.isSubscribeMobilePosition() && isDevice(device.getDeviceId())) {
|
||||
// 开启订阅
|
||||
device.setSubscribeCycleForMobilePosition(60);
|
||||
device.setMobilePositionSubmissionInterval(5);
|
||||
addMobilePositionSubscribe(device, null);
|
||||
}
|
||||
|
||||
sync(device);
|
||||
}else {
|
||||
device.setServerId(userSetting.getServerId());
|
||||
@ -346,6 +364,13 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
}
|
||||
if (device.getSubscribeCycleForMobilePosition() > 0 && !subscribeTaskRunner.containsKey(SubscribeTaskForMobilPosition.getKey(device))) {
|
||||
addMobilePositionSubscribe(device, null);
|
||||
}else{
|
||||
if (userSetting.isSubscribeMobilePosition() && isDevice(device.getDeviceId())) {
|
||||
// 开启订阅
|
||||
device.setSubscribeCycleForMobilePosition(60);
|
||||
device.setMobilePositionSubmissionInterval(5);
|
||||
addMobilePositionSubscribe(device, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (userSetting.getDeviceStatusNotify()) {
|
||||
@ -361,6 +386,7 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
sync(device);
|
||||
}
|
||||
}
|
||||
|
||||
// 设备状态任务添加
|
||||
long expiresTime = Math.min(device.getExpires(), device.getHeartBeatInterval() * device.getHeartBeatCount()) * 1000L;
|
||||
deviceStatusManager.add(device.getDeviceId(), expiresTime + System.currentTimeMillis());
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.genersoft.iot.vmp.gb28181.task.deviceStatus;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -13,7 +12,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.lang.Thread;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ -56,7 +54,6 @@ public class DeviceStatusManager {
|
||||
// 发送 Spring 异步事件
|
||||
eventPublisher.deviceOfflineEventPublish(expiredIds);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +159,7 @@ public class NotifyRequestForMobilePositionProcessor extends SIPRequestProcessor
|
||||
continue;
|
||||
}
|
||||
|
||||
log.info("[收到移动位置订阅通知]:{}/{}->{}.{}, 时间: {}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(),
|
||||
log.info("[收到移动位置订阅通知]:{}/{}->{}.{}, 时间: {}", mobilePosition.getDeviceId(), mobilePosition.getChannelDeviceId(),
|
||||
mobilePosition.getLongitude(), mobilePosition.getLatitude(), System.currentTimeMillis() - startTime);
|
||||
mobilePosition.setReportSource("Mobile Position");
|
||||
|
||||
|
||||
@ -69,6 +69,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||
log.error("[命令发送失败] 心跳回复: {}", e.getMessage());
|
||||
}
|
||||
taskQueue.add(device);
|
||||
SIPRequest request = (SIPRequest) evt.getRequest();
|
||||
|
||||
RemoteAddressInfo remoteAddressInfo = SipUtils.getRemoteAddressFromRequest(request, userSetting.getSipUseSourceIpAsRemoteAddress());
|
||||
@ -80,7 +81,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||
device.setLocalIp(request.getLocalAddress().getHostAddress());
|
||||
}
|
||||
device.setKeepaliveTimeStamp(System.currentTimeMillis());
|
||||
taskQueue.add(device);
|
||||
|
||||
if (device.isOnLine()) {
|
||||
long expiresTime = Math.min(device.getExpires(), device.getHeartBeatInterval() * device.getHeartBeatCount()) * 1000L;
|
||||
deviceStatusManager.add(device.getDeviceId(), expiresTime + System.currentTimeMillis());
|
||||
|
||||
@ -174,7 +174,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
||||
} else {
|
||||
catalogDataCatch.setChannelSyncEnd(deviceId, finalSn, null);
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,7 +467,7 @@ export default {
|
||||
})
|
||||
},
|
||||
getKeepaliveTimeStatistics: function(deviceId) {
|
||||
this.$refs.timeStatistics.openDialog('心跳时间统计', 'device/getKeepaliveTimeStatistics', deviceId, 10)
|
||||
this.$refs.timeStatistics.openDialog('心跳时间统计', 'device/getKeepaliveTimeStatistics', deviceId, 60)
|
||||
},
|
||||
getRegisterTimeStatistics: function(deviceId) {
|
||||
this.$refs.timeStatistics.openDialog('注册时间统计', 'device/getRegisterTimeStatistics', deviceId, 10)
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
<el-table
|
||||
v-if="viewMode === 'table'"
|
||||
:data="list"
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
size="mini"
|
||||
@ -109,6 +109,9 @@ export default {
|
||||
rows: this.list
|
||||
}
|
||||
},
|
||||
tableData() {
|
||||
return this.list.slice().reverse();
|
||||
},
|
||||
timeDiffDelta() {
|
||||
if (!this.list.length) return 0
|
||||
const nums = this.list
|
||||
|
||||
Loading…
Reference in New Issue
Block a user