From ee1d39f11b9483b64a88029f1755a6e7166fea15 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期日, 26 四月 2020 16:49:21 +0800 Subject: [PATCH] 等级显示问题 --- fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/SearchController.java | 57 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 47 insertions(+), 10 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/SearchController.java b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/SearchController.java index a1663fc..9d98fc2 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/SearchController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/SearchController.java @@ -1,6 +1,7 @@ package com.yeshi.fanli.controller.wxmp.v1; import java.io.PrintWriter; +import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -24,11 +25,15 @@ import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; import com.yeshi.fanli.dto.pdd.PDDGoodsResult; import com.yeshi.fanli.dto.pdd.PDDSearchFilter; +import com.yeshi.fanli.entity.accept.AcceptData; +import com.yeshi.fanli.entity.bus.search.HotSearch; import com.yeshi.fanli.entity.goods.CommonGoods; import com.yeshi.fanli.entity.jd.JDGoods; +import com.yeshi.fanli.entity.system.ConfigKeyEnum; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.brand.BrandInfoService; import com.yeshi.fanli.service.inter.config.ConfigService; +import com.yeshi.fanli.service.inter.config.HotSearchService; import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; import com.yeshi.fanli.service.manger.goods.jd.JDGoodsLinkParseManager; import com.yeshi.fanli.tag.PageEntity; @@ -65,7 +70,9 @@ @Resource private JDGoodsLinkParseManager jdGoodsLinkParseManager; - + + @Resource + private HotSearchService hotSearchService; /** * 绮樿创鏉夸俊鎭帹鑽� @@ -81,7 +88,7 @@ out.print(JsonUtil.loadFalseResult("鍊间负绌�")); return; } - + // 鍘婚櫎鍓嶅悗绌烘牸 int type = 1; text = text.trim(); @@ -162,7 +169,7 @@ } } } - + if (commonGoods == null) { out.println(JsonUtil.loadFalseResult("鏆傛湭鎵惧埌璇ュ晢鍝侊紝璇风◢鍚庡啀璇曪紒")); return; @@ -178,17 +185,48 @@ data.put("goods", goodsJSON); out.print(JsonUtil.loadTrueResult(data)); return; - } - + } + JSONObject data = new JSONObject(); Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); data.put("type", type); - data.put("goods", gson.toJson(GoodsDetailVOFactory.convertCommonGoods(commonGoods, hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion())))); + data.put("goods", gson.toJson(GoodsDetailVOFactory.convertCommonGoods(commonGoods, + hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion())))); out.print(JsonUtil.loadTrueResult(data)); return; } + /** + * 鐑棬鎼滅储 + * + * @param acceptData + * @param goodsType + * @param out + */ + @RequestMapping(value = "gethotsearch", method = RequestMethod.POST) + public void getHotSearch(AcceptData acceptData, Integer goodsType, PrintWriter out) { + // 榛樿娣樺疂 + if (goodsType == null) { + goodsType = Constant.SOURCE_TYPE_TAOBAO; + } + + List<HotSearch> list = hotSearchService.getHotSearchCache(goodsType); + if (list == null || list.size() == 0) { + out.print(JsonUtil.loadFalseResult("娌℃湁鏁版嵁")); + return; + } + List<String> hotSearchList = new ArrayList<String>(); + if(list!=null) + for (HotSearch hot : list) + hotSearchList.add(hot.getName()); + + JSONObject data = new JSONObject(); + data.put("count", list.size()); + data.put("hotSearchList", hotSearchList); + data.put("helpLink", configService.get(ConfigKeyEnum.newerGonglue.getKey())); + out.print(JsonUtil.loadTrueResult(data)); + } /** * 鎼滅储鍊欓�夎瘝 @@ -252,11 +290,11 @@ out.print(JsonUtil.loadFalseResult(1, "璇疯緭鍏ユ悳绱㈠唴瀹�")); return; } - + if (page == null || page < 1) { page = 1; } - + final String searchkey = key.trim(); if (searchkey.startsWith("http://") || searchkey.startsWith("https://")) { JSONObject data = new JSONObject(); @@ -279,7 +317,6 @@ } } - /** * 浜笢 * @@ -296,7 +333,7 @@ JDSearchResult result = null; boolean hasCoupon = false; - String way = configService.get("jd_api_search_key"); + String way = configService.get(ConfigKeyEnum.jdApiSearchKey.getKey()); if ("1".equals(way)) { JDFilter filterAPI = new JDFilter(); filterAPI.setKeyword(SearchFilterUtil.filterSearchContent(key)); -- Gitblit v1.8.0