|
|
package com.yoho.search.recall.scene.beans.builder;
|
|
|
|
|
|
|
|
|
import com.yoho.search.recall.common.ABUserPartitionUtils;
|
|
|
import com.yoho.search.recall.scene.beans.strategy.impls.*;
|
|
|
import com.yoho.search.recall.scene.constants.SknCountConstants;
|
|
|
import com.yoho.search.recall.scene.models.common.ParamQueryFilter;
|
|
|
import com.yoho.search.recall.scene.models.req.RecallRequest;
|
|
|
import com.yoho.search.recall.scene.models.req.UserRecallRequest;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
...
|
...
|
@@ -16,11 +18,12 @@ public class CommonRecallRequestBuilder { |
|
|
/**
|
|
|
* 批量召回业务需求
|
|
|
*
|
|
|
* @param paramQueryFilter
|
|
|
* @param userRecallRequest
|
|
|
* @param firstProductSkns
|
|
|
* @return
|
|
|
*/
|
|
|
public List<RecallRequest> buildCommonRecallRequests(ParamQueryFilter paramQueryFilter, int pageSize, List<String> firstProductSkns) {
|
|
|
public List<RecallRequest> buildCommonRecallRequests(UserRecallRequest userRecallRequest, int pageSize, List<String> firstProductSkns) {
|
|
|
ParamQueryFilter paramQueryFilter = userRecallRequest.getParamQueryFilter();
|
|
|
//1、构造召回请求
|
|
|
List<RecallRequest> requests = new ArrayList<>();
|
|
|
//1.1) firstSkn的召回
|
...
|
...
|
@@ -32,83 +35,84 @@ public class CommonRecallRequestBuilder { |
|
|
//1.4) 流量补偿的召回
|
|
|
requests.add(this.buildAddFlowRequest(paramQueryFilter, SknCountConstants.ADD_FLOW));
|
|
|
//1.5) 页面的兜底召回
|
|
|
requests.add(this.buildCommonRecallValueRequest(paramQueryFilter, SknCountConstants.COMMON_RECALL_VALUE_RECALL_COUNT));
|
|
|
//1.6) 真正的兜底的召回,不带任何过滤条件
|
|
|
requests.add(this.buildCommonRequest(paramQueryFilter, pageSize));
|
|
|
if (ABUserPartitionUtils.isAUserComplete(userRecallRequest.getUid(), userRecallRequest.getUdid())) {
|
|
|
requests.add(this.buildCommonHeatValueStrategy(paramQueryFilter, pageSize));
|
|
|
} else {
|
|
|
requests.add(this.buildCommonCtrValueStrategy(paramQueryFilter, pageSize));
|
|
|
}
|
|
|
return requests;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 构建【按兜底召回】的请求参数
|
|
|
* 构造【按FIRST_SKN召回】的请求参数
|
|
|
*
|
|
|
* @param paramQueryFilter
|
|
|
* @param firstProductSkns
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
private RecallRequest buildCommonRequest(ParamQueryFilter paramQueryFilter, int size) {
|
|
|
CommonStrategy strategy = new CommonStrategy(size);
|
|
|
private RecallRequest buildFirstSknRequest(ParamQueryFilter paramQueryFilter, List<String> firstProductSkns, int size) {
|
|
|
CommonFirstSknStrategy strategy = new CommonFirstSknStrategy(size, firstProductSkns);
|
|
|
return new RecallRequest(paramQueryFilter, strategy);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 构建【按兜底召回】的请求参数
|
|
|
* 构建【按直通车召回】的请求参数
|
|
|
*
|
|
|
* @param paramQueryFilter
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
private RecallRequest buildCommonRecallValueRequest(ParamQueryFilter paramQueryFilter, int size) {
|
|
|
CommonRecallValueStrategy strategy = new CommonRecallValueStrategy(size);
|
|
|
private RecallRequest buildDirectTrainRequest(ParamQueryFilter paramQueryFilter, int size) {
|
|
|
CommonDirectTrainStrategy strategy = new CommonDirectTrainStrategy(size);
|
|
|
return new RecallRequest(paramQueryFilter, strategy);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 构造【按FIRST_SKN召回】的请求参数
|
|
|
* 构建【按新开店铺召回】的请求参数
|
|
|
*
|
|
|
* @param paramQueryFilter
|
|
|
* @param firstProductSkns
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
private RecallRequest buildFirstSknRequest(ParamQueryFilter paramQueryFilter, List<String> firstProductSkns, int size) {
|
|
|
CommonFirstSknStrategy strategy = new CommonFirstSknStrategy(size, firstProductSkns);
|
|
|
private RecallRequest buildNewShopRequest(ParamQueryFilter paramQueryFilter, int size) {
|
|
|
CommonNewShopStrategy strategy = new CommonNewShopStrategy(size);
|
|
|
return new RecallRequest(paramQueryFilter, strategy);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 构建【按直通车召回】的请求参数
|
|
|
* 构建【流量补偿】的请求参数
|
|
|
*
|
|
|
* @param paramQueryFilter
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
private RecallRequest buildDirectTrainRequest(ParamQueryFilter paramQueryFilter, int size) {
|
|
|
CommonDirectTrainStrategy strategy = new CommonDirectTrainStrategy(size);
|
|
|
private RecallRequest buildAddFlowRequest(ParamQueryFilter paramQueryFilter, int size) {
|
|
|
CommonAddFlowStrategy strategy = new CommonAddFlowStrategy(size);
|
|
|
return new RecallRequest(paramQueryFilter, strategy);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 构建【按新开店铺召回】的请求参数
|
|
|
* 构建【按兜底召回】的请求参数
|
|
|
*
|
|
|
* @param paramQueryFilter
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
private RecallRequest buildNewShopRequest(ParamQueryFilter paramQueryFilter, int size) {
|
|
|
CommonNewShopStrategy strategy = new CommonNewShopStrategy(size);
|
|
|
private RecallRequest buildCommonHeatValueStrategy(ParamQueryFilter paramQueryFilter, int size) {
|
|
|
CommonHeatValueStrategy strategy = new CommonHeatValueStrategy(size);
|
|
|
return new RecallRequest(paramQueryFilter, strategy);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 构建【流量补偿】的请求参数
|
|
|
* 构建【按兜底召回】的请求参数
|
|
|
*
|
|
|
* @param paramQueryFilter
|
|
|
* @param size
|
|
|
* @return
|
|
|
*/
|
|
|
private RecallRequest buildAddFlowRequest(ParamQueryFilter paramQueryFilter, int size) {
|
|
|
CommonAddFlowStrategy strategy = new CommonAddFlowStrategy(size);
|
|
|
private RecallRequest buildCommonCtrValueStrategy(ParamQueryFilter paramQueryFilter, int size) {
|
|
|
CommonCtrValueStrategy strategy = new CommonCtrValueStrategy(size);
|
|
|
return new RecallRequest(paramQueryFilter, strategy);
|
|
|
}
|
|
|
|
...
|
...
|
|