| | |
| | | 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.StringUtils; |
| | |
| | | |
| | | 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); |
| | | /** |
| | | * 获取根组织数据 |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | *车位预约 |
| | | * @return |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | *车位取消预约 |
| | | * @return |
| | |
| | | return result; |
| | | }catch (Exception e){ |
| | | log.error("【海康访客预约签离】================失败====:\n"+ e.getMessage()); |
| | | } |
| | | 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; |
| | | } |
| | |
| | | public static BaseResponse<String> wxAccessToken(String configId,String tagId){ |
| | | log.info("【海康根据微信公众号信息获取AccessToken】================开始====configId:"+configId+" && tagId:"+tagId); |
| | | try { |
| | | String res = HKTools.wxAccessToken(configId,tagId); |
| | | 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()); |
| | |
| | | } |
| | | 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 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; |
| | |
| | | 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 { |
| | | String res = HKTools.getMenuUrl(menuId,token); |
| | | ///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()); |
| | |
| | | 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; |
| | | } |
| | |
| | | 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 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 |
| | | */ |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | *根据用户标识获取客户端TGC接口 |
| | | * @return |