...
|
...
|
@@ -36,6 +36,8 @@ public class SceneRecallProductListService { |
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(SceneRecallProductListService.class);
|
|
|
|
|
|
private static final Logger RECALL_NEW_LOGGER = LoggerFactory.getLogger("RECALL_NEW");
|
|
|
|
|
|
@Autowired
|
|
|
private RecallParamsBuilder recallParamsBuilder;
|
|
|
@Autowired
|
...
|
...
|
@@ -58,8 +60,11 @@ public class SceneRecallProductListService { |
|
|
//2、构造召回相关参数
|
|
|
RecallParams recallParams = recallParamsBuilder.buildRecallParams(paramMap,pageSize);
|
|
|
//3、执行召回
|
|
|
long begin = System.currentTimeMillis();
|
|
|
RecallResult recallResult = queryRecallResultCacheBean.queryRecallResult(recallParams);
|
|
|
RECALL_NEW_LOGGER.info("SceneRecallProductListService[1]-queryRecallResult,cost is [{}]", System.currentTimeMillis()-begin);
|
|
|
//4、根据召回结果查询商品信息
|
|
|
begin = System.currentTimeMillis();
|
|
|
List<Map<String, Object>> productList = this.queryProductList(recallParams, recallResult,page,pageSize);
|
|
|
//5、构造返回结果
|
|
|
JSONObject dataMap = new JSONObject();
|
...
|
...
|
@@ -87,18 +92,22 @@ public class SceneRecallProductListService { |
|
|
//1、判断当前页码是否在召回的页码里
|
|
|
int recallTotalPage = recallResult.getRecallTotalPage();
|
|
|
//2、在召回结果中则直接根据skn去查询
|
|
|
long begin = System.currentTimeMillis();
|
|
|
List<RecallSknInfo> recallSknInfos = null;
|
|
|
if(page<=recallTotalPage){
|
|
|
recallSknInfos = CollectionUtils.safeSubList(recallResult.getSknList(),(page-1)*pageSize,page*pageSize);
|
|
|
}else{
|
|
|
//3、过滤召回的skn,修改真实页码,执行查询
|
|
|
recallSknInfos = this.queryProductSknByFilterSkn(recallParams, recallResult.getSknList(), recallTotalPage-page, pageSize);
|
|
|
}
|
|
|
RECALL_NEW_LOGGER.info("SceneRecallProductListService[2].getRecallSknInfos,cost is [{}]", System.currentTimeMillis()-begin);
|
|
|
|
|
|
//3、获取召回结果的skn
|
|
|
List<Integer> productSknList = this.getProductSknList(recallSknInfos);
|
|
|
|
|
|
//4、获取商品的返回信息
|
|
|
begin = System.currentTimeMillis();
|
|
|
List<Map<String, Object>> productInfoList = queryProductInfoCacheBean.queryProductListBySkn(productSknList,productSknList.size());
|
|
|
RECALL_NEW_LOGGER.info("SceneRecallProductListService[3].queryProductListBySkn,cost is [{}]", System.currentTimeMillis()-begin);
|
|
|
|
|
|
//5、填充召回类型
|
|
|
Map<Integer,RecallSknInfo> sknRecallTypeMap = CollectionUtils.toMap(recallSknInfos, new Transfer<RecallSknInfo, Integer>() {
|
...
|
...
|
|