...
|
...
|
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
...
|
...
|
@@ -78,13 +79,14 @@ public class SceneRecallService { |
|
|
//1、判断当前页码是否在召回的页码里
|
|
|
int recallTotalPage = recallSknResult.getRecallTotalPage();
|
|
|
//2、在召回结果中则直接根据skn去查询
|
|
|
List<Integer> productSkns = null;
|
|
|
if(page<=recallTotalPage){
|
|
|
List<Integer> productSkns = CollectionUtils.safeSubList(recallSknResult.getSknList(),(page-1)*pageSize,page*pageSize);
|
|
|
return bacthSknInfoComponent.queryProductListBySkn(productSkns,productSkns.size());
|
|
|
productSkns = CollectionUtils.safeSubList(recallSknResult.getSknList(),(page-1)*pageSize,page*pageSize);
|
|
|
}else{
|
|
|
//3、过滤召回的skn,修改真实页码,执行查询
|
|
|
productSkns = this.queryProductSknByFilterSkn(recallSknParams, recallSknResult.getSknList(), recallTotalPage-page, pageSize);
|
|
|
}
|
|
|
//3、过滤召回的skn,修改真实页码,执行查询
|
|
|
int realPage = page - recallTotalPage;
|
|
|
return this.queryProductByFilterSkn(recallSknParams, recallSknResult.getSknList(), realPage, pageSize);
|
|
|
return bacthSknInfoComponent.queryProductListBySkn(productSkns,productSkns.size());
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -94,7 +96,7 @@ public class SceneRecallService { |
|
|
* @param pageSize
|
|
|
* @return
|
|
|
*/
|
|
|
private List<Map<String, Object>> queryProductByFilterSkn(RecallSknParams recallSknParams,List<Integer> notProductSkns,int realPage,int pageSize){
|
|
|
private List<Integer> queryProductSknByFilterSkn(RecallSknParams recallSknParams,List<Integer> notProductSkns,int realPage,int pageSize){
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
|
|
|
//1、设置query
|
...
|
...
|
@@ -110,7 +112,7 @@ public class SceneRecallService { |
|
|
searchParam.setSize(pageSize);
|
|
|
|
|
|
//4、设置IncludeFields
|
|
|
searchParam.setIncludeFields(productIndexBaseService.getProductIndexIncludeFields());
|
|
|
searchParam.setIncludeFields(Arrays.asList(ProductIndexEsField.productSkn));
|
|
|
|
|
|
//5、设置排序
|
|
|
List<SortBuilder<?>> sortBuilders = new ArrayList<>();
|
...
|
...
|
@@ -119,7 +121,12 @@ public class SceneRecallService { |
|
|
sortBuilders.add(SortBuilderHelper.getIdDescSort());
|
|
|
searchParam.setSortBuilders(sortBuilders);
|
|
|
SearchResult searchResult = searchCommonService.doSearch(ISearchConstants.INDEX_NAME_PRODUCT_INDEX,searchParam);
|
|
|
return productIndexBaseService.getProductListWithPricePlan(searchResult.getResultList());
|
|
|
|
|
|
List<Integer> results = new ArrayList<>();
|
|
|
for (Map<String, Object> product : searchResult.getResultList()) {
|
|
|
results.add(MapUtils.getIntValue(product,ProductIndexEsField.productSkn,0));
|
|
|
}
|
|
|
return results;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|