wyb 1 rok temu
rodzic
commit
7cd9651a0d

+ 7 - 0
src/main/java/com/chinaitop/depot/hk/constant/ApiHkConstant.java

@@ -49,6 +49,13 @@ public interface ApiHkConstant {
49 49
      * @date: 2024/6/20
50 50
      **/
51 51
     String API_HK_RECORD_STOP = "/artemis/api/video/v1/manualRecord/stop";
52
+    /**
53
+     * 手动抓图
54
+     *
55
+     * @author: ybw
56
+     * @date: 2024/6/20
57
+     **/
58
+    String API_HK_MANUAL_CAPTURE = "/artemis/api/video/v1/manualCapture";
52 59
 
53 60
 
54 61
     /**

+ 24 - 0
src/main/java/com/chinaitop/depot/hk/dto/req/CaptureReqDTO.java

@@ -0,0 +1,24 @@
1
+package com.chinaitop.depot.hk.dto.req;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+
6
+/**
7
+ * 手动抓图
8
+ *
9
+ * @author ybw
10
+ * @version V1.0
11
+ * @className CaptureReqDTO
12
+ * @date 2024/6/22
13
+ **/
14
+@Data
15
+@AllArgsConstructor
16
+public class CaptureReqDTO {
17
+    /**
18
+     * 监控点编号
19
+     *
20
+     * @author: ybw
21
+     * @date: 2024/6/19
22
+     **/
23
+    private String cameraIndexCode;
24
+}

+ 24 - 0
src/main/java/com/chinaitop/depot/hk/dto/res/CaptureResDTO.java

@@ -0,0 +1,24 @@
1
+package com.chinaitop.depot.hk.dto.res;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+
6
+/**
7
+ * 手动抓图
8
+ *
9
+ * @author ybw
10
+ * @version V1.0
11
+ * @className CaptureReqDTO
12
+ * @date 2024/6/22
13
+ **/
14
+@Data
15
+@AllArgsConstructor
16
+public class CaptureResDTO {
17
+    /**
18
+     * 图片 url 信息
19
+     *
20
+     * @author: ybw
21
+     * @date: 2024/6/19
22
+     **/
23
+    private String picUrl;
24
+}

+ 12 - 0
src/main/java/com/chinaitop/depot/hk/service/HkService.java

@@ -83,4 +83,16 @@ public interface HkService {
83 83
      * @date: 2024/6/20
84 84
      **/
85 85
     void recordStop(RecordStopReqDTO recordStopReqDTO);
86
+
87
+
88
+    /**
89
+     * 手动抓图
90
+     *
91
+     * @param captureReqDTO
92
+     * @methodName: manualCapture
93
+     * @return: com.ybw.dto.res.CaptureResDTO
94
+     * @author: ybw
95
+     * @date: 2024/6/20
96
+     **/
97
+    CaptureResDTO manualCapture(CaptureReqDTO captureReqDTO);
86 98
 }

+ 23 - 2
src/main/java/com/chinaitop/depot/hk/service/impl/HkServiceImpl.java

@@ -146,7 +146,7 @@ public class HkServiceImpl implements HkService {
146 146
                 return resultResDTO.getData();
147 147
             }
148 148
         } catch (Exception e) {
149
-            log.error("previewURLs error:", e);
149
+            log.error("recordStart error:", e);
150 150
         }
151 151
         return null;
152 152
     }
@@ -164,7 +164,28 @@ public class HkServiceImpl implements HkService {
164 164
             );
165 165
             log.info("{}", JSON.toJSONString(resultResDTO));
166 166
         } catch (Exception e) {
167
-            log.error("previewURLs error:", e);
167
+            log.error("recordStop error:", e);
168 168
         }
169 169
     }
170
+
171
+    @Override
172
+    public CaptureResDTO manualCapture(CaptureReqDTO captureReqDTO) {
173
+        try {
174
+            // 接口地址
175
+            Map<String, String> path = getPath(ApiHkConstant.API_HK_MANUAL_CAPTURE);
176
+            String result = ArtemisHttpUtil.doPostStringArtemis(artemisConfig, path, JSON.toJSONString(captureReqDTO), null, null, "application/json");
177
+            ResultResDTO<CaptureResDTO> resultResDTO = JSONObject.parseObject(
178
+                    result,
179
+                    new TypeReference<ResultResDTO<CaptureResDTO>>() {
180
+                    }
181
+            );
182
+            log.info("{}", JSON.toJSONString(resultResDTO));
183
+            if (ApiHkConstant.Code.SUCCESS.equals(resultResDTO.getCode())) {
184
+                return resultResDTO.getData();
185
+            }
186
+        } catch (Exception e) {
187
+            log.error("manualCapture error:", e);
188
+        }
189
+        return null;
190
+    }
170 191
 }