diff --git a/api/src/main/java/com/wx/application/adapter/controller/BulkController.java b/api/src/main/java/com/wx/application/adapter/controller/BulkController.java new file mode 100644 index 0000000..94657d0 --- /dev/null +++ b/api/src/main/java/com/wx/application/adapter/controller/BulkController.java @@ -0,0 +1,39 @@ +package com.wx.application.adapter.controller; + +import com.wx.application.adapter.dto.qo.GorseQ; +import com.wx.application.base.BaseController; +import com.wx.application.base.ResponseData; +import com.wx.application.core.service.EntrysService; +import com.wx.application.core.service.RiskUserService; +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.NebulaNode; +import com.wx.application.nebula.graph.service.ImportGraphService; +import com.wx.application.nebula.graph.service.NebulaOperateService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Slf4j +@RequestMapping("/bulk") +@Controller("bulkController") +public class BulkController extends BaseController { + + @Autowired + GorseService gorseService; + + @GetMapping(value = "/get_bulk/{type}") + public String getBulkUserOrItem(@PathVariable("type") String type) throws Exception { + return gorseService.getBulkUserOrItem(type); + } + + +} diff --git a/api/src/main/java/com/wx/application/adapter/controller/GorseController.java b/api/src/main/java/com/wx/application/adapter/controller/GorseController.java index 20e6edb..e25d16a 100644 --- a/api/src/main/java/com/wx/application/adapter/controller/GorseController.java +++ b/api/src/main/java/com/wx/application/adapter/controller/GorseController.java @@ -1,10 +1,13 @@ package com.wx.application.adapter.controller; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.alibaba.fastjson.JSONObject; +import com.wx.application.gorse4j.GorsePage; +import com.wx.application.gorse4j.User; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -124,9 +127,46 @@ public class GorseController extends BaseController { } @GetMapping(value = "/get_bulk/{type}") - public String getBulkUserOrItem(@PathVariable("type") String type) throws Exception { + public String getBulkUserOrItem(@PathVariable("type") String type) { return gorseService.getBulkUserOrItem(type); } + @GetMapping(value = "/query_users") + public ResponseData queryUsers(@RequestParam("cursor") String cursor) throws Exception { + GorsePage page = gorseService.getUserPageByCursor(cursor); + if(page.getUsers() == null || page.getUsers().size() == 0) { + return success(page); + } + List ids = new ArrayList<>(); + for(User user : page.getUsers()) { + ids.add(user.getUserId()); + } + Map mQ = new HashMap<>(); + mQ.put("INS_fid", StringUtils.join(ids, ",")); + + JSONObject obj = new JSONObject(); + obj.put("cursor", page.getCursor()); + obj.put("users", riskUserService.queryList(mQ)); + return success(obj); + } + + @GetMapping(value = "/query_items") + public ResponseData queryItems(@RequestParam("cursor") String cursor) throws Exception { + GorsePage page = gorseService.getItemPageByCursor(cursor); + if(page.getItems() == null || page.getItems().size() == 0) { + return success(page); + } + List ids = new ArrayList<>(); + for(Item item : page.getItems()) { + ids.add(item.getItemId()); + } + Map mQ = new HashMap<>(); + mQ.put("INS_fid", StringUtils.join(ids, ",")); + + JSONObject obj = new JSONObject(); + obj.put("cursor", page.getCursor()); + obj.put("items", entrysService.queryList(mQ)); + return success(obj); + } } diff --git a/api/src/main/java/com/wx/application/core/entity/FeedbackType.java b/api/src/main/java/com/wx/application/core/entity/FeedbackType.java index 2973691..9b42d12 100644 --- a/api/src/main/java/com/wx/application/core/entity/FeedbackType.java +++ b/api/src/main/java/com/wx/application/core/entity/FeedbackType.java @@ -21,7 +21,7 @@ public class FeedbackType extends BaseEntity { private String name; - + private String type; } diff --git a/api/src/main/java/com/wx/application/gorse4j/GorseService.java b/api/src/main/java/com/wx/application/gorse4j/GorseService.java index e75a020..43b4031 100644 --- a/api/src/main/java/com/wx/application/gorse4j/GorseService.java +++ b/api/src/main/java/com/wx/application/gorse4j/GorseService.java @@ -89,6 +89,29 @@ public class GorseService { return Arrays.asList(this.request("GET", this.endpoint + "/api/dashboard/user/" + userId + "/neighbors", null, User[].class)); } + + /** + * 分页查询用户 + */ + public GorsePage getUserPageByCursor(String cursor) throws IOException { + String baseUrl = this.endpoint + "/api/dashboard/users"; + if (StringUtils.isNotBlank(cursor)) { + baseUrl += ("?cursor=" + cursor); + } + return this.request("GET", baseUrl, null, GorsePage.class); + } + + /** + * 分页查询物品 + */ + public GorsePage getItemPageByCursor(String cursor) throws IOException { + String baseUrl = this.endpoint + "/api/items"; + if (StringUtils.isNotBlank(cursor)) { + baseUrl += ("?cursor=" + cursor); + } + return this.request("GET", baseUrl, null, GorsePage.class); + } + /** * 洞悉(根据用户获取推荐) */ diff --git a/api/src/main/resources/config.properties b/api/src/main/resources/config.properties index 4fdd440..8d5227c 100644 --- a/api/src/main/resources/config.properties +++ b/api/src/main/resources/config.properties @@ -11,6 +11,7 @@ spring.servlet.multipart.max-file-size=2048MB spring.servlet.multipart.max-request-size=2048MB server.port=@server_port@ ignore.urls[0]=/login/** +ignore.urls[1]=/bulk/get_bulk/** upload.graph.path=@upload_graph_path@ zbx.path=@zbx_path@ diff --git a/web/src/components/menus/EntrysManage.vue b/web/src/components/menus/EntrysManage.vue index 800bb89..13181aa 100644 --- a/web/src/components/menus/EntrysManage.vue +++ b/web/src/components/menus/EntrysManage.vue @@ -1,7 +1,7 @@