|
@@ -3,6 +3,8 @@ package com.ozs.utils;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.hikvision.artemis.sdk.ArtemisHttpUtil;
|
|
|
+import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
|
|
import com.ozs.common.config.BaseConfig;
|
|
|
import com.ozs.common.constant.Constants;
|
|
|
import com.ozs.common.core.domain.entity.SysDictData;
|
|
@@ -81,6 +83,9 @@ public class CameraUtil {
|
|
|
private static ServerConfig sc;
|
|
|
private static String recordUrl;
|
|
|
private static String hkUrl;
|
|
|
+ private static String host;
|
|
|
+ private static String appKey;
|
|
|
+ private static String appSecret;
|
|
|
|
|
|
@Autowired
|
|
|
private CaneraConfig caneraConfig;
|
|
@@ -507,6 +512,9 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
wsUrl = caneraConfig.getWsUrl();
|
|
|
recordUrl = caneraConfig.getRecordUrl();
|
|
|
hkUrl = caneraConfig.getHkUrl();
|
|
|
+ host = caneraConfig.getHost();
|
|
|
+ appKey = caneraConfig.getAppKey();
|
|
|
+ appSecret = caneraConfig.getAppSecret();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -520,7 +528,7 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
Date date = new Date();
|
|
|
Calendar calendar = new GregorianCalendar();
|
|
|
calendar.setTime(date);
|
|
|
- calendar.add(calendar.DATE, -1);
|
|
|
+ calendar.add(Calendar.DATE, -1);
|
|
|
date = calendar.getTime();
|
|
|
String path = BaseConfig.getProfile() + "/flv/" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date);
|
|
|
File file = new File(path);
|
|
@@ -618,81 +626,6 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
public static File[] getCurFilesList(String filePath) {
|
|
|
File path = new File(filePath);
|
|
@@ -752,38 +685,6 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
}
|
|
|
|
|
|
executor.shutdown();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -884,7 +785,9 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ * 机车状态修改
|
|
|
+ */
|
|
|
public void heartbeat() {
|
|
|
List<BaseTerminal> list = baseTerminalService.list();
|
|
|
for (BaseTerminal baseTerminal : list) {
|
|
@@ -915,24 +818,71 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * 天网接口
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String getPreviewURLs(String url, String body) {
|
|
|
+
|
|
|
+
|
|
|
+ * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
|
|
|
+ */
|
|
|
+ ArtemisConfig.host = host;
|
|
|
+ ArtemisConfig.appKey = appKey;
|
|
|
+ ArtemisConfig.appSecret = appSecret;
|
|
|
+
|
|
|
+
|
|
|
+ * STEP2:设置OpenAPI接口的上下文
|
|
|
+ */
|
|
|
+ final String ARTEMIS_PATH = "/artemis";
|
|
|
+
|
|
|
+
|
|
|
+ * STEP3:设置接口的URI地址
|
|
|
+ */
|
|
|
+ final String previewURLsApi = ARTEMIS_PATH + url;
|
|
|
+ Map<String, String> path = new HashMap<String, String>(2) {
|
|
|
+ {
|
|
|
+ put("https://", previewURLsApi);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ * STEP4:设置参数提交方式
|
|
|
+ */
|
|
|
+ String contentType = "application/json";
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * STEP6:调用接口
|
|
|
+ */
|
|
|
+ String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null);
|
|
|
+ log.info("GetCameraPreviewURL----->" + result);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public void previewURLs(CamerasVo camerasVo) {
|
|
|
- String result = null;
|
|
|
- String url = "http://" + hkUrl + "/api/video/v2/cameras/previewURLs";
|
|
|
- try {
|
|
|
- result = HttpClientUtil.postJson(url, JSON.toJSONString(camerasVo));
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("previewURLs------------>" + e.getMessage());
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- JSONObject outJson = (JSONObject) JSONObject.parse(result);
|
|
|
+
|
|
|
+ * jsonBody.put("cameraIndexCode", "01ea43e6676f4e47bd6c5cd9e02aa006");
|
|
|
+ * jsonBody.put("streamType", 0);
|
|
|
+ * jsonBody.put("protocol","rtsp");
|
|
|
+ * jsonBody.put("transmode", 1);
|
|
|
+ * jsonBody.put("expand","streamform=rtp");
|
|
|
+ */
|
|
|
+ camerasVo.setProtocol("rtsp");
|
|
|
+ camerasVo.setTransmode(1);
|
|
|
+ camerasVo.setExpand("streamform=rtp");
|
|
|
+ String body = JSONObject.toJSONString(camerasVo);
|
|
|
+ String previewURLs = getPreviewURLs("/api/video/v1/cameras/previewURLs", body);
|
|
|
+ log.info("-------------------------------->>>>>previewURLs" + previewURLs);
|
|
|
+ JSONObject outJson = JSONObject.parse(previewURLs);
|
|
|
if ("0".equals(outJson.getString("code"))) {
|
|
|
log.info("outJson----->" + outJson);
|
|
|
JSONObject data = outJson.getJSONObject("data");
|
|
|
String urls = data.getString("url");
|
|
|
HttpUtils.sendGet(historyUrl + "rtsp/api/pull?target=" + urls + "&streamPath=" + camerasVo.getCameraIndexCode() + "/" + camerasVo.getCameraIndexCode() + "&save=0");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public void playbackURLs(List<String> list) {
|
|
@@ -950,17 +900,11 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
playbackVo.setBeginTime(beforeTenMinutes.format(formatter));
|
|
|
playbackVo.setEndTime(afterTenMinutes.format(formatter));
|
|
|
-
|
|
|
-
|
|
|
- String result = null;
|
|
|
- String url = "http://" + hkUrl + "/api/video/v2/cameras/playbackURLs";
|
|
|
- try {
|
|
|
- result = HttpClientUtil.postJson(url, JSON.toJSONString(playbackVo));
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("playbackURLs------------>" + e.getMessage());
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- JSONObject outJson = (JSONObject) JSONObject.parse(result);
|
|
|
+
|
|
|
+ String body = JSONObject.toJSONString(playbackVo);
|
|
|
+
|
|
|
+ String previewURLs = getPreviewURLs("/api/video/v1/cameras/playbackURLs", body);
|
|
|
+ JSONObject outJson = (JSONObject) JSONObject.parse(previewURLs);
|
|
|
if ("0".equals(outJson.getString("code"))) {
|
|
|
log.info("outJson----->" + outJson);
|
|
|
JSONObject data = outJson.getJSONObject("data");
|