| | |
| | | |
| | | 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.*; |
| | |
| | | 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{ |
| | |
| | | String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json"); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //根据报警ID获取关联图片信息 |
| | | public static String findPicturesByAlarmId(FindPicturesByAlarmIdRequest findPicturesByAlarmIdRequest) throws Exception { |
| | | String findPicturesByAlarmIdDataApi = ARTEMIS_PATH +"/api/rtsm/v1/multimedia/findPicturesByAlarmId"; |
| | | Map<String,String> path = new HashMap<String,String>(2){ |
| | | { |
| | | put("https://",findPicturesByAlarmIdDataApi); |
| | | } |
| | | }; |
| | | String body=JSON.toJSONString(findPicturesByAlarmIdRequest); |
| | | String result =ArtemisHttpUtil.doPostStringArtemis(artemisConfig,path,body,null,null,"application/json"); |
| | | return result; |
| | | } |
| | | } |