...
|
...
|
@@ -60,24 +60,24 @@ public class SearchLikeInShopService { |
|
|
}
|
|
|
// 2、检测分页参数【默认30条】
|
|
|
int viewNum = 30;
|
|
|
|
|
|
// 3、获取当前查询的SKN的基本信息
|
|
|
JSONObject productInfoInEs = searchLikeHelper.getProductInfoInEs(productSkn);
|
|
|
if (productInfoInEs == null) {
|
|
|
return new SearchApiResult().setCode(400).setMessage("SKN不存在");
|
|
|
}
|
|
|
|
|
|
// 4、设置SearchParams
|
|
|
List<SearchParam> searchParams = new ArrayList<SearchParam>();
|
|
|
searchParams.add(this.builderSearchParam(productInfoInEs, Arrays.asList(productSkn), viewNum));
|
|
|
|
|
|
// 5、获取搜索结果[截取条数]
|
|
|
List<Map<String, Object>> tempProductList = searchLikeHelper.queryProductList(searchParams);
|
|
|
if (tempProductList.size() > viewNum) {
|
|
|
tempProductList = CollectionUtils.safeSubList(tempProductList,0, viewNum);
|
|
|
}
|
|
|
|
|
|
// 6、构造真实返回结果
|
|
|
//6、保留偶数
|
|
|
if (tempProductList.size() % 2 > 0) {
|
|
|
tempProductList = CollectionUtils.safeSubList(tempProductList, 0, tempProductList.size() - 1);
|
|
|
}
|
|
|
// 7、构造返回结果
|
|
|
List<Map<String, Object>> productListResults = new ArrayList<Map<String, Object>>();
|
|
|
if (!tempProductList.isEmpty()) {
|
|
|
productListResults = productListHelper.buildReturnInfoByEsSourceList(tempProductList);
|
...
|
...
|
|