From d8359ddb48dab5cc797a9d552e11fde571f4920c Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期二, 27 八月 2019 12:32:46 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/goods/recommend/HomeRecommendGoodsServiceImpl.java |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/recommend/HomeRecommendGoodsServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/recommend/HomeRecommendGoodsServiceImpl.java
index 0e977a8..dea9c34 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/recommend/HomeRecommendGoodsServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/recommend/HomeRecommendGoodsServiceImpl.java
@@ -22,6 +22,7 @@
 import com.yeshi.fanli.service.inter.goods.recommend.HomeRecommendGoodsService;
 import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
 import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
+import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
 import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
@@ -44,6 +45,9 @@
 
 	@Resource
 	private TLJBuyGoodsService tljBuyGoodsService;
+
+	@Resource
+	private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
 
 	@Override
 	public List<TaoBaoGoodsBrief> listGoodsByPage(Long uid, String device, String imei, String idfa, int page) {
@@ -170,7 +174,16 @@
 		if (fList != null && fList.size() > 0)
 			return fList;
 
-		DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(type, null);
+		DaTaoKeGoodsResult result = null;
+		int count = 0;
+		while (result == null && count < 4) {
+			count++;
+			try {
+				result = DaTaoKeApiUtil.getRankingList(type, null);
+			} catch (Exception e) {
+			}
+		}
+
 		List<DaTaoKeDetailV2> list = result.getGoodsList();
 		List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
 		if (list != null)
@@ -183,6 +196,8 @@
 		if (goodsList != null && goodsList.size() > 0)
 			saveObjList(goodsList, name, key);
 
+		// 鍟嗗搧淇℃伅杩囨护
+		goodsList = taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(goodsList);
 		return goodsList;
 	}
 
@@ -199,7 +214,8 @@
 		if (list != null && list.size() > 0)
 			return list;
 
-		TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(3756, page, Constant.PAGE_SIZE);
+		// 鐖嗘鍟嗗搧搴�
+		TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(14624, page, Constant.PAGE_SIZE);
 		if (result != null) {
 			list = daTaoKeGoodsDetailService.filterTaoBaoGoods(result.getTaoBaoGoodsBriefs());
 			saveObjList(list, name, key);
@@ -243,16 +259,23 @@
 		Map<Long, TLJBuyGoods> map = new ConcurrentHashMap<>();
 		if (list != null)
 			for (TLJBuyGoods goods : list) {
-				map.put(goods.getGoods().getAuctionId(), goods);
-				finalList.add(goods.getGoods());
+				try {
+					if (goods.getGoods().getAuctionId() == null) {
+						goods.getGoods().setAuctionId(goods.getGoods().getId());
+					}
+					map.put(goods.getGoods().getAuctionId(), goods);
+					finalList.add(goods.getGoods());
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
 			}
 
 		finalList = recommendGoodsDeleteHistoryService.filterGoods(device, finalList);
 
 		if (finalList != null && finalList.size() > 0) {
 			Collections.shuffle(finalList);
-			if (finalList.size() >= 3)
-				finalList = finalList.subList(0, 3);
+			if (finalList.size() >= 10)
+				finalList = finalList.subList(0, 10);
 			list = new ArrayList<>();
 			for (TaoBaoGoodsBrief goods : finalList) {
 				list.add(map.get(goods.getAuctionId()));

--
Gitblit v1.8.0