From 39a5c8e2cf18cab6469bc0204d2b3c4d7e9e2935 Mon Sep 17 00:00:00 2001
From: chenjialing <595168663@qq.com>
Date: 星期五, 17 六月 2022 16:01:18 +0800
Subject: [PATCH] fixed--解决ssrc默认开启失败的问题,解决信令超时设备下线的bug
---
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java | 29 ++++++++++++++++++++++++-----
1 files changed, 24 insertions(+), 5 deletions(-)
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 3e53848..4c89537 100644
--- 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
@@ -21,16 +21,22 @@
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.apache.commons.compress.utils.IOUtils;
+import org.apache.http.HttpResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.async.DeferredResult;
+import javax.servlet.http.HttpServletResponse;
import javax.sip.DialogState;
+import java.io.*;
+import java.nio.file.Files;
import java.util.*;
@Api(tags = "鍥芥爣璁惧鏌ヨ", value = "鍥芥爣璁惧鏌ヨ")
@@ -200,6 +206,11 @@
Set<String> allKeys = dynamicTask.getAllKeys();
for (String key : allKeys) {
if (key.startsWith(deviceId)) {
+ Runnable runnable = dynamicTask.get(key);
+ if (runnable instanceof ISubscribeTask) {
+ ISubscribeTask subscribeTask = (ISubscribeTask) runnable;
+ subscribeTask.stop();
+ }
dynamicTask.stop(key);
}
}
@@ -306,12 +317,7 @@
public ResponseEntity<WVPResult<String>> updateDevice(Device device){
if (device != null && device.getDeviceId() != null) {
-
-
- // TODO 鎶ヨ璁㈤槄鐩稿叧鐨勪俊鎭�
-
deviceService.updateDevice(device);
-// cmder.deviceInfoQuery(device);
}
WVPResult<String> result = new WVPResult<>();
result.setCode(0);
@@ -456,4 +462,17 @@
wvpResult.setData(dialogStateMap);
return wvpResult;
}
+
+ @GetMapping("/snap/{deviceId}/{channelId}")
+ @ApiOperation(value = "璇锋眰鎴浘", notes = "璇锋眰鎴浘")
+ public void getSnap(HttpServletResponse resp, @PathVariable String deviceId, @PathVariable String channelId) {
+
+ try {
+ final InputStream in = Files.newInputStream(new File("snap" + File.separator + deviceId + "_" + channelId + ".jpg").toPath());
+ resp.setContentType(MediaType.IMAGE_PNG_VALUE);
+ IOUtils.copy(in, resp.getOutputStream());
+ } catch (IOException e) {
+ resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
}
--
Gitblit v1.8.0