jiangping
2025-06-30 ccbcb9487250f063dc7c4e72cfa18228dca8dac8
server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java
@@ -7,22 +7,24 @@
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.DateUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Slf4j
public class HKService {
    private static String[] args;
    private Logger logger = LoggerFactory.getLogger(HKService.class);
    /**
     * 获取根组织数据
@@ -230,6 +232,8 @@
     */
    public static InputStream getFaceInputStream(FacePictureRequest param) {
        log.info("【海康人脸访问图片流】================开始===="+JSONObject.toJSONString(param));
        log.error("********************ArtemisConfig.host***********************************"+ ArtemisConfig.host);
        log.error("********************ArtemisConfig.key********************************"+ArtemisConfig.appKey);
        try {
            InputStream res = HKTools.getFaceInputStream(JSONObject.toJSONString(param));
            log.error("【海康人脸访问图片流】================成功====\n");
@@ -357,6 +361,8 @@
        }
        return  null;
    }
    /**
     *车位预约
     * @return
@@ -375,6 +381,7 @@
        }
        return  null;
    }
    /**
     *车位取消预约
     * @return
@@ -382,7 +389,7 @@
    public  static  BaseResponse   parkReservationDeletion(ParkReservationDelRequest param){
        log.info("【海康车位取消预约】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.carChargeDeletion(JSONObject.toJSONString(param));
            String res = HKTools.parkDeletion(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
@@ -404,6 +411,24 @@
            TypeReference typeReference =
                    new TypeReference< BaseResponse<VisitAppointmentResponse>>(){};
            BaseResponse<VisitAppointmentResponse>  result = JSONObject.parseObject(res, typeReference.getType());
           logResult(result,"海康访客预约");
            return  result;
        }catch (Exception e){
            log.error("【海康访客预约】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *访客预约
     * @return
     */
    public  static  BaseResponse<IccmAppointmentResponse>   iccmAppointment(IccmAppointmentRequest param){
        log.info("【海康访客预约】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.iccmAppointment(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<IccmAppointmentResponse>>(){};
            BaseResponse<IccmAppointmentResponse>  result = JSONObject.parseObject(res, typeReference.getType());
           logResult(result,"海康访客预约");
            return  result;
        }catch (Exception e){
@@ -448,6 +473,42 @@
        return  null;
    }
    /**
     *iccm访客预约签离
     * @return
     */
    public  static  BaseResponse  iccmSignoff(VisitAppointmentOutRequest param){
        log.info("【海康iccm访客预约签离】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.iccmSignoff(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
           logResult(result,"海康iccm访客预约签离");
            return  result;
        }catch (Exception e){
            log.error("【海康iccm访客预约签离】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *iccm访客预约取消
     * @return
     */
    public  static  BaseResponse  iccmCancelAppointment(VisitAppointmentCancelRequest param){
        log.info("【海康iccm访客预约取消】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.iccmCancelAppointment(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse>(){};
            BaseResponse  result = JSONObject.parseObject(res, typeReference.getType());
           logResult(result,"海康iccm访客预约取消");
            return  result;
        }catch (Exception e){
            log.error("【海康iccm访客预约取消】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *访客免登记预约
     * @return
     */
@@ -462,6 +523,24 @@
            return  result;
        }catch (Exception e){
            log.error("【海康访客免登记预约】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *访客免登记预约
     * @return
     */
    public  static  BaseResponse<IccmAppointmentMDJResponse>   iccmAppiontmentMDJ(IccmAppointmentMDJRequest param){
        log.info("【海康访客免登记预约】================iccm开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.iccmAppointmentMDJ(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<IccmAppointmentMDJResponse> >(){};
            BaseResponse<IccmAppointmentMDJResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康访客免登记预约");
            return  result;
        }catch (Exception e){
            log.error("【海康访客免登记预约】================iccm失败====:\n"+ e.getMessage());
        }
        return  null;
    }
@@ -824,6 +903,250 @@
        return  null;
    }
    /**
     *查询访客预约记录(分页)
     * @return
     */
    public  static  BaseResponse<BaseListPageResponse<IccmAppointmentListResponse>>   iccmAppointmentRecords(IccmAppointmentListRequest param){
        log.info("【海康访客预约记录查询】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.iccmAppointmentRecords(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<IccmAppointmentListResponse>>>(){};
            BaseResponse<BaseListPageResponse<IccmAppointmentListResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康访客预约记录查询");
            return  result;
        }catch (Exception e){
            log.error("【海康访客预约记录查询】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *1.9.1根据微信公众号信息获取AccessToken(分页)
     * @return
     */
    public  static  BaseResponse<String>   wxAccessToken(String configId,String tagId){
        log.info("【海康根据微信公众号信息获取AccessToken】================开始====configId:"+configId+" && tagId:"+tagId);
        try {
            HashMap<String,String> params = new HashMap<>();
            params.put("tagId",tagId);
            params.put("configId",configId);
            String res = HKTools.wxAccessToken(params);
            TypeReference typeReference =
                    new TypeReference<BaseResponse<String>>(){};
            BaseResponse<String>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康根据微信公众号信息获取AccessToken");
            return  result;
        }catch (Exception e){
            log.error("【海康根据微信公众号信息获取AccessToken】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *根据配置微信公众号编号查询微信公众号信息
     * @return
     */
    public  static  BaseResponse< WxConfigInfoResponse>  getWxConfig(WxConfigInfoRequest param){
        log.info("【海康根据配置微信公众号编号查询微信公众号信息】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.getWxConfig(toMap(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<WxConfigInfoResponse>>(){};
            BaseResponse<WxConfigInfoResponse>   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<GetTodoListResponse>>   getTodoListPage(GetTodoListRequest param){
        log.info("【海康分页获取待办列表】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.getTodoListPage(toMap(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<GetTodoListResponse>>>(){};
            BaseResponse<BaseListPageResponse<GetTodoListResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康分页获取待办列表");
            return  result;
        }catch (Exception e){
            log.error("【海康分页获取待办列表】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *消防看板-4温湿度统计
     * @return
     */
    public  static  BaseResponse<BaseListPageResponse<TemperatureHumidityDataResponse>>  temperatureHumidityDataStatistic(TemperatureHumidityDataRequest param){
        log.info("【海康消防看板-4温湿度统计】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.temperatureHumidityDataStatistic(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<TemperatureHumidityDataResponse> >>(){};
            BaseResponse<BaseListPageResponse<TemperatureHumidityDataResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康消防看板-4温湿度统计");
            return  result;
        }catch (Exception e){
            log.error("【海康消防看板-4温湿度统计】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *消防看板-4获取区域用量排名-能耗看板
     * @return
     */
    public  static  BaseResponse<List<RegionDataRankingDataResponse>>  regionDataRanking(RegionDataRankingDataRequest param){
        log.info("【海康消防看板-4获取区域用量排名-能耗看板】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.regionDataRanking(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<List<RegionDataRankingDataResponse> >>(){};
            BaseResponse<List<RegionDataRankingDataResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康消防看板-4获取区域用量排名-能耗看板");
            return  result;
        }catch (Exception e){
            log.error("【海康消防看板-4获取区域用量排名-能耗看板】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *消防看板-4获取区域用量排名-能耗看板
     * @return
     */
    public  static  BaseResponse<EnergyTotalDataResponse>  energyTotal(EnergyTotalDataRequest param){
        log.info("【海康消防看板-4根据时间和时间维度获取园区能耗数据】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.energyTotal(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<EnergyTotalDataResponse >>(){};
            BaseResponse<EnergyTotalDataResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康消防看板-4根据时间和时间维度获取园区能耗数据");
            return  result;
        }catch (Exception e){
            log.error("【海康消防看板-4根据时间和时间维度获取园区能耗数据】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *分页查询消防设备部件状态
     * @return
     */
    public  static  BaseResponse<BaseListPageResponse<FireDeviceStatusListResponse>>   fireDeviceStatusSearch(FireDeviceStatuslListRequest param){
        log.info("【海康查询消防设备部件状态】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.fireDeviceStatusSearch(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<FireDeviceStatusListResponse>>>(){};
            BaseResponse<BaseListPageResponse<FireDeviceStatusListResponse>>   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<SensorStatusListResponse>>   sensorStatusSearch(SensorStatusListRequest param){
        log.info("【海康分页查询消防传感器部件状态】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.sensorStatusSearch(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<SensorStatusListResponse>>>(){};
            BaseResponse<BaseListPageResponse<SensorStatusListResponse>>   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<FireChannelListResponse>>   fireChannelSearch(FireChannelListRequest param){
        log.info("【海康查询消防传感器列表】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.fireChannelSearch(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<FireChannelListResponse>>>(){};
            BaseResponse<BaseListPageResponse<FireChannelListResponse>>   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<FindDeviceAlarmListResponse>>   findDeviceAlarmPage(FindDeviceAlarmListRequest param){
        log.info("【海康分页查询设备下的所有报警记录】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.findDeviceAlarmPage(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<FindDeviceAlarmListResponse>>>(){};
            BaseResponse<BaseListPageResponse<FindDeviceAlarmListResponse>>   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<FireDeviceListResponse>>   fireDeviceSearch(FireDeviceListRequest param){
        log.info("【海康询消防设备列表】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.fireDeviceSearch(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<FireDeviceListResponse>>>(){};
            BaseResponse<BaseListPageResponse<FireDeviceListResponse>>   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<NhEventPageListResponse>>   nhEventPageList(NhEventPageListRequest param){
        log.info("【海康分页获取告警事件】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.nhEventPageList(toMap(param));
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<NhEventPageListResponse>>>(){};
            BaseResponse<BaseListPageResponse<NhEventPageListResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康分页获取告警事件");
            return  result;
        }catch (Exception e){
            log.error("【海康分页获取告警事件】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *查询访客来访记录(已登记)(分页)
     * @return
     */
@@ -856,6 +1179,41 @@
            return  result;
        }catch (Exception e){
            log.error("【海康全量组织查询】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *获取工作台菜单免密登陆调整地址
     * @return
     */
    public  static  String   getMenuUrl(Integer type,String token){
        String componentId = HKConstants.MenuPageId.componentIds[0];
        String menuId = HKConstants.MenuPageId.afzx;
        if(Constants.equalsInteger(type,Constants.ONE)){
            menuId = HKConstants.MenuPageId.xkzx;
        }else  if(Constants.equalsInteger(type,Constants.TWO)){
            menuId = HKConstants.MenuPageId.ngzx;
        }else  if(Constants.equalsInteger(type,Constants.THREE)){
            menuId = HKConstants.MenuPageId.jsc;
        }else  if(Constants.equalsInteger(type,Constants.FOUR)){
            menuId = HKConstants.MenuPageId.kqgzt;
        }else  if(Constants.equalsInteger(type,Constants.FIVE)){
            componentId = HKConstants.MenuPageId.componentIds[1];
            menuId = HKConstants.MenuPageId.kqdbcl;
        }else  if(Constants.equalsInteger(type,Constants.SIX)){
            componentId = HKConstants.MenuPageId.componentIds[2];
            menuId = HKConstants.MenuPageId.stxf;
//            return "https://10.50.250.253:443/xauthplus-plugin/thirdLogin?type=third&service=https://10.50.250.253:443/cems/config/generalCard&token="+token;
        }else if(Constants.equalsInteger(type,7)){
            menuId = HKConstants.MenuPageId.hqzx;
        }
        log.info("【海康获取工作台菜单免密登陆调整地址】================开始====menuId:"+menuId+"==token:"+token);
        try {
            ///xauthplus-plugin/thirdLogin?type=third&componentId=${componentId}&componentMenuId=${menuId}&token=${token}
            String res = HKTools.getMenuUrl(componentId,menuId,token);
            return  res;
        }catch (Exception e){
            log.error("【海康获取工作台菜单免密登陆调整地址】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
@@ -986,20 +1344,20 @@
        return  null;
    }
    /**
     *增量车辆查询(分页)
     *人脸评分
     * @return
     */
    public  static  BaseResponse<BaseListPageResponse<VehicleTimeRangeInfoResponse>>   facePictureCheck(TimeRangeListRequest param){
        log.info("【海康增量人员查询】================开始===="+JSONObject.toJSONString(param));
    public  static  BaseResponse<FacePictureCheckResponse>   facePictureCheck(FacePictureCheckRequest 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,"海康增量人员查询");
                    new TypeReference<BaseResponse<FacePictureCheckResponse>>(){};
            BaseResponse<FacePictureCheckResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"人脸评分");
            return  result;
        }catch (Exception e){
            log.error("【海康增量人员查询】================失败====:\n"+ e.getMessage());
            log.error("【人脸评分】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
@@ -1075,6 +1433,10 @@
        }
        return  null;
    }
    /**
     *获取月台组件配置的LED设备清单
     * @return
@@ -1097,13 +1459,13 @@
     *用于设置广播的自定播放和停止
     * @return
     */
    public  static  BaseResponse<BaseListPageResponse<LedRecordsInfoResponse>>   customBroadcast(CustomBroadcastRequest param){
    public  static  BaseResponse    customBroadcast(CustomBroadcastRequest param){
        log.info("【海康用于设置广播的自定播放和停止】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.customBroadcast(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<LedRecordsInfoResponse>> >(){};
            BaseResponse<BaseListPageResponse<LedRecordsInfoResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
                    new TypeReference< BaseResponse>(){};
            BaseResponse    result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康用于设置广播的自定播放和停止");
            return  result;
        }catch (Exception e){
@@ -1118,7 +1480,7 @@
    public  static  BaseResponse<BaseListPageResponse<PlatformStatusInfoResponse>>   platformStatus(PlatformStatusRequest param) {
        log.info("【海康获取全部月台信息】================开始====" + JSONObject.toJSONString(param));
        try {
            String res = HKTools.platformStatus(JSONObject.toJSONString(param));
            String res = HKTools.platformStatus(param.getPlatformIds());
            TypeReference typeReference =
                    new TypeReference<BaseResponse<BaseListPageResponse<PlatformStatusInfoResponse>>>() {
                    };
@@ -1129,7 +1491,6 @@
            log.error("【海康获取全部月台信息】================失败====:\n" + e.getMessage());
        }
        return null;
    }
    /**
     *发送消息给LED
@@ -1155,7 +1516,9 @@
        Class<?> clazz = obj.getClass();
        for (Field field : clazz.getDeclaredFields()) {
            field.setAccessible(true); // 使得私有字段也可以访问
            map.put(field.getName(), (String) field.get(obj));
            if(field.get(obj)!=null){
                map.put(field.getName(), String.valueOf( field.get(obj)));
            }
        }
        return map;
    }
@@ -1177,6 +1540,492 @@
        }
        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;
    }
    /**
     *安防看板-今日告警事件-根据eventType字段3
     * @return
     */
    public  static  BaseResponse<BaseListPageResponse<RuleEventSearchDataResponse>>   ruleEventSearch(RuleEventSearchRequest param){
        log.info("【海康安防看板-今日告警事件-根据eventType字段3】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.ruleEventSearch(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<RuleEventSearchDataResponse>> >(){};
            BaseResponse<BaseListPageResponse<RuleEventSearchDataResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康安防看板-今日告警事件-根据eventType字段3");
            return  result;
        }catch (Exception e){
            log.error("【海康安防看板-今日告警事件-根据eventType字段3】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *安防看板-- 分页查询未处理报警信息6
     * @return
     */
    public  static  BaseResponse<BaseListPageResponse<FindHomeAlarmInfoPageResponse>>   findHomeAlarmInfoPage(FindHomeAlarmInfoPageRequest param){
        log.info("【海康安防看板-- 分页查询未处理报警信息6】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.findHomeAlarmInfoPage(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<FindHomeAlarmInfoPageResponse>> >(){};
            BaseResponse<BaseListPageResponse<FindHomeAlarmInfoPageResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康安防看板-- 分页查询未处理报警信息6");
            return  result;
        }catch (Exception e){
            log.error("【海康安防看板-- 分页查询未处理报警信息6】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *保存用户及openId绑定信息微信公众号
     * @return
     */
    public  static  BaseResponse<Integer>   userOpenidSave(UserOpenidSaveRequest param){
        log.info("【海康保存用户及openId绑定信息微信公众号】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.userOpenidSave(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<Integer>>(){};
            BaseResponse<Integer>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康保存用户及openId绑定信息微信公众号");
            return  result;
        }catch (Exception e){
            log.error("【海康保存用户及openId绑定信息微信公众号】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *通过openId或userName等删除绑定信息
     * @return
     */
    public  static  BaseResponse  userOpenidDel(UserOpenidSaveRequest param){
        log.info("【海康通过openId或userName等删除绑定信息】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.userOpenidDel(toMap(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse >(){};
            BaseResponse<Integer>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康通过openId或userName等删除绑定信息");
            return  result;
        }catch (Exception e){
            log.error("【海康通过openId或userName等删除绑定信息】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *分页查询设备监测历史数据
     * @return
     */
    public  static  BaseResponse<BaseListPageResponse<MonitorDataSearchResponse>>   minitorDataSearch(MinitorDataSearchRequest param){
        log.info("【海康分页查询设备监测历史数据】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.minitorDataSearch(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<MonitorDataSearchResponse>> >(){};
            BaseResponse<BaseListPageResponse<MonitorDataSearchResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康分页查询设备监测历史数据");
            return  result;
        }catch (Exception e){
            log.error("【海康分页查询设备监测历史数据】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *统计统安防看板--园区实时车数量4
     * @return
     */
    public  static  BaseResponse<ParkingStatisticResponse>   getParkingStatistics(){
        log.info("【海康安防看板--园区实时车数量4】================开始====");
        try {
            String res = HKTools.getParkingStatistics();
            TypeReference typeReference =
                    new TypeReference< BaseResponse<ParkingStatisticResponse>>(){};
            BaseResponse<ParkingStatisticResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康安防看板--园区实时车数量4");
            return  result;
        }catch (Exception e){
            log.error("【海康安防看板--园区实时车数量4】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     * 能耗看板-3.获取各区域用能及总能耗
     * @param powerType 能源类型 电-1 水-2 气-3 热-4
     * @return
     */
    public  static  BaseResponse<RegionEnergyListResponse>   regionEnergyList(String  powerType){
        log.info("【海康能耗看板-3.获取各区域用能及总能耗】================开始====");
        try {
            Map<String,String>   map = new HashMap<>();
            map.put("powerType",powerType);
            String res = HKTools.regionEnergyList(map);
            TypeReference typeReference =
                    new TypeReference< BaseResponse<RegionEnergyListResponse>>(){};
            BaseResponse<RegionEnergyListResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"【海康能耗看板-3.获取各区域用能及总能耗】");
            return  result;
        }catch (Exception e){
            log.error("【海康能耗看板-3.获取各区域用能及总能耗】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     * 能耗看板-4.获取上月用能费用,一天刷新,凌晨某个点刷
     * @param powerType 能源类型 电-1 水-2 气-3 热-4
     * @return
     */
    public  static  BaseResponse<LastMonthFeeByMeterTypeResponse>   lastMonthFeeByMeterType(String  powerType){
        log.info("【海康能耗看板-4.获取上月用能费用,一天刷新,凌晨某个点刷】================开始====");
        try {
            Map<String,String>   map = new HashMap<>();
            map.put("powerType",powerType);
            String res = HKTools.lastMonthFeeByMeterType(map);
            TypeReference typeReference =  new TypeReference< BaseResponse<LastMonthFeeByMeterTypeResponse>>(){};
            BaseResponse<LastMonthFeeByMeterTypeResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"【海康能耗看板-4.获取上月用能费用,一天刷新,凌晨某个点刷】");
            return  result;
        }catch (Exception e){
            log.error("【海康能耗看板-4.获取上月用能费用,一天刷新,凌晨某个点刷】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     * 海康能耗看板-5.园区实时负荷曲线
     * @return
     */
    public  static  BaseResponse<List<EnergyTodayLoadDataResponse>>   energyTodayLoadData(){
        log.info("【海康能耗看板-5.园区实时负荷曲线】================开始====");
        try {
            String res = HKTools.energyTodayLoadData();
            TypeReference typeReference =  new TypeReference< BaseResponse<List<EnergyTodayLoadDataResponse>>>(){};
            BaseResponse<List<EnergyTodayLoadDataResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"【海康能耗看板-5.园区实时负荷曲线】");
            return  result;
        }catch (Exception e){
            log.error("【海康能耗看板-5.园区实时负荷曲线】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     * 能耗看板-2.获取区域用能前N位
     * @param param
     * @return
     */
    public  static  BaseResponse<List<RegionTopPowerResponse>>   regionTopPower(RegionTopPowerRequest   param){
        log.info("【海康能耗看板-2.获取区域用能前N位】================开始====");
        try {
            String res = HKTools.regionTopPower(toMap(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<List<RegionTopPowerResponse>>>(){};
            BaseResponse<List<RegionTopPowerResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康能耗看板-2.获取区域用能前N位");
            return  result;
        }catch (Exception e){
            log.error("【海康能耗看板-2.获取区域用能前N位】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     * 能耗看板-1.获取本月用能总量-自然月
     * @param powerType 能源类型 电-1 水-2 气-3 热-4
     * @return
     */
    public  static  BaseResponse<MonthDataByMeterTypeResponse>   getCurrentMonthDataByMeterType(String  powerType){
        log.info("【能耗看板-1.获取本月用能总量-自然月】================开始====");
        try {
            Map<String,String>   map = new HashMap<>();
            map.put("powerType",powerType);
            String res = HKTools.getCurrentMonthDataByMeterType(map);
            TypeReference typeReference =
                    new TypeReference< BaseResponse<MonthDataByMeterTypeResponse>>(){};
            BaseResponse<MonthDataByMeterTypeResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"能耗看板-1.获取本月用能总量-自然月");
            return  result;
        }catch (Exception e){
            log.error("【能耗看板-1.获取本月用能总量-自然月】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *统计园区总体的安防设备数量,在线数、在线率、离线数、离线率
     * @return
     */
    public  static  BaseResponse<List<SecureDevStatusTotalResponse>>   getSecureDevStatusTotal(SecureDevStatusTotalRequest param){
        log.info("【海康统计园区总体的安防设备数量,在线数、在线率、离线数、离线率】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.getSecureDevStatusTotal(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<List<SecureDevStatusTotalResponse>> >(){};
            BaseResponse<List<SecureDevStatusTotalResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康统计园区总体的安防设备数量,在线数、在线率、离线数、离线率");
            return  result;
        }catch (Exception e){
            log.error("【海康统计园区总体的安防设备数量,在线数、在线率、离线数、离线率】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *安防看板-园区安防设备-各类型设备状态数据列表
     * @return
     */
    public  static  BaseResponse<List<SecureDevStatusListResponse>>   getSecureDevStatusList(SecureDevStatusTotalRequest param){
        log.info("【海康安防看板-园区安防设备-各类型设备状态数据列表】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.getSecureDevStatusList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<List<SecureDevStatusListResponse>> >(){};
            BaseResponse<List<SecureDevStatusListResponse>>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康安防看板-园区安防设备-各类型设备状态数据列表");
            return  result;
        }catch (Exception e){
            log.error("【海康安防看板-园区安防设备-各类型设备状态数据列表】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *能耗看板-6按月查询近12个月的用电总量数据
     * @return
     */
    public  static  BaseResponse<EnergyTrendResponse>   energyTrend(EnergyTrendRequest param){
        log.info("【海康能耗看板-6按月查询近12个月的用电总量数据】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.energyTrend(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<EnergyTrendResponse>>(){};
            BaseResponse<EnergyTrendResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康能耗看板-6按月查询近12个月的用电总量数据");
            return  result;
        }catch (Exception e){
            log.error("【海康能耗看板-6按月查询近12个月的用电总量数据】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *消防维保统计
     * @return
     */
    public  static  BaseResponse<FireStatisticResponse>   fireStatistic(FireStatisticRequest param){
        log.info("【海康消防维保统计】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.fireStatistic(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<FireStatisticResponse>>(){};
            BaseResponse<FireStatisticResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康消防维保统计");
            return  result;
        }catch (Exception e){
            log.error("【海康消防维保统计】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *本月新增维保设备数
     * api_fire_statistic_month
     * @return
     */
    public  static  BaseResponse<FireStatisticResponse>   fireStatisticMonth(FireStatisticRequest param){
        log.info("【海康消防维保统计每月新增】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.fireStatisticMonth(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<FireStatisticResponse>>(){};
            BaseResponse<FireStatisticResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康消防维保统计每月新增");
            return  result;
        }catch (Exception e){
            log.error("【海康消防维保统计每月新增】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *消防看板-消防设备在离线1
     * @return
     */
    public  static  BaseResponse<List<SecureDevStatusTotalResponse> >  getFireDevStatusTotal(FireDevStatusTotalRequest param){
        log.info("【海康消防看板-消防设备在离线1】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.getFireDevStatusTotal(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<List<SecureDevStatusTotalResponse> >>(){};
            BaseResponse<List<SecureDevStatusTotalResponse> >   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康消防看板-消防设备在离线1");
            return  result;
        }catch (Exception e){
            log.error("【海康消防看板-消防设备在离线1】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *消防看板-各类型设备在线率2
     * @return
     */
    public  static  BaseResponse<List<FireDevStatusListResponse> >  getFireDevStatusList(FireDevStatusTotalRequest param){
        log.info("【海康消防看板-各类型设备在线率2】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.getFireDevStatusList(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<List<FireDevStatusListResponse> >>(){};
            BaseResponse<List<FireDevStatusListResponse> >   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康消防看板-各类型设备在线率2");
            return  result;
        }catch (Exception e){
            log.error("【海康消防看板-各类型设备在线率2】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *分页查询设备的以及下属传感器数据的状态统计
     * @return
     */
    public  static  BaseResponse<List<FindDeviceStatisticsResponse> >  findDeviceStatistics(FindDeviceStatisticsRequest param){
        log.info("【分页查询设备的以及下属传感器数据的状态统计】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.findDeviceStatistics(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<List<FindDeviceStatisticsResponse> >>(){};
            BaseResponse<List<FindDeviceStatisticsResponse> >   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<ResourcesByParamsResponse>>  resourcesByParams(ResourcesByParamsRequest param){
        log.info("【海康消防看板】根据条件查询目录下有权限的资源列表================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.resourcesByParams(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<BaseListPageResponse<ResourcesByParamsResponse> >>(){};
            BaseResponse<BaseListPageResponse<ResourcesByParamsResponse> >   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"【海康消防看板】根据条件查询目录下有权限的资源列表");
            return  result;
        }catch (Exception e){
            log.error("【海康消防看板】根据条件查询目录下有权限的资源列表================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *消防看板-4报警信息统计
     * @return
     */
    public  static  BaseResponse<FindAlarmBaseDataStatisticResponse>  findAlarmBaseDataStatistic(FindAlarmBaseDataStatisticRequest param){
        log.info("【海康消防看板-4报警信息统计】================开始===="+JSONObject.toJSONString(param));
        try {
            String res = HKTools.findAlarmBaseDataStatistic(JSONObject.toJSONString(param));
            TypeReference typeReference =
                    new TypeReference< BaseResponse<FindAlarmBaseDataStatisticResponse >>(){};
            BaseResponse<FindAlarmBaseDataStatisticResponse >   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康消防看板-4报警信息统计");
            return  result;
        }catch (Exception e){
            log.error("【海康消防看板-4报警信息统计】================失败====:\n"+ e.getMessage());
        }
        return  null;
    }
    /**
     *根据用户标识获取客户端TGC接口
     * @return
@@ -1213,6 +2062,44 @@
        }
        return  null;
    }
    public static BaseResponse<MenuDataResponse> getMenuConfig(Map<String,String> param){
        log.info("【获取菜单功能配置项】================开始===="+ JSONObject.toJSONString(param));
        try {
            String res = HKTools.getHkMenu(param);
            TypeReference typeReference =
                    new TypeReference<BaseResponse<MenuDataResponse>>(){};
            BaseResponse<MenuDataResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"获取菜单功能配置项");
            return  result;
        }catch (Exception e){
            log.error("【获取菜单功能配置项】================失败====:\n"+ e.getMessage());
            e.printStackTrace();
        }
        return null;
    }
    public static BaseResponse sendSms(Map<String,Object> param){
        log.info("【发送短信信息】================开始===="+ JSONObject.toJSONString(param));
        try {
            String res = HKTools.sendSms(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());
            e.printStackTrace();
        }
        return null;
    }
    private static void logResult(BaseResponse res,String name) {
        if(StringUtils.equals(res.getCode(),HKConstants.RESPONSE_SUCCEE)){
            log.info("【"+name+"】================成功====\n"+res);