| | |
| | | import com.doumee.core.haikang.model.param.BaseResponse; |
| | | import com.hikvision.artemis.sdk.config.ArtemisConfig; |
| | | 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 java.io.InputStream; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | //@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){ |
| | | public static BaseResponse<OrgListResponse> getRootOrg(BaseRequst param){ |
| | | log.error("ãæµ·åº·è·åæ ¹ç»ç»ã================å¼å§===="); |
| | | 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 |
| | | */ |
| | | public BaseResponse editOrg(OrgEditRequest param){ |
| | | public static BaseResponse editOrg(OrgEditRequest param){ |
| | | log.error("ãæµ·åº·ä¿®æ¹ç»ç»ã================å¼å§===="+JSONObject.toJSONString(param)); |
| | | try { |
| | | |
| | |
| | | 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){ |
| | | public static BaseResponse<OrgOrUserAddResponse> addBatchOrg(List<OrgAddRequest> param){ |
| | | log.error("ãæµ·åº·æ°å¢ç»ç»ã================å¼å§===="+JSONObject.toJSONString(param)); |
| | | try { |
| | | |
| | |
| | | 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){ |
| | | public static BaseResponse delBatchOrg(OrgDelRequest param){ |
| | | log.error("ãæµ·åº·å é¤ç»ç»ã================å¼å§===="+JSONObject.toJSONString(param)); |
| | | try { |
| | | |
| | |
| | | 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){ |
| | | public static BaseResponse<UserAddResponse> addUser(UserAddRequest param){ |
| | | log.error("ãæµ·åº·æ°å¢äººåã================å¼å§===="+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){ |
| | | public static BaseResponse editUser(UserAddRequest param){ |
| | | log.error("ãæµ·åº·ä¿®æ¹äººåã================å¼å§===="+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){ |
| | | public static BaseResponse<OrgOrUserAddResponse> addBatchUser(List<UserAddRequest> param){ |
| | | log.error("ãæµ·åº·æ¹éæ°å¢äººåã================å¼å§===="+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){ |
| | | public static BaseResponse<OrgOrUserAddFailureResponse> delBatchUser(List<UserAddRequest> param){ |
| | | log.error("ãæµ·åº·æ¹éæ°å¢äººåã================å¼å§===="+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){ |
| | | public static BaseResponse<FaceAddOrEditesponse> addFace(List<FaceAddRequest> param){ |
| | | log.error("ãæµ·åº·æ·»å 人è¸ä¿¡æ¯ã================å¼å§===="+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){ |
| | | public static BaseResponse<FaceAddOrEditesponse> editFace(List<FaceEditRequest> param){ |
| | | log.error("ãæµ·åº·ç¼è¾äººè¸ä¿¡æ¯ã================å¼å§===="+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){ |
| | | public static BaseResponse delFace(List<FaceEditRequest> param){ |
| | | log.error("ãæµ·åº·å é¤äººè¸ä¿¡æ¯ã================å¼å§===="+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 BaseResponse<List<ParkListResponse>> parkList(ParkListRequest param){ |
| | | public static BaseResponse<List<ParkListResponse>> parkList(ParkListRequest param){ |
| | | log.error("ãæµ·è·å车åºåè¡¨æ°æ®ã================å¼å§===="+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){ |
| | | public static BaseResponse<List<EntranceListResponse>> entranceList(EntranceListRequest param){ |
| | | log.error("ãæµ·è·å车åºåè¡¨æ°æ®ã================å¼å§===="+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){ |
| | | public static BaseResponse carChargeAddtion(CarChargeAddRequest param){ |
| | | log.error("ãæµ·åº·åºå®è½¦è¾å
å¼ã================å¼å§===="+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){ |
| | | public static BaseResponse carChargeDeletion(CarChargeDelRequest param){ |
| | | log.error("ãæµ·åº·åºå®è½¦è¾åæ¶å
æã================å¼å§===="+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){ |
| | | public static BaseResponse<ParkReservationAddResponse> parkReservationAddition(ParkReservationAddRequest param){ |
| | | log.error("ãæµ·åº·è½¦ä½é¢çº¦ã================å¼å§===="+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){ |
| | | public static BaseResponse parkReservationDeletion(ParkReservationDelRequest param){ |
| | | log.error("ãæµ·åº·è½¦ä½åæ¶é¢çº¦ã================å¼å§===="+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){ |
| | | public static BaseResponse<VisitAppointmentResponse> visitAppiontment(VisitAppointmentRequest param){ |
| | | log.error("ãæµ·åº·è®¿å®¢é¢çº¦ã================å¼å§===="+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 |
| | | */ |
| | | public BaseResponse<VisitAppointmentVistorResponse> visitAppiontmentMDJ(VisitAppointmentMDJRequest param){ |
| | | public static BaseResponse<VisitAppointmentVistorResponse> visitAppiontmentMDJ(VisitAppointmentMDJRequest param){ |
| | | log.error("ãæµ·åº·è®¿å®¢å
ç»è®°é¢çº¦ã================å¼å§===="+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<PrivilegeGroupListResponse> privilegeGroup(PrivilegeGroupRequest param){ |
| | | public static BaseResponse<PrivilegeGroupListResponse> privilegeGroup(PrivilegeGroupRequest param){ |
| | | log.error("ãæµ·åº·è®¿å®¢æéç»å表æ¥è¯¢ã================å¼å§===="+JSONObject.toJSONString(param)); |
| | | try { |
| | | String res = HKTools.privilegeGroup(JSONObject.toJSONString(param)); |
| | | TypeReference typeReference = |
| | | new TypeReference< BaseResponse<PrivilegeGroupListResponse> >(){}; |
| | | BaseResponse<PrivilegeGroupListResponse> 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<AcsDeviceListResponse> acsDeviceList(AcsDeviceListRequest param){ |
| | | public static BaseResponse<AcsDeviceListResponse> acsDeviceList(AcsDeviceListRequest param){ |
| | | log.error("ãæµ·åº·é¨ç¦è®¾å¤æ¥è¯¢ã================å¼å§===="+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.error("ãæµ·åº·äºä»¶è®¢é
ã================å¼å§===="+JSONObject.toJSONString(param)); |
| | | try { |
| | | String 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()); |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |