admin
2019-06-27 534e0d10fdedf5fdaba6f63c99605520314a97d4
fanli/src/main/java/com/yeshi/fanli/controller/web/ShareHotGoodsController.java
@@ -12,6 +12,7 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.taobao.ShareHotGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
@@ -48,25 +49,16 @@
    * @param out
    */
   @RequestMapping(value = "listPreGoods", method = RequestMethod.GET)
   public void getSugguestSearch(String callback, AcceptData acceptData, String kw, PrintWriter out) {
   public void listPreGoods(String callback, AcceptData acceptData, String kw, PrintWriter out) {
      // 大淘客数据,更新
      List<String> list = TaoBaoUtil.getSuguestSearch(kw);
      if (list != null && list.size() > 0) {
         JSONArray array = new JSONArray();
         int num = 0;
         for (String st : list) {
            array.add(st);
            num = num + 1;
            if (num >= 5) {
               break;
            }
         }
         out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(array)));
      } else {
         out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("")));
      List<TaoBaoGoodsBrief> list = shareHotGoodsService.listPreGoods();
      BigDecimal rate = hongBaoManageService.getFanLiRate();
      JSONArray array = new JSONArray();
      Gson gson = new Gson();
      for (TaoBaoGoodsBrief goods : list) {
         array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, rate + "", null)));
      }
      return;
      out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(array)));
   }
   /**
@@ -92,10 +84,15 @@
         } catch (TaobaoGoodsDownException e) {
            e.printStackTrace();
         }
         if (goods != null) {
            count++;
            goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
            shareHotGoodsService.addShareHotGoods(new ShareHotGoods(null, day, new Date(), goods));
         if (goods != null && goods.getCouponAmount() != null
               && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) {
            if (TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(goods.getTkRate())
                  .compareTo(new BigDecimal("734")) >= 0) {
               count++;
               goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
               shareHotGoodsService.addShareHotGoods(new ShareHotGoods(null, day, new Date(), goods));
            }
         }
      }
      out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("设置成功:" + count)));