Authored by hugufei

fix group_shops接口

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