liuyongxin 1 mēnesi atpakaļ
vecāks
revīzija
b844e7c049

+ 5 - 6
cloud-oil/cloud-oil-biz/src/main/java/com/lutao/cloud/oil/runner/VideoInfoExecutor.java

@@ -37,10 +37,9 @@ public class VideoInfoExecutor {
     private static final String CLIENT_SECRET = "OA!Bq_P!";
     private static final String CONTENT_TYPE = "application/json";
     private static final String TOKEN_URL = "http://dgs-servicebusgate2.zww.yjcloud.cn/oauth/token";
-    private static final String ROOT_URL = "http://dgs-servicebusgate2.zww.yjcloud.cn/service/api/api/resource/v1/regions/root";
-    private static final String CHILD_URL = "http://dgs-servicebusgate2.zww.yjcloud.cn/service/api/artemis/api/resource/v1/regions/subRegions";
+    private static final String ROOT_URL = "http://dgs-servicebusgate2.zww.yjcloud.cn/service/api/artemis/api/resource/v1/unit/getChildUnitsWithCameraByUnitIndexCode";
+    private static final String CHILD_URL = "http://dgs-servicebusgate2.zww.yjcloud.cn/service/api/artemis/api/resource/v1/unit/getChildUnitsWithCameraByUnitIndexCode";
     private static final String CAMERA_URL = "http://dgs-servicebusgate2.zww.yjcloud.cn/service/api/artemis/api/resource/v1/regions/regionIndexCode/cameras";
-    private static final String RTSP = "http://dgs-servicebusgate2.zww.yjcloud.cn/service/api/api/v1/cameras/previewURLs";
 
     private static Map<String, AppInfo> APP_MAP = new HashMap<>();
 
@@ -65,7 +64,7 @@ public class VideoInfoExecutor {
 
 
     @Transactional
-    @Scheduled(cron = "0 0 1 1 * ?")
+    @Scheduled(cron = "0 0 1 * * ?")
     public MessageInfo execute() {
         if (acquireLock()){
             try {
@@ -126,8 +125,8 @@ public class VideoInfoExecutor {
     }
 
     private String getRootIndexCode(String accessToken) {
-        JSONObject newRequestBody = JSONUtil.createObj().putOnce("parentIndexCode", "parentIndexCode");
-
+        JSONObject newRequestBody = JSONUtil.createObj().putOnce("parentIndexCode", "-1");
+        newRequestBody.set("treeCode", "0");
         String rootBody = HttpUtil.createPost(ROOT_URL)
                 .header("client_id", CLIENT_ID)
                 .header("access_token", accessToken)

+ 13 - 18
cloud-oil/cloud-oil-biz/src/main/java/com/lutao/cloud/oil/service/impl/VideoEquipmentInfoServiceImpl.java

@@ -139,17 +139,17 @@ public class VideoEquipmentInfoServiceImpl extends ServiceImpl<VideoEquipmentInf
     @Override
     public MessageInfo getVideoUrl(String videoCode) {
         // 获取token
-//        String url = "http://dgs-servicebusgate2.zww.yjcloud.cn/oauth/token?client_id=8a7b785f08d04d439b71bc2b415cb685&client_secret=OA!Bq_P!";
-//        Map<String, String> map = restTemplate.getForObject(url, Map.class);
-//        System.out.println("map:" + map);
-//        String token = map.get("access_token");
-//
-//        // 请求数据
-//        String url2 = "http://dgs-servicebusgate2.zww.yjcloud.cn/service/api/api/v1/cameras/previewURLs?client_id=8a7b785f08d04d439b71bc2b415cb685&access_token=" + token;
-//        Map<String, String> parameters = new LinkedHashMap<>();
-//        parameters.put("cameraIndexCode", videoCode);
-//        parameters.put("protocol", "ws");
-//        MessageInfo result = restTemplate.postForObject(url2, JSONObject.toJSONString(parameters), MessageInfo.class);
+        String url = "http://dgs-servicebusgate2.zww.yjcloud.cn/oauth/token?client_id=8a7b785f08d04d439b71bc2b415cb685&client_secret=OA!Bq_P!";
+        Map<String, String> map = restTemplate.getForObject(url, Map.class);
+        System.out.println("map:" + map);
+        String token = map.get("access_token");
+
+        // 请求数据
+        String url2 = "http://dgs-servicebusgate2.zww.yjcloud.cn/service/api/artemis/api/video/v1/cameras/previewURLs?client_id=8a7b785f08d04d439b71bc2b415cb685&access_token=" + token;
+        Map<String, String> parameters = new LinkedHashMap<>();
+        parameters.put("cameraIndexCode", videoCode);
+        parameters.put("protocol", "wss");
+        MessageInfo result = restTemplate.postForObject(url2, JSONObject.toJSONString(parameters), MessageInfo.class);
         // ws地址转化,从10段到59段
         /**
          * {
@@ -160,18 +160,13 @@ public class VideoEquipmentInfoServiceImpl extends ServiceImpl<VideoEquipmentInf
          * 	    }
          * }
          */
-        MessageInfo result = new MessageInfo();
-        result.setCode(200);
-        Map<String, String> data11 = new HashMap<>();
-        data11.put("url", "wss://10.18.18.53:6014/proxy/10.18.18.53:559/openUrl/uQhfGdq");
+//        Map<String, String> data11 = new HashMap<>();
+//        data11.put("url", "wss://10.18.18.53:6014/proxy/10.18.18.53:559/openUrl/uQhfGdq");
         //wss://10.18.18.53:6014/proxy/10.18.18.53:559/openUrl/yrtJ9EA
         //data11.put("url", "ws://10.18.18.53:559/openUrl/gC42FPi");
         //  wss://10.18.18.53:6014/proxy/10.18.18.53:559/openUrl/uQhfGdq
         //  => wss:/splw2.mem.cegn.cn:6014/proxy/splw2.mem.cegn.cn:559/openurl/xlgbLPy
 
-        result.setData(
-                data11
-        );
         Map<String, String> data = (Map<String, String>) result.getData();
         if (data != null) {
             String wsUrl = data.get("url");