|  |  |  | 
|---|
|  |  |  | package com.doumee.core.haikang.service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.request.*; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.respose.*; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.alibaba.fastjson.TypeReference; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.HKConstants; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.HKTools; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.BaseRequst; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.BaseResponse; | 
|---|
|  |  |  | import com.hikvision.artemis.sdk.config.ArtemisConfig; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.request.*; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.respose.*; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.slf4j.Logger; | 
|---|
|  |  |  | import org.slf4j.LoggerFactory; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.PostConstruct; | 
|---|
|  |  |  | import com.alibaba.fastjson.TypeReference; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.InputStream; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Service | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | public class HKService { | 
|---|
|  |  |  | private Logger logger = LoggerFactory.getLogger(HKService.class); | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz  systemDictDataBiz; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostConstruct | 
|---|
|  |  |  | public  int  initHkConfig(){ | 
|---|
|  |  |  | ArtemisConfig.host = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_HOST).getCode(); | 
|---|
|  |  |  | ArtemisConfig.appKey = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_APPKEY).getCode(); | 
|---|
|  |  |  | ArtemisConfig.appSecret = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_APPSECRET).getCode(); | 
|---|
|  |  |  | HKConstants.https = systemDictDataBiz.queryByCode(Constants.HK_PARAM, Constants.HK_HTTPS).getCode(); | 
|---|
|  |  |  | return  0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取根组织数据 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<OrgListResponse>  getRootOrg(BaseRequst param){ | 
|---|
|  |  |  | log.error("【海康获取根组织】================开始===="); | 
|---|
|  |  |  | public  static  BaseResponse<OrgListResponse>  getRootOrg(BaseRequst param){ | 
|---|
|  |  |  | log.info("【海康获取根组织】================开始===="); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.getRootOrg (); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<OrgListResponse>>(){}; | 
|---|
|  |  |  | BaseResponse<OrgListResponse> result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康获取根组织】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康获取根组织"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康获取根组织】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改组织数据 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse editOrg(OrgEditRequest param){ | 
|---|
|  |  |  | log.error("【海康修改组织】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse editOrg(OrgEditRequest param){ | 
|---|
|  |  |  | log.info("【海康修改组织】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String res = HKTools.editOrg(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse>(){}; | 
|---|
|  |  |  | BaseResponse  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康修改组织】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康修改组织"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康修改组织】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *批量新增组织数据 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<OrgOrUserAddResponse>  addBatchOrg(List<OrgAddRequest> param){ | 
|---|
|  |  |  | log.error("【海康新增组织】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<OrgOrUserAddResponse>  addBatchOrg(List<OrgAddRequest> param){ | 
|---|
|  |  |  | log.info("【海康新增组织】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String res = HKTools.addBatchOrg(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<OrgOrUserAddResponse>>(){}; | 
|---|
|  |  |  | BaseResponse<OrgOrUserAddResponse> result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康新增组织】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康新增组织"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康新增组织】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *批量删除组织数据 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse   delBatchOrg(OrgDelRequest param){ | 
|---|
|  |  |  | log.error("【海康删除组织】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse   delBatchOrg(OrgDelRequest param){ | 
|---|
|  |  |  | log.info("【海康删除组织】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String res = HKTools.delOrg(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse >(){}; | 
|---|
|  |  |  | BaseResponse result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康删除组织】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康删除组织"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康删除组织】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *新增人员信息(支持人脸数据) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<UserAddResponse>  addUser(UserAddRequest param){ | 
|---|
|  |  |  | log.error("【海康新增人员】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<UserAddResponse>  addUser(UserAddRequest param){ | 
|---|
|  |  |  | log.info("【海康新增人员】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.addUser(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<UserAddResponse>>(){}; | 
|---|
|  |  |  | BaseResponse<UserAddResponse> result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康新增人员】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康新增人员"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康新增人员】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *修改人员信息(不支持人脸数据) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse editUser(UserAddRequest param){ | 
|---|
|  |  |  | log.error("【海康修改人员】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse editUser(UserAddRequest param){ | 
|---|
|  |  |  | log.info("【海康修改人员】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.editUser(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<UserAddResponse>>(){}; | 
|---|
|  |  |  | BaseResponse<UserAddResponse> result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康修改人员】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康修改人员"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康修改人员】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *批量新增人员信息(无人脸) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<OrgOrUserAddResponse>  addBatchUser(List<UserAddRequest> param){ | 
|---|
|  |  |  | log.error("【海康批量新增人员】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<OrgOrUserAddResponse>  addBatchUser(List<UserAddRequest> param){ | 
|---|
|  |  |  | log.info("【海康批量新增人员】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.addBatchUser(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<OrgOrUserAddResponse>>(){}; | 
|---|
|  |  |  | BaseResponse<OrgOrUserAddResponse> result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康批量新增人员】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康批量新增人员"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康批量新增人员】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *批量删除人员信息 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<OrgOrUserAddFailureResponse>  delBatchUser(List<UserAddRequest> param){ | 
|---|
|  |  |  | log.error("【海康批量新增人员】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<OrgOrUserAddFailureResponse>  delBatchUser(List<UserAddRequest> param){ | 
|---|
|  |  |  | log.info("【海康批量新增人员】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.delBatchUser(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<OrgOrUserAddFailureResponse>>(){}; | 
|---|
|  |  |  | BaseResponse<OrgOrUserAddFailureResponse> result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康批量新增人员】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康批量新增人员"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康批量新增人员】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *添加人脸信息 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<FaceAddOrEditesponse>  addFace(List<FaceAddRequest> param){ | 
|---|
|  |  |  | log.error("【海康添加人脸信息】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<FaceAddOrEditesponse>  addFace(List<FaceAddRequest> param){ | 
|---|
|  |  |  | log.info("【海康添加人脸信息】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.addFace(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<FaceAddOrEditesponse>>(){}; | 
|---|
|  |  |  | BaseResponse<FaceAddOrEditesponse> result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康添加人脸信息】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康添加人脸信息"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康添加人脸信息】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *编辑人脸信息 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<FaceAddOrEditesponse>  editFace(List<FaceEditRequest> param){ | 
|---|
|  |  |  | log.error("【海康编辑人脸信息】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<FaceAddOrEditesponse>  editFace(List<FaceEditRequest> param){ | 
|---|
|  |  |  | log.info("【海康编辑人脸信息】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.editFace(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<FaceAddOrEditesponse>>(){}; | 
|---|
|  |  |  | BaseResponse<FaceAddOrEditesponse> result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康编辑人脸信息】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康编辑人脸信息"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康编辑人脸信息】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *删除人脸信息 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse   delFace(List<FaceEditRequest> param){ | 
|---|
|  |  |  | log.error("【海康删除人脸信息】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse   delFace(List<FaceEditRequest> param){ | 
|---|
|  |  |  | log.info("【海康删除人脸信息】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.editFace(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse>(){}; | 
|---|
|  |  |  | BaseResponse  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康删除人脸信息】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康删除人脸信息"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康删除人脸信息】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static InputStream getFaceInputStream(FacePictureRequest param) { | 
|---|
|  |  |  | log.error("【海康人脸访问图片流】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | log.info("【海康人脸访问图片流】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | InputStream res = HKTools.getFaceInputStream(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | log.error("【海康人脸访问图片流】================成功====\n"); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取访客记录中的图片 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static InputStream getVisitPicture(VisitPictureRequest param) { | 
|---|
|  |  |  | log.info("【海康访客图片流】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | InputStream res = HKTools.getVisitPicture(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | log.error("【海康访客图片流】================成功====\n"); | 
|---|
|  |  |  | return  res; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康访客图片流】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取门禁事件的图片 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static InputStream getDevicePicture(DevicePictureRequest param) { | 
|---|
|  |  |  | log.info("【海康门禁事件图片流】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | InputStream res = HKTools.getDevicePicture(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | log.error("【海康门禁事件图片流】================成功====\n"); | 
|---|
|  |  |  | return  res; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康门禁事件图片流】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询车辆抓拍图片 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static InputStream getCarPicture(CarPictureRequest param) { | 
|---|
|  |  |  | log.info("【海康车辆抓拍图片图片流】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | InputStream res = HKTools.getCarPicture(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | log.error("【海康车辆抓拍图片图片流】================成功====\n"); | 
|---|
|  |  |  | return  res; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康车辆抓拍图片图片流】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *获取车库列表数据(全量) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<List<ParkListResponse>>   parkList(ParkListRequest param){ | 
|---|
|  |  |  | log.error("【海获取车库列表数据】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<List<ParkListResponse>>   parkList(ParkListRequest param){ | 
|---|
|  |  |  | log.info("【海康获取车库列表数据】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.parkList(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<List<ParkListResponse>>>(){}; | 
|---|
|  |  |  | BaseResponse  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康获取车库列表数据】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康获取车库列表数据"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康获取车库列表数据】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *获取车库列表数据(全量) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<List<EntranceListResponse>>   entranceList(EntranceListRequest param){ | 
|---|
|  |  |  | log.error("【海获取车库列表数据】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<List<EntranceListResponse>>   entranceList(EntranceListRequest param){ | 
|---|
|  |  |  | log.info("【海获取车库列表数据】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.entranceList(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<List<EntranceListResponse>>>(){}; | 
|---|
|  |  |  | BaseResponse  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康获取车库列表数据】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康获取车库列表数据"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康获取车库列表数据】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *固定车辆充值(包期) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse   carChargeAddtion(CarChargeAddRequest param){ | 
|---|
|  |  |  | log.error("【海康固定车辆充值】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse   carChargeAddtion(CarChargeAddRequest param){ | 
|---|
|  |  |  | log.info("【海康固定车辆充值】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.carChargeAddtion(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse>(){}; | 
|---|
|  |  |  | BaseResponse  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康固定车辆充值】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康固定车辆充值"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康固定车辆充值】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *固定车辆取消包期 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse   carChargeDeletion(CarChargeDelRequest param){ | 
|---|
|  |  |  | log.error("【海康固定车辆取消包期】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse   carChargeDeletion(CarChargeDelRequest param){ | 
|---|
|  |  |  | log.info("【海康固定车辆取消包期】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.carChargeDeletion(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse>(){}; | 
|---|
|  |  |  | BaseResponse  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康固定车辆取消包期】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康固定车辆取消包期"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康固定车辆取消包期】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *车位预约 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<ParkReservationAddResponse>   parkReservationAddition(ParkReservationAddRequest param){ | 
|---|
|  |  |  | log.error("【海康车位预约】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<ParkReservationAddResponse>   parkReservationAddition(ParkReservationAddRequest param){ | 
|---|
|  |  |  | log.info("【海康车位预约】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.parkAddition(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<ParkReservationAddResponse>>(){}; | 
|---|
|  |  |  | BaseResponse<ParkReservationAddResponse>  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康车位预约】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康车位预约"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康车位预约】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *车位取消预约 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse   parkReservationDeletion(ParkReservationDelRequest param){ | 
|---|
|  |  |  | log.error("【海康车位取消预约】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse   parkReservationDeletion(ParkReservationDelRequest param){ | 
|---|
|  |  |  | log.info("【海康车位取消预约】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.carChargeDeletion(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse>(){}; | 
|---|
|  |  |  | BaseResponse  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康车位取消预约】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康车位取消预约"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康车位取消预约】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *访客预约 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<VisitAppointmentResponse>   visitAppiontment(VisitAppointmentRequest param){ | 
|---|
|  |  |  | log.error("【海康访客预约】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<VisitAppointmentResponse>   visitAppiontment(VisitAppointmentRequest param){ | 
|---|
|  |  |  | log.info("【海康访客预约】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.visitAppiontment(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<VisitAppointmentResponse>>(){}; | 
|---|
|  |  |  | BaseResponse<VisitAppointmentResponse>  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康访客预约】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康访客预约"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康访客预约】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *访客预约取消 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  static  BaseResponse   cancelVisitAppiontment(VisitAppointmentCancelRequest param){ | 
|---|
|  |  |  | log.info("【海康访客预约取消】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.visitCancel(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse>(){}; | 
|---|
|  |  |  | BaseResponse  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | logResult(result,"海康访客预约取消"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康访客预约取消】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *访客预约签离 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  static  BaseResponse  outVisitAppiontment(VisitAppointmentOutRequest param){ | 
|---|
|  |  |  | log.info("【海康访客预约签离】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.visitOut(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse>(){}; | 
|---|
|  |  |  | BaseResponse  result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | logResult(result,"海康访客预约签离"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康访客预约签离】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *访客免登记预约 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<VisitAppointmentVistorResponse>   visitAppiontmentMDJ(VisitAppointmentMDJRequest param){ | 
|---|
|  |  |  | log.error("【海康访客免登记预约】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<VisitAppointmentVistorResponse>   visitAppiontmentMDJ(VisitAppointmentMDJRequest param){ | 
|---|
|  |  |  | log.info("【海康访客免登记预约】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.visitAppiontmentMDJ(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<VisitAppointmentVistorResponse> >(){}; | 
|---|
|  |  |  | BaseResponse<VisitAppointmentVistorResponse>   result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康访客免登记预约】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康访客免登记预约"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康访客免登记预约】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | *访客权限组列表查询(分页) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<PrivilegeGroupResponse>   privilegeGroup(PrivilegeGroupRequest param){ | 
|---|
|  |  |  | log.error("【海康访客权限组列表查询】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<PrivilegeGroupListResponse>   privilegeGroup(PrivilegeGroupRequest param){ | 
|---|
|  |  |  | log.info("【海康访客权限组列表查询】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.privilegeGroup(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<PrivilegeGroupResponse> >(){}; | 
|---|
|  |  |  | BaseResponse<PrivilegeGroupResponse>   result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康访客权限组列表查询】================成功====\n"+res); | 
|---|
|  |  |  | new TypeReference< BaseResponse<PrivilegeGroupListResponse> >(){}; | 
|---|
|  |  |  | BaseResponse<PrivilegeGroupListResponse>   result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | logResult(result,"海康访客权限组列表查询"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康访客权限组列表查询】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *海康门禁点查询(分页) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  static  BaseResponse<DoorsListResponse>   doorSearch(DoorsListRequest param){ | 
|---|
|  |  |  | log.info("【海康门禁点查询】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.doorSearch(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<DoorsListResponse> >(){}; | 
|---|
|  |  |  | BaseResponse<DoorsListResponse>   result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | logResult(result,"海康门禁点查询"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康门禁点查询】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *门禁设备查询(分页) | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  BaseResponse<AcsDeviceListResponse>   acsDeviceList(AcsDeviceListRequest param){ | 
|---|
|  |  |  | log.error("【海康门禁设备查询】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | public  static  BaseResponse<AcsDeviceListResponse>   acsDeviceList(AcsDeviceListRequest param){ | 
|---|
|  |  |  | log.info("【海康门禁设备查询】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String res = HKTools.acsDeviceList(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse<AcsDeviceListResponse> >(){}; | 
|---|
|  |  |  | BaseResponse<AcsDeviceListResponse>   result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | log.error("【海康门禁设备查询】================成功====\n"+res); | 
|---|
|  |  |  | logResult(result,"海康门禁设备查询"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康门禁设备查询】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *事件订阅 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  static  BaseResponse   eventSub(EventSubRequest param){ | 
|---|
|  |  |  | log.info("【海康事件订阅】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | String res = null; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | res = HKTools.eventSub(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse >(){}; | 
|---|
|  |  |  | BaseResponse   result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | logResult(result,"海康事件订阅"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康事件订阅】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | }finally { | 
|---|
|  |  |  | // saveInterfaceLog(param,res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *事件订阅 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public  static  BaseResponse   cancelEventSub(EventSubRequest param){ | 
|---|
|  |  |  | log.info("【海康取消事件订阅】================开始===="+JSONObject.toJSONString(param)); | 
|---|
|  |  |  | String res = null; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | res = HKTools.cancelEventSub(JSONObject.toJSONString(param)); | 
|---|
|  |  |  | TypeReference typeReference = | 
|---|
|  |  |  | new TypeReference< BaseResponse >(){}; | 
|---|
|  |  |  | BaseResponse   result = JSONObject.parseObject(res, typeReference.getType()); | 
|---|
|  |  |  | logResult(result,"海康取消事件订阅"); | 
|---|
|  |  |  | return  result; | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("【海康取消事件订阅】================失败====:\n"+ e.getMessage()); | 
|---|
|  |  |  | }finally { | 
|---|
|  |  |  | // saveInterfaceLog(param,res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static void logResult(BaseResponse res,String name) { | 
|---|
|  |  |  | if(StringUtils.equals(res.getCode(),HKConstants.RESPONSE_SUCCEE)){ | 
|---|
|  |  |  | log.info("【"+name+"】================成功====\n"+res); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | log.error("【"+name+"】================失败====:\n"+ res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|