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