...
|
...
|
@@ -134,6 +134,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
// 3)填充变价计划,并做品牌打散
|
|
|
begin = System.currentTimeMillis();
|
|
|
List<Map<String, Object>> product_list = productIndexBaseService.getProductListWithPricePlan(recallProductInfoList.getProductInfoList());
|
|
|
product_list = productListSortService.sortProductList(product_list, paramMap);
|
|
|
super.doLogInfo("[func8=getProductListWithPricePlan][cost={}ms]", System.currentTimeMillis() - begin);
|
|
|
|
|
|
// 4)构造返回结果
|
...
|
...
|
@@ -232,7 +233,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
|
|
|
// 3、构造sort
|
|
|
List<SortBuilder<?>> sortBuilders = new ArrayList<SortBuilder<?>>();
|
|
|
sortBuilders.add(SortBuilders.fieldSort(ProductIndexEsField.salesNum).order(SortOrder.DESC));
|
|
|
sortBuilders.add(SortBuilders.fieldSort(ProductIndexEsField.sevendayMoney).order(SortOrder.DESC));
|
|
|
sortBuilders.add(SortBuilders.fieldSort(ProductIndexEsField.id).order(SortOrder.DESC));
|
|
|
searchParam.setSortBuilders(sortBuilders);
|
|
|
|
...
|
...
|
@@ -354,12 +355,12 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
long begin = System.currentTimeMillis();
|
|
|
if (searchDynamicConfigService.isSortPageRecallUseGlobalBrand()) {
|
|
|
brandIds = this.getUserGlobalBrandIds(paramMap);
|
|
|
super.doLogInfo("[func0=getUserGlobalBrandIds][cost={}ms],brandIds is [{}] ]", System.currentTimeMillis() - begin, brandIds);
|
|
|
super.doLogInfo("[func0=getUserGlobalBrandIds][cost={}ms],brandIds is {}]", System.currentTimeMillis() - begin, JSON.toJSONString(brandIds));
|
|
|
} else {
|
|
|
brandIds = this.getUserLikeBrandIds(paramMap);
|
|
|
super.doLogInfo("[func0=getUserLikeBrandIds][cost={}ms],brandIds is [{}] ]", System.currentTimeMillis() - begin, brandIds);
|
|
|
super.doLogInfo("[func0=getUserLikeBrandIds][cost={}ms],brandIds is {}]", System.currentTimeMillis() - begin, JSON.toJSONString(brandIds));
|
|
|
}
|
|
|
|
|
|
|
|
|
// 1、支持firstProductSkn的召回
|
|
|
recallStrategy.add(new FirstProductSknStrategy(1, this.getFirstProductSkns(paramMap)));
|
|
|
// 2、支持直通车的召回-随机召回
|
...
|
...
|
@@ -369,11 +370,11 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
// 4、新开店铺商品召回-随机召回
|
|
|
recallStrategy.add(new NewShopStrategy(2));
|
|
|
// 5、支持新上架的召回-有new标签的
|
|
|
recallStrategy.add(new NewShelveStrategy(brandIds, 10));
|
|
|
recallStrategy.add(new NewShelveStrategy(brandIds, 20));
|
|
|
// 6、支持新降价的召回-两天内实际降过价的
|
|
|
recallStrategy.add(new NewReducePriceStrategy(brandIds, 10));
|
|
|
recallStrategy.add(new NewReducePriceStrategy(brandIds, 20));
|
|
|
// 7、支持新开促销的召回-5种促销类型
|
|
|
recallStrategy.add(new NewPromotionStrategy(brandIds, 10));
|
|
|
recallStrategy.add(new NewPromotionStrategy(brandIds, 20));
|
|
|
// 8、支持兜底的召回-人气排序
|
|
|
recallStrategy.add(new CommonStrategy(pageSize));
|
|
|
return recallStrategy;
|
...
|
...
|
@@ -412,14 +413,24 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
|
|
|
@Override
|
|
|
protected RecallResult doCarefulRank(Map<String, String> paramMap, RecallResult recallResult) {
|
|
|
List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
|
|
|
|
|
|
// 1、获取productList
|
|
|
List<Map<String, Object>> productList = recallResult.getProductList();
|
|
|
// 2、精排
|
|
|
Collections.shuffle(productList);
|
|
|
// 3、TODO 品牌打散
|
|
|
|
|
|
// 2、各召回策略随机打散【除兜底的】
|
|
|
Iterator<Map<String, Object>> iterator = productList.iterator();
|
|
|
while (iterator.hasNext()) {
|
|
|
Map<String, Object> product = iterator.next();
|
|
|
if (!product.get("recallType").equals(RecallType.COMMON)) {
|
|
|
results.add(product);
|
|
|
iterator.remove();
|
|
|
}
|
|
|
}
|
|
|
Collections.shuffle(results);
|
|
|
// 3、加入剩余商品
|
|
|
results.addAll(productList);
|
|
|
// 4、回设productList
|
|
|
recallResult.setProductList(productList);
|
|
|
recallResult.setProductList(results);
|
|
|
return recallResult;
|
|
|
}
|
|
|
|
...
|
...
|
|