...
|
...
|
@@ -268,19 +268,19 @@ public class ShopsService extends BaseService implements ApplicationEventPublish |
|
|
return new SearchApiResult().setCode(400).setMessage("请传shop参数");
|
|
|
}
|
|
|
// 1、获取topHitCount
|
|
|
int topHitCount = StringUtils.isBlank(paramMap.get("viewNum")) || Integer.parseInt(paramMap.get("viewNum")) == 0 ? 10 : Integer.parseInt(paramMap.get("viewNum"));
|
|
|
int topHitCount = StringUtils.isBlank(paramMap.get("viewNum")) || Integer.parseInt(paramMap.get("viewNum")) == 0 ? 0 : Integer.parseInt(paramMap.get("viewNum"));
|
|
|
|
|
|
// 4、从ES中获取
|
|
|
// 2、从ES中获取
|
|
|
String[] shopIds = paramMap.get(SearchRequestParams.PARAM_SEARCH_SHOP).split(",");
|
|
|
List<ShopProductRequest> requests = new ArrayList<>();
|
|
|
for (String shopId : shopIds) {
|
|
|
paramMap.put(SearchRequestParams.PARAM_SEARCH_SHOP, shopId);
|
|
|
SearchParam searchParam = searchParamHelper.buildWithPersional(paramMap, false);
|
|
|
ParamQueryFilter paramQueryFilter = new ParamQueryFilter(searchParam.getQuery(), (BoolQueryBuilder)searchParam.getFiter());
|
|
|
ParamQueryFilter paramQueryFilter = new ParamQueryFilter(searchParam.getQuery(), (BoolQueryBuilder) searchParam.getFiter());
|
|
|
requests.add(new ShopProductRequest(paramQueryFilter, Integer.valueOf(shopId), topHitCount));
|
|
|
}
|
|
|
Map<String, ShopProductResponse> responseMap = shopProductCacheBean.queryShopProductList(requests);
|
|
|
// 5、返回生成结果
|
|
|
// 3、返回生成结果
|
|
|
Integer total = responseMap.values().stream().collect(Collectors.summingInt(ShopProductResponse::getCount));
|
|
|
JSONObject realResult = new JSONObject();
|
|
|
realResult.put("total", total);
|
...
|
...
|
|