Authored by hugufei

Merge branch 'master' into wn_promotion

@@ -74,7 +74,24 @@ public class PagePersionalFactorComponent extends AbstractPageComponent<PagePers @@ -74,7 +74,24 @@ public class PagePersionalFactorComponent extends AbstractPageComponent<PagePers
74 //4、构造结果 74 //4、构造结果
75 Map<String, Aggregation> aggregationMap = searchResult.getAggMaps(); 75 Map<String, Aggregation> aggregationMap = searchResult.getAggMaps();
76 List<PageBrandSorts> sortBrands = this.getBrandSortsFromAggregationMap(aggregationMap); 76 List<PageBrandSorts> sortBrands = this.getBrandSortsFromAggregationMap(aggregationMap);
77 - return new PagePersonalFactor(sortBrands); 77 + List<Integer> misortIds = this.getMisortIds(sortBrands);
  78 + return new PagePersonalFactor(sortBrands,misortIds);
  79 + }
  80 +
  81 + private List<Integer> getMisortIds(List<PageBrandSorts> sortBrands){
  82 + if(sortBrands==null||sortBrands.isEmpty()){
  83 + return new ArrayList<>();
  84 + }
  85 + List<Integer> results = new ArrayList<>();
  86 + for (PageBrandSorts pageBrandSort : sortBrands) {
  87 + List<Integer> misortIds = pageBrandSort.getMisorts();
  88 + for(Integer misortid: misortIds){
  89 + if(!results.contains(misortid)){
  90 + results.add(misortid);
  91 + }
  92 + }
  93 + }
  94 + return results;
78 } 95 }
79 96
80 /** 97 /**
@@ -55,7 +55,7 @@ public class QueryUserPersionalFactorBean { @@ -55,7 +55,7 @@ public class QueryUserPersionalFactorBean {
55 55
56 //2、获取用户的个性化因子 56 //2、获取用户的个性化因子
57 begin = System.currentTimeMillis(); 57 begin = System.currentTimeMillis();
58 - UserPersonalFactorRspNew userFactor = userComponent.queryUserPersionalFactor(userRecallRequest.getUid(), userRecallRequest.getUdid()); 58 + UserPersonalFactorRspNew userFactor = userComponent.queryUserPersionalFactor(userRecallRequest.getUid(), userRecallRequest.getUdid(),pageFactor.getMisortIds());
59 cost = System.currentTimeMillis() - begin; 59 cost = System.currentTimeMillis() - begin;
60 int forecastSortBrandSize = userFactor.getSortBrandList().size(); 60 int forecastSortBrandSize = userFactor.getSortBrandList().size();
61 int realTimeSortBrandSize = userFactor.getRealTimeSortBrandList().size(); 61 int realTimeSortBrandSize = userFactor.getRealTimeSortBrandList().size();
@@ -35,9 +35,9 @@ public class UserPersionalFactorComponent { @@ -35,9 +35,9 @@ public class UserPersionalFactorComponent {
35 * @param udid 35 * @param udid
36 * @return 36 * @return
37 */ 37 */
38 - public UserPersonalFactorRspNew queryUserPersionalFactor(int uid, String udid) { 38 + public UserPersonalFactorRspNew queryUserPersionalFactor(int uid, String udid,List<Integer> misortIds) {
39 try { 39 try {
40 - UserPersonalFactorReq userPersionalFactorReq = new UserPersonalFactorReq(uid, udid); 40 + UserPersonalFactorReq userPersionalFactorReq = new UserPersonalFactorReq(uid, udid,misortIds);
41 JSONObject result = serviceCaller.call(SERVICE_NAME, userPersionalFactorReq, JSONObject.class, timeOut); 41 JSONObject result = serviceCaller.call(SERVICE_NAME, userPersionalFactorReq, JSONObject.class, timeOut);
42 JSONObject userPersonalFactorRspJSon = result.getJSONObject("data"); 42 JSONObject userPersonalFactorRspJSon = result.getJSONObject("data");
43 UserPersonalFactorRspNew rsp = JSON.toJavaObject(userPersonalFactorRspJSon, UserPersonalFactorRspNew.class); 43 UserPersonalFactorRspNew rsp = JSON.toJavaObject(userPersonalFactorRspJSon, UserPersonalFactorRspNew.class);
@@ -10,13 +10,15 @@ public class PagePersonalFactor implements Serializable{ @@ -10,13 +10,15 @@ public class PagePersonalFactor implements Serializable{
10 10
11 private static final long serialVersionUID = 89030356435559223L; 11 private static final long serialVersionUID = 89030356435559223L;
12 12
  13 + private List<Integer> misortIds;
13 private List<PageBrandSorts> brandSortsList; 14 private List<PageBrandSorts> brandSortsList;
14 15
15 public PagePersonalFactor() { 16 public PagePersonalFactor() {
16 } 17 }
17 18
18 - public PagePersonalFactor(List<PageBrandSorts> brandSortsList){ 19 + public PagePersonalFactor(List<PageBrandSorts> brandSortsList,List<Integer> misortIds){
19 this.brandSortsList = brandSortsList; 20 this.brandSortsList = brandSortsList;
  21 + this.misortIds = misortIds;
20 } 22 }
21 23
22 public List<PageBrandSorts> getBrandSortsList() { 24 public List<PageBrandSorts> getBrandSortsList() {
@@ -30,4 +32,12 @@ public class PagePersonalFactor implements Serializable{ @@ -30,4 +32,12 @@ public class PagePersonalFactor implements Serializable{
30 public int pageBrandSortsSize(){ 32 public int pageBrandSortsSize(){
31 return brandSortsList==null ? 0:brandSortsList.size(); 33 return brandSortsList==null ? 0:brandSortsList.size();
32 } 34 }
  35 +
  36 + public List<Integer> getMisortIds() {
  37 + return misortIds;
  38 + }
  39 +
  40 + public void setMisortIds(List<Integer> misortIds) {
  41 + this.misortIds = misortIds;
  42 + }
33 } 43 }