123
This commit is contained in:
@@ -17,6 +17,7 @@ import com.wx.application.base.ResponseData;
|
|||||||
import com.wx.application.core.service.EntrysService;
|
import com.wx.application.core.service.EntrysService;
|
||||||
import com.wx.application.core.service.RiskUserService;
|
import com.wx.application.core.service.RiskUserService;
|
||||||
import com.wx.application.gorse4j.GorseService;
|
import com.wx.application.gorse4j.GorseService;
|
||||||
|
import com.wx.application.gorse4j.Item;
|
||||||
import com.wx.application.nebula.graph.query.NebulaModel;
|
import com.wx.application.nebula.graph.query.NebulaModel;
|
||||||
import com.wx.application.nebula.graph.query.NebulaNode;
|
import com.wx.application.nebula.graph.query.NebulaNode;
|
||||||
import com.wx.application.nebula.graph.service.NebulaOperateService;
|
import com.wx.application.nebula.graph.service.NebulaOperateService;
|
||||||
@@ -41,7 +42,7 @@ public class GorseController extends BaseController {
|
|||||||
NebulaOperateService nebulaOperateService;
|
NebulaOperateService nebulaOperateService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推荐
|
* 推荐根据userId
|
||||||
* @param gQo
|
* @param gQo
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -57,6 +58,25 @@ public class GorseController extends BaseController {
|
|||||||
return success(entrysService.queryList(mQ));
|
return success(entrysService.queryList(mQ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据列表推荐
|
||||||
|
* @param gQo
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/popular_by_category")
|
||||||
|
public ResponseData popularByCategory(@RequestBody GorseQ gQo) throws Exception {
|
||||||
|
List<Item> res = gorseService.getPopular(gQo.getCategory());
|
||||||
|
return success(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推荐根据知识图谱
|
||||||
|
* @param gQo
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
@PostMapping(value = "/recommend_by_userid_with_graph")
|
@PostMapping(value = "/recommend_by_userid_with_graph")
|
||||||
public ResponseData recommendByUserIdWithGraph(@RequestBody GorseQ gQo) throws Exception {
|
public ResponseData recommendByUserIdWithGraph(@RequestBody GorseQ gQo) throws Exception {
|
||||||
|
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ public class GorseQ {
|
|||||||
|
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
|
private String category;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,13 @@ public class GorseService {
|
|||||||
return Arrays.asList(this.request("GET", this.endpoint + "/api/recommend/" + userId, null, String[].class));
|
return Arrays.asList(this.request("GET", this.endpoint + "/api/recommend/" + userId, null, String[].class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Item> getPopular(String category) throws IOException {
|
||||||
|
return Arrays.asList(this.request("GET", this.endpoint + "/api/dashboard/popular/" + category, null, Item[].class));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private <Request, Response> Response request(String method, String url, Request request, Class<Response> responseClass) throws IOException {
|
private <Request, Response> Response request(String method, String url, Request request, Class<Response> responseClass) throws IOException {
|
||||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||||
connection.setRequestMethod(method);
|
connection.setRequestMethod(method);
|
||||||
|
|||||||
Reference in New Issue
Block a user