BigdataTestController.java
1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.yoho.search.restapi.tools;
import com.yoho.search.core.personalized.service.BidataServiceCaller;
import com.yoho.search.core.personalized.service.PersonalVersionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping(value = "/tools")
public class BigdataTestController {
@Autowired
private PersonalVersionManager personalVersionManager;
@Autowired
private BidataServiceCaller bidataServiceCaller;
@RequestMapping(value = "/bigdataServiceTest")
public Map<String, Object> bigdataServiceTets(Integer uid) {
Map<String, Object> results = new HashMap<>();
//大数据目前推荐的版本
String bigDataRecomDateStr = personalVersionManager.getBigDataRecomDateStr();
results.put("bigDataRecomDateStr", bigDataRecomDateStr == null ? "" : bigDataRecomDateStr);
results.put("bigDataRecomDateStrFeatures", bidataServiceCaller.getUserVectorFeature(uid.toString(), bigDataRecomDateStr));
//zk中目前的版本
String currentVersionInZk = personalVersionManager.getCurrentVersionInZk();
results.put("currentVersionInZk", currentVersionInZk == null ? "" : currentVersionInZk);
results.put("currentVersionInZkFeatures", bidataServiceCaller.getUserVectorFeature(uid.toString(), currentVersionInZk));
//用户性别偏好
results.put("userGenderFeature", bidataServiceCaller.getUserGenderFeature(uid.toString()));
//用户尺码偏好
results.put("userFavoriteSizes", bidataServiceCaller.getUserFavoriteSizes(uid.toString()));
//用户个性化因子
results.put("userPersionalFactor", bidataServiceCaller.queryUserPersionalFactor(uid, null, null));
return results;
}
}