yujian
2019-11-25 aa552facf6d833acab0d3e3e29bda2a0fb826ffe
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java
@@ -68,11 +68,21 @@
    * @return
    */
   private int addBrandGoodsTB(BrandInfo brandInfo) {
      Date date = new Date();
      String shopKey = brandInfo.getShopKey();
      if (StringUtil.isNullOrEmpty(shopKey)) {
         // 删除之前的
          brandGoodsCaheDao.removeByDate(brandInfo.getId(), 1 , date);
         // 删除店铺
          brandShopCaheService.removeByDateAndType(brandInfo.getId(), 11, date);
         return 0;
      }
      String searchKey = brandInfo.getSearchKey();
      if (StringUtil.isNullOrEmpty(searchKey))
         searchKey = brandInfo.getName();
      
      Date date = new Date();
      SearchFilter filter = new SearchFilter();
      filter.setKey(searchKey);
      filter.setPage(1);
@@ -94,8 +104,8 @@
            // 添加店铺
            String shopTitle = goods.getShopTitle();
            if (addShop && !StringUtil.isNullOrEmpty(shopTitle) && shopTitle.contains("旗舰店") 
                  && shopTitle.contains(brandInfo.getName())) {
               addShop = brandShopCaheService.addBrandShopTB(brandInfo.getId(), goods.getAuctionId(),
                  && shopTitle.toLowerCase().contains(shopKey.toLowerCase())) {
               addShop = brandShopCaheService.addBrandShopTB(brandInfo, goods.getAuctionId(),
                     goods.getSellerId());
            }
            
@@ -129,14 +139,23 @@
    * @return
    */
   private int addBrandGoodsJD(BrandInfo brandInfo) {
      String searchKey = brandInfo.getSearchKey();
      Date date = new Date();
      String shopKey = brandInfo.getShopKeyJD();
      if (StringUtil.isNullOrEmpty(shopKey)) {
         // 删除店铺
          brandShopCaheService.removeByDateAndType(brandInfo.getId(), 20, date);
         // 删除之前
          brandGoodsCaheDao.removeByDate(brandInfo.getId(), 2 , date);
          return 0;
      }
      String searchKey = brandInfo.getSearchKeyJD();
      if (StringUtil.isNullOrEmpty(searchKey))
         searchKey = brandInfo.getName();
      
      int count = 0;
      JDSearchResult result = null;
      String way = configService.get("jd_api_search_key");
      Date date = new Date();
      
      // 删除店铺
       brandShopCaheService.removeByDateAndType(brandInfo.getId(), 20, date);
@@ -178,7 +197,7 @@
               if (addShop && shopInfo != null) {
                  // 包含该品牌名称
                  String shopName = shopInfo.getShopName();
                  if (!StringUtil.isNullOrEmpty(shopName) && shopName.contains(brandInfo.getName())) {
                  if (!StringUtil.isNullOrEmpty(shopName) && shopName.toLowerCase().contains(shopKey.toLowerCase())) {
                     addShop = false;
                     brandShopCaheService.addBrandShopJD(brandInfo, shopInfo);
                  }
@@ -205,7 +224,17 @@
    * @return
    */
   private int addBrandGoodsPDD(BrandInfo brandInfo) {
      String searchKey = brandInfo.getSearchKey();
      Date date = new Date();
      String shopKey = brandInfo.getShopKeyPDD();
      if (StringUtil.isNullOrEmpty(shopKey)) {
         // 删除之前
         brandGoodsCaheDao.removeByDate(brandInfo.getId(), 3, date);
         // 删除之前店铺
         brandShopCaheService.removeByDateAndType(brandInfo.getId(), 30, date);
         return 0;
      }
      String searchKey = brandInfo.getSearchKeyPDD();
      if (StringUtil.isNullOrEmpty(searchKey))
         searchKey = brandInfo.getName();
      
@@ -217,7 +246,6 @@
      PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
      
      int count = 0;
      Date date = new Date();
      
      if (result != null) {
         List<PDDGoodsDetail> goodsList = result.getGoodsList();