Authored by hugufei

删除无用代码

... ... @@ -27,6 +27,29 @@ public class SceneRecommendBrandsService {
@Autowired
private UserPersionalFactorComponent userPersionalFactorComponent;
public void getRecommendBrands(Map<String, String> paramMap, SearchApiResult result) {
getRecommendBrands(paramMap, result, null);
}
public void getRecommendBrands(Map<String, String> paramMap, SearchApiResult result, BoolQueryBuilder extFilter) {
if (result != null && result.getData() != null) {
JSONObject data = (JSONObject) result.getData();
JSONObject commonFilters = data.getJSONObject("filter");
if (commonFilters != null) {
getRecommendBrandsNew(commonFilters, paramMap);
}
}
}
private void getRecommendBrandsNew(JSONObject commonFilters, Map<String, String> paramMap) {
JSONArray recommendBrands = new JSONArray();
JSONArray brandList = commonFilters.getJSONArray("brand");
if (!CollectionUtils.isEmpty(brandList)) {
recommendBrands = getRecommendBrands(paramMap, brandList);
}
commonFilters.put("recommendBrand", recommendBrands);
}
private JSONArray getRecommendBrands(Map<String, String> paramMap, JSONArray brandList) {
List<JSONObject> brandListTemp = JSON.parseObject(brandList.toJSONString(), new TypeReference<List<JSONObject>>() {
});
... ... @@ -68,26 +91,4 @@ public class SceneRecommendBrandsService {
return recBrands;
}
public void getRecommendBrands(Map<String, String> paramMap, SearchApiResult result) {
getRecommendBrands(paramMap, result, null);
}
public void getRecommendBrands(Map<String, String> paramMap, SearchApiResult result, BoolQueryBuilder extFilter) {
if (result != null && result.getData() != null) {
JSONObject data = (JSONObject) result.getData();
JSONObject commonFilters = data.getJSONObject("filter");
if (commonFilters != null) {
getRecommendBrandsNew(commonFilters, paramMap);
}
}
}
private void getRecommendBrandsNew(JSONObject commonFilters, Map<String, String> paramMap) {
JSONArray recommendBrands = new JSONArray();
JSONArray brandList = commonFilters.getJSONArray("brand");
if (!CollectionUtils.isEmpty(brandList)) {
recommendBrands = getRecommendBrands(paramMap, brandList);
}
commonFilters.put("recommendBrand", recommendBrands);
}
}
... ...
... ... @@ -16,14 +16,6 @@ public interface IAggRecommendService {
*/
SearchApiResult aggRecommendBrand(Map<String, String> paramMap);
/**
* 获取品牌的聚合结果[使用本地缓存]
*
* @param paramMap
* @return
*/
SearchApiResult aggRecommendBrand(Map<String, String> paramMap, BoolQueryBuilder mustFilter);
/**
* 获取店铺的聚合结果[使用本地缓存]
... ...
... ... @@ -54,20 +54,11 @@ public class AggRecommendServiceImpl extends AbstractCacheAbleService implements
public SearchApiResult aggRecommendBrand(Map<String, String> paramMap) {
try {
logger.info("[func=aggRecommendBrand][param={}][begin={}]", paramMap.toString(), System.currentTimeMillis());
return this.aggRecommendBrand(paramMap, null);
} catch (Exception e) {
return SearchApiResultUtils.errorSearchApiResult("aggRecommendBrand", paramMap, e);
}
}
@Override
public SearchApiResult aggRecommendBrand(Map<String, String> paramMap, BoolQueryBuilder mustFilter) {
try {
// 0、开关支持是否关闭个性化
if (!searchDynamicConfigService.isRecommendPersionalOpen()) {
paramMap.remove("uid");
}
// 1、获取核心参数
boolean needPreAggregation = true;
String aggWithParamBrand = paramMap.get(SearchRequestParams.PARAM_SEARCH_AGG_WITH_PARAM_BRAND);
... ... @@ -77,7 +68,7 @@ public class AggRecommendServiceImpl extends AbstractCacheAbleService implements
int recommendBrandCount = Integer.parseInt(paramMap.getOrDefault(SearchRequestParams.PARAM_SEARCH_VIEWNUM, "8"));
// 2、构建带queryBuilder和filter的SearchParam
SearchParam searchParam = searchParamHelper.buildSearchParam(paramMap, true, mustFilter, needPreAggregation ? "brand" : null);
SearchParam searchParam = searchParamHelper.buildSearchParam(paramMap, true, null, needPreAggregation ? "brand" : null);
// 3、构造聚合
IAggregation recommendBrandAgg = aggregationFactoryService.getRecommendBrandAggregation(paramMap, recommendBrandCount);
... ...