Commit 58d1f0ea16d95638d50d691a7a0169c83c8550af

Authored by 648540858
1 parent 3b1516af

修复云端录像界面

src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
... ... @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.conf;
2 2  
3 3 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
4 4 import com.genersoft.iot.vmp.service.IMediaServerService;
  5 +import org.apache.catalina.connector.ClientAbortException;
5 6 import org.apache.http.HttpHost;
6 7 import org.apache.http.HttpRequest;
7 8 import org.apache.http.HttpResponse;
... ... @@ -193,6 +194,12 @@ public class ProxyServletConfig {
193 194 } catch (IOException ioException) {
194 195 if (ioException instanceof ConnectException) {
195 196 logger.error("录像服务 连接失败");
  197 + }else if (ioException instanceof ClientAbortException) {
  198 + /**
  199 + * TODO 使用这个代理库实现代理在遇到代理视频文件时,如果是206结果,会遇到报错蛋市目前功能正常,
  200 + * TODO 暂时去除异常处理。后续使用其他代理框架修改测试
  201 + */
  202 +
196 203 }else {
197 204 logger.error("录像服务 代理失败: ", e);
198 205 }
... ...
src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java
... ... @@ -84,6 +84,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
84 84 matchers.add("/v3/api-docs/**");
85 85 matchers.add("/js/**");
86 86 matchers.add("/api/device/query/snap/**");
  87 + matchers.add("/record_proxy/*/**");
  88 + matchers.add("/zlm_Proxy/FhTuMYqB2HeCuNOb/record/t/1/2023-03-25/16:35:07-16:35:16-9353.mp4");
87 89 matchers.addAll(userSetting.getInterfaceAuthenticationExcludes());
88 90 // 可以直接访问的静态数据
89 91 web.ignoring().antMatchers(matchers.toArray(new String[0]));
... ... @@ -119,7 +121,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
119 121 .authorizeRequests()
120 122 .requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
121 123 .antMatchers(userSetting.getInterfaceAuthenticationExcludes().toArray(new String[0])).permitAll()
122   - .antMatchers("/api/user/login","/index/hook/**").permitAll()
  124 + .antMatchers("/api/user/login","/index/hook/**","/zlm_Proxy/FhTuMYqB2HeCuNOb/record/t/1/2023-03-25/16:35:07-16:35:16-9353.mp4").permitAll()
123 125 .anyRequest().authenticated()
124 126 // 异常处理器
125 127 .and()
... ...
web_src/src/components/CloudRecordDetail.vue
... ... @@ -220,14 +220,18 @@
220 220 }
221 221 this.queryRecordDetails(()=>{
222 222 if (this.detailFiles.length > 0){
  223 + console.log(this.detailFiles)
223 224 let timeForFile = this.getTimeForFile(this.detailFiles[0]);
224 225 let lastTimeForFile = this.getTimeForFile(this.detailFiles[this.detailFiles.length - 1]);
225 226 let timeNum = timeForFile[0].getTime() - new Date(this.chooseDate + " " + this.timeFormat).getTime()
  227 + console.log(timeNum)
226 228 let lastTimeNum = lastTimeForFile[1].getTime() - new Date(this.chooseDate + " " + this.timeFormat).getTime()
227 229  
228 230 this.playTime = parseInt(timeNum/1000)
229 231 this.sliderMIn = parseInt(timeNum/1000 - timeNum/1000%(60*60))
  232 + console.log(this.sliderMIn )
230 233 this.sliderMax = parseInt(lastTimeNum/1000 - lastTimeNum/1000%(60*60)) + 60*60
  234 + console.log(this.sliderMax )
231 235 }
232 236 });
233 237 },
... ... @@ -311,11 +315,12 @@
311 315 }
312 316 },
313 317 getTimeForFile(file){
  318 + console.log(file)
314 319 let timeStr = file.substring(0,17);
315 320 if(timeStr.indexOf("~") > 0){
316 321 timeStr = timeStr.replaceAll("-",":")
317 322 }
318   - let timeArr = timeStr.split("~");
  323 + let timeArr = timeStr.split("-");
319 324 let starTime = new Date(this.chooseDate + " " + timeArr[0]);
320 325 let endTime = new Date(this.chooseDate + " " + timeArr[1]);
321 326 if(this.checkIsOver24h(starTime,endTime)){
... ...