...
|
...
|
@@ -59,8 +59,8 @@ public class SceneRecallService { |
|
|
//3、执行召回
|
|
|
RecallSknResult recallSknResult = recallService.getRecallSknResult(recallSknParams);
|
|
|
//4、根据召回结果查询商品信息
|
|
|
List<Map<String, Object>> productList = this.queryProductList(recallSknParams, recallSknResult,page,pageSize);
|
|
|
//6、构造返回结果
|
|
|
List<Map<String, Object>> productList = this.queryProductList(recallSknParams,recallSknResult,page,pageSize);
|
|
|
//5、构造返回结果
|
|
|
JSONObject dataMap = new JSONObject();
|
|
|
dataMap.put("total", recallSknResult.getTotal());
|
|
|
dataMap.put("page", page);
|
...
|
...
|
@@ -74,7 +74,7 @@ public class SceneRecallService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
private List<Map<String, Object>> queryProductList(RecallSknParams recallSknParams, RecallSknResult recallSknResult,int page,int pageSize) {
|
|
|
private List<Map<String, Object>> queryProductList( RecallSknParams recallSknParams,RecallSknResult recallSknResult,int page,int pageSize) {
|
|
|
//1、判断当前页码是否在召回的页码里
|
|
|
int recallTotalPage = recallSknResult.getRecallTotalPage();
|
|
|
//2、在召回结果中则直接根据skn去查询
|
...
|
...
|
@@ -84,7 +84,7 @@ public class SceneRecallService { |
|
|
}
|
|
|
//3、过滤召回的skn,修改真实页码,执行查询
|
|
|
int realPage = page - recallTotalPage;
|
|
|
return this.queryProductByFilterSkn(recallSknResult.getSknList(), realPage, pageSize);
|
|
|
return this.queryProductByFilterSkn(recallSknParams, recallSknResult.getSknList(), realPage, pageSize);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -94,15 +94,20 @@ public class SceneRecallService { |
|
|
* @param pageSize
|
|
|
* @return
|
|
|
*/
|
|
|
private List<Map<String, Object>> queryProductByFilterSkn(List<Integer> notProductSkns,int realPage,int pageSize){
|
|
|
private List<Map<String, Object>> queryProductByFilterSkn(RecallSknParams recallSknParams,List<Integer> notProductSkns,int realPage,int pageSize){
|
|
|
SearchParam searchParam = new SearchParam();
|
|
|
//设置分页参数
|
|
|
searchParam.setOffset((realPage-1)*pageSize);
|
|
|
searchParam.setSize(pageSize);
|
|
|
|
|
|
//设置query
|
|
|
searchParam.setQuery(recallSknParams.getParamQueryFilter().getParamQuery());
|
|
|
|
|
|
//设置filter
|
|
|
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
|
|
BoolQueryBuilder filter = recallSknParams.getParamQueryFilter().getParamFilter();
|
|
|
filter.mustNot(QueryBuilders.termsQuery(ProductIndexEsField.productSkn,notProductSkns));
|
|
|
searchParam.setFiter(filter);
|
|
|
|
|
|
//设置分页参数
|
|
|
searchParam.setOffset((realPage-1)*pageSize);
|
|
|
searchParam.setSize(pageSize);
|
|
|
|
|
|
//设置IncludeFields
|
|
|
searchParam.setIncludeFields(productIndexBaseService.getProductIndexIncludeFields());
|
...
|
...
|
|