| | |
| | | package com.doumee.core.haikang.service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.haikang.model.HKConstants; |
| | | import com.doumee.core.haikang.model.HKTools; |
| | | import com.doumee.core.haikang.model.param.BaseListPageResponse; |
| | | import com.doumee.core.haikang.model.param.BaseRequst; |
| | | import com.doumee.core.haikang.model.param.BaseResponse; |
| | | import com.doumee.core.haikang.model.param.BaseListPageRequest; |
| | | import com.doumee.core.haikang.model.param.request.*; |
| | | import com.doumee.core.haikang.model.param.respose.*; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.HttpsUtil; |
| | | import com.hikvision.artemis.sdk.config.ArtemisConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | @Slf4j |
| | | public class HKService { |
| | |
| | | return null; |
| | | } |
| | | /** |
| | | *分页获取区域列表(分页) |
| | | * @return |
| | | */ |
| | | public static BaseResponse<BaseListPageResponse<PageRegionInfoResponse>> pageRegions(BaseListPageRequest param){ |
| | | log.info("【海康分页获取区域列表】================开始===="+JSONObject.toJSONString(param)); |
| | | try { |
| | | Map<String ,String> header = new HashMap<>(); |
| | | // header.put("userId",param.getUserId()); |
| | | String res = HKTools.pageRegions(header,JSONObject.toJSONString(param)); |
| | | TypeReference typeReference = |
| | | new TypeReference< BaseResponse<BaseListPageResponse<PageRegionInfoResponse>> >(){}; |
| | | BaseResponse<BaseListPageResponse<PageRegionInfoResponse>> result = JSONObject.parseObject(res, typeReference.getType()); |
| | | logResult(result,"海康分页获取区域列表"); |
| | | return result; |
| | | }catch (Exception e){ |
| | | log.error("【海康分页获取区域列表】================失败====:\n"+ e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | *获取监控点预览取流URL |
| | | * @return |
| | | */ |
| | | public static BaseResponse<CamerasPreviewURLsResponse> cameraPreviewURLs(CameraPreviewURLsRequest param){ |
| | | log.info("【海康获取监控点预览取流URL】================开始===="+JSONObject.toJSONString(param)); |
| | | try { |
| | | Map<String ,String> header = new HashMap<>(); |
| | | // header.put("userId",param.getUserId()); |
| | | // header.put("domainId ",param.getDomainId()); |
| | | String res = HKTools.cameraPreviewURLs(header,JSONObject.toJSONString(param)); |
| | | TypeReference typeReference = |
| | | new TypeReference< BaseResponse<CamerasPreviewURLsResponse> >(){}; |
| | | BaseResponse<CamerasPreviewURLsResponse> result = JSONObject.parseObject(res, typeReference.getType()); |
| | | logResult(result,"海康获取监控点预览取流URL"); |
| | | return result; |
| | | }catch (Exception e){ |
| | | log.error("【海康获取监控点预览取流URL】================失败====:\n"+ e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | *分页获取监控点资源(分页) |
| | | * @return |
| | | */ |
| | | public static BaseResponse<BaseListPageResponse<PageCameraInfoResponse>> pageCameras(BaseListPageRequest param){ |
| | | log.info("【海康分页获取监控点资源】================开始===="+JSONObject.toJSONString(param)); |
| | | try { |
| | | Map<String ,String> header = new HashMap<>(); |
| | | header.put("userId",param.getUserId()); |
| | | String res = HKTools.pageCameras(header,JSONObject.toJSONString(param)); |
| | | TypeReference typeReference = |
| | | new TypeReference< BaseResponse<BaseListPageResponse<PageCameraInfoResponse>> >(){}; |
| | | BaseResponse<BaseListPageResponse<PageCameraInfoResponse>> result = JSONObject.parseObject(res, typeReference.getType()); |
| | | logResult(result,"海康分页获取监控点资源"); |
| | | return result; |
| | | }catch (Exception e){ |
| | | log.error("【海康分页获取监控点资源】================失败====:\n"+ e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | *获取消防传感器列表(分页) |
| | | * @return |
| | | */ |
| | | public static BaseResponse<BaseListPageResponse<PageFireChannelInfoResponse>> pageFireChannel(BaseListPageRequest param){ |
| | | log.info("【海康分页获取消防传感器列表】================开始===="+JSONObject.toJSONString(param)); |
| | | try { |
| | | String res = HKTools.pageFireChannel(JSONObject.toJSONString(param)); |
| | | TypeReference typeReference = |
| | | new TypeReference< BaseResponse<BaseListPageResponse<PageFireChannelInfoResponse>> >(){}; |
| | | BaseResponse<BaseListPageResponse<PageFireChannelInfoResponse>> result = JSONObject.parseObject(res, typeReference.getType()); |
| | | logResult(result,"海康分页获取消防传感器列表"); |
| | | return result; |
| | | }catch (Exception e){ |
| | | log.error("【海康分页获取消防传感器列表】================失败====:\n"+ e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | *查询消防传感器部件状态v2(分页) |
| | | * @return |
| | | */ |
| | | public static BaseResponse<BaseListPageResponse<PageSensorStatusResponse>> pageSensorStatus(SensorStatusListRequest param){ |
| | | log.info("【海康分页查询消防传感器部件状态v2】================开始===="+JSONObject.toJSONString(param)); |
| | | try { |
| | | String res = HKTools.pageSensorStatus(JSONObject.toJSONString(param)); |
| | | TypeReference typeReference = |
| | | new TypeReference< BaseResponse<BaseListPageResponse<PageSensorStatusResponse>> >(){}; |
| | | BaseResponse<BaseListPageResponse<PageSensorStatusResponse>> result = JSONObject.parseObject(res, typeReference.getType()); |
| | | logResult(result,"海康分页查询消防传感器部件状态v2"); |
| | | return result; |
| | | }catch (Exception e){ |
| | | log.error("【海康分页查询消防传感器部件状态v2】================失败====:\n"+ e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | *根据用户标识获取客户端TGC接口 |
| | | * @return |
| | | */ |