From 20b11236b4364034f52df294b9240776f539ede1 Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期二, 16 七月 2024 14:49:01 +0800 Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/zbomyoujia --- server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java | 158 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 136 insertions(+), 22 deletions(-) diff --git a/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java b/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java index 663aa5c..2837a38 100644 --- a/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java +++ b/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java @@ -16,6 +16,7 @@ import com.doumee.dao.business.MemberMapper; import com.doumee.dao.business.model.CrmInterfaceLog; import com.doumee.dao.business.model.InterfaceLog; +import com.doumee.dao.web.response.ZSZXCatalogResponse; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -52,11 +53,37 @@ ZTConstants.IntegerName.USER_GET_TOKEN_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<ZTUserGetTokenResponse>>(){}); if(result!=null){ return result.getData(); } return null; + } + /** + * 鑾峰彇鐢ㄦ埛鐧婚檰token + * @return + */ + @Override + public ZSZXCatalogResponse getZSZXCatalogs(){ + ZSZXCatalogResponse response = new ZSZXCatalogResponse(); + ZTCatalogListRequest param = new ZTCatalogListRequest(); + param.setCatalogCode(ZTConstants.CatalogCode.ZHISHUO_ZHUANGXIU); + List<ZTCatalogInfoResponse> cataList = getCatalogList(param); + if(cataList!=null ){ + for(ZTCatalogInfoResponse data : cataList){ + if(StringUtils.equals(data.getCode(), ZTConstants.CatalogCode.JIADE_ID)){ + response.setJdId(data); + }else if(StringUtils.equals(data.getCode(), ZTConstants.CatalogCode.CHUFANGSHEJI)){ + response.setCfsj(data); + }else if(StringUtils.equals(data.getCode(), ZTConstants.CatalogCode.QW_SHEJI)){ + response.setQwsj(data); + }else if(StringUtils.equals(data.getCode(), ZTConstants.CatalogCode.SHOUNASHEJI)){ + response.setSnsj(data); + } + } + } + return response; } /** * 鐢ㄦ埛淇℃伅鍚屾 @@ -70,7 +97,8 @@ ZTConstants.IntegerName.USER_UPDATE_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<ZTUserGetTokenResponse>>(){}); if(result!=null){ return result.getData(); } @@ -88,7 +116,8 @@ ZTConstants.IntegerName.USER_LOGOUT_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<Object>>(){}); if(result!=null ){ return true; } @@ -102,12 +131,33 @@ */ @Override public List<ZTCatalogInfoResponse> getCatalogList(ZTCatalogListRequest param){ - ZTBaseResponse<List<ZTCatalogInfoResponse>> result = sendHttpRequest( + + ZTBaseResponse<List<ZTCatalogInfoResponse>> result = sendHttpRequest( ZTConstants.IntegerUrl.CATALOG_LIST_URL, ZTConstants.IntegerName.CATALOG_LIST_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<List<ZTCatalogInfoResponse>>>(){}); + if(result!=null){ + return result.getData(); + } + return null; + } + /** + * 鑾峰彇鍒嗙被鍜屽垎绫讳笅鐨勬爣绛� + * @param param + * @return + */ + @Override + public List<ZTTagInfoResponse> getTagList(ZTCatalogListRequest param){ + ZTBaseResponse<List<ZTTagInfoResponse>> result = sendHttpRequest( + ZTConstants.IntegerUrl.TAG_LIST_URL, + ZTConstants.IntegerName.TAG_LIST_NAME, + param.getToken(), + param.getUserType(), + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<List<ZTTagInfoResponse>>>(){}); if(result!=null){ return result.getData(); } @@ -126,7 +176,8 @@ ZTConstants.IntegerName.CONTENT_LIST_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<ZTBasePageResponse<ZTContentListResponse>>>(){}); if(result!=null){ return result.getData(); } @@ -140,11 +191,12 @@ @Override public ZTContentInfoResponse getContentInfo(ZTContentInfoRequest param){ ZTBaseResponse<ZTContentInfoResponse> result = sendHttpRequest( - ZTConstants.IntegerUrl.CONTENT_INFO_URL+ param.getArticleId(), + ZTConstants.IntegerUrl.CONTENT_INFO_URL+ param.getId(), ZTConstants.IntegerName.CONTENT_INFO_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<ZTContentInfoResponse>>(){}); if(result!=null){ return result.getData(); } @@ -162,7 +214,8 @@ ZTConstants.IntegerName.COLLECT_DO_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<Object>>(){}); if(result!=null ){ return true; } @@ -180,7 +233,8 @@ ZTConstants.IntegerName.LIKE_DO_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<Object>>(){}); if(result!=null ){ return true; } @@ -198,7 +252,8 @@ ZTConstants.IntegerName.SHARE_DO_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<Object>>(){}); if(result!=null ){ return true; } @@ -216,7 +271,27 @@ ZTConstants.IntegerName.VIEW_DO_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<Object>>(){}); + if(result!=null ){ + return true; + } + return false; + } + /** + * 鐢ㄦ埛缁戝畾瀹㈡埛鍠滄娓呭崟锛屽彲缁戝畾澶氫釜鍐呭 + * @param param + * @return + */ + @Override + public boolean bindCustomerFavorites(ZTBindCusFavoriteDoRequest param){ + ZTBaseResponse result = sendHttpRequest( + ZTConstants.IntegerUrl.BIND_CUSTOMER_FAVORITES_URL, + ZTConstants.IntegerName.BIND_CUSTOMER_FAVORITES_NAME, + param.getToken(), + param.getUserType(), + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<Object>>(){}); if(result!=null ){ return true; } @@ -228,13 +303,52 @@ * @return */ @Override - public ZTBasePageResponse<ZTContentListResponse> pageCollectList(ZTContentListRequest param){ - ZTBaseResponse< ZTBasePageResponse<ZTContentListResponse>> result = sendHttpRequest( + public ZTBasePageResponse<ZTCollectInfoResponse> pageCollectList(ZTContentListRequest param){ + ZTBaseResponse< ZTBasePageResponse<ZTCollectInfoResponse>> result = sendHttpRequest( ZTConstants.IntegerUrl.COLLECT_LIST_URL, ZTConstants.IntegerName.COLLECT_LIST_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<ZTBasePageResponse<ZTCollectInfoResponse>>>(){}); + if(result!=null){ + return result.getData(); + } + return null; + } + /** + * 鑾峰彇鎴戠殑鏀惰棌鍒楄〃鍒嗛〉 + * @param param + * @return + */ + @Override + public ZTBasePageResponse<ZTBehaviorInfoResponse> pageBehavoirList(ZTContentListRequest param){ + ZTBaseResponse< ZTBasePageResponse<ZTBehaviorInfoResponse>> result = sendHttpRequest( + ZTConstants.IntegerUrl.BEHAVIOR_LIST_URL, + ZTConstants.IntegerName.BEHAVIOR_LIST_NAME, + param.getToken(), + param.getUserType(), + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<ZTBasePageResponse<ZTBehaviorInfoResponse>>>(){}); + if(result!=null){ + return result.getData(); + } + return null; + } + /** + * 鑾峰彇瀹㈡埛鍠滄 + * @param param + * @return + */ + @Override + public ZTBasePageResponse<ZTCusFavoritesInfoResponse> pageCusFavoriteList(ZTContentListRequest param){ + ZTBaseResponse< ZTBasePageResponse<ZTCusFavoritesInfoResponse>> result = sendHttpRequest( + ZTConstants.IntegerUrl.CUSTOMER_FAVORITES_LIST_URL, + ZTConstants.IntegerName.CUSTOMER_FAVORITES_LIST_NAME, + param.getToken(), + param.getUserType(), + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<ZTBasePageResponse<ZTCusFavoritesInfoResponse>>>(){}); if(result!=null){ return result.getData(); } @@ -253,7 +367,8 @@ ZTConstants.IntegerName.LIKE_LIST_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<ZTBasePageResponse<ZTContentListResponse>>>(){}); if(result!=null){ return result.getData(); } @@ -275,7 +390,8 @@ ZTConstants.IntegerName.AREA_LIST_NAME, param.getToken(), param.getUserType(), - JSONObject.toJSONString(param )); + JSONObject.toJSONString(param ), + new TypeReference<ZTBaseResponse<List<ZTAreaInfoResponse>>>(){}); if(result!=null){ return result.getData(); } @@ -283,7 +399,7 @@ } - public <T> ZTBaseResponse<T> sendHttpRequest(String url,String name,String token,String userType,String param){ + public <T> ZTBaseResponse<T> sendHttpRequest(String url,String name,String token,String userType,String param,TypeReference<ZTBaseResponse<T>> typeReference){ log.info("銆�"+name+"銆�================寮�濮�===="+ JSONObject.toJSONString(param)); String res = null; int success = 0; @@ -294,11 +410,9 @@ headers.put(ZTConstants.HEADER_USERTYPE,userType); String index = (String) redisTemplate.opsForValue().get(Constants.RedisKeys.ZBOM_ZHONGTAI_API_URL); res = HttpsUtil.postJsonWithHeaders(index+url,param,headers); - TypeReference typeReference = - new TypeReference<ZTBaseResponse<T>>(){}; ZTBaseResponse<T> result = JSONObject.parseObject(res, typeReference.getType()); logResult(result,name); - if(StringUtils.equals(result.getCode(),ZTConstants.CODE_SUCCESS)){ + if(Constants.equalsInteger(result.getCode(),ZTConstants.CODE_SUCCESS)){ return result; }else{ success =1; @@ -329,7 +443,7 @@ interfaceLogMapper.insert(log); } private static void logResult(ZTBaseResponse res,String name) { - if(StringUtils.equals(res.getCode(), ZTConstants.CODE_SUCCESS)){ + if(Constants.equalsInteger(res.getCode(),ZTConstants.CODE_SUCCESS)){ log.info("銆愪腑鍙版帴鍙o細"+name+"銆�================鎴愬姛====\n"+res); }else{ log.error("銆愪腑鍙版帴鍙o細"+name+"銆�================澶辫触====锛歕n"+ res); -- Gitblit v1.9.3