|
@@ -10,6 +10,7 @@ import com.ozs.common.core.redis.RedisCache;
|
|
|
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.service.entity.BaseCameraManagement;
|
|
|
import com.ozs.service.service.BaseCameraManagementService;
|
|
|
import com.ozs.system.mapper.SysDictDataMapper;
|
|
@@ -19,8 +20,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
-import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
@@ -33,8 +32,6 @@ import java.util.*;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
-import java.util.regex.Matcher;
|
|
|
-import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -47,8 +44,7 @@ import java.util.stream.Collectors;
|
|
|
public class CameraUtil {
|
|
|
|
|
|
private static final ExecutorService executor = Executors.newFixedThreadPool(20);
|
|
|
- private static String historyUrl;
|
|
|
- private static String recordUrl;
|
|
|
+
|
|
|
private static String ffmpegPath;
|
|
|
private static String filePath;
|
|
|
private static String transcribeFilePath;
|
|
@@ -56,19 +52,31 @@ public class CameraUtil {
|
|
|
private static String bakUrl;
|
|
|
private static CmdCameraUtil cUtil;
|
|
|
private static RedisCache rc;
|
|
|
+ private static ServerConfig sc;
|
|
|
|
|
|
public final static String mvkey = "WAIT_MERGE_VIDEO_ALARM_ID";
|
|
|
+
|
|
|
+ // 相机配置
|
|
|
@Autowired
|
|
|
private CaneraConfig caneraConfig;
|
|
|
|
|
|
+ // 命令工具
|
|
|
@Autowired
|
|
|
private CmdCameraUtil cmdCameraUtil;
|
|
|
|
|
|
+ // 字典
|
|
|
@Autowired
|
|
|
private SysDictDataMapper dictDataMapper;
|
|
|
|
|
|
+ // redis
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
+
|
|
|
+ // redis
|
|
|
+ @Autowired
|
|
|
+ private ServerConfig serverConfig;
|
|
|
+
|
|
|
+
|
|
|
@Resource
|
|
|
BaseCameraManagementService baseCameraManagementService;
|
|
|
|
|
@@ -93,15 +101,6 @@ public class CameraUtil {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
try {
|
|
|
-// Map<String, String> map = myConvetor(fromVideoFileList, NewfilePath, uuid);
|
|
|
-// if (!ObjectUtils.isEmpty(map)) {
|
|
|
-// cUtil.cmd(map.get("cmd"));
|
|
|
-// //删除生成的ts文件
|
|
|
-// File file1 = new File(map.get("path"));
|
|
|
-// if (file1.exists()) {
|
|
|
-// file1.delete();
|
|
|
-// }
|
|
|
-// }
|
|
|
txConvetor(fromVideoFileList, NewfilePath, uuid);
|
|
|
} catch (IOException e) {
|
|
|
log.error(e.getMessage());
|
|
@@ -146,7 +145,7 @@ public class CameraUtil {
|
|
|
* @return
|
|
|
*/
|
|
|
public static String startRecording(String cameraCode, String channel) {
|
|
|
- return historyUrl + "/api/record/flv/start?streamPath=" + channel + "/" + cameraCode;
|
|
|
+ return webUrl + "/api/record/flv/start?streamPath=" + channel + "/" + cameraCode;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -156,7 +155,7 @@ public class CameraUtil {
|
|
|
* @return
|
|
|
*/
|
|
|
public static String endRecording(String taskId) {
|
|
|
- return historyUrl + "/api/record/flv/stop?id=" + taskId;
|
|
|
+ return webUrl + "/api/record/flv/stop?id=" + taskId;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -436,7 +435,7 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.flv
|
|
|
}
|
|
|
|
|
|
public static List<Map<String, Object>> getRecordList(String channel, Date startTm, Date endTm) {
|
|
|
- return filterRecordList(channel, startTm, endTm, filePath, recordUrl + "/");
|
|
|
+ return filterRecordList(channel, startTm, endTm, filePath, sc.getUrl() + "/profile/");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -670,25 +669,11 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.flv
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @PostConstruct
|
|
|
- public void init() {
|
|
|
- historyUrl = caneraConfig.getHistoryUrl();
|
|
|
- ffmpegPath = caneraConfig.getFfmpegPath();
|
|
|
- filePath = caneraConfig.getFilePath();
|
|
|
- transcribeFilePath = caneraConfig.getTranscribeFilePath();
|
|
|
- webUrl = caneraConfig.getWebUrl();
|
|
|
- bakUrl = caneraConfig.getBakUrl();
|
|
|
- recordUrl = caneraConfig.getRecordUrl();
|
|
|
- cUtil = cmdCameraUtil;
|
|
|
- rc = redisCache;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
public static List<Map<String, Object>> filterRecordList(String channel,
|
|
|
Date startTm,
|
|
|
Date endTm,
|
|
|
String mappingUrl,
|
|
|
- String webUrl) {
|
|
|
+ String wUrl) {
|
|
|
List<Map<String, Object>> rmaps = new ArrayList<>();
|
|
|
|
|
|
if (StringUtils.isBlank(channel)
|
|
@@ -702,7 +687,7 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.flv
|
|
|
String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, endTm);
|
|
|
|
|
|
String param = "channel=" + channel + "&startTime=" + startTime + "&endTime=" + endTime;
|
|
|
- String s = HttpUtils.sendGet(historyUrl + "/api/record/flv/list", param);
|
|
|
+ String s = HttpUtils.sendGet(webUrl + "/api/record/flv/list", param);
|
|
|
// 视频拼接
|
|
|
if (!StringUtils.isBlank(s) || "null".equals(s)) {
|
|
|
List<Map<String, Object>> maps = JSON.parseArray(s, Map.class);
|
|
@@ -730,7 +715,7 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.flv
|
|
|
Date edate = DateUtils.dateTime(DateUtils.YYYYMMDDHHMMSS, s4);
|
|
|
mo.put("startTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, sdate));
|
|
|
mo.put("entTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, edate));
|
|
|
- mo.put("url", webUrl + path.toString());
|
|
|
+ mo.put("url", wUrl + path.toString());
|
|
|
mo.put("path", mappingUrl + path.toString());
|
|
|
mo.put("fileName", substring);
|
|
|
mo.put("size", size);
|
|
@@ -771,6 +756,18 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.flv
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ @PostConstruct
|
|
|
+ public void init() {
|
|
|
+ ffmpegPath = caneraConfig.getFfmpegPath();
|
|
|
+ filePath = caneraConfig.getFilePath();
|
|
|
+ transcribeFilePath = caneraConfig.getTranscribeFilePath();
|
|
|
+ webUrl = caneraConfig.getWebUrl();
|
|
|
+ bakUrl = caneraConfig.getBakUrl();
|
|
|
+ cUtil = cmdCameraUtil;
|
|
|
+ rc = redisCache;
|
|
|
+ sc = serverConfig;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 定时合成视频
|