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