Compare commits
28 Commits
23ef8577bb
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ae4a83573 | |||
| 9e3f0c440a | |||
| 20b77a119a | |||
| da3fb87975 | |||
| eeb87693d4 | |||
| a790a20f80 | |||
| 55dd565e92 | |||
| 66222d5d93 | |||
| 4eb096907b | |||
| a038772795 | |||
| dc1b11155a | |||
|
|
bbd24b24ae | ||
| 8cd092c4fd | |||
| ee0013fc18 | |||
| 68ed8e92e7 | |||
| c655b8300a | |||
| 2019e15b7a | |||
| c1438af1e4 | |||
| dfd0ba6ffa | |||
| 41e3f0dafa | |||
| 0df46cc022 | |||
| 3ef1ea7a93 | |||
| 5cfa136576 | |||
| 0bddfd3e0e | |||
| b11bf94612 | |||
| 024738565c | |||
| c53990299a | |||
| d0a0a59ea3 |
3
api/path/to/file
Normal file
@@ -0,0 +1,3 @@
|
||||
user_id,comment,labels
|
||||
wxxwjef,This is a way,[]
|
||||
hahah,No matter,[]
|
||||
13
api/pom.xml
@@ -311,6 +311,19 @@
|
||||
<artifactId>client</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
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.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
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.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.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Slf4j
|
||||
@RequestMapping("/gorse")
|
||||
@RestController("gorseController")
|
||||
public class GorseController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
GorseService gorseService;
|
||||
|
||||
@Autowired
|
||||
NebulaOperateService nebulaOperateService;
|
||||
|
||||
@Autowired
|
||||
ImportGraphService importGraphService;
|
||||
|
||||
/**
|
||||
* 推荐根据userId
|
||||
*
|
||||
* @param gQo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/recommend_by_userid")
|
||||
public ResponseData recommendByUserId(@RequestBody GorseQ gQo) throws Exception {
|
||||
return success(gorseService.getRecommend(gQo.getUserId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据列表推荐
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/ipt")
|
||||
public ResponseData ipt() throws Exception {
|
||||
importGraphService.iptUser();
|
||||
importGraphService.iptentrys();
|
||||
return success();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/delete_user/{userId}")
|
||||
public ResponseData deleteUser(@PathVariable("userId") String userId) throws Exception {
|
||||
return success(gorseService.deleteUser(userId));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get_item/{itemId}")
|
||||
public ResponseData getItem(@PathVariable("itemId") String itemId) throws Exception {
|
||||
return success(gorseService.getItem(itemId));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get_user/{userId}")
|
||||
public ResponseData getUser(@PathVariable("userId") String userId) throws Exception {
|
||||
return success(gorseService.getUser(userId));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/delete_item/{itemId}")
|
||||
public ResponseData deleteItem(@PathVariable("itemId") String itemId) throws Exception {
|
||||
return success(gorseService.deleteItem(itemId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 推荐根据知识图谱
|
||||
*
|
||||
* @param gQo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/recommend_by_userid_with_graph")
|
||||
public ResponseData recommendByUserIdWithGraph(@RequestBody GorseQ gQo) throws Exception {
|
||||
|
||||
NebulaModel nebulaModel = nebulaOperateService.findOnePathById("", gQo.getUserId());
|
||||
List<NebulaNode> nodes = nebulaModel.getNodes();
|
||||
|
||||
if (nodes != null && nodes.size() > 0) {
|
||||
nodes.get(0).getVid();
|
||||
}
|
||||
|
||||
return success(gorseService.getRecommend(gQo.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/get_similar_user")
|
||||
public ResponseData getSimilarUser(@RequestBody GorseQ gQo) throws Exception {
|
||||
return success(gorseService.getSimilarUser(gQo.getUserId()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/get_similar_item")
|
||||
public ResponseData getSimilarItem(@RequestBody GorseQ gQo) throws Exception {
|
||||
return success(gorseService.getSimilarItem(gQo.getItemId(), gQo.getCategory(), gQo.getN()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/get_recommend_by_user")
|
||||
public ResponseData getRecommendByUser(@RequestBody GorseQ gQo) throws Exception {
|
||||
return success(gorseService.getRecommendByUser(gQo.getUserId(), gQo.getRecommendation(), gQo.getCategory(), gQo.getN()));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get_feedback_list/{userId}/{type}")
|
||||
public ResponseData getFeedbackList(@PathVariable("userId") String userId, @PathVariable("type") String type) throws Exception {
|
||||
return success(gorseService.listFeedback(userId, type));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/insert_feedback/{type}/{userId}/{itemId}")
|
||||
public ResponseData insertFeedback(@PathVariable("userId") String userId, @PathVariable("type") String type,
|
||||
@PathVariable("itemId") String itemId) throws Exception {
|
||||
List<Feedback> list = new ArrayList<>();
|
||||
Feedback fb = new Feedback();
|
||||
fb.init(userId, itemId, type);
|
||||
list.add(fb);
|
||||
return success(gorseService.insertFeedback(list));
|
||||
}
|
||||
|
||||
@PutMapping(value = "/bulk/{type}")
|
||||
public ResponseData bulkUserOrItem(@RequestParam Map<String, String> data, @RequestParam("file") MultipartFile file, @PathVariable("type") String type) throws Exception {
|
||||
return success(gorseService.bulkUserOrItem(data, file, type));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get_bulk/{type}")
|
||||
public String getBulkUserOrItem(@PathVariable("type") String type) {
|
||||
return gorseService.getBulkUserOrItem(type);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/query_users")
|
||||
public ResponseData queryUsers(@RequestParam("cursor") String cursor) throws Exception {
|
||||
return success(gorseService.getUserPageByCursor(cursor));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/query_user/{id}")
|
||||
public ResponseData queryUser(@PathVariable("id") String id) throws Exception {
|
||||
return success(gorseService.getUserById(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/query_items")
|
||||
public ResponseData queryItems(@RequestParam("cursor") String cursor) throws Exception {
|
||||
return success(gorseService.getItemPageByCursor(cursor));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/query_item/{id}")
|
||||
public ResponseData queryItem(@PathVariable("id") String id) throws Exception {
|
||||
return success(gorseService.getItemById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,8 +10,15 @@ import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.api.R;
|
||||
import com.wx.application.core.mapper.RiskUserMapper;
|
||||
import com.wx.application.gorse4j.GorseService;
|
||||
import com.wx.application.gorse4j.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
//import org.redisson.api.RedissonClient;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -40,11 +47,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@RestController("loginController")
|
||||
public class LoginController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
RiskUserService riskUserService;
|
||||
|
||||
/*@Autowired
|
||||
RedissonClient redissonClient;*/
|
||||
@Autowired
|
||||
RiskUserService riskUserService;
|
||||
|
||||
@Autowired
|
||||
RiskUserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
GorseService gorseService;
|
||||
|
||||
@Autowired
|
||||
private Kaptcha kaptcha;
|
||||
@@ -72,68 +82,75 @@ public class LoginController extends BaseController {
|
||||
kaptcha.render();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
@PostMapping(value = "/user")
|
||||
public ResponseData login(@RequestBody RiskUserQ loginQo) throws Exception {
|
||||
|
||||
// if(StringUtils.isBlank(loginQo.getCode())) {
|
||||
// Map<String,String> data = new HashMap<>();
|
||||
// data.put("msg", "验证码不能为空");
|
||||
// return error(ErrorCodeEnum.USER_NOT_EXIST,data);
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// kaptcha.validate(loginQo.getCode());
|
||||
// } catch (Exception e) {
|
||||
// Map<String,String> data = new HashMap<>();
|
||||
// data.put("msg", "验证码错误");
|
||||
// return error(ErrorCodeEnum.USER_NOT_EXIST,data);
|
||||
// }
|
||||
|
||||
/*if(StringUtils.isBlank(loginQo.getCode())) {
|
||||
Map<String,String> data = new HashMap<>();
|
||||
data.put("msg", "验证码不能为空");
|
||||
return error(ErrorCodeEnum.USER_NOT_EXIST,data);
|
||||
}
|
||||
|
||||
try {
|
||||
kaptcha.validate(loginQo.getCode());
|
||||
} catch (Exception e) {
|
||||
Map<String,String> data = new HashMap<>();
|
||||
data.put("msg", "验证码错误");
|
||||
return error(ErrorCodeEnum.USER_NOT_EXIST,data);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 将密码改成md5加密查询
|
||||
*/
|
||||
Map<String,Object> mQ = new HashMap<>();
|
||||
mQ.put("EQS_username", loginQo.getUsername());
|
||||
mQ.put("EQS_password", MD5Util.MD5(loginQo.getPassword()));
|
||||
mQ.put("EQS_type", loginQo.getType());
|
||||
|
||||
RiskUser riskUser = riskUserService.queryUnique(mQ);
|
||||
|
||||
if(riskUser != null) {
|
||||
String token = JwtUtils.generateJwtToken(riskUser.getId(), CONSTANT.LOGIN_TYPE_ADMIN, riskUser);
|
||||
|
||||
RiskUser _riskUser = new RiskUser();
|
||||
_riskUser.setRealname(riskUser.getRealname());
|
||||
_riskUser.setUsername(riskUser.getUsername());
|
||||
|
||||
return success(ImmutableMap.<String, Object>builder()
|
||||
.put("Authorization",token)
|
||||
.put("user", _riskUser)
|
||||
.build());
|
||||
}
|
||||
Map<String,String> data = new HashMap<>();
|
||||
data.put("msg", "用户名密码错误");
|
||||
return error(ErrorCodeEnum.USER_NOT_EXIST,data);
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
@PostMapping(value = "/user")
|
||||
public ResponseData login(@RequestBody RiskUserQ loginQo) throws Exception {
|
||||
|
||||
/**
|
||||
* 将密码改成md5加密查询
|
||||
*/
|
||||
Map<String, Object> mQ = new HashMap<>();
|
||||
mQ.put("EQS_username", loginQo.getUsername());
|
||||
mQ.put("EQS_password", MD5Util.MD5(loginQo.getPassword()));
|
||||
mQ.put("EQS_type", loginQo.getType());
|
||||
|
||||
RiskUser riskUser = riskUserService.queryUnique(mQ);
|
||||
|
||||
if (riskUser != null) {
|
||||
String token = JwtUtils.generateJwtToken(riskUser.getId(), CONSTANT.LOGIN_TYPE_ADMIN, riskUser);
|
||||
|
||||
RiskUser _riskUser = new RiskUser();
|
||||
_riskUser.setRealname(riskUser.getUsername());
|
||||
_riskUser.setUsername(riskUser.getUsername());
|
||||
|
||||
return success(ImmutableMap.<String, Object>builder()
|
||||
.put("Authorization", token)
|
||||
.put("user", _riskUser)
|
||||
.build());
|
||||
}
|
||||
Map<String, String> data = new HashMap<>();
|
||||
data.put("msg", "用户名密码错误");
|
||||
return error(ErrorCodeEnum.USER_NOT_EXIST, data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
@PostMapping(value = "/register")
|
||||
public ResponseData register(@RequestBody RiskUserQ registerQ) throws Exception {
|
||||
|
||||
|
||||
Map<String, String> data = new HashMap<>();
|
||||
if (StringUtils.isEmpty(registerQ.getUsername()) || StringUtils.isEmpty(registerQ.getPassword())) {
|
||||
data.put("msg", "用户名密码不能为空");
|
||||
return error(ErrorCodeEnum.PARAM_ERROR, data);
|
||||
}
|
||||
|
||||
int blankUserCount = userMapper.selectCount(new QueryWrapper<RiskUser>().lambda().eq(RiskUser::getUsername, registerQ.getUsername()));
|
||||
if (blankUserCount > 0) {
|
||||
data.put("msg", "用户名已存在");
|
||||
return error(ErrorCodeEnum.MOBILE_USED, data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将密码改成md5加密
|
||||
*/
|
||||
RiskUser nowUser = new RiskUser();
|
||||
nowUser.setUsername(registerQ.getUsername());
|
||||
nowUser.setPassword(MD5Util.MD5(registerQ.getPassword()));
|
||||
nowUser.setType(registerQ.getType());
|
||||
|
||||
userMapper.insert(nowUser);
|
||||
// User user = new User(registerQ.getUsername(), null);
|
||||
// gorseService.insertUser(user);
|
||||
return success();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密用户敏感数据获取用户信息
|
||||
*
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.wx.application.adapter.dto.qo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class GorseQ {
|
||||
|
||||
private String userId;
|
||||
|
||||
private String itemId;
|
||||
|
||||
private String category;
|
||||
|
||||
private Integer n;
|
||||
|
||||
private String recommendation;
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package com.wx.application.core.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.wx.application.base.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.wx.application.core.service.CategoryService;
|
||||
import com.wx.application.core.entity.Category;
|
||||
import com.wx.application.base.ResponseData;
|
||||
import java.util.Map;
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
* @description : Category 默认控制器,仅供生成器使用
|
||||
* ---------------------------------
|
||||
* @since 2023-05-23
|
||||
*/
|
||||
/*@Slf4j*/
|
||||
@RestController("coreCategoryController")
|
||||
@RequestMapping("//category")
|
||||
public class CategoryController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 定义一些通用的错误信息,供其他 api引用
|
||||
* @apiDefine DefaultException
|
||||
* @apiError {String} code 错误码
|
||||
* @apiError {String} msg 错误描述
|
||||
* @apiError {String} requestId 请求id标识
|
||||
*
|
||||
* @apiErrorExample Error-Response:
|
||||
* HTTP/1.1 200
|
||||
* {
|
||||
* "code": "UNAUTHORIZED",
|
||||
* "msg": "未授权,请先登录",
|
||||
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 定义标准对象请求的结构体,供api引用
|
||||
* @apiDefine CategoryReq
|
||||
* @apiParam {String} name
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 定义标准对象返回的结构体,供api引用
|
||||
* @apiDefine CategoryResp
|
||||
* @apiSuccess {String} name
|
||||
*/
|
||||
|
||||
/**
|
||||
* 定义标准头部,供api引用
|
||||
* @apiDefine CategoryHeader
|
||||
* @apiHeader {String} Authorization 用户授权token
|
||||
* @apiHeaderExample {json} Header-Example:
|
||||
* {
|
||||
* "Authorization": "Bearer 1eyJhbGciOiJIUzI1NiJ9....tzNK43MPVQWYYhDwihCAZa88zXzar7KLdgiBBDuUpBM",
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @api {post} //category/query_unique 通过条件查询对象
|
||||
* @apiName 通过条件查询对象
|
||||
* @apiGroup Category
|
||||
*
|
||||
* @apiUse CategoryHeader
|
||||
* @apiUse CategoryResp
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
* {
|
||||
* "data": {
|
||||
|
||||
"name": null,
|
||||
* },
|
||||
* "code": "SUCCESS",
|
||||
* "msg": "请求成功",
|
||||
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
|
||||
* }
|
||||
*
|
||||
* @apiUse DefaultException
|
||||
*
|
||||
* @description : 通过条件查询对象
|
||||
* 仅查询第一条
|
||||
* ---------------------------------
|
||||
* @author : zj
|
||||
* @since : Create in 2023-05-23
|
||||
*/
|
||||
@PostMapping(value = "/query_unique")
|
||||
public ResponseData queryUnique(@RequestBody Map categoryQ) {
|
||||
return success(categoryService.queryUnique(categoryQ));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @api {post} //category/query_pages 通过条件分页查询列表
|
||||
* @apiName 通过条件分页查询列表
|
||||
* @apiGroup Category
|
||||
*
|
||||
* @apiUse CategoryHeader
|
||||
* @apiUse CategoryResp
|
||||
* @apiSuccess {Long} total 总数
|
||||
* @apiSuccess {Long} size 分页大小
|
||||
* @apiSuccess {Long} current 当前页
|
||||
* @apiSuccess {Long} orders 排序
|
||||
* @apiSuccess {Long} pages 总页数
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
* {
|
||||
* "data": {
|
||||
* "records": [{
|
||||
|
||||
"name": null, * }],
|
||||
* "total": 1,
|
||||
* "size": 10,
|
||||
* "current": 1,
|
||||
* "orders": [],
|
||||
* "searchCount": true,
|
||||
* "pages": 1
|
||||
* "code": "SUCCESS",
|
||||
* "msg": "请求成功",
|
||||
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
|
||||
* }
|
||||
*
|
||||
* @apiUse DefaultException
|
||||
*
|
||||
* @description : 通过条件分页查询列表
|
||||
* 默认第一页 分页长度为10
|
||||
* ---------------------------------
|
||||
* @author : zj
|
||||
* @since : Create in 2023-05-23
|
||||
*/
|
||||
@PostMapping(value = "/query_pages")
|
||||
public ResponseData queryPages(@RequestBody Map categoryQ) {
|
||||
return success(categoryService.queryPage(categoryQ));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @api {post} //category/query_list 通过条件查询列表
|
||||
* @apiName 通过条件查询列表
|
||||
* @apiGroup Category
|
||||
*
|
||||
* @apiUse CategoryHeader
|
||||
* @apiUse CategoryResp
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
* {
|
||||
* "data": [{
|
||||
|
||||
"name": null,
|
||||
* }],
|
||||
* "code": "SUCCESS",
|
||||
* "msg": "请求成功",
|
||||
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
|
||||
* }
|
||||
*
|
||||
* @apiUse DefaultException
|
||||
*
|
||||
* @description : 通过条件查询列表
|
||||
* 不分页直接返回list
|
||||
* ---------------------------------
|
||||
* @author : zj
|
||||
* @since : Create in 2023-05-23
|
||||
*/
|
||||
@PostMapping(value = "/query_list")
|
||||
public ResponseData queryList(@RequestBody Map categoryQ) {
|
||||
return success(categoryService.queryList(categoryQ));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @api {post} //category/remove/:id 通过id删除单个记录
|
||||
* @apiName 通过id删除单个记录
|
||||
* @apiGroup Category
|
||||
*
|
||||
* @apiUse CategoryHeader
|
||||
* @apiParam {PK} id 记录主键
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
* {
|
||||
* "data": true,
|
||||
* "code": "SUCCESS",
|
||||
* "msg": "请求成功",
|
||||
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
|
||||
* }
|
||||
*
|
||||
* @apiUse DefaultException
|
||||
*
|
||||
* @description : 通过id删除单个记录
|
||||
* ---------------------------------
|
||||
* @author : zj
|
||||
* @since : Create in 2023-05-23
|
||||
*/
|
||||
@PostMapping(value = "/remove/{id}")
|
||||
public ResponseData remove(@PathVariable("id") Serializable id) {
|
||||
return success(categoryService.remove(id));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @api {post} //category/modify 通过id更新单个记录
|
||||
* @apiName 通过id更新单个记录
|
||||
* @apiGroup Category
|
||||
*
|
||||
* @apiUse CategoryHeader
|
||||
* @apiParam {PK} id 记录主键
|
||||
* @apiUse CategoryReq
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
* {
|
||||
* "data": true,
|
||||
* "code": "SUCCESS",
|
||||
* "msg": "请求成功",
|
||||
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
|
||||
* }
|
||||
*
|
||||
* @apiUse DefaultException
|
||||
*
|
||||
* @description : 通过id更新单个记录
|
||||
* ---------------------------------
|
||||
* @author : zj
|
||||
* @since : Create in 2023-05-23
|
||||
*/
|
||||
@PostMapping(value = "/modify")
|
||||
public ResponseData modify(@RequestBody Category category) {
|
||||
return success(categoryService.modify(category));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @api {post} //category/create 新增
|
||||
* @apiName 新增
|
||||
* @apiGroup Category
|
||||
*
|
||||
* @apiUse CategoryHeader
|
||||
* @apiUse CategoryReq
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
* {
|
||||
* "data": true,
|
||||
* "code": "SUCCESS",
|
||||
* "msg": "请求成功",
|
||||
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
|
||||
* }
|
||||
*
|
||||
* @apiUse DefaultException
|
||||
*
|
||||
* @description : 新增
|
||||
* ---------------------------------
|
||||
* @author : zj
|
||||
* @since : Create in 2023-05-23
|
||||
*/
|
||||
@PostMapping(value = "/create")
|
||||
public ResponseData create(@RequestBody Category category) {
|
||||
return success(categoryService.create(category));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.wx.application.core.controller;
|
||||
|
||||
import com.wx.application.base.BaseController;
|
||||
import com.wx.application.base.ResponseData;
|
||||
import com.wx.application.core.entity.Entrys;
|
||||
import com.wx.application.core.service.EntrysService;
|
||||
import com.wx.application.core.service.RiskUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description : Entrys 默认控制器,仅供生成器使用
|
||||
* ---------------------------------
|
||||
* @since 2023-05-12
|
||||
*/
|
||||
/*@Slf4j*/
|
||||
@RestController("coreRiskUserController")
|
||||
@RequestMapping("/risk-user")
|
||||
public class RiskUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RiskUserService userService;
|
||||
|
||||
@PostMapping(value = "/query_list")
|
||||
public ResponseData queryList(@RequestBody Map userQ) {
|
||||
return success(userService.queryList(userQ));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/query_pages")
|
||||
public ResponseData queryPages(@RequestBody Map entrysQ) {
|
||||
return success(userService.queryPage(entrysQ));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/query_unique")
|
||||
public ResponseData queryUnique(@RequestBody Map entrysQ) {
|
||||
return success(userService.queryUnique(entrysQ));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.wx.application.core.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.wx.application.base.BaseEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author zj
|
||||
* @since 2023-05-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@TableName("re_category")
|
||||
public class Category extends BaseEntity<Long> {
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class FeedbackType extends BaseEntity<Long> {
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private String type;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
public class RiskUser extends BaseEntity<Long> {
|
||||
|
||||
private String fid;
|
||||
|
||||
private String username;
|
||||
|
||||
private String realname;
|
||||
@@ -25,4 +27,5 @@ public class RiskUser extends BaseEntity<Long> {
|
||||
|
||||
private String type;
|
||||
|
||||
private String lables;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.wx.application.core.mapper;
|
||||
|
||||
import com.wx.application.core.entity.Category;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zj
|
||||
* @since 2023-05-23
|
||||
*/
|
||||
@Repository
|
||||
public interface CategoryMapper extends BaseMapper<Category> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.wx.application.core.service;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.wx.application.base.BaseService;
|
||||
import com.wx.application.core.entity.Category;
|
||||
import com.wx.application.core.mapper.CategoryMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zj
|
||||
* @since 2023-05-23
|
||||
*/
|
||||
/*@Slf4j*/
|
||||
@Service("coreCategoryService")
|
||||
@Transactional
|
||||
public class CategoryService extends BaseService<Category, CategoryMapper> {
|
||||
|
||||
@Autowired
|
||||
CategoryMapper baseMapper;
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.wx.application.core.service;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.wx.application.core.entity.Entrys;
|
||||
import com.wx.application.base.BaseService;
|
||||
import com.wx.application.core.entity.Entrys;
|
||||
import com.wx.application.core.mapper.EntrysMapper;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.wx.application.core.service;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.wx.application.core.entity.FeedbackType;
|
||||
import com.wx.application.base.BaseService;
|
||||
import com.wx.application.core.entity.FeedbackType;
|
||||
import com.wx.application.core.mapper.FeedbackTypeMapper;
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,15 +12,23 @@ public class Feedback {
|
||||
private String userId;
|
||||
private String itemId;
|
||||
private String timestamp;
|
||||
private Item item;
|
||||
|
||||
public Feedback() {
|
||||
}
|
||||
|
||||
public Feedback(String feedbackType, String userId, String itemId, String timestamp) {
|
||||
public void init(String userId, String itemId, String feedbackType) {
|
||||
this.itemId = itemId;
|
||||
this.userId = userId;
|
||||
this.feedbackType = feedbackType;
|
||||
}
|
||||
|
||||
public Feedback(String feedbackType, String userId, String itemId, String timestamp, Item item) {
|
||||
this.feedbackType = feedbackType;
|
||||
this.userId = userId;
|
||||
this.itemId = itemId;
|
||||
this.timestamp = timestamp;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@JsonProperty("FeedbackType")
|
||||
@@ -38,6 +46,11 @@ public class Feedback {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
@JsonProperty("Item")
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
@JsonProperty("Timestamp")
|
||||
public String getTimestamp() {
|
||||
return timestamp;
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.wx.application.gorse4j;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class Gorse {
|
||||
|
||||
private final String endpoint;
|
||||
private final String apiKey;
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
// Create a client.
|
||||
Gorse client = new Gorse("http://43.139.83.67:8088/", "");
|
||||
System.out.println(client.getRecommend("1265177464"));
|
||||
}
|
||||
|
||||
public Gorse(String endpoint, String apiKey) {
|
||||
this.endpoint = endpoint;
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public RowAffected insertUser(User user) throws IOException {
|
||||
return this.request("POST", this.endpoint + "/api/user", user, RowAffected.class);
|
||||
}
|
||||
|
||||
public User getUser(String userId) throws IOException {
|
||||
return this.request("GET", this.endpoint + "/api/user/" + userId, null, User.class);
|
||||
}
|
||||
|
||||
public RowAffected deleteUser(String userId) throws IOException {
|
||||
return this.request("DELETE", this.endpoint + "/api/user/" + userId, null, RowAffected.class);
|
||||
}
|
||||
|
||||
public RowAffected insertItem(Item item) throws IOException {
|
||||
return this.request("POST", this.endpoint + "/api/item", item, RowAffected.class);
|
||||
}
|
||||
|
||||
public Item getItem(String itemId) throws IOException {
|
||||
return this.request("GET", this.endpoint + "/api/item/" + itemId, null, Item.class);
|
||||
}
|
||||
|
||||
public RowAffected deleteItem(String itemId) throws IOException {
|
||||
return this.request("DELETE", this.endpoint + "/api/item/" + itemId, null, RowAffected.class);
|
||||
}
|
||||
|
||||
public RowAffected insertFeedback(List<Feedback> feedbacks) throws IOException {
|
||||
return this.request("POST", this.endpoint + "/api/feedback", feedbacks, RowAffected.class);
|
||||
}
|
||||
|
||||
public List<Feedback> listFeedback(String userId, String feedbackType) throws IOException {
|
||||
return Arrays.asList(this.request("GET", this.endpoint + "/api/user/" + userId + "/feedback/" + feedbackType, null, Feedback[].class));
|
||||
}
|
||||
|
||||
public List<String> getRecommend(String userId) throws IOException {
|
||||
return Arrays.asList(this.request("GET", this.endpoint + "/api/recommend/" + userId, null, String[].class));
|
||||
}
|
||||
|
||||
private <Request, Response> Response request(String method, String url, Request request, Class<Response> responseClass) throws IOException {
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setRequestMethod(method);
|
||||
connection.setRequestProperty("X-API-Key", this.apiKey);
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
// Send request
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
if (request != null) {
|
||||
connection.setDoOutput(true);
|
||||
String requestBody = mapper.writeValueAsString(request);
|
||||
DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
|
||||
outputStream.write(requestBody.getBytes());
|
||||
outputStream.close();
|
||||
}
|
||||
// Get Response
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
return mapper.readValue(inputStream, responseClass);
|
||||
}
|
||||
}
|
||||
38
api/src/main/java/com/wx/application/gorse4j/GorsePage.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.wx.application.gorse4j;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询的分页结果
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class GorsePage {
|
||||
|
||||
/**
|
||||
* 下一页的查询码,查询首页可缺省
|
||||
*/
|
||||
private String cursor;
|
||||
|
||||
private List<User> users;
|
||||
|
||||
private List<Item> items;
|
||||
|
||||
@JsonProperty("Cursor")
|
||||
public String getCursor() {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
@JsonProperty("Users")
|
||||
public List<User> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
@JsonProperty("Items")
|
||||
public List<Item> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
}
|
||||
225
api/src/main/java/com/wx/application/gorse4j/GorseService.java
Normal file
@@ -0,0 +1,225 @@
|
||||
package com.wx.application.gorse4j;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
|
||||
import com.wx.application.util.CSVUtils;
|
||||
import com.wx.application.util.HttpUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Service
|
||||
public class GorseService {
|
||||
|
||||
private String endpoint = "http://43.139.83.67:8088/";
|
||||
private String apiKey = "";
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
// Create a client.
|
||||
//Gorse client = new Gorse("", "");
|
||||
//System.out.println(client.getRecommend("1265177464"));
|
||||
}
|
||||
|
||||
|
||||
public RowAffected insertUser(User user) throws IOException {
|
||||
return this.request("POST", this.endpoint + "/api/user", user, RowAffected.class);
|
||||
}
|
||||
|
||||
public User getUser(String userId) throws IOException {
|
||||
return this.request("GET", this.endpoint + "/api/user/" + userId, null, User.class);
|
||||
}
|
||||
|
||||
public RowAffected deleteUser(String userId) throws IOException {
|
||||
return this.request("DELETE", this.endpoint + "/api/user/" + userId, null, RowAffected.class);
|
||||
}
|
||||
|
||||
public RowAffected insertItem(Item item) throws IOException {
|
||||
return this.request("POST", this.endpoint + "/api/item", item, RowAffected.class);
|
||||
}
|
||||
|
||||
public Item getItem(String itemId) throws IOException {
|
||||
return this.request("GET", this.endpoint + "/api/item/" + itemId, null, Item.class);
|
||||
}
|
||||
|
||||
public RowAffected deleteItem(String itemId) throws IOException {
|
||||
return this.request("DELETE", this.endpoint + "/api/item/" + itemId, null, RowAffected.class);
|
||||
}
|
||||
|
||||
public Object insertFeedback(List<Feedback> feedbacks) throws IOException {
|
||||
return HttpUtils.doPost(this.endpoint + "/api/feedback", JSONObject.toJSONString(feedbacks));
|
||||
// return this.request("POST", this.endpoint + "/api/feedback", feedbacks, RowAffected.class);
|
||||
}
|
||||
|
||||
public List<Feedback> listFeedback(String userId, String feedbackType) throws IOException {
|
||||
return Arrays.asList(this.request("GET", this.endpoint + "/api/dashboard/user/" + userId + "/feedback/" + feedbackType, null, Feedback[].class));
|
||||
}
|
||||
|
||||
public List<String> getRecommend(String userId) throws IOException {
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 相似(获取相似用户)
|
||||
*/
|
||||
public List<User> getSimilarUser(String userId) throws IOException {
|
||||
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 User getUserById(String id) throws IOException {
|
||||
return this.request("GET", this.endpoint + "/api/dashboard/user/" + id, null, User.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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物品
|
||||
*/
|
||||
public Item getItemById(String id) throws IOException {
|
||||
return this.request("GET", this.endpoint + "/api/item/" + id, null, Item.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 洞悉(根据用户获取推荐)
|
||||
*/
|
||||
public List<Item> getRecommendByUser(String userId, String recommendation, String category, Integer n) throws IOException {
|
||||
return Arrays.asList(this.request("GET", this.endpoint + "/api/dashboard/recommend/" + userId
|
||||
+ "/" + recommendation + "/" + category + "?n=" + ((n == null || n <= 0) ? 10 : n), null, Item[].class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 相似物品(根据物品ID和分类获取相似物品)
|
||||
*/
|
||||
public List<Item> getSimilarItem(String itemId, String category, Integer n) throws IOException {
|
||||
String url = this.endpoint + "/api/dashboard/item/" + itemId + "/neighbors";
|
||||
if (StringUtils.isNotBlank(category)) {
|
||||
// 当默认查询10条
|
||||
url += "/" + category + "?n=" + ((n == null || n <= 0) ? 10 : n);
|
||||
}
|
||||
System.out.println(url);
|
||||
return Arrays.asList(this.request("GET", url, null, Item[].class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件方式导入用户或者物品users\items
|
||||
*/
|
||||
public JSONObject bulkUserOrItem(Map<String, String> data, MultipartFile multipartFile, String type) throws IOException {
|
||||
File file = new File("path/to/file");
|
||||
|
||||
FileUtils.writeByteArrayToFile(file, multipartFile.getBytes());
|
||||
|
||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||
for (Map.Entry<String, String> entry : data.entrySet()) {
|
||||
builder.addTextBody(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
// 导入附加的属性数据到mysql
|
||||
if ("users".equals(type)) {
|
||||
List<List<String>> rows = CSVUtils.parseCSV(file, data.get("sep"));
|
||||
|
||||
} else if ("items".equals(type)) {
|
||||
List<List<String>> rows = CSVUtils.parseCSV(file, data.get("sep"));
|
||||
}
|
||||
|
||||
builder.addBinaryBody("file", file, ContentType.APPLICATION_OCTET_STREAM, multipartFile.getOriginalFilename());
|
||||
return this.sendPostFormData(this.endpoint + "/api/bulk/" + type, builder);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出用户或物品信息
|
||||
*/
|
||||
public String getBulkUserOrItem(String type) {
|
||||
return "redirect:" + this.endpoint + "/api/bulk/" + type;
|
||||
}
|
||||
|
||||
public JSONObject sendPostFormData(String url, MultipartEntityBuilder builder) throws IOException {
|
||||
JSONObject resJson;
|
||||
HttpClient httpClient = HttpClientBuilder.create().build();
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
HttpEntity entity = builder.build();
|
||||
httpPost.setEntity(entity);
|
||||
|
||||
HttpResponse response = null;
|
||||
try {
|
||||
response = httpClient.execute(httpPost);
|
||||
HttpEntity responseEntity = response.getEntity();
|
||||
resJson = JSONObject.parseObject(EntityUtils.toString(responseEntity));
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
}
|
||||
return resJson;
|
||||
}
|
||||
|
||||
private <Request, Response> Response request(String method, String url, Request request, Class<Response> responseClass) throws IOException {
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setRequestMethod(method);
|
||||
connection.setRequestProperty("X-API-Key", this.apiKey);
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
// Send request
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
if (request != null) {
|
||||
connection.setDoOutput(true);
|
||||
String requestBody = mapper.writeValueAsString(request);
|
||||
OutputStream outputStream = connection.getOutputStream();
|
||||
outputStream.write(requestBody.getBytes());
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
}
|
||||
// Get Response
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
return mapper.readValue(inputStream, responseClass);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,17 +13,20 @@ public class Item {
|
||||
private List<String> categories;
|
||||
private String timestamp;
|
||||
private String comment;
|
||||
|
||||
|
||||
private Float score;
|
||||
|
||||
public Item() {
|
||||
}
|
||||
|
||||
public Item(String itemId, Boolean isHidden, List<String> labels, List<String> categories, String timestamp, String comment) {
|
||||
public Item(String itemId, Boolean isHidden, List<String> labels, List<String> categories, String timestamp, String comment,Float score) {
|
||||
this.itemId = itemId;
|
||||
this.isHidden = isHidden;
|
||||
this.labels = labels;
|
||||
this.categories = categories;
|
||||
this.timestamp = timestamp;
|
||||
this.comment = comment;
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
@JsonProperty("ItemId")
|
||||
@@ -56,16 +59,27 @@ public class Item {
|
||||
return comment;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonProperty("Score")
|
||||
public Float getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Item item = (Item) o;
|
||||
return Objects.equals(itemId, item.itemId) && Objects.equals(isHidden, item.isHidden) && Objects.equals(labels, item.labels) && Objects.equals(categories, item.categories) && Objects.equals(timestamp, item.timestamp) && Objects.equals(comment, item.comment);
|
||||
return Objects.equals(itemId, item.itemId)
|
||||
&& Objects.equals(isHidden, item.isHidden)
|
||||
&& Objects.equals(labels, item.labels)
|
||||
&& Objects.equals(categories, item.categories)
|
||||
&& Objects.equals(timestamp, item.timestamp)
|
||||
&& Objects.equals(comment, item.comment)
|
||||
&& Objects.equals(score, item.score);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(itemId, isHidden, labels, categories, timestamp, comment);
|
||||
return Objects.hash(itemId, isHidden, labels, categories, timestamp, comment, score);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ public class User {
|
||||
private String userId;
|
||||
private List<String> labels;
|
||||
|
||||
private Float score;
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
@@ -30,6 +32,11 @@ public class User {
|
||||
return labels;
|
||||
}
|
||||
|
||||
@JsonProperty("Score")
|
||||
public Float getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -730,6 +730,19 @@ public class BaseGraphSerice {
|
||||
return ResultSetUtils.printResultPath(resultSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据明确关系查询一个节点的周边一层节点关系
|
||||
* @param nQ
|
||||
* @return
|
||||
*/
|
||||
public NebulaModel findOnePathById(final String space,final String vid, List<String> relations) {
|
||||
final String fmtVid = StrUtil.format("\"{}\"", vid);
|
||||
final String rl = StringUtils.join(relations, "|");
|
||||
final String fmtrl = StrUtil.format("[r:{}]", rl);
|
||||
final String nGql = StrUtil.format(GqlTemplate.WITHRELATIONBYID, fmtrl, fmtVid);
|
||||
ResultSet resultSet = executeGql(space, nGql);
|
||||
return ResultSetUtils.printResultPath(resultSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询一个头节点和尾结点的关系
|
||||
|
||||
@@ -49,6 +49,8 @@ public interface GqlTemplate {
|
||||
|
||||
final static String ONERELATIONBYID = "MATCH p=(n1)-->(n2) where id(n1)=={} RETURN p";
|
||||
|
||||
final static String WITHRELATIONBYID = "MATCH p=(n1)-{}->(n2) where id(n1)=={} RETURN p";
|
||||
|
||||
final static String ONERELATIONBYSRCIDANDDCTID = "MATCH p=(n1)-->(n2) where id(n1)=={} and id(n2)=={} RETURN p";
|
||||
|
||||
final static String PAGING =" | limit {},{}";
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.wx.application.nebula.graph.conrtroller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -11,6 +12,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import com.wx.application.base.BaseController;
|
||||
import com.wx.application.base.ResponseData;
|
||||
import com.wx.application.nebula.graph.service.ImportGraphInJsonService;
|
||||
import com.wx.application.nebula.graph.service.ImportGraphService;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/nebula_graph_import")
|
||||
@@ -19,6 +21,8 @@ public class NebulaImportController extends BaseController {
|
||||
@Autowired
|
||||
ImportGraphInJsonService importGraphInJsonService;
|
||||
|
||||
@Autowired
|
||||
ImportGraphService importGraphService;
|
||||
/**
|
||||
* 上传zip文件
|
||||
* @param space
|
||||
@@ -31,6 +35,18 @@ public class NebulaImportController extends BaseController {
|
||||
return success(importGraphInJsonService.uploadFile(file, space));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/iptuser")
|
||||
public ResponseData iptUser() {
|
||||
importGraphService.iptUser();
|
||||
return success();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/iptentrys")
|
||||
public ResponseData iptentrys() {
|
||||
importGraphService.iptentrys();
|
||||
return success();
|
||||
}
|
||||
|
||||
/*@Autowired
|
||||
ImportGraphInExcelService importGraphService;
|
||||
|
||||
|
||||
@@ -382,6 +382,20 @@ public class NebulaOperateController extends BaseController {
|
||||
return success(nebulaOperateService.findOnePathById(space, vid));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询一个节点和明确的关系查询周边一层节点关系
|
||||
* @param nQ
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/findonepathbyidwithrelation/{space}/{vid}")
|
||||
public ResponseData findOnePathById(@PathVariable("space") String space,
|
||||
@PathVariable("vid") String vid,
|
||||
@RequestBody NebulaQo nebulaQo) {
|
||||
return success(nebulaOperateService.findOnePathById(space, vid, nebulaQo.getRelations()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询一个头节点和尾结点的关系
|
||||
* @param nQ
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.wx.application.nebula.graph.query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@@ -18,5 +20,7 @@ public class NebulaQo {
|
||||
private Integer page = 1;
|
||||
|
||||
private Integer pageSize = 200;
|
||||
|
||||
private List<String> relations;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.wx.application.nebula.graph.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.wx.application.core.entity.Entrys;
|
||||
import com.wx.application.core.entity.RiskUser;
|
||||
import com.wx.application.core.service.EntrysService;
|
||||
import com.wx.application.core.service.RiskUserService;
|
||||
import com.wx.application.nebula.graph.bean.NebulaVertex;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ImportGraphService {
|
||||
|
||||
@Autowired
|
||||
NebulaOperateService nebulaOperateService;
|
||||
|
||||
@Autowired
|
||||
RiskUserService riskUserService;
|
||||
|
||||
@Autowired
|
||||
EntrysService entrysService;
|
||||
|
||||
public void iptUser() {
|
||||
|
||||
List<RiskUser> riskUsers = riskUserService.queryList(new HashMap<>());
|
||||
|
||||
List<NebulaVertex> list = new Vector<>();
|
||||
|
||||
riskUsers.forEach(v-> {
|
||||
NebulaVertex vertex = new NebulaVertex();
|
||||
vertex.setTag("tag_252150072");
|
||||
vertex.setVid(v.getFid());
|
||||
|
||||
list.add(vertex);
|
||||
|
||||
|
||||
if(list.size() > 2000) {
|
||||
log.info("执行一次 节点导入 {}", list.size());
|
||||
nebulaOperateService.insertTagAll("recom_gorse", "tag_252150072", list);
|
||||
list.clear();
|
||||
}
|
||||
});
|
||||
|
||||
if(list.size() > 0) {
|
||||
log.info("执行一次 节点导入 {}", list.size());
|
||||
nebulaOperateService.insertTagAll("recom_gorse", "tag_1412011336", list);
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void iptentrys() {
|
||||
|
||||
List<Entrys> entrys = entrysService.queryList(new HashMap<>());
|
||||
|
||||
List<NebulaVertex> list = new Vector<>();
|
||||
entrys.forEach(v-> {
|
||||
NebulaVertex vertex = new NebulaVertex();
|
||||
vertex.setTag("tag_1412011336");
|
||||
vertex.setVid(v.getFid());
|
||||
|
||||
list.add(vertex);
|
||||
|
||||
if(list.size() > 2000) {
|
||||
log.info("执行一次 节点导入 {}", list.size());
|
||||
nebulaOperateService.insertTagAll("recom_gorse", "tag_1412011336", list);
|
||||
list.clear();
|
||||
}
|
||||
});
|
||||
|
||||
if(list.size() > 0) {
|
||||
log.info("执行一次 节点导入 {}", list.size());
|
||||
nebulaOperateService.insertTagAll("recom_gorse", "tag_1412011336", list);
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
52
api/src/main/java/com/wx/application/util/CSVUtils.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.wx.application.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class CSVUtils {
|
||||
|
||||
/**
|
||||
* @param file
|
||||
* @param sep 属性分隔符
|
||||
* @return
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public static List<List<String>> parseCSV(File file, String sep) throws FileNotFoundException {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
|
||||
if (file == null) {
|
||||
return rows;
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(sep)) {
|
||||
sep = ",";
|
||||
}
|
||||
|
||||
try {
|
||||
Scanner scanner = new Scanner(file);
|
||||
|
||||
while (scanner.hasNextLine()) {
|
||||
String line = scanner.nextLine();
|
||||
String[] values = line.split(sep);
|
||||
List<String> row = new ArrayList<>();
|
||||
|
||||
for (String value : values) {
|
||||
row.add(value);
|
||||
}
|
||||
|
||||
rows.add(row);
|
||||
}
|
||||
|
||||
scanner.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
191
api/src/main/java/com/wx/application/util/HttpUtils.java
Normal file
@@ -0,0 +1,191 @@
|
||||
package com.wx.application.util;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpUtils {
|
||||
|
||||
|
||||
private static PoolingHttpClientConnectionManager connMgr = new PoolingHttpClientConnectionManager();
|
||||
private static RequestConfig requestConfig;
|
||||
|
||||
/**
|
||||
* 情况方法直接放这里就行
|
||||
*/
|
||||
|
||||
|
||||
static {
|
||||
connMgr.setMaxTotal(100);
|
||||
connMgr.setDefaultMaxPerRoute(connMgr.getMaxTotal());
|
||||
RequestConfig.Builder configBuilder = RequestConfig.custom();
|
||||
configBuilder.setConnectTimeout(60000);
|
||||
configBuilder.setSocketTimeout(70000);
|
||||
configBuilder.setConnectionRequestTimeout(30000);
|
||||
requestConfig = configBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定URL发送GET方法的请求
|
||||
*
|
||||
* @param url 发送请求的URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return URL 所代表远程资源的响应结果
|
||||
*/
|
||||
public Object sendGet(String url, String param) {
|
||||
String result = "";
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
String urlNameString = url + "?" + param;
|
||||
URL realUrl = new URL(urlNameString);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection connection = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
connection.setRequestProperty("accept", "*/*");
|
||||
connection.setRequestProperty("connection", "Keep-Alive");
|
||||
connection.setRequestProperty("user-agent",
|
||||
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
// 建立实际的连接
|
||||
connection.connect();
|
||||
// 获取所有响应头字段
|
||||
Map<String, List<String>> map = connection.getHeaderFields();
|
||||
// 遍历所有的响应头字段
|
||||
for (String key : map.keySet()) {
|
||||
System.out.println(key + "--->" + map.get(key));
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(
|
||||
connection.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送GET请求出现异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 使用finally块来关闭输入流
|
||||
finally {
|
||||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static Object sendPost(String url, String param) {
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
String result = "";
|
||||
try {
|
||||
URL realUrl = new URL(url);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent",
|
||||
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
// 发送请求参数
|
||||
out.print(param);
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(
|
||||
new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送 POST 请求出现异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
//使用finally块来关闭输出流、输入流
|
||||
finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* post,以 application/json 形式
|
||||
* @param apiUrl
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
public static String doPost(String apiUrl, String json) {
|
||||
long start = System.currentTimeMillis();
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
String httpStr = null;
|
||||
HttpPost httpPost = new HttpPost(apiUrl);
|
||||
CloseableHttpResponse response = null;
|
||||
int statusCode = -999;
|
||||
try {
|
||||
httpPost.setConfig(requestConfig);
|
||||
StringEntity stringEntity = new StringEntity(json.toString(), "UTF-8");
|
||||
stringEntity.setContentEncoding("UTF-8");
|
||||
stringEntity.setContentType("application/json");
|
||||
httpPost.setEntity(stringEntity);
|
||||
response = httpClient.execute(httpPost);
|
||||
HttpEntity entity = response.getEntity();
|
||||
statusCode = response.getStatusLine().getStatusCode();
|
||||
httpStr = EntityUtils.toString(entity, "UTF-8");
|
||||
} catch (Exception var20) {
|
||||
var20.printStackTrace();
|
||||
} finally {
|
||||
if (response != null) {
|
||||
try {
|
||||
EntityUtils.consume(response.getEntity());
|
||||
} catch (IOException var19) {
|
||||
var19.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return httpStr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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@
|
||||
|
||||
6
api/src/main/resources/mapper/CategoryMapper.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wx.application.core.mapper.CategoryMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
29
web/package-lock.json
generated
@@ -2141,7 +2141,7 @@
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
@@ -2177,7 +2177,7 @@
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
@@ -2188,7 +2188,7 @@
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
@@ -2198,7 +2198,7 @@
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
@@ -2217,14 +2217,14 @@
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"loader-utils": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/loader-utils/-/loader-utils-2.0.4.tgz",
|
||||
"integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
@@ -2252,7 +2252,7 @@
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
@@ -2279,7 +2279,7 @@
|
||||
},
|
||||
"vue-loader-v16": {
|
||||
"version": "npm:vue-loader@16.8.3",
|
||||
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
|
||||
"resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-16.8.3.tgz",
|
||||
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
@@ -9996,6 +9996,11 @@
|
||||
"integrity": "sha1-bJWZ00DVTf05RjgCUqNXBaa5kr8=",
|
||||
"dev": true
|
||||
},
|
||||
"papaparse": {
|
||||
"version": "5.4.1",
|
||||
"resolved": "https://registry.npmmirror.com/papaparse/-/papaparse-5.4.1.tgz",
|
||||
"integrity": "sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw=="
|
||||
},
|
||||
"parallel-transform": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npm.taobao.org/parallel-transform/download/parallel-transform-1.2.0.tgz",
|
||||
@@ -14600,6 +14605,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"vue-papa-parse": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/vue-papa-parse/-/vue-papa-parse-3.1.0.tgz",
|
||||
"integrity": "sha512-5YdF3Dtf49EGfaz3+IgIpUw9yYuvV3HekZkob6jrK/Ffz1aCrWjevtcQByKxrNtK7RAL39B0ca93bogKuiQQKg==",
|
||||
"requires": {
|
||||
"papaparse": "^5.3.0"
|
||||
}
|
||||
},
|
||||
"vue-quill-editor": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npm.taobao.org/vue-quill-editor/download/vue-quill-editor-3.0.6.tgz",
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
"vue": "^2.6.11",
|
||||
"vue-axios": "^3.2.4",
|
||||
"vue-json-editor": "^1.4.3",
|
||||
"vue-papa-parse": "^3.1.0",
|
||||
"vue-quill-editor": "^3.0.6",
|
||||
"vuex": "^3.1.0"
|
||||
},
|
||||
|
||||
BIN
web/public/template.xlsx
Normal file
@@ -21,17 +21,23 @@ html, body, #app {
|
||||
}
|
||||
|
||||
.el-table th.is-leaf {
|
||||
background: rgba(250, 250, 250, 1);
|
||||
background: rgba(235,241,255);
|
||||
border-top: 1px solid #EBEEF5;
|
||||
}
|
||||
|
||||
.el-table th.el-table__cell{
|
||||
background: rgba(235,241,255)!important;
|
||||
color: #333333!important;
|
||||
font-weight: normal!important;
|
||||
}
|
||||
|
||||
.menu-content {
|
||||
margin: 25px;
|
||||
background: #FFFFFF;
|
||||
overflow: auto;
|
||||
position: absolute;
|
||||
left: 290px;
|
||||
top: 100px;
|
||||
left: 260px;
|
||||
top: 40px;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
padding: 25px;
|
||||
@@ -70,4 +76,75 @@ html, body, #app {
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.login-input .el-input__inner{
|
||||
height: 60px!important;
|
||||
line-height: 60px!important;
|
||||
border-radius: 10px!important;
|
||||
font-size: 16px!important;
|
||||
padding: 0px 30px 0 60px!important;
|
||||
}
|
||||
|
||||
.login-input i{
|
||||
font-size: 30px!important;
|
||||
line-height: 60px!important;
|
||||
margin-left: 15px!important;
|
||||
}
|
||||
|
||||
.login-button{
|
||||
height: 60px!important;
|
||||
width: 100%!important;
|
||||
border-radius: 10px!important;
|
||||
//background: rgba(16,108,255, 1);
|
||||
border: none;
|
||||
font-size: 16px!important;
|
||||
letter-spacing:5px!important;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/*滚动条样式*/
|
||||
::-webkit-scrollbar {/*滚动条整体样式*/
|
||||
width: 8px; /*高宽分别对应横竖滚动条的尺寸*/
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: inset 0 0 5px #d9d9d9;
|
||||
background: #d9d9d9;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track { /*滚动条里面轨道*/
|
||||
-webkit-box-shadow: inset 0 0 5px #ffffff;
|
||||
border-radius: 0;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.el-dialog__header{
|
||||
background: cornflowerblue;
|
||||
padding-bottom:15px!important;
|
||||
padding-top: 15px!important;
|
||||
}
|
||||
|
||||
.el-dialog__title{
|
||||
color: #ffffff!important;
|
||||
}
|
||||
|
||||
.el-dialog__headerbtn .el-dialog__close{
|
||||
color: #ffffff!important;
|
||||
}
|
||||
|
||||
.el-dialog__body{
|
||||
padding-bottom:20px!important;
|
||||
}
|
||||
|
||||
.content-box .el-input__inner{
|
||||
height: 33px!important;
|
||||
line-height: 33px!important;
|
||||
}
|
||||
|
||||
.content-box .el-button--primary,.content-box .el-button--default{
|
||||
padding: 9px 15px!important;
|
||||
font-size: 12px!important;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
Before Width: | Height: | Size: 171 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 234 KiB |
|
Before Width: | Height: | Size: 212 KiB |
|
Before Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 225 KiB |
|
Before Width: | Height: | Size: 277 KiB |
|
Before Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 131 KiB |
|
Before Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 126 KiB |
|
Before Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 128 KiB |
|
Before Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 152 KiB |
|
Before Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 160 KiB |
|
Before Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 148 KiB |
|
Before Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 144 KiB |
|
Before Width: | Height: | Size: 168 KiB |
BIN
web/src/assets/image/ambari-logo.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
web/src/assets/image/background.png
Normal file
|
After Width: | Height: | Size: 112 KiB |
BIN
web/src/assets/image/content-logo.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
web/src/assets/image/login-img.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
web/src/assets/image/password.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
web/src/assets/image/user.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
@@ -20,13 +20,13 @@
|
||||
<label>查询中</label>
|
||||
</div>
|
||||
<el-form-item :label="item.comment" v-for="item in infoList" :key="item.field">
|
||||
<el-input v-model="item.value"></el-input>
|
||||
<el-input v-model="item.value" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="btn-box">
|
||||
<el-button type="danger" @click="removeItem" v-show="editFlag">删 除</el-button>
|
||||
<el-button type="primary" @click="submitUpdate">保 存</el-button>
|
||||
</div>
|
||||
<!-- <div class="btn-box">-->
|
||||
<!-- <el-button type="danger" @click="removeItem" v-show="editFlag">删 除</el-button>-->
|
||||
<!-- <el-button type="primary" @click="submitUpdate">保 存</el-button>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -96,7 +96,9 @@ export default {
|
||||
method: 'get',
|
||||
data: {}
|
||||
}).then(res => {
|
||||
vm.form[comment] = getFirstStringProperty(res.data.properties);
|
||||
|
||||
// vm.form[comment] = getFirstStringProperty(res.data.properties);
|
||||
vm.form[comment] = vid;
|
||||
});
|
||||
},
|
||||
queryEdgeDetail(edgeType, srcVid, dstVid) {
|
||||
@@ -141,7 +143,8 @@ export default {
|
||||
let _infoList = [];
|
||||
Reflect.ownKeys(properties).forEach(key => {
|
||||
_infoList.push({
|
||||
comment: map[key],
|
||||
// comment: map[key],
|
||||
comment: key,
|
||||
field: key,
|
||||
value: properties[key]
|
||||
});
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
<!-- <el-table-column prop="comment" label="描述"></el-table-column>-->
|
||||
<el-table-column prop="type" label="类型"></el-table-column>
|
||||
<el-table-column label="删除" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click.native.prevent="removeField(scope.row,scope.$index)" type="text" size="small">
|
||||
<template slot-scope="scope" >
|
||||
<el-button @click.native.prevent="removeField(scope.row,scope.$index)" type="text" size="small" v-show="scope.row.type">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -71,7 +71,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="删除" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click.native.prevent="removeRelation(scope.row,scope.$index)" type="text" size="small">
|
||||
<el-button @click.native.prevent="removeRelation(scope.row,scope.$index)" type="text" size="small" v-show="scope.row.label && scope.row.dstId">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
@@ -107,6 +107,11 @@ export default {
|
||||
|
||||
},
|
||||
methods: {
|
||||
handleCommentFormatter(row) {
|
||||
// for(let i in ) {
|
||||
//
|
||||
// }
|
||||
},
|
||||
updateValue(space, name) {
|
||||
vm.space = space;
|
||||
vm.modifyCmd.name = name;
|
||||
|
||||
@@ -258,7 +258,7 @@ var _ = require('lodash');
|
||||
var nodeProps = {
|
||||
id: 'vid',
|
||||
label: 'properties.label',
|
||||
name: 'properties.tagName',
|
||||
name: 'vid',
|
||||
labelName: 'properties.label'
|
||||
};
|
||||
var edgeProps = {
|
||||
@@ -873,6 +873,7 @@ function resolveGraphData(data) {
|
||||
Reflect.ownKeys(nodeProps).forEach(key => {
|
||||
node[key] = _.get(node, nodeProps[key], '');
|
||||
});
|
||||
console.log(node);
|
||||
});
|
||||
data.relations.forEach(edge => {
|
||||
Reflect.ownKeys(edgeProps).forEach(key => {
|
||||
|
||||
@@ -5,22 +5,22 @@
|
||||
<div class="graph-info-child">
|
||||
<div class="info-item" style="margin-bottom: 15px">
|
||||
<div class="info-item-title">
|
||||
<label>{{comment}}</label>
|
||||
<label>{{ comment }}</label>
|
||||
<!--<div class="add-attribute-box" style="float: right" @click="showAddGraphSpaceDialog({Name:''})">新建-->
|
||||
<!--</div>-->
|
||||
<!--<div class="add-attribute-box" style="float: right;margin-right: 10px" @click="removeGraphSpace()">-->
|
||||
<!--删除-->
|
||||
<!--删除-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
<div class="info-item-content">
|
||||
<!--<el-select v-model="space" filterable placeholder="请选择" @change="handleSpaceChange">-->
|
||||
<!--<el-option v-for="item in spaceList"-->
|
||||
<!--:key="item.name"-->
|
||||
<!--:label="item.comment"-->
|
||||
<!--:value="item.name">-->
|
||||
<!--</el-option>-->
|
||||
<!--<el-option v-for="item in spaceList"-->
|
||||
<!--:key="item.name"-->
|
||||
<!--:label="item.comment"-->
|
||||
<!--:value="item.name">-->
|
||||
<!--</el-option>-->
|
||||
<!--</el-select>-->
|
||||
<div style="margin-top: 20px;font-size: 14px;color: #606266">本体名称:{{ontologyName}}</div>
|
||||
<div style="margin-top: 20px;font-size: 14px;color: #606266">本体名称:{{ ontologyName }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-tabs v-model="activeTab" class="el-tabs-item">
|
||||
@@ -36,7 +36,7 @@
|
||||
<template slot-scope="scope">
|
||||
<div :style="scope.row.Name === activeSelectType ? 'color: #409EFF':''">
|
||||
<label>{{ scope.row.comment }}</label>
|
||||
<label>({{ scope.row.count }})</label>
|
||||
<!-- <label>({{ scope.row.count }})</label>-->
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -55,7 +55,7 @@
|
||||
<template slot-scope="scope">
|
||||
<div :style="scope.row.Name === activeSelectType ? 'color: #409EFF':''">
|
||||
<label>{{ scope.row.comment }}</label>
|
||||
<label>({{ scope.row.count }})</label>
|
||||
<!-- <label>({{ scope.row.count }})</label>-->
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -79,6 +79,9 @@
|
||||
<div v-show="tabModifyCmdType === 'nodeDetail'">
|
||||
<node-detail ref="nodeDetail"></node-detail>
|
||||
</div>
|
||||
<div v-show="tabModifyCmdType === 'edgeDetail'">
|
||||
<edge-detail ref="edgeDetail"></edge-detail>
|
||||
</div>
|
||||
<div v-show="tabModifyCmdType === 'edgeAdd'">
|
||||
<edge-add ref="edgeAdd"></edge-add>
|
||||
</div>
|
||||
@@ -92,7 +95,8 @@
|
||||
<div v-if="showFlag" style="display: inline-block;margin-right: 50px">
|
||||
<el-input placeholder="请输入关键词" v-model="keyword" style="width: 550px">
|
||||
<el-select v-model="searchTag" slot="prepend" placeholder="请选择概念" style="width: 150px" filterable>
|
||||
<el-option :label="item.comment" :value="item.Name" v-for="(item,index) in tagList" v-if="index != 0"></el-option>
|
||||
<el-option :label="item.comment" :value="item.Name" v-for="(item,index) in tagList"
|
||||
v-if="index != 0"></el-option>
|
||||
</el-select>
|
||||
<el-button slot="append" icon="el-icon-search" @click="searchBtn()"></el-button>
|
||||
</el-input>
|
||||
@@ -111,8 +115,8 @@
|
||||
<i title="返回"></i>
|
||||
</div>
|
||||
<!--<div title="按住shift点选两节点可新增关系" :class="['icon icon-arrow', createEdgeModelFlag ? 'active' : '']"-->
|
||||
<!--@click="changeCreateEdgeModel">-->
|
||||
<!--<i title="按住shift点选两节点可新增关系"></i>-->
|
||||
<!--@click="changeCreateEdgeModel">-->
|
||||
<!--<i title="按住shift点选两节点可新增关系"></i>-->
|
||||
<!--</div>-->
|
||||
<!-- <div class="icon icon-remove" @click="removeNode">-->
|
||||
<!-- <i title="删除"></i>-->
|
||||
@@ -212,7 +216,7 @@ export default {
|
||||
'node-detail': nodeDetail,
|
||||
'edge-detail': edgeDetail,
|
||||
'graph-space-add': graphSpaceAdd,
|
||||
'edge-add':edgeAdd
|
||||
'edge-add': edgeAdd
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -233,15 +237,15 @@ export default {
|
||||
},
|
||||
tagMap: {},
|
||||
edgeMap: {},
|
||||
ontologyName:"",
|
||||
showFlag:false,
|
||||
keyword:"",
|
||||
searchTag:"",
|
||||
ontologyId:"",
|
||||
comment:"",
|
||||
qo:{
|
||||
pageNo:"",
|
||||
name:""
|
||||
ontologyName: "",
|
||||
showFlag: false,
|
||||
keyword: "",
|
||||
searchTag: "",
|
||||
ontologyId: "",
|
||||
comment: "",
|
||||
qo: {
|
||||
pageNo: "",
|
||||
name: ""
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -249,15 +253,15 @@ export default {
|
||||
vm = this;
|
||||
},
|
||||
mounted() {
|
||||
vm.qo = {
|
||||
pageNo: this.$route.query.pageNo,
|
||||
name: this.$route.query.name
|
||||
};
|
||||
vm.ontologyId = this.$route.query.ontologyId;
|
||||
vm.space = this.$route.query.space;
|
||||
vm.comment = this.$route.query.comment;
|
||||
vm.handleSpaceChange();
|
||||
// vm.querySpaceList();
|
||||
vm.qo = {
|
||||
pageNo: this.$route.query.pageNo,
|
||||
name: this.$route.query.name
|
||||
};
|
||||
vm.ontologyId = this.$route.query.ontologyId;
|
||||
vm.space = this.$route.query.space;
|
||||
vm.comment = this.$route.query.comment;
|
||||
vm.handleSpaceChange();
|
||||
// vm.querySpaceList();
|
||||
// vm.initGraph();
|
||||
},
|
||||
methods: {
|
||||
@@ -271,34 +275,34 @@ export default {
|
||||
if (res.data.length > 0) {
|
||||
vm.space = res.data[0].name;
|
||||
vm.handleSpaceChange();
|
||||
}else{
|
||||
vm.space = "";
|
||||
vm.tagMap = {};
|
||||
vm.edgeMap = {};
|
||||
vm.tagList = [];
|
||||
vm.edgeList = [];
|
||||
vm.ontologyName = "";
|
||||
vm.destroyGraph();
|
||||
} else {
|
||||
vm.space = "";
|
||||
vm.tagMap = {};
|
||||
vm.edgeMap = {};
|
||||
vm.tagList = [];
|
||||
vm.edgeList = [];
|
||||
vm.ontologyName = "";
|
||||
vm.destroyGraph();
|
||||
}
|
||||
});
|
||||
},
|
||||
queryOntologyDetail(){
|
||||
var id = vm.ontologyId;
|
||||
// vm.spaceList.forEach(item => {
|
||||
// if(item.name == vm.space){
|
||||
// id = item.OntologyId;
|
||||
// }
|
||||
// })
|
||||
queryOntologyDetail() {
|
||||
var id = vm.ontologyId;
|
||||
// vm.spaceList.forEach(item => {
|
||||
// if(item.name == vm.space){
|
||||
// id = item.OntologyId;
|
||||
// }
|
||||
// })
|
||||
|
||||
if(id){
|
||||
request({
|
||||
url: `/ontology/getone/`+id,
|
||||
method: 'post',
|
||||
data: {id:id}
|
||||
}).then(res => {
|
||||
vm.ontologyName = res.data.name;
|
||||
})
|
||||
}
|
||||
if (id) {
|
||||
request({
|
||||
url: `/ontology/getone/` + id,
|
||||
method: 'post',
|
||||
data: {id: id}
|
||||
}).then(res => {
|
||||
vm.ontologyName = res.data.name;
|
||||
})
|
||||
}
|
||||
},
|
||||
handleSpaceChange() {
|
||||
vm.initGraph();
|
||||
@@ -342,10 +346,10 @@ export default {
|
||||
method: 'get',
|
||||
data: {}
|
||||
}).then(res => {
|
||||
res.data.unshift({
|
||||
Name: `All`,
|
||||
comment: '实体数'
|
||||
});
|
||||
// res.data.unshift({
|
||||
// Name: `All`,
|
||||
// comment: '实体数'
|
||||
// });
|
||||
res.data.forEach(row => {
|
||||
row.count = vm.tagMap[row.Name] ? vm.tagMap[row.Name] : 0;
|
||||
});
|
||||
@@ -359,10 +363,10 @@ export default {
|
||||
method: 'get',
|
||||
data: {}
|
||||
}).then(res => {
|
||||
res.data.unshift({
|
||||
Name: `All`,
|
||||
comment: '三元组数'
|
||||
});
|
||||
// res.data.unshift({
|
||||
// Name: `All`,
|
||||
// comment: '三元组数'
|
||||
// });
|
||||
res.data.forEach(row => {
|
||||
row.count = vm.edgeMap[row.Name] ? vm.edgeMap[row.Name] : 0;
|
||||
});
|
||||
@@ -405,6 +409,7 @@ export default {
|
||||
queryDetail(type, obj) { // type : node/edge
|
||||
vm.tabModifyCmdType = type + 'Detail';
|
||||
vm.propsInfoVisible = true;
|
||||
console.log(type);
|
||||
vm.$nextTick(() => {
|
||||
vm.$refs[type + 'Detail'].queryDetail(vm.space, obj);
|
||||
});
|
||||
@@ -478,8 +483,17 @@ export default {
|
||||
});
|
||||
|
||||
if (node.properties) {
|
||||
node.label = node.name = getFirstStringProperty(node.properties);
|
||||
// node.label = node.name = getFirstStringProperty(node.properties);
|
||||
node.label = node.name = node.vid;
|
||||
}
|
||||
|
||||
if(node.labels === 'tag_1412011336') {
|
||||
node.style = {
|
||||
fill: '#3cec6c'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -603,90 +617,90 @@ export default {
|
||||
vm.$refs['nodeDetail'].createItem(vm.space);
|
||||
});
|
||||
},
|
||||
showAddEdgeDialog(){
|
||||
vm.tabModifyCmdType = 'edgeAdd';
|
||||
vm.propsInfoVisible = true;
|
||||
vm.$nextTick(() => {
|
||||
vm.$refs['edgeAdd'].createItem(vm.space);
|
||||
});
|
||||
showAddEdgeDialog() {
|
||||
vm.tabModifyCmdType = 'edgeAdd';
|
||||
vm.propsInfoVisible = true;
|
||||
vm.$nextTick(() => {
|
||||
vm.$refs['edgeAdd'].createItem(vm.space);
|
||||
});
|
||||
},
|
||||
//搜索
|
||||
searchBtn(){
|
||||
if(!vm.searchTag){
|
||||
vm.$message.warning("请选择概念");
|
||||
return false;
|
||||
}
|
||||
if(!vm.keyword){
|
||||
vm.$message.warning("请输入关键字");
|
||||
return false;
|
||||
}
|
||||
vm.graphLoading = true;
|
||||
request({
|
||||
url: `/nebula_operate/findnodebykeyword/${vm.space}/${vm.searchTag}`,
|
||||
method: 'post',
|
||||
data: {keyword:vm.keyword}
|
||||
}).then(res => {
|
||||
if (res.data) {
|
||||
res.data.forEach(node => {
|
||||
Reflect.ownKeys(nodeProps).forEach(key => {
|
||||
node[key] = _.get(node, nodeProps[key], '');
|
||||
});
|
||||
searchBtn() {
|
||||
if (!vm.searchTag) {
|
||||
vm.$message.warning("请选择概念");
|
||||
return false;
|
||||
}
|
||||
if (!vm.keyword) {
|
||||
vm.$message.warning("请输入关键字");
|
||||
return false;
|
||||
}
|
||||
vm.graphLoading = true;
|
||||
request({
|
||||
url: `/nebula_operate/findnodebykeyword/${vm.space}/${vm.searchTag}`,
|
||||
method: 'post',
|
||||
data: {keyword: vm.keyword}
|
||||
}).then(res => {
|
||||
if (res.data) {
|
||||
res.data.forEach(node => {
|
||||
Reflect.ownKeys(nodeProps).forEach(key => {
|
||||
node[key] = _.get(node, nodeProps[key], '');
|
||||
});
|
||||
|
||||
if (node.properties) {
|
||||
node.label = node.name = getFirstStringProperty(node.properties);
|
||||
}
|
||||
});
|
||||
if (node.properties) {
|
||||
node.label = node.name = getFirstStringProperty(node.properties);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
graphData = {
|
||||
nodes: res.data ? res.data : [],
|
||||
edges: []
|
||||
};
|
||||
// 读取数据
|
||||
graph.data(graphData);
|
||||
// 渲染图
|
||||
graph.render();
|
||||
vm.graphLoading = false;
|
||||
});
|
||||
graphData = {
|
||||
nodes: res.data ? res.data : [],
|
||||
edges: []
|
||||
};
|
||||
// 读取数据
|
||||
graph.data(graphData);
|
||||
// 渲染图
|
||||
graph.render();
|
||||
vm.graphLoading = false;
|
||||
});
|
||||
},
|
||||
findOnePathBySrcidAndDctid(srcId, dstId){
|
||||
request({
|
||||
url: `/nebula_operate/findonepathbysrcidanddctid/${vm.space}/${srcId}/${dstId}`,
|
||||
method: 'get',
|
||||
data: {}
|
||||
}).then(res => {
|
||||
vm.resolveGraphData(res);
|
||||
});
|
||||
findOnePathBySrcidAndDctid(srcId, dstId) {
|
||||
request({
|
||||
url: `/nebula_operate/findonepathbysrcidanddctid/${vm.space}/${srcId}/${dstId}`,
|
||||
method: 'get',
|
||||
data: {}
|
||||
}).then(res => {
|
||||
vm.resolveGraphData(res);
|
||||
});
|
||||
},
|
||||
findNodeById(tag,vid){
|
||||
request({
|
||||
url: `/nebula_operate/findnodebyid/${vm.space}/${tag}/${vid}`,
|
||||
method: 'get',
|
||||
data: {}
|
||||
}).then(res => {
|
||||
if (res.data) {
|
||||
Reflect.ownKeys(nodeProps).forEach(key => {
|
||||
res.data[key] = _.get(res.data, nodeProps[key], '');
|
||||
});
|
||||
findNodeById(tag, vid) {
|
||||
request({
|
||||
url: `/nebula_operate/findnodebyid/${vm.space}/${tag}/${vid}`,
|
||||
method: 'get',
|
||||
data: {}
|
||||
}).then(res => {
|
||||
if (res.data) {
|
||||
Reflect.ownKeys(nodeProps).forEach(key => {
|
||||
res.data[key] = _.get(res.data, nodeProps[key], '');
|
||||
});
|
||||
|
||||
if (res.data.properties) {
|
||||
res.data.label = res.data.name = getFirstStringProperty(res.data.properties);
|
||||
}
|
||||
}
|
||||
if (res.data.properties) {
|
||||
res.data.label = res.data.name = getFirstStringProperty(res.data.properties);
|
||||
}
|
||||
}
|
||||
|
||||
graphData = {
|
||||
nodes: res.data ? [res.data] : [],
|
||||
edges: []
|
||||
};
|
||||
// 读取数据
|
||||
graph.data(graphData);
|
||||
// 渲染图
|
||||
graph.render();
|
||||
vm.graphLoading = false;
|
||||
});
|
||||
graphData = {
|
||||
nodes: res.data ? [res.data] : [],
|
||||
edges: []
|
||||
};
|
||||
// 读取数据
|
||||
graph.data(graphData);
|
||||
// 渲染图
|
||||
graph.render();
|
||||
vm.graphLoading = false;
|
||||
});
|
||||
},
|
||||
backGraph() { // 返回
|
||||
vm.$router.push({path: "/graphSpaceManage", query: {pageNo: vm.qo.pageNo, name: vm.qo.name}})
|
||||
vm.$router.push({path: "/graphSpaceManage", query: {pageNo: vm.qo.pageNo, name: vm.qo.name}})
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -777,7 +791,7 @@ function refreshDragedNodePosition(e) {
|
||||
}
|
||||
|
||||
.graph-info-box {
|
||||
left: 0;
|
||||
left: 20px;
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
|
||||
387
web/src/components/menus/EntrysManage.vue
Normal file
@@ -0,0 +1,387 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="menu-title">
|
||||
物类管理
|
||||
</div>
|
||||
<div class="menu-content">
|
||||
<div>
|
||||
<el-form :inline="true" :model="qo" class="demo-form-inline">
|
||||
<el-form-item label="唯一标识:">
|
||||
<el-input v-model="qo.LIKES_fid" placeholder="请输入唯一标识" clearable style="width: 300px"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="种类:">-->
|
||||
<!-- <el-input v-model="qo.LIKES_categories" placeholder="请输入种类" clearable style="width: 300px"></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="标签:">-->
|
||||
<!-- <el-input v-model="qo.LIKES_labels" placeholder="请输入标签" clearable style="width: 300px"></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="queryDataById()">搜 索</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="queryData(-1)">上一页</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="queryData(1)">下一页</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div style="margin: 0px 0 20px 0">
|
||||
<!-- <el-button type="primary" @click="createRow()" icon="el-icon-plus">添 加</el-button>-->
|
||||
<el-button type="primary" @click="downloadItem()" icon="el-icon-download">导出物类</el-button>
|
||||
<el-button type="primary" @click="showImportItemPage()" icon="el-icon-upload2">导入物类</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-table :data="result.records" style="width: 100%" v-loading="loading">
|
||||
<el-table-column type="index" label="行号" width="60"></el-table-column>
|
||||
<el-table-column prop="ItemId" label="唯一标识"></el-table-column>
|
||||
<el-table-column prop="Categories" label="种类">
|
||||
<div slot-scope="scope">
|
||||
<template v-if="scope.row.Categories">
|
||||
<template v-for="(tag,index) in scope.row.Categories">
|
||||
<el-tag :key="index" v-if="index < 5">{{ tag }}</el-tag>
|
||||
</template>
|
||||
<el-tag v-if="scope.row.Categories.length > 10">...</el-tag>
|
||||
</template>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column prop="Labels" label="标签">
|
||||
<div slot-scope="scope">
|
||||
<template v-if="scope.row.Labels">
|
||||
<template v-for="(tag,index) in scope.row.Labels">
|
||||
<el-tag :key="index" v-if="index < 5">{{ tag }}</el-tag>
|
||||
</template>
|
||||
<el-tag v-if="scope.row.Labels.length > 5">...</el-tag>
|
||||
</template>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column prop="IsHidden" label="是否隐藏" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.IsHidden ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="description" label="描述">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.Comment.substring(0, 100) }}{{ scope.row.Comment.length > 100 ? '...' : '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="Timestamp" label="创建时间" width="180"></el-table-column>
|
||||
<el-table-column label="操作" width="120">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button @click.native.prevent="modifyRow(scope.row)" type="text" size="small">-->
|
||||
<!-- 编辑-->
|
||||
<!-- </el-button>-->
|
||||
<el-button @click.native.prevent="similarItem(scope.row)" type="text" size="small">
|
||||
相似条目
|
||||
</el-button>
|
||||
<el-button @click.native.prevent="removeRow(scope.row)" type="text" size="small">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- <div class="page-box">-->
|
||||
<!-- <el-pagination background-->
|
||||
<!-- @current-change="handleCurrentChange"-->
|
||||
<!-- :current-page="qo.pageNo"-->
|
||||
<!-- :page-size="qo.pageSize"-->
|
||||
<!-- layout="total, prev, pager, next"-->
|
||||
<!-- :total="result.total">-->
|
||||
<!-- </el-pagination>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
<el-dialog
|
||||
:title="dialogName"
|
||||
:visible.sync="cmdDialogVisible"
|
||||
width="40%">
|
||||
<el-form ref="cmd" label-width="100px" :rules="rules" :model="cmd">
|
||||
<el-form-item label="fid" prop="fid">
|
||||
<el-input v-model="cmd.fid" placeholder="请输入fid"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="种类">
|
||||
<el-tag
|
||||
:key="tag"
|
||||
v-for="(tag,index) in cmd.categoriesArr"
|
||||
closable
|
||||
:disable-transitions="false"
|
||||
@close="handleTagClose(index, 'categories')">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<el-input
|
||||
class="input-new-tag"
|
||||
v-if="categoriesInputVisible"
|
||||
v-model="categoriesInputValue"
|
||||
ref="saveCategoriesTagInput"
|
||||
size="small"
|
||||
@keyup.enter.native="handleInputConfirm('categories')"
|
||||
@blur="handleInputConfirm('categories')"
|
||||
>
|
||||
</el-input>
|
||||
<el-button v-else class="button-new-tag" size="small" @click="showInput('categories')">+ 种 类</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签">
|
||||
<el-tag
|
||||
:key="tag"
|
||||
v-for="(tag,index) in cmd.labelsArr"
|
||||
closable
|
||||
:disable-transitions="false"
|
||||
@close="handleTagClose(index, 'labels')">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<el-input
|
||||
class="input-new-tag"
|
||||
v-if="labelsInputVisible"
|
||||
v-model="labelsInputValue"
|
||||
ref="saveLabelsTagInput"
|
||||
size="small"
|
||||
@keyup.enter.native="handleInputConfirm('labels')"
|
||||
@blur="handleInputConfirm('labels')"
|
||||
>
|
||||
</el-input>
|
||||
<el-button v-else class="button-new-tag" size="small" @click="showInput('labels')">+ 标 签</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否隐藏" prop="isHidden">
|
||||
<el-radio v-model="cmd.isHidden" :label="true">是</el-radio>
|
||||
<el-radio v-model="cmd.isHidden" :label="false">否</el-radio>
|
||||
</el-form-item>
|
||||
<el-form-item label="描述">
|
||||
<el-input v-model="cmd.description" placeholder="请输入描述" type="textarea" :rows="5"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="cmdDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitModify">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request, {getBaseUrl} from '@/utils/request';
|
||||
|
||||
var _this;
|
||||
export default {
|
||||
name: "entrys",
|
||||
data() {
|
||||
return {
|
||||
qo: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
LIKES_fid: '',
|
||||
LIKES_categories: '',
|
||||
LIKES_labels: '',
|
||||
},
|
||||
result: {
|
||||
records: [],
|
||||
total: 0
|
||||
},
|
||||
loading: false,
|
||||
cursorArr: [''],
|
||||
sourceTypeList: [
|
||||
{name: '自定义本体', value: 1},
|
||||
{name: '标注系统', value: 2}
|
||||
],
|
||||
dialogName: '编辑',
|
||||
cmdDialogVisible: false,
|
||||
cmd: {},
|
||||
rules: {
|
||||
fid: [
|
||||
{required: true, message: '请输入fid'}
|
||||
],
|
||||
isHidden: [
|
||||
{required: true, message: '请选择是否隐藏'}
|
||||
],
|
||||
},
|
||||
categoriesInputValue: '',
|
||||
categoriesInputVisible: false,
|
||||
labelsInputValue: '',
|
||||
labelsInputVisible: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
_this = this;
|
||||
let _qo = _this.$route.query.qo;
|
||||
if (_qo) {
|
||||
_this.qo = JSON.parse(_qo);
|
||||
}
|
||||
_this.queryData(0);
|
||||
},
|
||||
methods: {
|
||||
queryDataById() {
|
||||
if (this.qo.LIKES_fid.length > 0) {
|
||||
this.loading = true;
|
||||
request({
|
||||
url: '/gorse/query_item/' + this.qo.LIKES_fid,
|
||||
method: 'get',
|
||||
}).then(res => {
|
||||
let item = res.data;
|
||||
if (!item) {
|
||||
_this.result.records = [];
|
||||
} else {
|
||||
_this.result.records = [item];
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
this.cursorArr = [''];
|
||||
this.queryData(1);
|
||||
}
|
||||
},
|
||||
queryData(index) {// index -1 上一页,0刷新, 1下一页
|
||||
this.loading = true;
|
||||
this.cursorArr = this.cursorArr.slice(0, this.cursorArr.length - 1 + index);
|
||||
this.cursorArr = this.cursorArr.length === 0 ? [''] : this.cursorArr;
|
||||
request({
|
||||
url: '/gorse/query_items?cursor=' + this.cursorArr[this.cursorArr.length - 1],
|
||||
method: 'get',
|
||||
}).then(res => {
|
||||
this.cursorArr.push(res.data.Cursor);
|
||||
_this.result.records = res.data.Items;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
_this.qo.pageNo = val;
|
||||
_this.queryData();
|
||||
},
|
||||
downloadItem() {
|
||||
window.open(getBaseUrl() + '/bulk/get_bulk/items');
|
||||
},
|
||||
similarItem(item) {
|
||||
_this.$router.push({
|
||||
path: "similarItem", query: {
|
||||
itemId: item.ItemId,
|
||||
qo: JSON.stringify(_this.qo)
|
||||
}
|
||||
});
|
||||
},
|
||||
showImportItemPage() {
|
||||
_this.$router.push({
|
||||
path: "importItem"
|
||||
});
|
||||
},
|
||||
removeRow(item) {
|
||||
_this.$confirm('此操作将永久删除记录, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: '/gorse/delete_item/' + item.ItemId,
|
||||
method: 'post'
|
||||
}).then(res => {
|
||||
_this.$message.success("删除成功");
|
||||
_this.queryData(0);
|
||||
});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
createRow() {
|
||||
_this.dialogName = '新建';
|
||||
_this.cmdDialogVisible = true;
|
||||
_this.$nextTick(_ => {
|
||||
_this.$refs['cmd'].clearValidate();
|
||||
_this.cmd = {
|
||||
fid: '',
|
||||
isHidden: false,
|
||||
categoriesArr: [],
|
||||
labelsArr: [],
|
||||
description: ''
|
||||
};
|
||||
})
|
||||
},
|
||||
modifyRow(item) {
|
||||
_this.dialogName = '编辑';
|
||||
_this.cmdDialogVisible = true;
|
||||
_this.$nextTick(_ => {
|
||||
_this.$refs['cmd'].clearValidate();
|
||||
_this.cmd = JSON.parse(JSON.stringify(item));
|
||||
})
|
||||
},
|
||||
submitModify() {
|
||||
this.$refs.cmd.validate((valid) => {
|
||||
if (valid) {
|
||||
if (_this.cmd.categoriesArr) {
|
||||
_this.cmd.categories = _this.cmd.categoriesArr.toString();
|
||||
}
|
||||
if (_this.cmd.labelsArr) {
|
||||
_this.cmd.labels = _this.cmd.labelsArr.toString();
|
||||
}
|
||||
|
||||
if (_this.cmd.id) {
|
||||
request({
|
||||
url: '/entrys/modify',
|
||||
method: 'post',
|
||||
data: _this.cmd
|
||||
}).then(res => {
|
||||
_this.$message.success("编辑成功");
|
||||
_this.queryData();
|
||||
_this.cmdDialogVisible = false;
|
||||
});
|
||||
} else { // 新建
|
||||
request({
|
||||
url: '/entrys/create',
|
||||
method: 'post',
|
||||
data: _this.cmd
|
||||
}).then(res => {
|
||||
_this.$message.success("添加成功");
|
||||
_this.cmdDialogVisible = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
showInput(typeName) {
|
||||
if (typeName === 'categories') {
|
||||
this.categoriesInputVisible = true;
|
||||
this.$nextTick(_ => {
|
||||
this.$refs.saveCategoriesTagInput.$refs.input.focus();
|
||||
});
|
||||
} else if (typeName === 'labels') {
|
||||
this.labelsInputVisible = true;
|
||||
this.$nextTick(_ => {
|
||||
this.$refs.saveLabelsTagInput.$refs.input.focus();
|
||||
});
|
||||
}
|
||||
},
|
||||
handleTagClose(index, typeName) {
|
||||
_this.cmd[typeName + "Arr"].splice(index, 1);
|
||||
},
|
||||
handleInputConfirm(typeName) {
|
||||
let inputValue = _this[typeName + "InputValue"];
|
||||
if (inputValue) {
|
||||
_this.cmd[typeName + "Arr"].push(inputValue);
|
||||
}
|
||||
_this[typeName + "InputVisible"] = false;
|
||||
_this[typeName + "InputValue"] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.input-new-tag {
|
||||
margin-bottom: 12px;
|
||||
height: 32px;
|
||||
width: 80px;
|
||||
|
||||
input {
|
||||
height: 32px !important;
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.button-new-tag {
|
||||
line-height: 30px;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
|
||||
}
|
||||
</style>
|
||||
214
web/src/components/menus/FeedbackType.vue
Normal file
@@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="menu-title">
|
||||
反馈类型
|
||||
</div>
|
||||
<div class="menu-content">
|
||||
<div>
|
||||
<el-form :inline="true" :model="qo" class="demo-form-inline">
|
||||
<el-form-item label="名称:">
|
||||
<el-input v-model="qo.LIKES_name" placeholder="请输入名称" clearable style="width: 300px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="qo.pageNo=1;queryData()">搜 索</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div style="margin: 0px 0 20px 0">
|
||||
<el-button type="primary" @click="downloadFeedback()" icon="el-icon-download">导出反馈</el-button>
|
||||
<el-button type="primary" @click="showImportFeedbackPage()" icon="el-icon-upload2">导入反馈</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-table :data="result.records" style="width: 100%">
|
||||
<el-table-column type="index" label="行号" width="60"></el-table-column>
|
||||
<el-table-column prop="name" label="名称"></el-table-column>
|
||||
<el-table-column prop="type" label="性质" :formatter="typeFormatter"></el-table-column>
|
||||
<!-- <el-table-column label="操作" width="100">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-button @click.native.prevent="modifyRow(scope.row)" type="text" size="small">-->
|
||||
<!-- 编辑-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button @click.native.prevent="removeRow(scope.row)" type="text" size="small">-->
|
||||
<!-- 删除-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="page-box">
|
||||
<el-pagination background
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="qo.pageNo"
|
||||
:page-size="qo.pageSize"
|
||||
layout="total, prev, pager, next"
|
||||
:total="result.total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog
|
||||
:title="dialogName"
|
||||
:visible.sync="cmdDialogVisible"
|
||||
width="40%">
|
||||
<el-form ref="cmd" label-width="80px" :rules="rules" :model="cmd">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="cmd.name" placeholder="请输入名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="cmdDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitModify">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request, {getBaseUrl} from '@/utils/request';
|
||||
|
||||
var _this;
|
||||
export default {
|
||||
name: "feedbackType",
|
||||
data() {
|
||||
return {
|
||||
qo: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
LIKES_name: '',
|
||||
},
|
||||
result: {
|
||||
records: [],
|
||||
total: 0
|
||||
},
|
||||
typeMap: {
|
||||
read: '已读反馈',
|
||||
positive: '正向反馈'
|
||||
},
|
||||
dialogName: '编辑',
|
||||
cmdDialogVisible: false,
|
||||
cmd: {},
|
||||
rules: {
|
||||
name: [
|
||||
{required: true, message: '请输入名称'}
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
_this = this;
|
||||
_this.queryData();
|
||||
},
|
||||
methods: {
|
||||
queryData() {
|
||||
request({
|
||||
url: '/feedback-type/query_pages',
|
||||
method: 'post',
|
||||
data: _this.qo
|
||||
}).then(res => {
|
||||
_this.result.records = res.data.records;
|
||||
_this.result.total = res.data.total;
|
||||
});
|
||||
},
|
||||
typeFormatter(row) {
|
||||
return this.typeMap[row.type] || "";
|
||||
},
|
||||
showImportFeedbackPage() {
|
||||
_this.$router.push({
|
||||
path: "importFeedback"
|
||||
});
|
||||
},
|
||||
downloadFeedback() {
|
||||
window.open(getBaseUrl() + '/bulk/get_bulk/feedback');
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
_this.qo.pageNo = val;
|
||||
_this.queryData();
|
||||
},
|
||||
removeRow(item) {
|
||||
_this.$confirm('此操作将永久删除记录, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: '/feedback-type/remove/' + item.id,
|
||||
method: 'post'
|
||||
}).then(res => {
|
||||
_this.$message.success("删除成功");
|
||||
_this.queryData();
|
||||
});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
createRow() {
|
||||
_this.dialogName = '新建';
|
||||
_this.cmdDialogVisible = true;
|
||||
_this.$nextTick(_=> {
|
||||
_this.$refs['cmd'].clearValidate();
|
||||
_this.cmd = {
|
||||
name: '',
|
||||
};
|
||||
})
|
||||
},
|
||||
modifyRow(item) {
|
||||
_this.dialogName = '编辑';
|
||||
_this.cmdDialogVisible = true;
|
||||
_this.$nextTick(_=> {
|
||||
_this.$refs['cmd'].clearValidate();
|
||||
_this.cmd = JSON.parse(JSON.stringify(item));
|
||||
})
|
||||
},
|
||||
submitModify() {
|
||||
this.$refs.cmd.validate((valid) => {
|
||||
if (valid) {
|
||||
if (_this.cmd.id) {
|
||||
request({
|
||||
url: '/feedback-type/modify',
|
||||
method: 'post',
|
||||
data: _this.cmd
|
||||
}).then(res => {
|
||||
_this.$message.success("编辑成功");
|
||||
_this.queryData();
|
||||
_this.cmdDialogVisible = false;
|
||||
});
|
||||
} else { // 新建
|
||||
request({
|
||||
url: '/feedback-type/create',
|
||||
method: 'post',
|
||||
data: _this.cmd
|
||||
}).then(res => {
|
||||
_this.$message.success("添加成功");
|
||||
_this.cmdDialogVisible = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.input-new-tag {
|
||||
margin-bottom: 12px;
|
||||
height: 32px;
|
||||
width: 80px;
|
||||
|
||||
input {
|
||||
height: 32px !important;
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
.el-tag {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.button-new-tag {
|
||||
line-height: 30px;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="menu-title">
|
||||
知识图谱导入
|
||||
图谱导入
|
||||
</div>
|
||||
<div class="menu-content">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
@@ -26,15 +26,15 @@
|
||||
:on-change="handleFileChange"
|
||||
:limit="2"
|
||||
:show-file-list="false">
|
||||
<el-button type="primary">上传文件</el-button>
|
||||
<el-button type="primary" icon="el-icon-upload2">上传文件</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button type="primary" style="float:right;" @click="queryData" :loading="btLoading">执行</el-button>
|
||||
<el-button type="primary" style="float:right;" @click="queryData" :loading="btLoading" icon="el-icon-check">执行</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div><a :href="path+'武器装备-本体模型.xlsx'" download="武器装备-本体模型.xlsx" style="text-decoration:underline;color: #0D6DFF">下载模板</a></div>
|
||||
<div><a :href="path+'template.xlsx'" download="template.xlsx" style="text-decoration:underline;color: #0D6DFF">下载模板</a></div>
|
||||
<div class="result" style="width: 100%;margin-top: 20px;color: #5c5c5c;" v-if="showFlag && activeName == 'first'">成功导入</div>
|
||||
<div style="margin-top: 20px;height:20px;border: 1px solid rgba(0, 0, 0, 0.1);padding: 20px" v-if="showFlag && activeName == 'first'">
|
||||
<el-descriptions title="" :column="3" >
|
||||
@@ -58,7 +58,7 @@
|
||||
<el-col :span="10">
|
||||
<div >
|
||||
<label>请选择文件:</label>
|
||||
<el-input v-model="fileName" readonly style="margin-right: 20px;width: calc(100% - 204px)" disabled></el-input>
|
||||
<el-input v-model="fileName" readonly style="margin-right: 20px;width: calc(100% - 254px)" disabled></el-input>
|
||||
<el-upload
|
||||
ref="upload" style="display: inline-block"
|
||||
:auto-upload="false"
|
||||
@@ -66,19 +66,19 @@
|
||||
:on-change="handleFileChange"
|
||||
:limit="2"
|
||||
:show-file-list="false">
|
||||
<el-button type="primary">上传文件</el-button>
|
||||
<el-button type="primary" icon="el-icon-upload2">上传文件</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
<div style="color: red;margin-top: 10px">* zip文件必须包含vertex.json、edge.json</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button type="primary" style="float:right;" @click="startSpace">执行</el-button>
|
||||
<el-button type="primary" style="float:right;" @click="startSpace" icon="el-icon-check">执行</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div><a :href="path+'图谱数据.zip'" download="图谱数据.zip" style="text-decoration:underline;color: #0D6DFF">下载模板</a></div>
|
||||
<div class="result" style="width: 100%;margin-top: 20px;color: #5c5c5c;" v-if="showFlag && activeName == 'second'">{{message}}</div>
|
||||
<div style="margin-top: 20px;" v-if="showFlag && activeName == 'second'">
|
||||
<el-table :data="resultCmd1" border style="width: 100%" >
|
||||
<el-table :data="resultCmd1" border style="width: 100%" >
|
||||
<el-table-column prop="title" label="标题"></el-table-column>
|
||||
<el-table-column prop="gf_name" label="文件名"></el-table-column>
|
||||
<el-table-column prop="flag" label="状态">
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="menu-title">
|
||||
知识图谱本体管理
|
||||
本体管理
|
||||
</div>
|
||||
<div class="menu-content">
|
||||
<div>
|
||||
<el-form :inline="true" :model="qo" class="demo-form-inline">
|
||||
<el-form-item>
|
||||
<el-input v-model="qo.LIKES_name" placeholder="请输入本体名称"></el-input>
|
||||
<el-form-item label="本体名称:">
|
||||
<el-input v-model="qo.LIKES_name" placeholder="请输入本体名称" style="width: 300px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="qo.pageNo=1;queryData()">搜 索</el-button>
|
||||
@@ -15,10 +15,10 @@
|
||||
</el-form>
|
||||
</div>
|
||||
<div style="margin: 0px 0 20px 0">
|
||||
<el-button type="primary" @click="createRow()">新建知识图谱本体</el-button>
|
||||
<el-button type="primary" @click="createRow()" icon="el-icon-plus">新建知识图谱本体</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-table :data="result.records" style="width: 100%">
|
||||
<el-table :data="result.records" style="width: 100%">
|
||||
<el-table-column type="index" label="行号" width="100"></el-table-column>
|
||||
<el-table-column prop="name" label="本体名称"></el-table-column>
|
||||
<el-table-column prop="description" label="本体描述"></el-table-column>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="menu-title">
|
||||
知识图谱管理
|
||||
图谱管理
|
||||
</div>
|
||||
<div class="menu-content">
|
||||
<div>
|
||||
<el-form :inline="true" :model="qo" class="demo-form-inline">
|
||||
<el-form-item>
|
||||
<el-input v-model="qo.LIKES_name" placeholder="请输入图谱名称"></el-input>
|
||||
<el-form-item label="图谱名称:">
|
||||
<el-input v-model="qo.LIKES_name" placeholder="请输入图谱名称" style="width: 300px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="qo.pageNo=1;queryData()">搜 索</el-button>
|
||||
@@ -15,10 +15,10 @@
|
||||
</el-form>
|
||||
</div>
|
||||
<div style="margin: 0px 0 20px 0">
|
||||
<el-button type="primary" @click="createRow()">新建知识图谱</el-button>
|
||||
<el-button type="primary" @click="createRow()" icon="el-icon-plus">新建知识图谱</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-table :data="result.records" style="width: 100%">
|
||||
<el-table :data="result.records" style="width: 100%">
|
||||
<el-table-column type="index" label="行号" width="100"></el-table-column>
|
||||
<el-table-column prop="name" label="图谱名称"></el-table-column>
|
||||
<el-table-column prop="comment" label="图谱描述"></el-table-column>
|
||||
|
||||