admin
2020-02-06 e61ed7fbbc44d1ff5b92b2e76ec168f23ffe07df
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,12 +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;
@@ -67,6 +71,8 @@
   @Resource
   private JDGoodsLinkParseManager jdGoodsLinkParseManager;
   
   @Resource
   private HotSearchService hotSearchService;
   /**
    * 粘贴板信息推荐
@@ -185,11 +191,42 @@
      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));
   }
   /**
    * 搜索候选词
@@ -279,7 +316,6 @@
         return;
      }
   }
   /**
    * 京东