...
|
...
|
@@ -43,19 +43,8 @@ public class BrandIndexBaseService { |
|
|
map.put("brand_name", esMap.get("brandName"));
|
|
|
map.put("brand_keyword", esMap.get("brandKeyword"));
|
|
|
map.put("status", esMap.get("status"));
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 返回真实的全球购品牌信息时,需要把id转换为正数
|
|
|
*
|
|
|
* @param esMap
|
|
|
* @return
|
|
|
*/
|
|
|
private Map<String, Object> getGlobalBrandMap(Map<String, Object> esMap) {
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
map.putAll(this.getBrandMap(esMap));
|
|
|
map.put("id", (-1) * (Integer) esMap.get("id"));
|
|
|
map.put("yoho_brand_id", esMap.get("yohoBrandId"));
|
|
|
map.put("is_global", esMap.get("isGlobal"));
|
|
|
return map;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -87,7 +76,10 @@ public class BrandIndexBaseService { |
|
|
* @param globalBrandIds
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> getGlobalBrandListByIds(List<?> brandIds) {
|
|
|
private List<Map<String, Object>> getGlobalBrandListByIds(List<?> brandIds) {
|
|
|
if (brandIds == null || brandIds.isEmpty()) {
|
|
|
return new ArrayList<Map<String, Object>>();
|
|
|
}
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
BoolQueryBuilder boolFilter = QueryBuilders.boolQuery();
|
|
|
boolFilter.must(QueryBuilders.termQuery("isGlobal", "Y"));
|
...
|
...
|
@@ -102,7 +94,7 @@ public class BrandIndexBaseService { |
|
|
List<Map<String, Object>> esResults = searchResult.getResultList();
|
|
|
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
|
|
for (Map<String, Object> esResult : esResults) {
|
|
|
list.add(this.getGlobalBrandMap(esResult));
|
|
|
list.add(this.getBrandMap(esResult));
|
|
|
}
|
|
|
return list;
|
|
|
}
|
...
|
...
|
@@ -111,7 +103,16 @@ public class BrandIndexBaseService { |
|
|
List<Map<String, Object>> resultList = this.getGlobalBrandListByIds(brandIds);
|
|
|
Map<String, Map<String, Object>> resultMap = new HashMap<String, Map<String, Object>>();
|
|
|
for (Map<String, Object> result : resultList) {
|
|
|
resultMap.put(result.get("id").toString(), result);
|
|
|
String realBrandId = result.get("id").toString();
|
|
|
// 将id转为真实的id
|
|
|
result.put("id", Integer.valueOf(realBrandId) * (-1));
|
|
|
// realBrandId加入map
|
|
|
resultMap.put(realBrandId, result);
|
|
|
// yohobrandId加入map
|
|
|
Object yohobrandId = result.get("yoho_brand_id");
|
|
|
if (yohobrandId != null) {
|
|
|
resultMap.put(yohobrandId.toString(), result);
|
|
|
}
|
|
|
}
|
|
|
return resultMap;
|
|
|
}
|
...
|
...
|
|