...
|
...
|
@@ -41,11 +41,11 @@ public class QueryUserPersionalFactorBean { |
|
|
long begin = System.currentTimeMillis();
|
|
|
//2、获取用户的个性化因子
|
|
|
UserPersonalFactorRsp userFactor = userComponent.queryUserPersionalFactor(userRecallRequest.getUid(), userRecallRequest.getUdid(), pageFactor.getMisortIds());
|
|
|
RecallLoggerHelper.info("QueryUserPersionalFactorBean[1]:queryUserPersionalFactor. uid is[{}],udid is[{}], cost is[{}ms]", userRecallRequest.getUid(), userRecallRequest.getUdid(), System.currentTimeMillis()-begin);
|
|
|
RecallLoggerHelper.info("QueryUserPersionalFactorBean[1]:queryUserPersionalFactor. uid is[{}],udid is[{}], cost is[{}ms]", userRecallRequest.getUid(), userRecallRequest.getUdid(), System.currentTimeMillis() - begin);
|
|
|
//3、构造结果
|
|
|
begin = System.currentTimeMillis();
|
|
|
UserPersonalFactor userPersonalFactor = this.buildUserPersonalFactor(userRecallRequest, pageFactor, userFactor);
|
|
|
RecallLoggerHelper.info("QueryUserPersionalFactorBean[2]:buildUserPersonalFactor. uid is[{}],udid is[{}], cost is[{}ms]", userRecallRequest.getUid(), userRecallRequest.getUdid(), System.currentTimeMillis()-begin);
|
|
|
RecallLoggerHelper.info("QueryUserPersionalFactorBean[2]:buildUserPersonalFactor. uid is[{}],udid is[{}], cost is[{}ms]", userRecallRequest.getUid(), userRecallRequest.getUdid(), System.currentTimeMillis() - begin);
|
|
|
return userPersonalFactor;
|
|
|
} catch (Exception e) {
|
|
|
RecallLoggerHelper.error(e.getMessage(), e);
|
...
|
...
|
@@ -57,53 +57,56 @@ public class QueryUserPersionalFactorBean { |
|
|
//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();
|
|
|
|
|
|
//3、获取页面中存在的所有的key
|
|
|
//2、获取页面中存在的所有的品类品牌key
|
|
|
Set<String> pageSortBrandKeys = new HashSet<>();
|
|
|
for (SortBrand pageSortBrand : pageFactor.getSortBrandList()) {
|
|
|
pageSortBrandKeys.add(pageSortBrand.key());
|
|
|
}
|
|
|
|
|
|
//4、构造实时【品类+品牌】
|
|
|
//3、构造实时【品类+品牌】
|
|
|
int recSortBrandCount = recallConfigService.querySortBrandConfigCount(userRecallRequest, SortBrandType.REC_SORT_BRAND, 12);
|
|
|
List<SortBrand> realTimeSortBrandList = this.joinRealTimeSortBrandList(pageSortBrandKeys, userFactor.getRealTimeSortBrandList(), recSortBrandCount);
|
|
|
|
|
|
//5、构造临时过滤对象
|
|
|
//4、构造临时过滤对象
|
|
|
Set<String> filterSortBrandKeys = new HashSet<>();
|
|
|
for (SortBrand existSortBrand : realTimeSortBrandList) {
|
|
|
filterSortBrandKeys.add(existSortBrand.key());
|
|
|
}
|
|
|
//6、构造基于RNN向量的【品牌+品牌】,去除实时的品类和品牌
|
|
|
|
|
|
//5、构造基于RNN向量的【品牌+品牌】,去除实时的品类和品牌
|
|
|
int vectorRNNSortBrandCount = recallConfigService.querySortBrandConfigCount(userRecallRequest, SortBrandType.VEC_RNN_SORT_BRAND, 0);
|
|
|
List<SortBrand> vectorRnnSortBrandList = sortBrandVectorComponent.queryVectorSortBrandList(pageFactor, filterSortBrandKeys, userFactor.getBrandVector(), userFactor.getSortBrandVector(), true, vectorRNNSortBrandCount);
|
|
|
for (SortBrand existSortBrand : vectorRnnSortBrandList) {
|
|
|
filterSortBrandKeys.add(existSortBrand.key());
|
|
|
}
|
|
|
//7、构造基于W2V向量的【品牌+品牌】,去除实时的品类和品牌
|
|
|
|
|
|
//6、构造基于W2V向量的【品牌+品牌】,去除实时的品类和品牌
|
|
|
int vecW2vSortBrandCount = recallConfigService.querySortBrandConfigCount(userRecallRequest, SortBrandType.VEC_W2V_SORT_BRAND, 12);
|
|
|
List<SortBrand> vectorW2vSortBrandList = sortBrandVectorComponent.queryVectorSortBrandList(pageFactor, filterSortBrandKeys, userFactor.getBrandVectorW2v(), userFactor.getSortBrandVectorW2v(), false, vecW2vSortBrandCount);
|
|
|
for (SortBrand existSortBrand : vectorW2vSortBrandList) {
|
|
|
filterSortBrandKeys.add(existSortBrand.key());
|
|
|
}
|
|
|
|
|
|
//8、是否下过单
|
|
|
boolean orderAvaiable = userFactor.isOrderAvailable();
|
|
|
|
|
|
//9、构造个性化结果
|
|
|
UserPersonalFactor userPersonalFactor = new UserPersonalFactor(recommendSknList, realTimeSimilarSknList, realTimeYoutubeSknList, sortPriceAreasList, realTimeSortBrandList, vectorRnnSortBrandList, vectorW2vSortBrandList,orderAvaiable);
|
|
|
|
|
|
//10、如果个性化结果为空,再取配置的品类品牌数据
|
|
|
//7、构造个性化结果
|
|
|
UserPersonalFactor userPersonalFactor = new UserPersonalFactor(
|
|
|
userFactor.getRecommendSknList(),
|
|
|
userFactor.getRealTimeSimilarSknList(),
|
|
|
userFactor.getRealTimeYoutubeSknList(),
|
|
|
userFactor.getRealTimeYtbNewSknList(),
|
|
|
sortPriceAreasList,
|
|
|
realTimeSortBrandList,
|
|
|
vectorRnnSortBrandList,
|
|
|
vectorW2vSortBrandList,
|
|
|
userFactor.isOrderAvailable());
|
|
|
|
|
|
//8、如果个性化结果为空,再取配置的品类品牌数据
|
|
|
if (userPersonalFactor.isUserPersonalFactorEmpty()) {
|
|
|
int configSortBrandCount = recallConfigService.querySortBrandConfigCount(userRecallRequest, SortBrandType.CONFIG_SORT_BRAND, 12);
|
|
|
List<SortBrand> configSortBrandList = recallConfigService.randomConfigSortBrand(pageFactor, pageSortBrandKeys, filterSortBrandKeys, configSortBrandCount);
|
|
|
userPersonalFactor.setConfigSortBrandList(configSortBrandList);
|
|
|
}
|
|
|
|
|
|
//11、返回最终结果
|
|
|
//9、返回最终结果
|
|
|
return userPersonalFactor;
|
|
|
}
|
|
|
|
...
|
...
|
|