From e1310d24b502fea752afb403b080aa4eda4046b0 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期五, 15 十一月 2024 17:40:34 +0800 Subject: [PATCH] 最新版本541200007 --- server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java | 324 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 304 insertions(+), 20 deletions(-) diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java b/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java index e1b202c..351ff86 100644 --- a/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java +++ b/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java @@ -1,19 +1,16 @@ package com.doumee.core.haikang.service; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; -import com.doumee.core.constants.ResponseStatus; -import com.doumee.core.exception.BusinessException; 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.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.HttpsUtil; import com.hikvision.artemis.sdk.config.ArtemisConfig; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -25,7 +22,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; @Slf4j public class HKService { @@ -1431,6 +1427,292 @@ 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; + } + /** + *鑾峰彇鐩戞帶鐐归瑙堝彇娴乁RL + * @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,"娴峰悍鑾峰彇鐩戞帶鐐归瑙堝彇娴乁RL"); + 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; + } + /** + *鏌ヨ娑堥槻浼犳劅鍣ㄩ儴浠剁姸鎬乿2锛堝垎椤碉級 + * @return + */ + public static BaseResponse<BaseListPageResponse<PageSensorStatusResponse>> pageSensorStatus(SensorStatusListRequest param){ + log.info("銆愭捣搴峰垎椤垫煡璇㈡秷闃蹭紶鎰熷櫒閮ㄤ欢鐘舵�乿2銆�================寮�濮�===="+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,"娴峰悍鍒嗛〉鏌ヨ娑堥槻浼犳劅鍣ㄩ儴浠剁姸鎬乿2"); + return result; + }catch (Exception e){ + log.error("銆愭捣搴峰垎椤垫煡璇㈡秷闃蹭紶鎰熷櫒閮ㄤ欢鐘舵�乿2銆�================澶辫触====锛歕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; + } + /** + *缁熻缁熷畨闃茬湅鏉�--鍥尯瀹炴椂杞︽暟閲�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.鑾峰彇鍖哄煙鐢ㄨ兘鍓峃浣� + * @param param + * @return + */ + public static BaseResponse<List<RegionTopPowerResponse>> regionTopPower(RegionTopPowerRequest param){ + log.info("銆愭捣搴疯兘鑰楃湅鏉�-2.鑾峰彇鍖哄煙鐢ㄨ兘鍓峃浣嶃��================寮�濮�===="); + 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.鑾峰彇鍖哄煙鐢ㄨ兘鍓峃浣�"); + return result; + }catch (Exception e){ + log.error("銆愭捣搴疯兘鑰楃湅鏉�-2.鑾峰彇鍖哄煙鐢ㄨ兘鍓峃浣嶃��================澶辫触====锛歕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; + } + /** *鏍规嵁鐢ㄦ埛鏍囪瘑鑾峰彇瀹㈡埛绔疶GC鎺ュ彛 * @return */ @@ -1467,21 +1749,6 @@ return null; } - public static BaseResponse sendSmsByHk(Map<String,Object> param,String url){ - log.info("銆愭捣搴峰彂閫佺煭淇°��================寮�濮�===="+JSONObject.toJSONString(param)); - try { - TypeReference typeReference = - new TypeReference<BaseResponse>(){}; - String res = HttpsUtil.postJson(url, JSONObject.toJSONString(param)); - BaseResponse result = JSONObject.parseObject(res, typeReference.getType()); - logResult(result,"娴峰悍鍙戦�佺煭淇�"); - return result; - }catch (Exception e){ - log.error("銆愭捣搴峰彂閫佺煭淇°��================澶辫触====锛歕n"+ e.getMessage()); - e.printStackTrace(); - } - return null; - } @@ -1502,6 +1769,23 @@ } + 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); -- Gitblit v1.9.3