| 
					
				 | 
			
			
				@@ -0,0 +1,271 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package com.ozs.web.core.util; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.alibaba.fastjson2.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.config.BaseConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.exception.base.BaseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.utils.DateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.utils.http.HttpUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.framework.config.ServerConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.web.core.config.CaneraConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.stereotype.Component; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.util.ObjectUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import springfox.documentation.spring.web.json.Json; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.annotation.PostConstruct; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.regex.Matcher; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.regex.Pattern; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 相机工具 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Component 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class CameraUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static String url; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static String historyUrl = "http://47.106.159.135/streams"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static String ffmpegPath; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static String systemUrl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static String mappingUrl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private CaneraConfig caneraConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ServerConfig serverConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static String getPlayFlv(String cameraCode, String channel) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return historyUrl + "/hdl/" + channel + "/" + cameraCode + ".flv"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 实时播放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param cameraCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param channel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static String play(String cameraCode, String channel) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isBlank(cameraCode) || StringUtils.isBlank(channel)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String param = "id=" + cameraCode + "&channel=" + channel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return HttpUtils.sendGet(url + "/gb28181/api/records", param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static List<String> historyPlayList(String channel, Date startTm, Date endTm) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isBlank(channel) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                || ObjectUtils.isEmpty(startTm) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                || ObjectUtils.isEmpty(endTm)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> ls = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 调用视频服务返回参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, startTm); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, startTm); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String param = "channel=" + channel + "&startTime=" + startTime + "&endTime=" + endTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String s = HttpUtils.sendGet(historyUrl + "/api/record/flv/list", param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 视频拼接 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!StringUtils.isBlank(s)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<Map<String, Object>> maps = JSON.parseArray(s, Map.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (Map<String, Object> map : maps) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Object path = map.get("Path"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!ObjectUtils.isEmpty(path)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ls.add(mappingUrl + path.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return ls; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 历史回放 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param channel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param startTm 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param endTm 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @throws IOException 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static String historyPlay(String channel, Date startTm, Date endTm) throws IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isBlank(channel) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                || ObjectUtils.isEmpty(startTm) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                || ObjectUtils.isEmpty(endTm)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 调用视频服务返回参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, startTm); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, startTm); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String param = "channel=" + channel + "&startTime=" + startTime + "&endTime=" + endTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String s = HttpUtils.sendGet(historyUrl + "/api/record/flv/list", param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 视频拼接 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!StringUtils.isBlank(s)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<Map<String, Object>> maps = JSON.parseArray(s, Map.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 视频服务映射路径 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String NewfilePath = BaseConfig.getProfile() + "/" + channel + "/" + startTime + "/" + endTime + ".flv"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<String> fromVideoFileList = new ArrayList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (Map<String, Object> map : maps) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Object path = map.get("Path"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (!ObjectUtils.isEmpty(path)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    fromVideoFileList.add(mappingUrl + path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            convetor(fromVideoFileList, NewfilePath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return systemUrl + "/profile" + "/" + channel + "/" + startTime + "/" + endTime + ".flv"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // http://47.106.159.135/record/flv/34020000001320000002/20230304_183122_183222-d98df13f-ba77-11ed-aeb9-00163e06a5f3.flv 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * * 参数: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * **List<String> fromVideoFileList 需要合并的多视频url地址以List存放** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * **String ffmpeg 此处是ffmpeg 配置地址,可写死如“E:/ffmpeg/bin/ffmpeg.exe”** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * **String NewfilePath 合并后的视频存放地址,如:E:/mergevideo.mp4*** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static void convetor(List<String> fromVideoFileList, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                String NewfilePath) throws IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        new Thread( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                () -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<String> voidTS = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Process process = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        ProcessBuilder builder = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<String> command = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (int i = 0; i < fromVideoFileList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            String fromVideoFile = fromVideoFileList.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command = new ArrayList<String>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add(ffmpegPath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add("-y"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add("-i"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add(fromVideoFile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add("-vcodec"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add("copy"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add("-bsf:v"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add("h264_mp4toannexb"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add("-f"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add("mpegts"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            command.add(fromVideoFile.substring(0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    fromVideoFile.lastIndexOf(".")) + ".ts"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            builder = new ProcessBuilder(command); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            voidTS.add(fromVideoFile.substring(0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    fromVideoFile.lastIndexOf(".")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    + ".ts"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                process = builder.start(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                InputStream errorStream = process 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .getErrorStream(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                InputStreamReader inputStreamReader = new InputStreamReader( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        errorStream); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                BufferedReader br = new BufferedReader( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        inputStreamReader); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                String line = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                StringBuffer sb = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                while ((line = br.readLine()) != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    sb.append(line); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                String regexDuration = "Duration: (.*?), start: (.*?), bitrate: (\\d*) kb\\/s"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Pattern pattern = Pattern 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .compile(regexDuration); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Matcher m = pattern.matcher(sb.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                System.out.println(sb.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                br.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                inputStreamReader.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                errorStream.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } catch (IOException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<String> dos = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        StringBuffer tsPath = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tsPath.append(ffmpegPath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tsPath.append(" -i "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tsPath.append("concat:"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (int t = 0; t < voidTS.size(); t++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (t != voidTS.size() - 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                tsPath.append(voidTS.get(t) + "|"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                tsPath.append(voidTS.get(t)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tsPath.append(" -vcodec "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tsPath.append(" copy "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tsPath.append(" -bsf:a "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tsPath.append(" aac_adtstoasc "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tsPath.append(" -movflags "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tsPath.append(" +faststart "); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        tsPath.append(NewfilePath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        Process pr = Runtime.getRuntime().exec( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                tsPath.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        process.getInputStream(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        pr.getOutputStream().close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        pr.getInputStream().close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        pr.getErrorStream().close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            pr.waitFor(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Thread.sleep(1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            pr.destroy(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } catch (InterruptedException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            // TODO Auto-generated catch block 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //删除生成的ts文件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (String filePath : voidTS) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            File file = new File(filePath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            file.delete(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            pr.destroy(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }).start(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    //工具类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static void queryRecords(String cameraCode, String channel, Date startTm, Date endTm) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isBlank(cameraCode) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                || StringUtils.isBlank(channel) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                || ObjectUtils.isEmpty(startTm) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                || ObjectUtils.isEmpty(endTm)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BaseException("参数为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String param = "id=" + cameraCode + "&channel=" + channel + "&startTime=" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, startTm) + "&endTm=" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, endTm); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String s = HttpUtils.sendGet(historyUrl + "/api/gb28181/query/records", param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        System.out.println(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static void main(String[] args) throws IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        historyPlay("34020000001320000002", "2023-03-03", "2023-03-04"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String s = "record/flv/34020000001320000002/20230304_211304_211404-70a2dff9-ba8e-11ed-aeb9-00163e06a5f3.flv"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        int i = s.lastIndexOf("/"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String substring = s.substring(i + 1, s.length()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String substring1 = substring.substring(0, substring.indexOf("-")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        String[] s1 = substring1.split("_"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        System.out.println(s1.length); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        for (String s2 : s1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            System.out.println(s2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        Date backupTime=DateUtils.addDays(new Date(), -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//        queryRecords("34020000001320000002","34020000001320000002",backupTime,DateUtils.getNowDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        System.out.println(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostConstruct 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void init() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        url = caneraConfig.getUrl(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mappingUrl = caneraConfig.getMappingUrl(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        historyUrl = caneraConfig.getHistoryUrl(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ffmpegPath = caneraConfig.getFfmpegPath(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        systemUrl = serverConfig.getUrl(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |