用户物品导出
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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<String> 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<String> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class FeedbackType extends BaseEntity<Long> {
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private String type;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 洞悉(根据用户获取推荐)
|
||||
*/
|
||||
|
||||
@@ -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@
|
||||
|
||||
Reference in New Issue
Block a user