Authored by 胡古飞

fix

... ... @@ -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;
}
... ...
... ... @@ -117,7 +117,7 @@ public class SearchCommonHelper {
if (!paramMap.containsKey("contain_global") || !"Y".equals(paramMap.get("contain_global"))) {
return false;
}
return false;
return true;
}
/**
... ...
... ... @@ -182,7 +182,7 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic
// 4)获取所有的全球购品牌数据
Map<String, Map<String, Object>> globalBrandInfoMap = brandIndexBaseService.getGlobalBrandMapByIds(globalBrandIds);
// 4)获取所有的店铺数据还
Map<String, Map<String, Object>> shopInfoMap = shopsIndexBaseService.getShopsMapByIds(brandIds);
Map<String, Map<String, Object>> shopInfoMap = shopsIndexBaseService.getShopsMapByIds(shopIds);
// 5)构造真正的数据
Map<String, JSONArray> result = new LinkedHashMap<String, JSONArray>();
... ... @@ -236,9 +236,12 @@ public class BrandWithShopsServiceImpl implements IBrandWithShopsService, Applic
continue;
}
Map<String, Object> shopInfo = shopInfoMap.get(shopId);
if (shopInfo == null || (Integer) shopInfo.get("status") != 1 || (Integer) shopInfo.get("check_status") != 300) {
if (shopInfo == null ) {
continue;
}
// if ((Integer) shopInfo.get("status") != 1 || (Integer) shopInfo.get("check_status") != 300) {
// continue;
// }
yohoShops.add(shopInfo);
}
return yohoShops;
... ...