From 74d97734bab2479f857add5e6d1ef9007f5f59ee Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 11 Jul 2022 17:34:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=E6=8E=A8?= =?UTF-8?q?=E6=B5=81=E6=92=AD=E6=94=BE=E5=9C=B0=E5=9D=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql.sql | 20 ++++---- .../streamPush/StreamPushController.java | 47 +++++++++++++++++++ web_src/src/components/PushVideoList.vue | 2 +- 3 files changed, 58 insertions(+), 11 deletions(-) diff --git a/sql/mysql.sql b/sql/mysql.sql index 77bfb532..9d2e1174 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -50,7 +50,7 @@ CREATE TABLE `device` ( `treeType` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `device_deviceId_uindex` (`deviceId`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -142,7 +142,7 @@ CREATE TABLE `device_channel` ( PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `device_channel_id_uindex` (`id`) USING BTREE, UNIQUE KEY `device_channel_pk` (`channelId`,`deviceId`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=19324 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=19331 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -179,7 +179,7 @@ CREATE TABLE `device_mobile_position` ( `latitudeWgs84` double DEFAULT NULL, `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=5649 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=6751 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -208,7 +208,6 @@ CREATE TABLE `gb_stream` ( `latitude` double DEFAULT NULL, `streamType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, `mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, - `status` int DEFAULT NULL, `createTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, `gpsTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY (`gbStreamId`) USING BTREE, @@ -244,7 +243,7 @@ CREATE TABLE `log` ( `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=29943 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=34997 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -455,7 +454,7 @@ CREATE TABLE `stream_proxy` ( `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `stream_proxy_pk` (`app`,`stream`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -487,9 +486,10 @@ CREATE TABLE `stream_push` ( `serverId` varchar(50) COLLATE utf8mb4_general_ci NOT NULL, `pushTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, `updateTime` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, + `status` int DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `stream_push_pk` (`app`,`stream`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=305304 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB AUTO_INCREMENT=305315 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -513,9 +513,9 @@ CREATE TABLE `user` ( `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `roleId` int NOT NULL, - `pushKey` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci default null, `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `pushKey` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, UNIQUE KEY `user_username_uindex` (`username`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; @@ -527,7 +527,7 @@ CREATE TABLE `user` ( LOCK TABLES `user` WRITE; /*!40000 ALTER TABLE `user` DISABLE KEYS */; -INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'453df297a57a5a7438934sda801fc3','2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57'); +INSERT INTO `user` VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021 - 04 - 13 14:14:57','2021 - 04 - 13 14:14:57','453df297a57a5a7438934sda801fc3'); /*!40000 ALTER TABLE `user` ENABLE KEYS */; UNLOCK TABLES; @@ -567,4 +567,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-07-06 9:43:54 +-- Dump completed on 2022-07-11 17:32:51 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java index cf0fed8a..300f9521 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java @@ -3,11 +3,16 @@ package com.genersoft.iot.vmp.vmanager.streamPush; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelReader; import com.alibaba.excel.read.metadata.ReadSheet; +import com.genersoft.iot.vmp.common.StreamInfo; +import com.genersoft.iot.vmp.conf.security.SecurityUtils; +import com.genersoft.iot.vmp.conf.security.dto.LoginUser; import com.genersoft.iot.vmp.gb28181.bean.GbStream; import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; +import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.service.IMediaService; import com.genersoft.iot.vmp.service.IStreamPushService; import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler; import com.genersoft.iot.vmp.vmanager.bean.BatchGBStreamParam; @@ -30,6 +35,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.async.DeferredResult; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; @@ -54,6 +60,9 @@ public class StreamPushController { @Autowired private DeferredResultHolder resultHolder; + @Autowired + private IMediaService mediaService; + @ApiOperation("推流列表查询") @ApiImplicitParams({ @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), @@ -237,5 +246,43 @@ public class StreamPushController { return result; } + /** + * 获取推流播放地址 + * @param app 应用名 + * @param stream 流id + * @return + */ + @ApiOperation("获取推流播放地址") + @ApiImplicitParams({ + @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), + @ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class), + @ApiImplicitParam(name = "mediaServerId", value = "媒体服务器id", dataTypeClass = String.class, required = false), + }) + @GetMapping(value = "/getPlayUrl") + @ResponseBody + public WVPResult getPlayUrl(HttpServletRequest request, @RequestParam String app, + @RequestParam String stream, + @RequestParam(required = false) String mediaServerId){ + boolean authority = false; + // 是否登陆用户, 登陆用户返回完整信息 + LoginUser userInfo = SecurityUtils.getUserInfo(); + if (userInfo!= null) { + authority = true; + } + + StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, authority); + + WVPResult result = new WVPResult<>(); + if (streamInfo != null){ + result.setCode(0); + result.setMsg("scccess"); + result.setData(streamInfo); + }else { + result.setCode(-1); + result.setMsg("fail"); + } + return result; + } + } diff --git a/web_src/src/components/PushVideoList.vue b/web_src/src/components/PushVideoList.vue index 678d13f5..0253c1e3 100644 --- a/web_src/src/components/PushVideoList.vue +++ b/web_src/src/components/PushVideoList.vue @@ -187,7 +187,7 @@ export default { this.getListLoading = true; this.$axios({ method: 'get', - url: '/api/media/stream_info_by_app_and_stream', + url: '/api/push/getPlayUrl', params: { app: row.app, stream: row.stream,