From ca103731c721aae3f5f622e58c679ed5c09fd9e9 Mon Sep 17 00:00:00 2001
From: Kairlec <sunfokairlec@gmail.com>
Date: 星期一, 15 五月 2023 16:26:37 +0800
Subject: [PATCH] fix response `content-type` is not set if access without access token

---
 src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
index 106caec..a0d120c 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -12,6 +12,7 @@
 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd.CatalogResponseMessageHandler;
 import com.genersoft.iot.vmp.service.IDeviceChannelService;
 import com.genersoft.iot.vmp.service.IDeviceService;
+import com.genersoft.iot.vmp.service.IInviteStreamService;
 import com.genersoft.iot.vmp.service.IMediaServerService;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
@@ -59,6 +60,9 @@
     private IRedisCatchStorage redisCatchStorage;
 
     @Autowired
+    private IInviteStreamService inviteStreamService;
+
+    @Autowired
     private DeviceMapper deviceMapper;
 
     @Autowired
@@ -97,7 +101,7 @@
         String now = DateUtil.getNow();
         if (deviceInRedis != null && deviceInDb == null) {
             // redis 瀛樺湪鑴忔暟鎹�
-            redisCatchStorage.clearCatchByDeviceId(device.getDeviceId());
+            inviteStreamService.clearInviteInfo(device.getDeviceId());
         }
         device.setUpdateTime(now);
         if (device.getKeepaliveIntervalTime() == 0) {
@@ -497,8 +501,10 @@
             node.setBasicData(channel);
             node.setParent(false);
             if (channel.getChannelId().length() > 8) {
-                String gbCodeType = channel.getChannelId().substring(10, 13);
-                node.setParent(gbCodeType.equals(ChannelIdType.BUSINESS_GROUP) || gbCodeType.equals(ChannelIdType.VIRTUAL_ORGANIZATION) );
+                if (channel.getChannelId().length() > 13) {
+                    String gbCodeType = channel.getChannelId().substring(10, 13);
+                    node.setParent(gbCodeType.equals(ChannelIdType.BUSINESS_GROUP) || gbCodeType.equals(ChannelIdType.VIRTUAL_ORGANIZATION) );
+                }
             }else {
                 node.setParent(true);
             }

--
Gitblit v1.8.0