nidapeng
2024-03-28 d16520069e7a89b5ac0d13d0c8ba4e30af023279
server/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java
@@ -4,6 +4,7 @@
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.BaseListPageResponse;
import com.doumee.core.haikang.model.param.BaseRequst;
import com.doumee.core.haikang.model.param.BaseResponse;
import com.doumee.core.haikang.model.param.request.*;
@@ -23,13 +24,13 @@
     * 获取根组织数据
     * @return
     */
    public  static  BaseResponse<OrgListResponse>  getRootOrg(BaseRequst param){
    public  static  BaseResponse<OrgInfoResponse>  getRootOrg(BaseRequst param){
        log.info("【海康获取根组织】================开始====");
        try {
            String res = HKTools.getRootOrg ();
            TypeReference typeReference =
                    new TypeReference< BaseResponse<OrgListResponse>>(){};
            BaseResponse<OrgListResponse> result = JSONObject.parseObject(res, typeReference.getType());
                    new TypeReference< BaseResponse<OrgInfoResponse>>(){};
            BaseResponse<OrgInfoResponse> result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康获取根组织");
            return  result;
        }catch (Exception e){
@@ -208,7 +209,7 @@
    public  static  BaseResponse   delFace(List<FaceEditRequest> param){
        log.info("【海康删除人脸信息】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.editFace(JSONObject.toJSONString(param));
            String res = HKTools.delFace(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
@@ -782,7 +783,204 @@
        }
        return  null;
    }
    /**
     *查询访客预约记录(分页)
     * @return
     */
    public  static  BaseResponse<BaseListPageResponse<AppointmentInfoResponse>>   appointmentRecords(AppointmentListRequest param){
        log.info("【海康访客预约记录查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.appointmentRecords(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<AppointmentInfoResponse>>>(){};
            BaseResponse<BaseListPageResponse<AppointmentInfoResponse>>   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<VisitingInfoResponse>>   visitingRecords(VisitingInfoRequest param){
        log.info("【海康访客来访记录查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.visitingRecords(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<VisitingInfoResponse>>>(){};
            BaseResponse<BaseListPageResponse<VisitingInfoResponse>>   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<OrgInfoResponse>>   orgAllList(TimeRangeListRequest param){
        log.info("【海康全量组织查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.orgAllList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<OrgInfoResponse>>> (){};
            BaseResponse<BaseListPageResponse<OrgInfoResponse>>   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<OrgTimeRangeInfoResponse>>   orgTimeRangeList(TimeRangeListRequest param){
        log.info("【海康增量组织查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.orgTimeRangeList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<OrgTimeRangeInfoResponse>> >(){};
            BaseResponse<BaseListPageResponse<OrgTimeRangeInfoResponse>>   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<UserInfoResponse>>   userAllList(TimeRangeListRequest param){
        log.info("【海康全量人员查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.userAllList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<UserInfoResponse>> >(){};
            BaseResponse<BaseListPageResponse<UserInfoResponse>>   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<UserTimeRangeInfoResponse>>   userTimeRangeList(TimeRangeListRequest param){
        log.info("【海康增量人员查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.userTimeRangeList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<UserTimeRangeInfoResponse>> >(){};
            BaseResponse<BaseListPageResponse<UserTimeRangeInfoResponse>>   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<VehicleInfoResponse>>   vehicleList(TimeRangeListRequest param){
        log.info("【海康全量人员查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.vehicleList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<VehicleInfoResponse>> >(){};
            BaseResponse<BaseListPageResponse<VehicleInfoResponse>>   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<ParkCrossRecordInfoResponse>>   parkCrossRecords(ParkCrossRecordListRequest param){
        log.info("【海康过车记录查询查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.parkCrossRecords(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<ParkCrossRecordInfoResponse>> >(){};
            BaseResponse<BaseListPageResponse<ParkCrossRecordInfoResponse>>   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<VehicleTimeRangeInfoResponse>>   vehicleTimeRangeList(TimeRangeListRequest param){
        log.info("【海康增量人员查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.vehicleTimeRangeList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<VehicleTimeRangeInfoResponse>> >(){};
            BaseResponse<BaseListPageResponse<VehicleTimeRangeInfoResponse>>   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<VehicleTimeRangeInfoResponse>>   facePictureCheck(TimeRangeListRequest param){
        log.info("【海康增量人员查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.facePictureCheck(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<VehicleTimeRangeInfoResponse>> >(){};
            BaseResponse<BaseListPageResponse<VehicleTimeRangeInfoResponse>>   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<AscDeviceStatusInfoResponse>>   acsDeviceStatus(AcsDeviceStatusListRequest param){
        log.info("【海康获取门禁设备在线状态】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.acsDeviceStatus(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<AscDeviceStatusInfoResponse>> >(){};
            BaseResponse<BaseListPageResponse<AscDeviceStatusInfoResponse>>   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);