|
@@ -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
|
}
|