Authored by hugufei

FirstSknStrategy改成int型

... ... @@ -53,7 +53,7 @@ public class CommonRecallRequestBuilder {
* @return
*/
private RecallRequest buildFirstSknRequest(UserRecallRequest userRecallRequest) {
List<String> firstProductSkns = userRecallRequest.getFirstProductSkns();
List<Integer> firstProductSkns = userRecallRequest.getFirstProductSkns();
int size = recallConfigService.queryStrategyConfigSize(userRecallRequest, StrategyEnum.FIRST_SKN, 0);
CommonFirstSknStrategy strategy = new CommonFirstSknStrategy(size, firstProductSkns);
return new RecallRequest(userRecallRequest.getParamQueryFilter(), strategy);
... ...
package com.yoho.search.service.recall.beans.builder;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.common.SearchRequestParams;
import com.yoho.search.service.helper.SearchQueryHelper;
import com.yoho.search.service.recall.models.common.ParamQueryFilter;
... ... @@ -65,7 +66,7 @@ public class UserRecallRequestBuilder {
private UserRecallRequest innerBuildUserRecallRequest(ParamQueryFilter paramQueryFilter, Map<String, String> paramMap, int pageSize) {
//1、获取firstSkn参数
List<String> firstProductSkns = this.getFirstProductSkns(paramMap);
List<Integer> firstProductSkns = this.getFirstProductSkns(paramMap);
//2、获取uid和udid
int uid = MapUtils.getIntValue(paramMap, "uid", 0);
String udid = MapUtils.getString(paramMap, "udid", "");
... ... @@ -78,12 +79,12 @@ public class UserRecallRequestBuilder {
return new UserRecallRequest(paramQueryFilter, pageSize, firstProductSkns, uid, udid, pageId, defaultOrder);
}
private List<String> getFirstProductSkns(Map<String, String> paramMap) {
String firstSkns = MapUtils.getString(paramMap, SearchRequestParams.PARAM_SEARCH_FIRST_PRODUCRSKN, "");
if (StringUtils.isBlank(firstSkns)) {
private List<Integer> getFirstProductSkns(Map<String, String> paramMap) {
try {
String firstSkns = MapUtils.getString(paramMap, SearchRequestParams.PARAM_SEARCH_FIRST_PRODUCRSKN, "");
return ConvertUtils.stringToIntList(firstSkns,",");
}catch (Exception e){
return new ArrayList<>();
}
return Arrays.asList(firstSkns.split(","));
}
}
... ...
... ... @@ -73,7 +73,7 @@ public class ExtendFilterHelper {
*
* @return
*/
public static QueryBuilder firstSknFilter(List<String> firstSkns) {
public static QueryBuilder firstSknFilter(List<Integer> firstSkns) {
return QueryBuilders.termsQuery(ProductIndexEsField.productSkn, firstSkns);
}
... ...
... ... @@ -14,14 +14,14 @@ public class UserRecallRequest implements ICacheRequest {
private final ParamQueryFilter paramQueryFilter;
private final int pageSize;
private final List<String> firstProductSkns;
private final List<Integer> firstProductSkns;
private final int uid;
private final String udid;
private int pageId;
private RedisKeyBuilder redisKeyBuilder;
private boolean defaultOrder;
public UserRecallRequest(ParamQueryFilter paramQueryFilter, int pageSize, List<String> firstProductSkns, int uid, String udid, int pageId, boolean defaultOrder) {
public UserRecallRequest(ParamQueryFilter paramQueryFilter, int pageSize, List<Integer> firstProductSkns, int uid, String udid, int pageId, boolean defaultOrder) {
this.paramQueryFilter = paramQueryFilter;
this.firstProductSkns = firstProductSkns;
this.pageSize = pageSize;
... ... @@ -85,7 +85,7 @@ public class UserRecallRequest implements ICacheRequest {
return udid;
}
public List<String> getFirstProductSkns() {
public List<Integer> getFirstProductSkns() {
return firstProductSkns;
}
... ...
... ... @@ -22,9 +22,9 @@ import java.util.List;
public class CommonFirstSknStrategy implements IStrategy {
private int size;
private List<String> firstSkns;
private List<Integer> firstSkns;
public CommonFirstSknStrategy(int size, List<String> firstSkns) {
public CommonFirstSknStrategy(int size, List<Integer> firstSkns) {
this.size = size > firstSkns.size() ? size : firstSkns.size();
this.firstSkns = SearchCollectionUtils.safeSubList(firstSkns,0,size);
}
... ...