From 806bfd1be601735121afcf252ceeaf8f06fd6464 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 25 十一月 2019 09:44:59 +0800
Subject: [PATCH] 品牌修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java |   40 ++++++++++++++++++++++++++++++----------
 1 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java
index d6be2b0..ede5a43 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java
@@ -68,15 +68,21 @@
 	 * @return
 	 */
 	private int addBrandGoodsTB(BrandInfo brandInfo) {
+		Date date = new Date();
 		String shopKey = brandInfo.getShopKey();
-		if (StringUtil.isNullOrEmpty(shopKey))
-			shopKey = brandInfo.getName();
+		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);
@@ -133,18 +139,23 @@
 	 * @return
 	 */
 	private int addBrandGoodsJD(BrandInfo brandInfo) {
-		String shopKey = brandInfo.getShopKey();
-		if (StringUtil.isNullOrEmpty(shopKey))
-			shopKey = brandInfo.getName();
+		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.getSearchKey();
+		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);
@@ -213,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();
 		
@@ -225,7 +246,6 @@
 		PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
 		
 		int count = 0;
-		Date date = new Date();
 		
 		if (result != null) {
 			List<PDDGoodsDetail> goodsList = result.getGoodsList();

--
Gitblit v1.8.0