Authored by hugufei

fix group_shops接口

... ... @@ -32,7 +32,7 @@ public class ShopProductCacheBean extends AbstractCacheBean<ShopProductRequest,
List<ShopProductRequestResponse> requestResponses = new ArrayList<>();
requests.forEach(e -> requestResponses.add(new ShopProductRequestResponse(e)));
//2、执行查询
this.bacthFillResponseWithCache(requestResponses,60);
this.bacthFillResponseWithCache(requestResponses,requests.size());
//3、返回结果
Map<String, ShopProductResponse> responseMap = new HashMap<>();
requestResponses.forEach(e -> {
... ... @@ -84,9 +84,4 @@ public class ShopProductCacheBean extends AbstractCacheBean<ShopProductRequest,
}
return results;
}
@Override
protected void batchAddResponseToCache(List<ShopProductRequestResponse> shopProductRequestResponses) {
super.batchAddResponseToCache(shopProductRequestResponses);
}
}
... ...
... ... @@ -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);
... ...