...
|
...
|
@@ -2,7 +2,7 @@ package com.yoho.search.service.recall.beans.persional; |
|
|
|
|
|
import com.yoho.search.core.personalized.models.SortBrand;
|
|
|
import com.yoho.search.core.personalized.models.SortPriceAreas;
|
|
|
import com.yoho.search.core.personalized.models.UserPersonalFactorRspNew;
|
|
|
import com.yoho.search.core.personalized.models.UserPersonalFactorRsp;
|
|
|
import com.yoho.search.service.recall.beans.strategy.SortBrandType;
|
|
|
import com.yoho.search.service.recall.beans.vector.SortBrandVectorComponent;
|
|
|
import com.yoho.search.service.recall.config.RecallConfigService;
|
...
|
...
|
@@ -14,7 +14,10 @@ import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
|
|
|
@Component
|
|
|
public class QueryUserPersionalFactorBean {
|
...
|
...
|
@@ -53,7 +56,7 @@ public class QueryUserPersionalFactorBean { |
|
|
RECALL_NEW_LOGGER.info("QueryUserPersionalFactorBean[1]:queryPagePersionalFactor. uid is[{}],udid is[{}], cost is[{}]] ms", uid, udid, cost);
|
|
|
//2、获取用户的个性化因子
|
|
|
begin = System.currentTimeMillis();
|
|
|
UserPersonalFactorRspNew userFactor = userComponent.queryUserPersionalFactor(userRecallRequest.getUid(), userRecallRequest.getUdid(), pageFactor.getMisortIds());
|
|
|
UserPersonalFactorRsp userFactor = userComponent.queryUserPersionalFactor(userRecallRequest.getUid(), userRecallRequest.getUdid(), pageFactor.getMisortIds());
|
|
|
cost = System.currentTimeMillis() - begin;
|
|
|
RECALL_NEW_LOGGER.info("QueryUserPersionalFactorBean[2]:queryUserPersionalFactor. uid is[{}],udid is[{}], cost is[{}]", uid, udid, cost);
|
|
|
//3、构造结果
|
...
|
...
|
@@ -68,15 +71,15 @@ public class QueryUserPersionalFactorBean { |
|
|
}
|
|
|
}
|
|
|
|
|
|
private UserPersonalFactor buildUserPersonalFactor(int pageId, PagePersonalFactor pageFactor, UserPersonalFactorRspNew userFactor) {
|
|
|
private UserPersonalFactor buildUserPersonalFactor(int pageId, PagePersonalFactor pageFactor, UserPersonalFactorRsp userFactor) {
|
|
|
//1、构造品类价格带
|
|
|
List<SortPriceAreas> sortPriceAreasList = this.getSortPriceAreasListWithSort(userFactor, pageFactor);
|
|
|
//2、构造推荐的skn列表
|
|
|
List<Integer> recommendSknList = userFactor.getRecommendSknList();
|
|
|
List<Integer> realTimeSimilarSknList = userFactor.getRealTimeSimilarSknList();
|
|
|
List<Integer> realTimeYoutubeSknList = userFactor.getRealTimeYoutubeSknList();
|
|
|
//TODO remove
|
|
|
//realTimeSimilarSknList.addAll(Arrays.asList(50003513,50013179,50018239,50023799));
|
|
|
|
|
|
//3、获取页面中存在的所有的key
|
|
|
Set<String> pageSortBrandKeys = new HashSet<>();
|
|
|
for (SortBrand pageSortBrand : pageFactor.getSortBrandList()) {
|
...
|
...
|
@@ -106,11 +109,11 @@ public class QueryUserPersionalFactorBean { |
|
|
filterSortBrandKeys.add(existSortBrand.key());
|
|
|
}
|
|
|
//8、构造个性化结果[如果个性化结果为空,则取配置的品类品牌数据]
|
|
|
UserPersonalFactor userPersonalFactor = new UserPersonalFactor(recommendSknList, realTimeSimilarSknList, sortPriceAreasList, realTimeSortBrandList, vectorRnnSortBrandList, vectorW2vSortBrandList);
|
|
|
UserPersonalFactor userPersonalFactor = new UserPersonalFactor(recommendSknList, realTimeSimilarSknList,realTimeYoutubeSknList, sortPriceAreasList, realTimeSortBrandList, vectorRnnSortBrandList, vectorW2vSortBrandList);
|
|
|
if (userPersonalFactor.isUserPersonalFactorEmpty()) {
|
|
|
this.fillConfigSortBrandList(userPersonalFactor, pageId, pageFactor, pageSortBrandKeys, filterSortBrandKeys);
|
|
|
}
|
|
|
//10、返回最终结果
|
|
|
//9、返回最终结果
|
|
|
return userPersonalFactor;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -147,7 +150,7 @@ public class QueryUserPersionalFactorBean { |
|
|
* @param userFactorNew
|
|
|
* @return
|
|
|
*/
|
|
|
private List<SortPriceAreas> getSortPriceAreasListWithSort(UserPersonalFactorRspNew userFactorNew, PagePersonalFactor pageFactor) {
|
|
|
private List<SortPriceAreas> getSortPriceAreasListWithSort(UserPersonalFactorRsp userFactorNew, PagePersonalFactor pageFactor) {
|
|
|
List<SortPriceAreas> sortPriceAreas = userFactorNew.getSortPriceAreasList();
|
|
|
if (sortPriceAreas == null || sortPriceAreas.isEmpty()) {
|
|
|
return new ArrayList<>();
|
...
|
...
|
|