Authored by 胡古飞

fix

@@ -43,19 +43,8 @@ public class BrandIndexBaseService { @@ -43,19 +43,8 @@ public class BrandIndexBaseService {
43 map.put("brand_name", esMap.get("brandName")); 43 map.put("brand_name", esMap.get("brandName"));
44 map.put("brand_keyword", esMap.get("brandKeyword")); 44 map.put("brand_keyword", esMap.get("brandKeyword"));
45 map.put("status", esMap.get("status")); 45 map.put("status", esMap.get("status"));
46 - return map;  
47 - }  
48 -  
49 - /**  
50 - * 返回真实的全球购品牌信息时,需要把id转换为正数  
51 - *  
52 - * @param esMap  
53 - * @return  
54 - */  
55 - private Map<String, Object> getGlobalBrandMap(Map<String, Object> esMap) {  
56 - Map<String, Object> map = new HashMap<String, Object>();  
57 - map.putAll(this.getBrandMap(esMap));  
58 - map.put("id", (-1) * (Integer) esMap.get("id")); 46 + map.put("yoho_brand_id", esMap.get("yohoBrandId"));
  47 + map.put("is_global", esMap.get("isGlobal"));
59 return map; 48 return map;
60 } 49 }
61 50
@@ -87,7 +76,10 @@ public class BrandIndexBaseService { @@ -87,7 +76,10 @@ public class BrandIndexBaseService {
87 * @param globalBrandIds 76 * @param globalBrandIds
88 * @return 77 * @return
89 */ 78 */
90 - public List<Map<String, Object>> getGlobalBrandListByIds(List<?> brandIds) { 79 + private List<Map<String, Object>> getGlobalBrandListByIds(List<?> brandIds) {
  80 + if (brandIds == null || brandIds.isEmpty()) {
  81 + return new ArrayList<Map<String, Object>>();
  82 + }
91 SearchParam searchParam = new SearchParam(); 83 SearchParam searchParam = new SearchParam();
92 BoolQueryBuilder boolFilter = QueryBuilders.boolQuery(); 84 BoolQueryBuilder boolFilter = QueryBuilders.boolQuery();
93 boolFilter.must(QueryBuilders.termQuery("isGlobal", "Y")); 85 boolFilter.must(QueryBuilders.termQuery("isGlobal", "Y"));
@@ -102,7 +94,7 @@ public class BrandIndexBaseService { @@ -102,7 +94,7 @@ public class BrandIndexBaseService {
102 List<Map<String, Object>> esResults = searchResult.getResultList(); 94 List<Map<String, Object>> esResults = searchResult.getResultList();
103 List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); 95 List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
104 for (Map<String, Object> esResult : esResults) { 96 for (Map<String, Object> esResult : esResults) {
105 - list.add(this.getGlobalBrandMap(esResult)); 97 + list.add(this.getBrandMap(esResult));
106 } 98 }
107 return list; 99 return list;
108 } 100 }
@@ -111,7 +103,16 @@ public class BrandIndexBaseService { @@ -111,7 +103,16 @@ public class BrandIndexBaseService {
111 List<Map<String, Object>> resultList = this.getGlobalBrandListByIds(brandIds); 103 List<Map<String, Object>> resultList = this.getGlobalBrandListByIds(brandIds);
112 Map<String, Map<String, Object>> resultMap = new HashMap<String, Map<String, Object>>(); 104 Map<String, Map<String, Object>> resultMap = new HashMap<String, Map<String, Object>>();
113 for (Map<String, Object> result : resultList) { 105 for (Map<String, Object> result : resultList) {
114 - resultMap.put(result.get("id").toString(), result); 106 + String realBrandId = result.get("id").toString();
  107 + // 将id转为真实的id
  108 + result.put("id", Integer.valueOf(realBrandId) * (-1));
  109 + // realBrandId加入map
  110 + resultMap.put(realBrandId, result);
  111 + // yohobrandId加入map
  112 + Object yohobrandId = result.get("yoho_brand_id");
  113 + if (yohobrandId != null) {
  114 + resultMap.put(yohobrandId.toString(), result);
  115 + }
115 } 116 }
116 return resultMap; 117 return resultMap;
117 } 118 }
@@ -117,7 +117,7 @@ public class SearchCommonHelper { @@ -117,7 +117,7 @@ public class SearchCommonHelper {
117 if (!paramMap.containsKey("contain_global") || !"Y".equals(paramMap.get("contain_global"))) { 117 if (!paramMap.containsKey("contain_global") || !"Y".equals(paramMap.get("contain_global"))) {
118 return false; 118 return false;
119 } 119 }
120 - return false; 120 + return true;
121 } 121 }
122 122
123 /** 123 /**
@@ -182,7 +182,7 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic @@ -182,7 +182,7 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic
182 // 4)获取所有的全球购品牌数据 182 // 4)获取所有的全球购品牌数据
183 Map<String, Map<String, Object>> globalBrandInfoMap = brandIndexBaseService.getGlobalBrandMapByIds(globalBrandIds); 183 Map<String, Map<String, Object>> globalBrandInfoMap = brandIndexBaseService.getGlobalBrandMapByIds(globalBrandIds);
184 // 4)获取所有的店铺数据还 184 // 4)获取所有的店铺数据还
185 - Map<String, Map<String, Object>> shopInfoMap = shopsIndexBaseService.getShopsMapByIds(brandIds); 185 + Map<String, Map<String, Object>> shopInfoMap = shopsIndexBaseService.getShopsMapByIds(shopIds);
186 186
187 // 5)构造真正的数据 187 // 5)构造真正的数据
188 Map<String, JSONArray> result = new LinkedHashMap<String, JSONArray>(); 188 Map<String, JSONArray> result = new LinkedHashMap<String, JSONArray>();
@@ -236,9 +236,12 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic @@ -236,9 +236,12 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic
236 continue; 236 continue;
237 } 237 }
238 Map<String, Object> shopInfo = shopInfoMap.get(shopId); 238 Map<String, Object> shopInfo = shopInfoMap.get(shopId);
239 - if (shopInfo == null || (Integer) shopInfo.get("status") != 1 || (Integer) shopInfo.get("check_status") != 300) { 239 + if (shopInfo == null ) {
240 continue; 240 continue;
241 } 241 }
  242 +// if ((Integer) shopInfo.get("status") != 1 || (Integer) shopInfo.get("check_status") != 300) {
  243 +// continue;
  244 +// }
242 yohoShops.add(shopInfo); 245 yohoShops.add(shopInfo);
243 } 246 }
244 return yohoShops; 247 return yohoShops;