Showing
5 changed files
with
9 additions
and
14 deletions
@@ -67,7 +67,7 @@ public class RecallService { | @@ -67,7 +67,7 @@ public class RecallService { | ||
67 | //1、构造召回请求 | 67 | //1、构造召回请求 |
68 | List<RecallRequest> allRequests = new ArrayList<>(); | 68 | List<RecallRequest> allRequests = new ArrayList<>(); |
69 | //2、构造非个性化的请求 | 69 | //2、构造非个性化的请求 |
70 | - List<RecallRequest> commonRequests = commonRequestBuilder.buildCommonRecallRequests(param.getParamQueryFilter(), param.getFirstProductSkns(), param.getPageSize()); | 70 | + List<RecallRequest> commonRequests = commonRequestBuilder.buildCommonRecallRequests(param.getParamQueryFilter(), param.getFirstProductSkns()); |
71 | allRequests.addAll(commonRequests); | 71 | allRequests.addAll(commonRequests); |
72 | //4、构建个性化品牌的召回请求 | 72 | //4、构建个性化品牌的召回请求 |
73 | List<RecallRequest> brandRequests = brandRequestBuilder.buildBrandRecallRequests(param.getParamQueryFilter(), persionalFactor.getBrandIds()); | 73 | List<RecallRequest> brandRequests = brandRequestBuilder.buildBrandRecallRequests(param.getParamQueryFilter(), persionalFactor.getBrandIds()); |
@@ -49,8 +49,8 @@ public class SceneRecallService { | @@ -49,8 +49,8 @@ public class SceneRecallService { | ||
49 | public SearchApiResult sceneRecall(Map<String, String> paramMap) { | 49 | public SearchApiResult sceneRecall(Map<String, String> paramMap) { |
50 | try { | 50 | try { |
51 | //1、分页参数验证 | 51 | //1、分页参数验证 |
52 | - int page = MapUtils.getIntValue(paramMap, "page", 10); | ||
53 | - int pageSize = MapUtils.getIntValue(paramMap, "viewNum", 10); | 52 | + int page = MapUtils.getIntValue(paramMap, "page", 1); |
53 | + int pageSize = MapUtils.getIntValue(paramMap, "viewNum", 20); | ||
54 | if (page < 1 || pageSize < 0 || page * pageSize > 1000000) { | 54 | if (page < 1 || pageSize < 0 || page * pageSize > 1000000) { |
55 | return new SearchApiResult().setCode(400).setMessage("分页参数不合法"); | 55 | return new SearchApiResult().setCode(400).setMessage("分页参数不合法"); |
56 | } | 56 | } |
@@ -74,7 +74,6 @@ public class SceneRecallService { | @@ -74,7 +74,6 @@ public class SceneRecallService { | ||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | - | ||
78 | private List<Map<String, Object>> queryProductList(RecallSknParams recallSknParams, RecallSknResult recallSknResult,int page,int pageSize) { | 77 | private List<Map<String, Object>> queryProductList(RecallSknParams recallSknParams, RecallSknResult recallSknResult,int page,int pageSize) { |
79 | //1、判断当前页码是否在召回的页码里 | 78 | //1、判断当前页码是否在召回的页码里 |
80 | int recallTotalPage = recallSknResult.getRecallTotalPage(); | 79 | int recallTotalPage = recallSknResult.getRecallTotalPage(); |
@@ -18,10 +18,9 @@ public class CommonRecallRequestBuilder{ | @@ -18,10 +18,9 @@ public class CommonRecallRequestBuilder{ | ||
18 | * | 18 | * |
19 | * @param paramQueryFilter | 19 | * @param paramQueryFilter |
20 | * @param firstProductSkns | 20 | * @param firstProductSkns |
21 | - * @param pageSize | ||
22 | * @return | 21 | * @return |
23 | */ | 22 | */ |
24 | - public List<RecallRequest> buildCommonRecallRequests(ParamQueryFilter paramQueryFilter, List<String> firstProductSkns, int pageSize) { | 23 | + public List<RecallRequest> buildCommonRecallRequests(ParamQueryFilter paramQueryFilter, List<String> firstProductSkns) { |
25 | //1、构造召回请求 | 24 | //1、构造召回请求 |
26 | List<RecallRequest> requests = new ArrayList<>(); | 25 | List<RecallRequest> requests = new ArrayList<>(); |
27 | //1.1) firstSkn的召回 | 26 | //1.1) firstSkn的召回 |
@@ -29,7 +28,7 @@ public class CommonRecallRequestBuilder{ | @@ -29,7 +28,7 @@ public class CommonRecallRequestBuilder{ | ||
29 | //1.2) 直通车的召回 | 28 | //1.2) 直通车的召回 |
30 | requests.add(this.buildDirectTrainRequest(paramQueryFilter, SknCountConstants.DIRECT_TRAIN)); | 29 | requests.add(this.buildDirectTrainRequest(paramQueryFilter, SknCountConstants.DIRECT_TRAIN)); |
31 | //1.3) 人气的召回 | 30 | //1.3) 人气的召回 |
32 | - requests.add(this.buildCommonRequest(paramQueryFilter, Math.min(3 * pageSize, SknCountConstants.COMMON_HEAT_VALUE))); | 31 | + requests.add(this.buildCommonRequest(paramQueryFilter,SknCountConstants.COMMON)); |
33 | //1.4) 新开店铺的召回 | 32 | //1.4) 新开店铺的召回 |
34 | requests.add(this.buildNewShopRequest(paramQueryFilter, SknCountConstants.NEW_SHOP)); | 33 | requests.add(this.buildNewShopRequest(paramQueryFilter, SknCountConstants.NEW_SHOP)); |
35 | //1.5) 流量补偿的召回 | 34 | //1.5) 流量补偿的召回 |
@@ -21,19 +21,16 @@ public class RecallParamsBuilder { | @@ -21,19 +21,16 @@ public class RecallParamsBuilder { | ||
21 | @Autowired | 21 | @Autowired |
22 | private RecallServiceHelper recallServiceHelper; | 22 | private RecallServiceHelper recallServiceHelper; |
23 | 23 | ||
24 | - public RecallSknParams buildRecallParams(Map<String, String> paramMap) throws Exception { | 24 | + public RecallSknParams buildRecallParams(Map<String, String> paramMap,int pageSize) throws Exception { |
25 | //1、获取链接中的query和filter参数 | 25 | //1、获取链接中的query和filter参数 |
26 | QueryBuilder query = searchServiceHelepr.constructQueryBuilder(paramMap); | 26 | QueryBuilder query = searchServiceHelepr.constructQueryBuilder(paramMap); |
27 | BoolQueryBuilder filter = searchServiceHelepr.constructFilterBuilder(paramMap, null); | 27 | BoolQueryBuilder filter = searchServiceHelepr.constructFilterBuilder(paramMap, null); |
28 | ParamQueryFilter queryFilter = new ParamQueryFilter(query,filter); | 28 | ParamQueryFilter queryFilter = new ParamQueryFilter(query,filter); |
29 | 29 | ||
30 | - //2、获取分页参数 | ||
31 | - int pageSize = MapUtils.getIntValue(paramMap, "viewNum", 10); | ||
32 | - | ||
33 | - //3、获取firstSkn参数 | 30 | + //2、获取firstSkn参数 |
34 | List<String> firstProductSkns = recallServiceHelper.getFirstProductSkns(paramMap); | 31 | List<String> firstProductSkns = recallServiceHelper.getFirstProductSkns(paramMap); |
35 | 32 | ||
36 | - //4、获取uid或udid | 33 | + //3、获取uid或udid |
37 | int uid = MapUtils.getIntValue(paramMap, "uid", 1); | 34 | int uid = MapUtils.getIntValue(paramMap, "uid", 1); |
38 | String udid = MapUtils.getString(paramMap, "udid", ""); | 35 | String udid = MapUtils.getString(paramMap, "udid", ""); |
39 | 36 |
@@ -5,7 +5,7 @@ public class SknCountConstants { | @@ -5,7 +5,7 @@ public class SknCountConstants { | ||
5 | /** | 5 | /** |
6 | * 单次召回的商品数量 | 6 | * 单次召回的商品数量 |
7 | */ | 7 | */ |
8 | - public static final int COMMON_HEAT_VALUE = 60; | 8 | + public static final int COMMON = 60; |
9 | 9 | ||
10 | public static final int FIRST_SKN = 1; | 10 | public static final int FIRST_SKN = 1; |
11 | public static final int DIRECT_TRAIN = 20; | 11 | public static final int DIRECT_TRAIN = 20; |
-
Please register or login to post a comment