소스 검색

接口测试

gao.qiang 1 년 전
부모
커밋
efd8d99933

+ 4 - 1
.idea/compiler.xml

@@ -7,14 +7,17 @@
         <sourceOutputDir name="target/generated-sources/annotations" />
         <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
         <outputRelativeToContentRoot value="true" />
-        <module name="vehicle-admin" />
+        <module name="vehicle-sdk" />
         <module name="hazard-admin" />
+        <module name="vehicle-admin" />
         <module name="business-service" />
         <module name="hazard-sdk" />
       </profile>
     </annotationProcessing>
     <bytecodeTargetLevel>
       <module name="admin" target="1.8" />
+      <module name="hazard-sdk" target="1.8" />
+      <module name="vehicle-sdk" target="1.8" />
     </bytecodeTargetLevel>
   </component>
 </project>

+ 5 - 4
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java

@@ -524,7 +524,8 @@ public class BaseCameraManagementController extends BaseController {
 //        baseCameraManagement.setMilesRange(begin + "-" + end);
 //        baseCameraManagement.setLongitudeAndLatitude(baseCameraManagement.getInstallLongitude() + "," + baseCameraManagement.getInstallLongitude());
 //        return AjaxResult.success(baseCameraManagement);
-        String cameraPreviewURL = GetCameraPreviewURL.getPreviewURLs();
+        String cameraPreviewURL = GetCameraPreviewURL.playbackURLs();
+//        String cameraPreviewURL = GetCameraPreviewURL.getPreviewURLs();
         log.info("-------------------------------->>>>>" + cameraPreviewURL);
         JSONObject outJson = JSONObject.parse(cameraPreviewURL);
         log.info("-------------------------------->>>>>outJson------" + outJson);
@@ -532,10 +533,10 @@ public class BaseCameraManagementController extends BaseController {
         log.info("-------------------------------->>>>>data------" + data);
         String urls = data.getString("url");
         log.info("-------------------------------->>>>>urls------" + urls);
-        TimeUnit.SECONDS.sleep(5);
-        String msg = HttpUtils.sendGet("http://10.48.36.47:9080/rtsp/api/pull?target=" + urls + "&streamPath=01ea43e6676f4e47bd6c5cd9e02aa006/01ea43e6676f4e47bd6c5cd9e02aa006&save=0");
+//        TimeUnit.SECONDS.sleep(5);
+//        String msg = HttpUtils.sendGet("http://10.48.36.47:9080/rtsp/api/pull?target=" + urls + "&streamPath=01ea43e6676f4e47bd6c5cd9e02aa006/01ea43e6676f4e47bd6c5cd9e02aa006&save=0");
 //        String msg = HttpUtils.sendGet("http://10.48.36.47:9080/api/gateway/stop?stream=01ea43e6676f4e47bd6c5cd9e02aa006/01ea43e6676f4e47bd6c5cd9e02aa006");
-        return AjaxResult.success(msg);
+        return AjaxResult.success(urls);
     }
 
     /**

+ 46 - 0
vehicle-admin/src/main/java/com/ozs/web/core/config/GetCameraPreviewURL.java

@@ -105,5 +105,51 @@ public class GetCameraPreviewURL {
         log.info("GetCameraPreviewURL----->"+result);
         return result;
     }
+
+
+    public static String playbackURLs() {
+
+        /**
+         * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
+         */
+        ArtemisConfig.host = "10.48.253.21:1443"; // 平台的ip端口
+        ArtemisConfig.appKey = "20110033";  // 密钥appkey
+        ArtemisConfig.appSecret = "QoGESFXOYrC68ixIS7wo";// 密钥appSecret
+
+        /**
+         * STEP2:设置OpenAPI接口的上下文
+         */
+        final String ARTEMIS_PATH = "/artemis";
+
+        /**
+         * STEP3:设置接口的URI地址
+         */
+        final String previewURLsApi = ARTEMIS_PATH+"/api/video/v1/cameras/playbackURLs";
+        Map<String, String> path = new HashMap<String, String>(2) {
+            {
+                put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
+            }
+        };
+
+        /**
+         * STEP4:设置参数提交方式
+         */
+        String contentType = "application/json";
+
+        /**
+         * STEP5:组装请求参数
+         */
+        JSONObject jsonBody = new JSONObject();
+        jsonBody.put("cameraIndexCode", "01ea43e6676f4e47bd6c5cd9e02aa006");
+        jsonBody.put("beginTime", "2023-11-29T14:00:00.000+08:00");
+        jsonBody.put("endTime","2023-11-29T14:20:00.000+08:00");
+        String body = jsonBody.toJSONString();
+        /**
+         * STEP6:调用接口
+         */
+        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
+        log.info("GetCameraPreviewURL----->"+result);
+        return result;
+    }
     
 }