admin
2020-11-28 dc5be7d38446f70e6ff86df311119c32b41fe7f8
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandShopCaheServiceImpl.java
@@ -5,6 +5,7 @@
import javax.annotation.Resource;
import com.yeshi.fanli.util.Constant;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.brand.BrandShopCaheDao;
@@ -14,7 +15,7 @@
import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
import com.yeshi.fanli.entity.brand.BrandInfo;
import com.yeshi.fanli.entity.brand.BrandShopCahe;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.common.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.service.inter.brand.BrandShopCaheService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
import com.yeshi.fanli.util.StringUtil;
@@ -38,14 +39,17 @@
    * @return
    */
   @Override
   public boolean addBrandShopTB(Long brandId, Long auctionId, Long sellerId) {
   public boolean addBrandShopTB(BrandInfo brandInfo, Long auctionId, Long sellerId) {
      TaoBaoShop taoBaoShop = taoBaoShopService.getTaoBaoShop(auctionId, sellerId);
      if (taoBaoShop == null)
         return true;
      
      ShopInfoVO shopInfoVO = ShopInfoVOFactory.convertTaoBaoShop(taoBaoShop);
      shopInfoVO.setShopIcon(brandInfo.getIcon());
      BrandShopCahe brandShop = new BrandShopCahe();
      brandShop.setBrandId(brandId);
      brandShop.setShop(ShopInfoVOFactory.convertTaoBaoShop(taoBaoShop));
      brandShop.setBrandId(brandInfo.getId());
      brandShop.setShop(shopInfoVO);
      brandShop.setCreateTime(new Date());
      brandShopCaheDao.insert(brandShop);
      return false;
@@ -77,8 +81,12 @@
    * @return
    */
   @Override
   public void addBrandShopPDD(BrandInfo brandInfo) {
      String searchKey = brandInfo.getSearchKey();
   public int addBrandShopPDD(BrandInfo brandInfo) {
      String shopKey = brandInfo.getShopKeyPDD();
      if (StringUtil.isNullOrEmpty(shopKey))
         return 0;
      String searchKey = brandInfo.getSearchKeyPDD();
      if (StringUtil.isNullOrEmpty(searchKey))
         searchKey = brandInfo.getName();
      
@@ -90,14 +98,14 @@
      pddfilter.setSortType(6);
      pddfilter.setMerchantType(3);
      
      PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
      PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter, Constant.PDD_SEARCH_CUSTOMER_PARAMS);
      if (result != null && result.getGoodsList() != null && result.getGoodsList().size() > 0) {
         boolean addShop = true;
         List<PDDGoodsDetail> goodsList = result.getGoodsList();
         for (PDDGoodsDetail goods : goodsList) {
            // 包含店铺id 、包含品牌名称
            String mallName = goods.getMallName();
            if(addShop && !StringUtil.isNullOrEmpty(mallName) && mallName.contains(brandInfo.getName())
            if(addShop && !StringUtil.isNullOrEmpty(mallName) && mallName.toLowerCase().contains(shopKey.toLowerCase())
                  && goods.getMallId() != null){
               shopInfoVO = new ShopInfoVO();
               shopInfoVO.setId(goods.getMallId().toString());
@@ -117,7 +125,9 @@
         brandShop.setShop(shopInfoVO);
         brandShop.setCreateTime(new Date());
         brandShopCaheDao.insert(brandShop);
         return 1;
      }
      return 0;
   }