Authored by hugufei

添加 /tools/userVectorSortBrand.json

... ... @@ -197,7 +197,11 @@ public class ToolsController {
}
}
/**
* 获取用户根据向量预测出来的品类品牌
* @param request
* @return
*/
@RequestMapping(method = RequestMethod.GET, value = "/userVectorSortBrand")
@ResponseBody
public SearchApiResult userVectorSortBrand(HttpServletRequest request) {
... ...
... ... @@ -3,12 +3,14 @@ package com.yoho.search.service.scene;
import com.yoho.search.models.SearchApiResult;
import com.yoho.search.recall.scene.beans.builder.UserRecallRequestBuilder;
import com.yoho.search.recall.scene.beans.persional.QueryUserPersionalFactorBean;
import com.yoho.search.recall.scene.models.personal.UserPersonalFactor;
import com.yoho.search.recall.scene.models.req.UserRecallRequest;
import com.yoho.search.service.base.SearchRequestParams;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Service
... ... @@ -27,9 +29,32 @@ public class UserVectorSortBrandService {
*/
public SearchApiResult userVectorSortBrand(Map<String, String> paramMap) {
try {
int pageSize = MapUtils.getIntValue(paramMap, SearchRequestParams.PARAM_SEARCH_VIEWNUM,30);
int pageSize = MapUtils.getIntValue(paramMap, SearchRequestParams.PARAM_SEARCH_VIEWNUM,20);
UserRecallRequest userRecallRequest = userRecallRequestBuilder.buildUserRecallRequest(paramMap,pageSize);
return new SearchApiResult();
UserPersonalFactor userPersonalFactor = queryUserPersionalFactorBean.queryPersionalFactor(userRecallRequest);
Map<String,Object> results = new HashMap<>();
//uid+udid
results.put("uid",userRecallRequest.getUid());
results.put("udid",userRecallRequest.getUdid());
//推荐的skn
results.put("recommendSknList",userPersonalFactor.getRecommendSknList());
results.put("realTimeSimilarSknList",userPersonalFactor.getRealTimeSimilarSknList());
//用户价格带
results.put("sortPriceAreasListSize",userPersonalFactor.getSortPriceAreasListSize());
//实时的品类品牌
results.put("realTimeSortBrandList",userPersonalFactor.getRealTimeSortBrandList());
//RNN预测的品类品牌
results.put("forecastSortBrandList",userPersonalFactor.getForecastSortBrandListSize());
//向量相关
results.put("userVector",userPersonalFactor.getVector());
results.put("vectorSortBrandList",userPersonalFactor.getVectorSortBrandListSize());
return new SearchApiResult().setData(results);
}catch (Exception e){
return new SearchApiResult();
}
... ...