From d8e6fe75c7bfb14c73da86b79991bda18d94a105 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 17 十二月 2019 15:14:40 +0800
Subject: [PATCH] 搜索品牌匹配

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java |   44 +++++++++++++++++++++++++++++---------------
 1 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
index 6a5beb0..77d1fa6 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -41,6 +41,7 @@
 import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
 import com.yeshi.fanli.exception.user.TokenRecordException;
 import com.yeshi.fanli.log.LogHelper;
+import com.yeshi.fanli.service.inter.brand.BrandInfoService;
 import com.yeshi.fanli.service.inter.config.BusinessSystemService;
 import com.yeshi.fanli.service.inter.config.ConfigService;
 import com.yeshi.fanli.service.inter.config.SuperHotSearchService;
@@ -128,6 +129,11 @@
 
 	@Resource
 	private IntegralGetCacheManager integralGetCacheManager;
+	
+	
+	@Resource
+	private BrandInfoService brandInfoService;
+	
 
 	/**
 	 * 绮樿创鏉夸俊鎭帹鑽�
@@ -772,25 +778,33 @@
 		data.put("count", result.getTaoBaoHead().getDocsfound());
 
 		if (page == 1) { // 绗竴椤佃繑鍥炲簵閾轰俊鎭�
-			List<TaoBaoShopVO> listShop = taoBaoShopService.getShopByKeyV2(key);
-			if (listShop != null && listShop.size() > 0 && listShop.get(0).getListGoodsVO() != null
-					&& listShop.get(0).getListGoodsVO().size() > 2) {
-				String platform = acceptData.getPlatform();
-				TaoBaoShopVO taoBaoShop = listShop.get(0);
-				if (("ios".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0(platform, acceptData.getVersion()))
-						|| ("android".equalsIgnoreCase(platform)
-								&& VersionUtil.greaterThan_2_0_1(platform, acceptData.getVersion()))) {
-					BrandInfoVO brandInfoVO = new BrandInfoVO();
-					brandInfoVO.setId(taoBaoShop.getId());
-					brandInfoVO.setName(taoBaoShop.getShopName());
-					brandInfoVO.setIcon(taoBaoShop.getShopIcon());
-					brandInfoVO.setListGoods(taoBaoShop.getListGoodsVO());
+			String platform = acceptData.getPlatform();
+			String version = acceptData.getVersion();
+			if (("ios".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_1(platform, version))
+					|| ("android".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0_2(platform, version))) {
+				BrandInfoVO brandInfoVO = brandInfoService.listByAlikeName(key);
+				if (brandInfoVO != null)
 					data.put("shop", JsonUtil.getApiCommonGson().toJson(brandInfoVO));
-				} else {
-					data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop));
+			} else {
+				List<TaoBaoShopVO> listShop = taoBaoShopService.getShopByKeyV2(key);
+				if (listShop != null && listShop.size() > 0 && listShop.get(0).getListGoodsVO() != null
+						&& listShop.get(0).getListGoodsVO().size() > 2) {
+					TaoBaoShopVO taoBaoShop = listShop.get(0);
+					if (("ios".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0(platform, version))
+					   || ("android".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0_1(platform, version))) {
+						BrandInfoVO brandInfoVO = new BrandInfoVO();
+						brandInfoVO.setId(taoBaoShop.getId());
+						brandInfoVO.setName(taoBaoShop.getShopName());
+						brandInfoVO.setIcon(taoBaoShop.getShopIcon());
+						brandInfoVO.setListGoods(taoBaoShop.getListGoodsVO());
+						data.put("shop", JsonUtil.getApiCommonGson().toJson(brandInfoVO));
+					} else {
+						data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop));
+					}
 				}
 			}
 		}
+		
 		out.print(JsonUtil.loadTrueResult(data));
 	}
 

--
Gitblit v1.8.0