From 620a4803da1fa01ef02e17f4a9d5a997a7aa4830 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期一, 18 三月 2024 23:56:27 +0800 Subject: [PATCH] 实现部分优化后的接口 --- src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java | 33 +++++++++++++++++++++++---------- 1 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java index de9def5..b4552b7 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java @@ -1,25 +1,23 @@ package com.genersoft.iot.vmp.vmanager.cloudRecord; import com.alibaba.fastjson2.JSONArray; -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.media.zlm.SendRtpPortManager; -import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; +import com.genersoft.iot.vmp.conf.security.JwtUtils; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.service.ICloudRecordService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.bean.CloudRecordItem; +import com.genersoft.iot.vmp.service.bean.DownloadFileInfo; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import org.apache.commons.lang3.ObjectUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -46,7 +44,7 @@ @ResponseBody @GetMapping("/date/list") - @Operation(summary = "鏌ヨ瀛樺湪浜戠褰曞儚鐨勬棩鏈�") + @Operation(summary = "鏌ヨ瀛樺湪浜戠褰曞儚鐨勬棩鏈�", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "app", description = "搴旂敤鍚�", required = true) @Parameter(name = "stream", description = "娴両D", required = true) @Parameter(name = "year", description = "骞达紝缃┖鍒欐煡璇㈠綋骞�", required = false) @@ -89,7 +87,7 @@ @ResponseBody @GetMapping("/list") - @Operation(summary = "鍒嗛〉鏌ヨ浜戠褰曞儚") + @Operation(summary = "鍒嗛〉鏌ヨ浜戠褰曞儚", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "query", description = "妫�绱㈠唴瀹�", required = false) @Parameter(name = "app", description = "搴旂敤鍚�", required = false) @Parameter(name = "stream", description = "娴両D", required = false) @@ -174,7 +172,7 @@ throw new ControllerException(ErrorCode.ERROR100.getCode(), "鏈壘鍒板彲鐢ㄧ殑娴佸獟浣�"); }else { if (remoteHost == null) { - remoteHost = request.getScheme() + "://" + request.getLocalAddr() + ":" + mediaServerItem.getRecordAssistPort(); + remoteHost = request.getScheme() + "://" + mediaServerItem.getIp() + ":" + mediaServerItem.getRecordAssistPort(); } } return cloudRecordService.addTask(app, stream, mediaServerItem, startTime, endTime, callId, remoteHost, mediaServerId != null); @@ -187,6 +185,7 @@ @Parameter(name = "mediaServerId", description = "娴佸獟浣揑D", required = false) @Parameter(name = "isEnd", description = "鏄惁缁撴潫", required = false) public JSONArray queryTaskList( + HttpServletRequest request, @RequestParam(required = false) String app, @RequestParam(required = false) String stream, @RequestParam(required = false) String callId, @@ -194,7 +193,11 @@ @RequestParam(required = false) String mediaServerId, @RequestParam(required = false) Boolean isEnd ){ - return cloudRecordService.queryTask(app, stream, callId, taskId, mediaServerId, isEnd); + if (ObjectUtils.isEmpty(mediaServerId)) { + mediaServerId = null; + } + + return cloudRecordService.queryTask(app, stream, callId, taskId, mediaServerId, isEnd, request.getScheme()); } @ResponseBody @@ -252,4 +255,14 @@ return cloudRecordService.changeCollect(false, app, stream, mediaServerId, startTime, endTime, callId); } } + + @ResponseBody + @GetMapping("/play/path") + @Operation(summary = "鑾峰彇鎾斁鍦板潃") + @Parameter(name = "recordId", description = "褰曞儚璁板綍鐨処D", required = true) + public DownloadFileInfo getPlayUrlPath( + @RequestParam(required = true) Integer recordId + ){ + return cloudRecordService.getPlayUrlPath(recordId); + } } -- Gitblit v1.8.0