Authored by hugufei

添加 /tools/userVectorSortBrand.json

@@ -197,7 +197,11 @@ public class ToolsController { @@ -197,7 +197,11 @@ public class ToolsController {
197 } 197 }
198 } 198 }
199 199
200 - 200 + /**
  201 + * 获取用户根据向量预测出来的品类品牌
  202 + * @param request
  203 + * @return
  204 + */
201 @RequestMapping(method = RequestMethod.GET, value = "/userVectorSortBrand") 205 @RequestMapping(method = RequestMethod.GET, value = "/userVectorSortBrand")
202 @ResponseBody 206 @ResponseBody
203 public SearchApiResult userVectorSortBrand(HttpServletRequest request) { 207 public SearchApiResult userVectorSortBrand(HttpServletRequest request) {
@@ -3,12 +3,14 @@ package com.yoho.search.service.scene; @@ -3,12 +3,14 @@ package com.yoho.search.service.scene;
3 import com.yoho.search.models.SearchApiResult; 3 import com.yoho.search.models.SearchApiResult;
4 import com.yoho.search.recall.scene.beans.builder.UserRecallRequestBuilder; 4 import com.yoho.search.recall.scene.beans.builder.UserRecallRequestBuilder;
5 import com.yoho.search.recall.scene.beans.persional.QueryUserPersionalFactorBean; 5 import com.yoho.search.recall.scene.beans.persional.QueryUserPersionalFactorBean;
  6 +import com.yoho.search.recall.scene.models.personal.UserPersonalFactor;
6 import com.yoho.search.recall.scene.models.req.UserRecallRequest; 7 import com.yoho.search.recall.scene.models.req.UserRecallRequest;
7 import com.yoho.search.service.base.SearchRequestParams; 8 import com.yoho.search.service.base.SearchRequestParams;
8 import org.apache.commons.collections.MapUtils; 9 import org.apache.commons.collections.MapUtils;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
11 12
  13 +import java.util.HashMap;
12 import java.util.Map; 14 import java.util.Map;
13 15
14 @Service 16 @Service
@@ -27,9 +29,32 @@ public class UserVectorSortBrandService { @@ -27,9 +29,32 @@ public class UserVectorSortBrandService {
27 */ 29 */
28 public SearchApiResult userVectorSortBrand(Map<String, String> paramMap) { 30 public SearchApiResult userVectorSortBrand(Map<String, String> paramMap) {
29 try { 31 try {
30 - int pageSize = MapUtils.getIntValue(paramMap, SearchRequestParams.PARAM_SEARCH_VIEWNUM,30); 32 + int pageSize = MapUtils.getIntValue(paramMap, SearchRequestParams.PARAM_SEARCH_VIEWNUM,20);
31 UserRecallRequest userRecallRequest = userRecallRequestBuilder.buildUserRecallRequest(paramMap,pageSize); 33 UserRecallRequest userRecallRequest = userRecallRequestBuilder.buildUserRecallRequest(paramMap,pageSize);
32 - return new SearchApiResult(); 34 + UserPersonalFactor userPersonalFactor = queryUserPersionalFactorBean.queryPersionalFactor(userRecallRequest);
  35 +
  36 + Map<String,Object> results = new HashMap<>();
  37 + //uid+udid
  38 + results.put("uid",userRecallRequest.getUid());
  39 + results.put("udid",userRecallRequest.getUdid());
  40 +
  41 + //推荐的skn
  42 + results.put("recommendSknList",userPersonalFactor.getRecommendSknList());
  43 + results.put("realTimeSimilarSknList",userPersonalFactor.getRealTimeSimilarSknList());
  44 +
  45 + //用户价格带
  46 + results.put("sortPriceAreasListSize",userPersonalFactor.getSortPriceAreasListSize());
  47 +
  48 + //实时的品类品牌
  49 + results.put("realTimeSortBrandList",userPersonalFactor.getRealTimeSortBrandList());
  50 + //RNN预测的品类品牌
  51 + results.put("forecastSortBrandList",userPersonalFactor.getForecastSortBrandListSize());
  52 +
  53 + //向量相关
  54 + results.put("userVector",userPersonalFactor.getVector());
  55 + results.put("vectorSortBrandList",userPersonalFactor.getVectorSortBrandListSize());
  56 +
  57 + return new SearchApiResult().setData(results);
33 }catch (Exception e){ 58 }catch (Exception e){
34 return new SearchApiResult(); 59 return new SearchApiResult();
35 } 60 }