Authored by wangnan9279

品牌下店铺,配置直接跳转

... ... @@ -2,12 +2,8 @@ package com.yoho.search.service.index;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.common.SearchCommonService;
import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.core.es.model.SearchResult;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -45,6 +41,7 @@ public class BrandIndexBaseService {
map.put("brand_keyword", MapUtils.getString(esMap, "brandKeyword", ""));
map.put("tbl_brand_id", MapUtils.getIntValue(esMap, "tblBrandId", 0));
map.put("ufo_brand_id", MapUtils.getIntValue(esMap, "ufoBrandId", 0));
map.put("shop_id", MapUtils.getIntValue(esMap, "shopId", 0));
//排序用的品牌名称
if (returnBrandNameForSort) {
map.put("brand_name_for_sort", MapUtils.getString(esMap, "brandNameForSort", "#"));
... ...
... ... @@ -137,7 +137,7 @@ public class BrandWithShopsService implements ApplicationEventPublisherAware {
}
JSONObject shop_info = new JSONObject();
List<String> shopIdList = entry.getValue();
JSONArray shop_yoho_list = this.getYohoShopInfo(shopIdList, shopInfoMap);
JSONArray shop_yoho_list = this.getYohoShopInfo(shopIdList, shopInfoMap, brandInfo);
shop_info.put("yoho_shop_list", shop_yoho_list);
shop_info.put("yoho_shop_count", shop_yoho_list.size());
JSONArray global_brand_List = this.getGlobalBrandList(shopIdList, brandId, brandInfoMap);
... ... @@ -201,8 +201,9 @@ public class BrandWithShopsService implements ApplicationEventPublisherAware {
*
* @return
*/
private JSONArray getYohoShopInfo(List<String> shopIdList, Map<String, Map<String, Object>> shopInfoMap) {
private JSONArray getYohoShopInfo(List<String> shopIdList, Map<String, Map<String, Object>> shopInfoMap, Map<String, Object> brandInfo) {
JSONArray yohoShops = new JSONArray();
Integer configShopInfo = MapUtils.getIntValue(brandInfo, "shop_id", 0);
for (String shopId : shopIdList) {
try {
if (StringUtils.isBlank(shopId)) {
... ... @@ -212,11 +213,14 @@ public class BrandWithShopsService implements ApplicationEventPublisherAware {
if (shopIdInt <= 0) {
continue;
}
if (configShopInfo > 0 && !shopIdInt.equals(configShopInfo)) {
continue;
}
Map<String, Object> shopInfo = shopInfoMap.get(shopId);
if (shopInfo == null) {
continue;
}
if (MapUtils.getIntValue(shopInfo,"status",0)!= 1) {
if (MapUtils.getIntValue(shopInfo, "status", 0) != 1) {
continue;
}
yohoShops.add(shopInfo);
... ...