yujian
2019-07-29 a1175313094799efcdbbecf2840a90350d3159a7
fanli/src/main/java/com/yeshi/fanli/service/impl/jd/JDGoodsServiceImpl.java
@@ -35,7 +35,6 @@
   @Resource
   private HongBaoManageService hongBaoManageService;
   
   private Map<String, Long> countMap = new HashMap<String, Long>();
   private static final Map<Long, String> cidMap = new HashMap<Long, String>();
@@ -60,7 +59,6 @@
      cidMap.put(18L, "6728");// 汽车:汽车用品
   }
   @Override
   public List<GoodsClass> getSpecialClass() {
      List<GoodsClass> list = new ArrayList<GoodsClass>();
@@ -84,7 +82,6 @@
      list.add(new GoodsClass(18L, "汽车"));
      return list; 
   }
   
   @Cacheable(value = "jdSpecialCache", key = "'specialSearch-'+#page+'-'+#cid")
   @Override
@@ -150,7 +147,6 @@
         }
      } 
      
      if (!jdcid.contains(",")) {
         return search(page, Constant.PAGE_SIZE, jdcid);
      } 
@@ -169,7 +165,6 @@
      }
      return list;
   }
   
   private List<JDGoods> search(int page, int pageSize, String jdcid) {
      JDSearchResult result = null;
@@ -195,4 +190,24 @@
      }
   }
   @Cacheable(value = "jdCache", key = "'getIndexJDGoods-'+#page")
   @Override
   public JDSearchResult getIndexJDGoods(int page) {
      JDSearchResult result = null;
      String way = configService.get("jd_api_search_key");
      if ("1".equals(way)) {
         JDFilter filterAPI = new JDFilter();
         filterAPI.setPageIndex(page);
         filterAPI.setPageSize(20);
         result = JDApiUtil.queryByKey(filterAPI);
      } else {
         // 网页爬取
         JDSearchFilter jdfilter = new JDSearchFilter();
         jdfilter.setPageNo(page);
         jdfilter.setPageSize(Constant.PAGE_SIZE);
         result = JDUtil.searchByKey(jdfilter);
      }
      return result;
   }
}