Pu Zhibing
2025-07-23 1ee76c252f2dbba62e0ec34cccf9eaac51de9083
ruoyi-service/ruoyi-dataInterchange/src/main/java/com/ruoyi/dataInterchange/util/haikang/Artemis.java
@@ -2,7 +2,6 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSONArray;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.ruoyi.dataInterchange.util.haikang.model.*;
@@ -72,67 +71,6 @@
      return result;
   }
   
   public static void main(String[] args) {
      try {
         FindVehicleByLicensePlateRequest findVehicleByLicensePlateRequest = new FindVehicleByLicensePlateRequest();
         findVehicleByLicensePlateRequest.setVehicleLicensePlate("川J52303");
         String vehicleByLicensePlate = Artemis.findVehicleByLicensePlate(findVehicleByLicensePlateRequest);
         com.alibaba.fastjson2.JSONObject jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(vehicleByLicensePlate);
         String code = jsonObject.getString("code");
         if(!"0".equals(code)){
            return ;
         }
         com.alibaba.fastjson2.JSONObject data = jsonObject.getJSONObject("data");
         //车辆编号
         String indexCode = data.getString("indexCode");
         //主设备编号
         String primaryDeviceIndexCode = data.getString("primaryDeviceIndexCode");
         //根据车辆编号和设备编号获取监控点信息列表
         FindCameraPageRequest findCameraPageRequest = new FindCameraPageRequest();
         findCameraPageRequest.setPageNo(1);
         findCameraPageRequest.setPageSize(1000);
         ExactCondition1 exactCondition = new ExactCondition1();
         exactCondition.setDeviceIndexCodes(new ArrayList<String>(){{
            add(primaryDeviceIndexCode);
         }});
         exactCondition.setVehicleIndexCodes(new ArrayList<String>(){{
            add(indexCode);
         }});
         findCameraPageRequest.setExactCondition(exactCondition);
         String cameraPage = Artemis.findCameraPage(findCameraPageRequest);
         jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(cameraPage);
         code = jsonObject.getString("code");
         if(!"0".equals(code)){
            return;
         }
         data = jsonObject.getJSONObject("data");
         JSONArray list = data.getJSONArray("list");
         //监控点编号
         String indexCode1 = "";
         for (int i = 0; i < list.size(); i++) {
            com.alibaba.fastjson2.JSONObject jsonObject1 = list.getJSONObject(i);
            String cameraName = jsonObject1.getString("cameraName");
            if("驾驶位".equals(cameraName)){
               indexCode1 = jsonObject1.getString("indexCode");
            }
         }
         //根据监控点编号获取监控预览url
         PreviewURLsRequest previewURLsRequest = new PreviewURLsRequest();
         previewURLsRequest.setCameraIndexCode(indexCode1);
         String s = Artemis.previewURLs(previewURLsRequest);
         jsonObject = com.alibaba.fastjson2.JSONObject.parseObject(s);
         code = jsonObject.getString("code");
         if(!"0".equals(code)){
            return ;
         }
         data = jsonObject.getJSONObject("data");
         String url = data.getString("url");
         System.out.println(url);
      }catch (Exception e) {
         e.printStackTrace();
      }
   }
   
   //根据车牌号码获取车辆信息(含设备)
   public static String findVehicleByLicensePlate(FindVehicleByLicensePlateRequest findVehicleByLicensePlateRequest)throws Exception{