From 20d2f06486e57b82a9045a754dd538a8a37e5c80 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期五, 09 八月 2024 18:05:47 +0800 Subject: [PATCH] 最新版本 --- server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java | 142 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 142 insertions(+), 0 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 bdbe7c6..5711c81 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 @@ -10,12 +10,16 @@ import com.doumee.core.haikang.model.param.request.*; import com.doumee.core.haikang.model.param.respose.*; 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; @Slf4j public class HKService { @@ -1018,6 +1022,144 @@ return null; } /** + *鍒嗛〉鑾峰彇骞挎挱鐐癸紙鍒嗛〉锛� + * @return + */ + public static BaseResponse<BaseListPageResponse<FetchAudioChannelInfoResponse>> fetchAudioChannel(FetchAudioChannelRequest param){ + log.info("銆愭捣搴疯幏鍙栧垎椤佃幏鍙栧箍鎾偣銆�================寮�濮�===="+JSONObject.toJSONString(param)); + try { + String res = HKTools.fetchAudioChannel(JSONObject.toJSONString(param)); + TypeReference typeReference = + new TypeReference< BaseResponse<BaseListPageResponse<FetchAudioChannelInfoResponse>> >(){}; + BaseResponse<BaseListPageResponse<FetchAudioChannelInfoResponse>> 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<FetchAudioChannelInfoResponse>> fetchAudioDevice(FetchAudioChannelRequest param){ + log.info("銆愭捣搴疯幏鍙栧垎椤佃幏鍙栧箍鎾偣銆�================寮�濮�===="+JSONObject.toJSONString(param)); + try { + String res = HKTools.fetchAudioDevice(JSONObject.toJSONString(param)); + TypeReference typeReference = + new TypeReference< BaseResponse<BaseListPageResponse<FetchAudioChannelInfoResponse>> >(){}; + BaseResponse<BaseListPageResponse<FetchAudioChannelInfoResponse>> 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<PlatformListInfoResponse>> platformsList(PlatformsListRequest param){ + log.info("銆愭捣搴疯幏鍙栧叏閮ㄦ湀鍙颁俊鎭��================寮�濮�===="+JSONObject.toJSONString(param)); + try { + String res = HKTools.platformsList(JSONObject.toJSONString(param)); + TypeReference typeReference = + new TypeReference< BaseResponse<BaseListPageResponse<PlatformListInfoResponse>> >(){}; + BaseResponse<BaseListPageResponse<PlatformListInfoResponse>> result = JSONObject.parseObject(res, typeReference.getType()); + logResult(result,"娴峰悍鑾峰彇鍏ㄩ儴鏈堝彴淇℃伅"); + return result; + }catch (Exception e){ + log.error("銆愭捣搴疯幏鍙栧叏閮ㄦ湀鍙颁俊鎭��================澶辫触====锛歕n"+ e.getMessage()); + } + return null; + } + /** + *鑾峰彇鏈堝彴缁勪欢閰嶇疆鐨凩ED璁惧娓呭崟 + * @return + */ + public static BaseResponse<BaseListPageResponse<LedRecordsInfoResponse>> ledRecords(LedRecordsRequest param){ + log.info("銆愭捣搴疯幏鍙栨湀鍙扮粍浠堕厤缃殑LED璁惧娓呭崟銆�================寮�濮�===="+JSONObject.toJSONString(param)); + try { + String res = HKTools.ledRecords(JSONObject.toJSONString(param)); + TypeReference typeReference = + new TypeReference< BaseResponse<BaseListPageResponse<LedRecordsInfoResponse>> >(){}; + BaseResponse<BaseListPageResponse<LedRecordsInfoResponse>> result = JSONObject.parseObject(res, typeReference.getType()); + logResult(result,"娴峰悍鑾峰彇鏈堝彴缁勪欢閰嶇疆鐨凩ED璁惧娓呭崟"); + return result; + }catch (Exception e){ + log.error("銆愭捣搴疯幏鍙栨湀鍙扮粍浠堕厤缃殑LED璁惧娓呭崟銆�================澶辫触====锛歕n"+ e.getMessage()); + } + return null; + } + /** + *鐢ㄤ簬璁剧疆骞挎挱鐨勮嚜瀹氭挱鏀惧拰鍋滄 + * @return + */ + public static BaseResponse<BaseListPageResponse<LedRecordsInfoResponse>> customBroadcast(LedRecordsRequest 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()); + logResult(result,"娴峰悍鐢ㄤ簬璁剧疆骞挎挱鐨勮嚜瀹氭挱鏀惧拰鍋滄"); + return result; + }catch (Exception e){ + log.error("銆愭捣搴风敤浜庤缃箍鎾殑鑷畾鎾斁鍜屽仠姝€��================澶辫触====锛歕n"+ e.getMessage()); + } + return null; + } + /** + *鑾峰彇鍏ㄩ儴鏈堝彴淇℃伅 + * @return + */ + public static BaseResponse<BaseListPageResponse<PlatformStatusInfoResponse>> platformStatus(PlatformStatusRequest param) { + log.info("銆愭捣搴疯幏鍙栧叏閮ㄦ湀鍙颁俊鎭��================寮�濮�====" + JSONObject.toJSONString(param)); + try { + String res = HKTools.platformStatus(JSONObject.toJSONString(param)); + TypeReference typeReference = + new TypeReference<BaseResponse<BaseListPageResponse<PlatformStatusInfoResponse>>>() { + }; + BaseResponse<BaseListPageResponse<PlatformStatusInfoResponse>> result = JSONObject.parseObject(res, typeReference.getType()); + logResult(result, "娴峰悍鑾峰彇鍏ㄩ儴鏈堝彴淇℃伅"); + return result; + } catch (Exception e) { + log.error("銆愭捣搴疯幏鍙栧叏閮ㄦ湀鍙颁俊鎭��================澶辫触====锛歕n" + e.getMessage()); + } + return null; + + } + /** + *鍙戦�佹秷鎭粰LED + * @return + */ + public static BaseResponse transparentchannel(TransparentChannelHeadRequest head,TransparentChannelBodyRequest param){ + log.info("銆愭捣搴峰彂閫佹秷鎭粰LED銆�================寮�濮�===="+JSONObject.toJSONString(param)); + try { + Map<String,String> header = toMap(head); + String res = HKTools.transparentchannel(header,JSONObject.toJSONString(param)); + TypeReference typeReference = + new TypeReference<BaseResponse>(){}; + BaseResponse result = JSONObject.parseObject(res, typeReference.getType()); + logResult(result,"娴峰悍鍙戦�佹秷鎭粰LED"); + return result; + }catch (Exception e){ + log.error("銆愭捣搴峰彂閫佹秷鎭粰LED銆�================澶辫触====锛歕n"+ e.getMessage()); + } + return null; + } + public static Map<String, String> toMap(Object obj) throws IllegalAccessException { + Map<String, String> map = new HashMap<>(); + Class<?> clazz = obj.getClass(); + for (Field field : clazz.getDeclaredFields()) { + field.setAccessible(true); // 浣垮緱绉佹湁瀛楁涔熷彲浠ヨ闂� + map.put(field.getName(), (String) field.get(obj)); + } + return map; + } + /** *鏌ヨ鍦哄唴杞﹀仠杞︿俊鎭紙鍒嗛〉锛� * @return */ -- Gitblit v1.9.3