...
|
...
|
@@ -39,6 +39,7 @@ import com.yoho.search.recall.sort.strategy.NewPromotionStrategy; |
|
|
import com.yoho.search.recall.sort.strategy.NewReducePriceStrategy;
|
|
|
import com.yoho.search.recall.sort.strategy.NewShelveStrategy;
|
|
|
import com.yoho.search.recall.sort.strategy.NewShopStrategy;
|
|
|
import sun.applet.Main;
|
|
|
|
|
|
@Service
|
|
|
public class SortRecallSceneService extends AbstractRecallService {
|
...
|
...
|
@@ -103,7 +104,7 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
// 1、支持firstProductSkn的召回
|
|
|
recallStrategy.add(new FirstProductSknStrategy(1, recallServiceHelper.getFirstProductSkns(paramMap)));
|
|
|
// 2、支持直通车的召回-随机召回
|
|
|
recallStrategy.add(new DirectTrainStrategy(2));
|
|
|
recallStrategy.add(new DirectTrainStrategy(20));
|
|
|
// 3、支持曝光补偿的召回-大数据给的,随机召回
|
|
|
recallStrategy.add(new AddFlowStrategy(2));
|
|
|
// 4、新开店铺商品召回-随机召回
|
...
|
...
|
@@ -207,17 +208,16 @@ public class SortRecallSceneService extends AbstractRecallService { |
|
|
iterator = productList.iterator();
|
|
|
int index = 0;
|
|
|
while (iterator.hasNext()) {
|
|
|
// 生成插入位置
|
|
|
Map<String, Object> product = iterator.next();
|
|
|
// 生成插入位置-超出新列表的长度,则直接丢弃
|
|
|
int totalNewProductListSize = newProductList.size();
|
|
|
int randomIndex = (int) (4 * (index++ + Math.random()));
|
|
|
if (randomIndex > totalNewProductListSize) {
|
|
|
randomIndex = totalNewProductListSize;
|
|
|
}
|
|
|
if (randomIndex == 0 && !newProductList.isEmpty()) {
|
|
|
randomIndex = 1;
|
|
|
randomIndex = 1;//防止影响firstSkn
|
|
|
}
|
|
|
Map<String, Object> product = iterator.next();
|
|
|
if(randomIndex <= totalNewProductListSize){
|
|
|
newProductList.add(randomIndex, product);
|
|
|
}
|
|
|
iterator.remove();
|
|
|
}
|
|
|
// 4、数量截取-保留整数页个商品[只能召回一页,则保留一页]
|
...
|
...
|
|