Authored by hugufei

模糊搜索第二页以后shop_list、customize_tag 、customize_tag_new 返回空数组

... ... @@ -89,6 +89,7 @@ public class FuzzySceneService extends AbstractPageSceneService {
if (StringUtils.isBlank(paramMap.get(SearchRequestParams.PARAM_SEARCH_QUERY))) {
return new SearchApiResult().setCode(400).setMessage("请传query参数");
}
final int page = MapUtils.getIntValue(paramMap, "page", 1);
// 2、添加默认参数
this.addParamsToParamMap(paramMap);
... ... @@ -97,7 +98,17 @@ public class FuzzySceneService extends AbstractPageSceneService {
CompletableFuture<SearchApiResult> productListuture = CompletableFuture.supplyAsync(() -> productListSwitchService.fuzzyProductList(this.newParamMap(paramMap)), executor);
// 4、获取自定义标签聚合结果
CompletableFuture<JSONObject> customizeTagFuture = CompletableFuture.supplyAsync(() -> pageAggregationHelper.sceneAggCustomizeTag(this.newParamMap(paramMap)), executor);
CompletableFuture<JSONObject> customizeTagFuture = CompletableFuture.supplyAsync(() -> {
if (page > 1) {
JSONObject result = new JSONObject();
result.put("customize_tag", Collections.emptyList());
result.put("customize_tag_new", Collections.emptyList());
return result;
} else {
return pageAggregationHelper.sceneAggCustomizeTag(newParamMap(paramMap));
}
}, executor);
// 5、获取促销专题
//CompletableFuture<SearchApiResult> promotionsFuture = CompletableFuture.supplyAsync(() -> pageAggregationHelper.sceneAggPromotion(this.newParamMap(paramMap)), executor);
... ... @@ -193,7 +204,11 @@ public class FuzzySceneService extends AbstractPageSceneService {
});
//6、加入返回结果
dataMap.put("shop_list", shopsResult.getJSONArray("shop_list"));
if (page == 1) {
dataMap.put("shop_list", shopsResult.getJSONArray("shop_list"));
} else {
dataMap.put("shop_list", Collections.emptyList());
}
dataMap.put("shop_list_page", shop_list_page1);
dataMap.put("search_resource_list", search_resource_list1);
... ...