diff --git a/virtual-patient-graph/pom.xml b/virtual-patient-graph/pom.xml
index c83ff2c7..d87cf2c2 100644
--- a/virtual-patient-graph/pom.xml
+++ b/virtual-patient-graph/pom.xml
@@ -36,6 +36,42 @@
spring-boot-starter-data-neo4j
+
+ com.github.pagehelper
+ pagehelper-spring-boot-starter
+ 1.4.2
+
+
+ org.mybatis
+ mybatis
+
+
+ org.mybatis
+ mybatis-spring
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+
+
+
+ com.vesoft
+ client
+ 3.0.0
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ com.fasterxml
+ classmate
+
+
org.projectlombok
diff --git a/virtual-patient-graph/src/main/java/com/supervision/VirtualPatientGraphApplication.java b/virtual-patient-graph/src/main/java/com/supervision/VirtualPatientGraphApplication.java
index 8437e948..12dadb1b 100644
--- a/virtual-patient-graph/src/main/java/com/supervision/VirtualPatientGraphApplication.java
+++ b/virtual-patient-graph/src/main/java/com/supervision/VirtualPatientGraphApplication.java
@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
+@EnableScheduling
@SpringBootApplication
@MapperScan(basePackages = {"com.supervision.**.mapper"})
@EnableNeo4jRepositories("com.**.repo")
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/config/NebulaGraphProperties.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/config/NebulaGraphProperties.java
new file mode 100644
index 00000000..01bd6de0
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/config/NebulaGraphProperties.java
@@ -0,0 +1,35 @@
+package com.supervision.nebula.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+
+/**
+ * @author fulin
+ */
+@Configuration
+@ConfigurationProperties(prefix = "nebula")
+@EnableConfigurationProperties(NebulaGraphProperties.class)
+@Data
+public class NebulaGraphProperties {
+
+ private String userName;
+
+ private String password;
+ /**
+ * 格式:ip:prot
+ */
+ private List hostAddresses;
+
+ private int minConnSize;
+
+ private int maxConnSize;
+
+ private int timeout;
+
+ private int idleTime;
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/config/NebulaSession.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/config/NebulaSession.java
new file mode 100644
index 00000000..e82544d1
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/config/NebulaSession.java
@@ -0,0 +1,28 @@
+package com.supervision.nebula.config;
+
+import com.vesoft.nebula.client.graph.net.Session;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author fulin
+ * 配置全局唯一session链接
+ **/
+@Component
+@RequiredArgsConstructor
+public class NebulaSession {
+
+ private final NebulaGraphProperties nebulaGraphProperties;
+
+ @Bean
+ public Session session() throws Exception {
+ SessionPool sessionPool = new SessionPool(nebulaGraphProperties.getMaxConnSize(),
+ nebulaGraphProperties.getMinConnSize(),
+ nebulaGraphProperties.getHostAddresses().get(0),
+ nebulaGraphProperties.getUserName(),
+ nebulaGraphProperties.getPassword());
+ return sessionPool.borrow();
+ }
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/config/SessionPool.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/config/SessionPool.java
new file mode 100644
index 00000000..7af461c2
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/config/SessionPool.java
@@ -0,0 +1,120 @@
+package com.supervision.nebula.config;
+
+import com.vesoft.nebula.client.graph.NebulaPoolConfig;
+import com.vesoft.nebula.client.graph.data.HostAddress;
+import com.vesoft.nebula.client.graph.exception.AuthFailedException;
+import com.vesoft.nebula.client.graph.exception.ClientServerIncompatibleException;
+import com.vesoft.nebula.client.graph.exception.IOErrorException;
+import com.vesoft.nebula.client.graph.exception.NotValidConnectionException;
+import com.vesoft.nebula.client.graph.net.NebulaPool;
+import com.vesoft.nebula.client.graph.net.Session;
+import lombok.extern.slf4j.Slf4j;
+
+import javax.annotation.PreDestroy;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Queue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.stream.Collectors;
+
+/**
+ * @author fulin
+ * SessionPool
+ */
+@Slf4j
+public class SessionPool {
+
+ private final Queue queue;
+
+ private final String userName;
+
+ private final String passWord;
+
+ private final int minCountSession;
+
+ private final int maxCountSession;
+
+ private final NebulaPool pool;
+
+
+ /**
+ * 创建连接池
+ *
+ * @param maxCountSession 默认创建连接数
+ * @param minCountSession 最大创建连接数
+ * @param hostAndPort 机器端口列表
+ * @param userName 用户名
+ * @param passWord 密码
+ * @throws UnknownHostException
+ * @throws NotValidConnectionException
+ * @throws IOErrorException
+ * @throws AuthFailedException
+ */
+ public SessionPool(int maxCountSession, int minCountSession, String hostAndPort, String userName, String passWord) throws UnknownHostException, NotValidConnectionException, IOErrorException, AuthFailedException, ClientServerIncompatibleException {
+ this.minCountSession = minCountSession;
+ this.maxCountSession = maxCountSession;
+ this.userName = userName;
+ this.passWord = passWord;
+ this.queue = new LinkedBlockingQueue<>(minCountSession);
+ this.pool = this.initGraphClient(hostAndPort, maxCountSession, minCountSession);
+ initSession();
+ }
+
+ public Session borrow() {
+ Session se = queue.poll();
+ if (se != null) {
+ return se;
+ }
+ try {
+ return this.pool.getSession(userName, passWord, true);
+ } catch (Exception e) {
+ log.error("execute borrow session fail, detail: ", e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ @PreDestroy
+ public void release() {
+ Queue queue = this.queue;
+ for (Session se : queue) {
+ if (se != null) {
+ boolean success = this.queue.offer(se);
+ if (!success) {
+ se.release();
+ }
+ }
+ }
+ }
+
+ public void close() {
+ this.pool.close();
+ }
+
+ private void initSession() throws NotValidConnectionException, IOErrorException, AuthFailedException, ClientServerIncompatibleException {
+ for (int i = 0; i < minCountSession; i++) {
+ queue.offer(this.pool.getSession(userName, passWord, true));
+ }
+ }
+
+ private NebulaPool initGraphClient(String hostAndPort, int maxConnSize, int minCount) throws UnknownHostException {
+ List hostAndPorts = getGraphHostPort(hostAndPort);
+ NebulaPool pool = new NebulaPool();
+ NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig();
+ nebulaPoolConfig = nebulaPoolConfig.setMaxConnSize(maxConnSize);
+ nebulaPoolConfig = nebulaPoolConfig.setMinConnSize(minCount);
+ nebulaPoolConfig = nebulaPoolConfig.setIdleTime(1000 * 600);
+ pool.init(hostAndPorts, nebulaPoolConfig);
+ return pool;
+ }
+
+ private List getGraphHostPort(String hostAndPort) {
+ String[] split = hostAndPort.split(",");
+ return Arrays.stream(split).map(item -> {
+ String[] splitList = item.split(":");
+ return new HostAddress(splitList[0], Integer.parseInt(splitList[1]));
+ }).collect(Collectors.toList());
+ }
+
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/AttributeEnum.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/AttributeEnum.java
new file mode 100644
index 00000000..63f77557
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/AttributeEnum.java
@@ -0,0 +1,18 @@
+package com.supervision.nebula.constant;
+
+import lombok.Getter;
+
+/**
+ * 属性枚举
+ *
+ * @author fulin
+ */
+@Getter
+public enum AttributeEnum {
+ // 实体类型
+ TAGS,
+ // 关系类型
+ EDGES,
+ // 空间
+ SPACES;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/ConditionEnum.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/ConditionEnum.java
new file mode 100644
index 00000000..a2c96056
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/ConditionEnum.java
@@ -0,0 +1,32 @@
+package com.supervision.nebula.constant;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author fulin
+ */
+
+@AllArgsConstructor
+@Getter
+public enum ConditionEnum {
+
+ // 比较判断
+ 相等("EQUAL", "=="),
+ 包含("CONTAINS", "CONTAINS"),
+ 开始("STARTS", "STARTS WITH"),
+ 结束("ENDS", "ENDS WITH");
+
+ private String name;
+ private String code;
+
+ public static String getCode(String name) {
+ ConditionEnum[] values = ConditionEnum.values();
+ for (ConditionEnum conditionEnum : values) {
+ if (name.equalsIgnoreCase(conditionEnum.getName())) {
+ return conditionEnum.getCode();
+ }
+ }
+ return "";
+ }
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/EdgeDirectionEnum.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/EdgeDirectionEnum.java
new file mode 100644
index 00000000..a61c686e
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/EdgeDirectionEnum.java
@@ -0,0 +1,59 @@
+package com.supervision.nebula.constant;
+
+
+import cn.hutool.core.collection.CollectionUtil;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.List;
+
+/**
+ * @author fulin
+ */
+
+@Getter
+@AllArgsConstructor
+public enum EdgeDirectionEnum {
+
+ // 边方向
+ 流出("OUTFLOW", "", ">", "OUT"),
+ 流入("INFLOW", "<", "", "IN"),
+ 双向("TWO-WAY", "", "", "BOTH");
+
+ private String name;
+ private String left;
+ private String right;
+ private String direct;
+
+
+ /**
+ * @return java.util.List
+ * @Description 获取方向
+ * @Param [name]
+ **/
+ public static List getLeftAndRight(String name) {
+ EdgeDirectionEnum[] values = EdgeDirectionEnum.values();
+ List results = CollectionUtil.newArrayList();
+ for (EdgeDirectionEnum edgeDirectionEnum : values) {
+ if (name.equalsIgnoreCase(edgeDirectionEnum.getName())) {
+ results.add(edgeDirectionEnum.getLeft());
+ results.add(edgeDirectionEnum.getRight());
+ return results;
+ }
+ }
+ results.add("");
+ results.add("");
+ return results;
+ }
+
+ public static String getDirection(String name) {
+ EdgeDirectionEnum[] values = EdgeDirectionEnum.values();
+ for (EdgeDirectionEnum edgeDirectionEnum : values) {
+ if (name.equalsIgnoreCase(edgeDirectionEnum.getName())) {
+ return edgeDirectionEnum.getDirect();
+ }
+ }
+ return "BOTH";
+ }
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/GqlConstant.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/GqlConstant.java
new file mode 100644
index 00000000..0574592e
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/constant/GqlConstant.java
@@ -0,0 +1,19 @@
+package com.supervision.nebula.constant;
+
+import com.google.common.base.Joiner;
+
+/**
+ * GQL 相关常量
+ *
+ * @author fulin by 2022/3/28
+ */
+public class GqlConstant {
+ public static final String UNKNOWN = "unknown";
+ public static final String ID = "id";
+ public static final Joiner GQL_UNION_JOINER = Joiner.on(" UNION ");
+ public static final Joiner GQL_UNION_COMMA = Joiner.on(",");
+
+ private GqlConstant() {
+ }
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/AttributeController.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/AttributeController.java
new file mode 100644
index 00000000..a89b9b47
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/AttributeController.java
@@ -0,0 +1,55 @@
+package com.supervision.nebula.controller;
+
+
+import com.github.pagehelper.PageInfo;
+import com.supervision.nebula.dto.graph.GraphPageAttribute;
+import com.supervision.nebula.dto.graph.GraphShowAttribute;
+import com.supervision.nebula.dto.graph.GraphShowInfo;
+import com.supervision.nebula.service.AttributeService;
+import com.supervision.nebula.service.GraphCommonService;
+import com.supervision.nebula.vo.AttributeVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@SuppressWarnings("ALL")
+@RestController
+@RequestMapping("/attribute")
+@Api(tags = "属性查询控制器")
+@RequiredArgsConstructor
+public class AttributeController {
+
+ private final GraphCommonService graphCommonService;
+
+ private final AttributeService attributeService;
+
+ @PostMapping("/list")
+ @ApiOperation("属性查询(spaces tags edges列表)")
+ public List showAttribute(@RequestBody GraphShowAttribute graphShowAttribute) {
+ return attributeService.showAttribute(graphShowAttribute);
+ }
+
+ @PostMapping("/page")
+ @ApiOperation("属性分页查询 tags edges 分页列表")
+ public PageInfo pageListAttribute(@RequestBody GraphPageAttribute graphPageAttribute) {
+ return attributeService.pageListAttribute(graphPageAttribute);
+ }
+
+ @PostMapping("/listProperty")
+ @ApiOperation("属性的子属性列表查询 tag edge 的属性列表查询")
+ public List showAttributeInfo(@RequestBody GraphShowInfo graphShowInfo) {
+ return attributeService.showAttributeInfo(graphShowInfo);
+ }
+
+ @PostMapping("/propertyInfo")
+ @ApiOperation("属性的详细信息")
+ public List showCreateAttributeInfo(@RequestBody GraphShowInfo graphShowInfo) {
+ return attributeService.showCreateAttributeInfo(graphShowInfo);
+ }
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/AttributeManageController.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/AttributeManageController.java
new file mode 100644
index 00000000..130cef2c
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/AttributeManageController.java
@@ -0,0 +1,52 @@
+package com.supervision.nebula.controller;
+
+
+import com.supervision.nebula.dto.graph.GraphAddAttribute;
+import com.supervision.nebula.dto.graph.GraphDelAttribute;
+import com.supervision.nebula.dto.graph.GraphDropAttribute;
+import com.supervision.nebula.service.AttributeService;
+import com.supervision.nebula.service.GraphCommonService;
+import com.supervision.nebula.util.NebulaUtil;
+import com.supervision.nebula.vo.CommonVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author fulin
+ */
+@RestController
+@RequestMapping("/attribute")
+@Api(tags = "属性编辑控制器")
+@RequiredArgsConstructor
+public class AttributeManageController {
+
+ private final GraphCommonService graphCommonService;
+
+ private final AttributeService attributeService;
+
+ @PostMapping("/dropAttribute")
+ @ApiOperation("删除属性(删除 space空间 tag标签 edge边类型)")
+ public List dropAttribute(@RequestBody GraphDropAttribute graphDropAttribute) {
+ return attributeService.dropAttribute(graphDropAttribute);
+ }
+
+ @PostMapping("/addAttributeProperty")
+ @ApiOperation("增加属性的子属性(tag标签的属性 edge边类型的属性)")
+ public List addAttributeProperty(@RequestBody GraphAddAttribute graphAddAttribute) {
+ return attributeService.addAttributeProperty(graphAddAttribute);
+ }
+
+ @PostMapping("/delAttributeProperty")
+ @ApiOperation("删除属性的子属性(tag标签的属性 edge边类型的属性)")
+ public List delAttributeProperty(@RequestBody GraphDelAttribute graphDelAttribute) {
+ return graphCommonService.executeJson(NebulaUtil.delAttributeProperty(graphDelAttribute), CommonVo.class);
+ }
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/EdgeController.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/EdgeController.java
new file mode 100644
index 00000000..5101c751
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/EdgeController.java
@@ -0,0 +1,37 @@
+package com.supervision.nebula.controller;
+
+
+import com.supervision.nebula.dto.NebulaVertexJsonResult;
+import com.supervision.nebula.dto.graph.GraphSpace;
+import com.supervision.nebula.service.GraphCommonService;
+import com.supervision.nebula.util.NebulaUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author fulin
+ * @Descriptin: 边控制器
+ * @ClassName: VertexController
+ */
+@RestController
+@Api(tags = "边edge查询控制器")
+@RequestMapping("/edge")
+@RequiredArgsConstructor
+public class EdgeController {
+
+ private final GraphCommonService graphCommonService;
+
+ @PostMapping("/listEdge")
+ @ApiOperation("查询插入的边edge(绑定关系查询)")
+ public List listEdge(@RequestBody GraphSpace graphSpace) {
+ return graphCommonService.executeJson(NebulaUtil.listEdge(graphSpace), NebulaVertexJsonResult.class);
+ }
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/EdgeManageController.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/EdgeManageController.java
new file mode 100644
index 00000000..347fada5
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/EdgeManageController.java
@@ -0,0 +1,47 @@
+package com.supervision.nebula.controller;
+
+
+import com.supervision.nebula.dto.graph.GraphDeleteEdge;
+import com.supervision.nebula.dto.graph.GraphInsertEdge;
+import com.supervision.nebula.service.GraphCommonService;
+import com.supervision.nebula.util.NebulaUtil;
+import com.supervision.nebula.vo.CommonVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author fulin
+ * @Descriptin: 边控制器
+ * @ClassName: VertexController
+ */
+@RestController
+@Api(tags = "边edge管理控制器")
+@RequestMapping("/edge")
+@RequiredArgsConstructor
+public class EdgeManageController {
+
+ private final GraphCommonService graphCommonService;
+
+ @PostMapping("/insertEdge")
+ @ApiOperation("插入边edge(关系编辑-绑定两个点的关系)")
+ public List insertEdge(@RequestBody GraphInsertEdge graphInsertEdge) {
+ String vidType = graphCommonService.getVidType(graphInsertEdge.getSpace());
+ return graphCommonService.executeJson(NebulaUtil.insertEdge(graphInsertEdge, vidType), CommonVo.class);
+ }
+
+ @PostMapping("/deleteEdge")
+ @ApiOperation("删除边edge(解除关系编辑-解除两个点的关系)")
+ public List deleteEdge(@RequestBody GraphDeleteEdge graphDeleteEdge) {
+ String vidType = graphCommonService.getVidType(graphDeleteEdge.getSpace());
+ return graphCommonService.executeJson(NebulaUtil.deleteEdge(graphDeleteEdge, vidType), CommonVo.class);
+ }
+
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/GraphFileController.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/GraphFileController.java
new file mode 100644
index 00000000..4812fec1
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/GraphFileController.java
@@ -0,0 +1,57 @@
+package com.supervision.nebula.controller;
+
+
+import com.supervision.nebula.dto.ImportBean;
+import com.supervision.nebula.entity.GraphFile;
+import com.supervision.nebula.service.GraphFileService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * (GraphFile)表控制层
+ *
+ * @author makejava
+ * @since 2022-08-23 09:09:26
+ */
+@RestController
+@Api(tags = "文件控制器")
+@RequestMapping("graphFile")
+public class GraphFileController {
+
+ @Resource
+ private GraphFileService graphFileService;
+
+ /**
+ * 文件上传
+ *
+ * @param file 文件
+ * @return 文件实例对象
+ */
+
+ @ApiOperation("文件上传--可以不做,这里为了预览数据")
+ @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+ public GraphFile uploadFile(@RequestParam("file") MultipartFile file) {
+ return this.graphFileService.uploadFile(file);
+ }
+
+ @ApiOperation("文件导入--执行nebula import插件")
+ @PostMapping("/import")
+ public Boolean importFile(@RequestBody ImportBean importBean) throws IOException {
+ return this.graphFileService.importFile(importBean);
+ }
+
+ @ApiOperation("模板下载,可以填充数据")
+ @GetMapping("/template")
+ public void template(@RequestParam String space, HttpServletResponse response) {
+ graphFileService.template(space, response);
+ }
+
+}
+
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/SpaceController.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/SpaceController.java
new file mode 100644
index 00000000..ad2d6c28
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/SpaceController.java
@@ -0,0 +1,64 @@
+package com.supervision.nebula.controller;
+
+
+import com.supervision.nebula.dto.graph.GraphCreateSpace;
+import com.supervision.nebula.dto.graph.GraphShowAttribute;
+import com.supervision.nebula.dto.graph.GraphSpace;
+import com.supervision.nebula.service.GraphCommonService;
+import com.supervision.nebula.service.SpaceService;
+import com.supervision.nebula.util.NebulaUtil;
+import com.supervision.nebula.vo.AttributeVo;
+import com.supervision.nebula.vo.CommonVo;
+import com.supervision.nebula.vo.DetailSpace;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author fulin
+ * space控制器
+ */
+@RestController
+@Api(tags = "图谱space控制器")
+@RequestMapping("/space")
+@RequiredArgsConstructor
+public class SpaceController {
+
+ private final GraphCommonService graphCommonService;
+
+ private final SpaceService spaceService;
+
+
+ @PostMapping("/create")
+ @ApiOperation("创建图谱")
+ public List createSpace(@RequestBody GraphCreateSpace graphCreateSpace) {
+ return spaceService.createSpace(graphCreateSpace);
+ }
+
+
+ @PostMapping("/use")
+ @ApiOperation("切换图谱")
+ public List useSpace(@RequestBody GraphCreateSpace graphCreateSpace) {
+ return graphCommonService.executeJson(NebulaUtil.useSpace(graphCreateSpace.getSpace()), CommonVo.class);
+ }
+
+ @PostMapping("/list")
+ @ApiOperation("卡片展示列表(图谱详情)")
+ public List detailSpace(@RequestBody GraphShowAttribute graphShowAttribute) {
+ return spaceService.detailSpace(graphShowAttribute);
+ }
+
+ @PostMapping("/info")
+ @ApiOperation("查询某个空间的信息")
+ public List spaceInfo(@RequestBody GraphSpace graphSpace) {
+ return spaceService.spaceInfo(graphSpace.getSpace());
+ }
+
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/SubGraphController.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/SubGraphController.java
new file mode 100644
index 00000000..50582916
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/SubGraphController.java
@@ -0,0 +1,31 @@
+package com.supervision.nebula.controller;
+
+
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.supervision.nebula.service.GraphCommonService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Api(tags = "子图查询控制器")
+@RequestMapping("/subGraph")
+@RequiredArgsConstructor
+public class SubGraphController {
+
+ private final GraphCommonService graphCommonService;
+
+ @PostMapping("querySubGraph")
+ @ApiOperation("子图查询")
+ public JSONObject querySubGraph() {
+ String subgraphQuery = "use subgraph;GET SUBGRAPH 100 STEPS FROM \"player101\" YIELD VERTICES AS `vertices_`, EDGES AS `edges_`;";
+ String s = graphCommonService.executeJson(subgraphQuery);
+ return JSONUtil.parseObj(s);
+ }
+}
+
+
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/TagEdgeController.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/TagEdgeController.java
new file mode 100644
index 00000000..e8f5dab2
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/TagEdgeController.java
@@ -0,0 +1,43 @@
+package com.supervision.nebula.controller;
+
+
+import com.supervision.nebula.dto.graph.GraphCreateIndex;
+import com.supervision.nebula.dto.graph.GraphCreateTagEdge;
+import com.supervision.nebula.service.GraphCommonService;
+import com.supervision.nebula.util.NebulaUtil;
+import com.supervision.nebula.vo.CommonVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author fulin
+ * 点类型标签tag控制器
+ */
+@RestController
+@Api(tags = "标签tag edge 新增控制器")
+@RequestMapping("/tagEdge")
+public class TagEdgeController {
+
+ @Autowired
+ GraphCommonService graphCommonService;
+
+ @PostMapping("/createTagEdge")
+ @ApiOperation("创建tag 或者 edge")
+ public List createTagEdge(@RequestBody GraphCreateTagEdge graphCreateTagEdge) {
+ return graphCommonService.executeJson(NebulaUtil.createTagEdge(graphCreateTagEdge), CommonVo.class);
+ }
+
+
+ @PostMapping("/createIndex")
+ @ApiOperation("创建索引")
+ public List createIndex(@RequestBody GraphCreateIndex graphCreateIndex) {
+ return graphCommonService.executeJson(NebulaUtil.createIndex(graphCreateIndex), CommonVo.class);
+ }
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/VertexController.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/VertexController.java
new file mode 100644
index 00000000..17401c1f
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/VertexController.java
@@ -0,0 +1,69 @@
+package com.supervision.nebula.controller;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONUtil;
+import com.supervision.nebula.dto.NebulaJsonConverter;
+import com.supervision.nebula.dto.NebulaVertexJsonResult;
+import com.supervision.nebula.dto.graph.*;
+import com.supervision.nebula.service.VertexService;
+import com.supervision.nebula.vo.AttributeVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 点控制器
+ *
+ * @author fulin
+ */
+@RestController
+@Api(tags = "点查询(实体)控制器")
+@RequestMapping("/vertex")
+@RequiredArgsConstructor
+public class VertexController {
+
+ private final VertexService vertexService;
+
+ @PostMapping("/vertexList")
+ @ApiOperation("查询创建的点列表")
+ public List vertexList(@RequestBody GraphSpace graphSpace) {
+ return vertexService.vertexList(graphSpace.getSpace());
+ }
+
+ @PostMapping("/vertexTagsQuery")
+ @ApiOperation("根据tag标签查询点")
+ public List vertexTagsQuery(@RequestBody GraphVertexTatsQuery graphVertexTatsQuery) {
+ return vertexService.vertexTagsQuery(graphVertexTatsQuery);
+ }
+
+ @PostMapping("/vertexTagAttributeQuery")
+ @ApiOperation("根据tag标签属性查询点(先要保证该标签属性已经建立索引)")
+ public List vertexTagAttributeQuery(@RequestBody GraphVertexTatAttributeQuery graphVertexTatAttributeQuery) {
+ return vertexService.vertexTagAttributeQuery(graphVertexTatAttributeQuery);
+ }
+
+ @PostMapping("/expandQuery")
+ @ApiOperation("根据点以及边信息扩展查询")
+ public GraphData vertexExpandQuery(@RequestBody GraphExpand graphExpand) {
+ List data = vertexService.vertexExpandQuery(graphExpand);
+ JSONArray objects = JSONUtil.parseArray(JSONUtil.toJsonStr(data));
+ return NebulaJsonConverter.toGraphDataMain(objects, new ArrayList());
+ }
+
+ @PostMapping("/page")
+ @ApiOperation("查询创建的点分页列表")
+ public Map vertexPage(@RequestBody GraphVertexTatsQuery graphVertexTatsQuery) {
+ return vertexService.vertexPage(graphVertexTatsQuery);
+ }
+}
+
+
+
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/VertexManageController.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/VertexManageController.java
new file mode 100644
index 00000000..6d59afca
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/controller/VertexManageController.java
@@ -0,0 +1,44 @@
+package com.supervision.nebula.controller;
+
+
+import com.supervision.nebula.dto.graph.GraphCreateVertex;
+import com.supervision.nebula.dto.graph.GraphDeleteVertex;
+import com.supervision.nebula.service.GraphCommonService;
+import com.supervision.nebula.util.NebulaUtil;
+import com.supervision.nebula.vo.CommonVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author fulin
+ * 点控制器
+ */
+@RestController
+@Api(tags = "点编辑(实体)控制器")
+@RequestMapping("/vertex")
+@RequiredArgsConstructor
+public class VertexManageController {
+
+ private final GraphCommonService graphCommonService;
+
+ @PostMapping("/createVertex")
+ @ApiOperation("创建点(需要附加标签tag信息)")
+ public List createVertex(@RequestBody GraphCreateVertex graphCreateVertex) {
+ String vidType = graphCommonService.getVidType(graphCreateVertex.getSpace());
+ return graphCommonService.executeJson(NebulaUtil.createPoint(graphCreateVertex, vidType), CommonVo.class);
+ }
+
+ @PostMapping("/deleteVertex")
+ @ApiOperation("删除点(根据点id删除)")
+ public List deleteVertex(@RequestBody GraphDeleteVertex graphDeleteVertex) {
+ String vidType = graphCommonService.getVidType(graphDeleteVertex.getSpace());
+ return graphCommonService.executeJson(NebulaUtil.deleteVertex(graphDeleteVertex, vidType), CommonVo.class);
+ }
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/EdgeCombo.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/EdgeCombo.java
new file mode 100644
index 00000000..70d92f12
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/EdgeCombo.java
@@ -0,0 +1,15 @@
+package com.supervision.nebula.dto;
+
+import lombok.Data;
+
+@Data
+public class EdgeCombo {
+ /**
+ * 文件id
+ */
+ private Integer fileId;
+ /**
+ * 元素属性
+ */
+ private EdgeElement edgeElement;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/EdgeElement.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/EdgeElement.java
new file mode 100644
index 00000000..127f646a
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/EdgeElement.java
@@ -0,0 +1,27 @@
+package com.supervision.nebula.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class EdgeElement {
+ /**
+ * 边名称
+ */
+ private String elementName;
+ /**
+ * 起点对应的列号
+ */
+ private Integer srcId;
+ /**
+ * 终点对应的列号
+ */
+ private Integer dstId;
+
+ private Integer rank;
+ /**
+ * 属性集合
+ */
+ private List properties;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/FailureTroubleshootingVo.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/FailureTroubleshootingVo.java
new file mode 100644
index 00000000..b0d875aa
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/FailureTroubleshootingVo.java
@@ -0,0 +1,21 @@
+package com.supervision.nebula.dto;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Map;
+
+/**
+ * 故障图谱归因分析-失效现象解析结果
+ *
+ * @author fulin by 2022/3/29
+ */
+@Builder
+@Data
+@EqualsAndHashCode(of = "id")
+public class FailureTroubleshootingVo {
+ private String id;
+ private String tag;
+ private Map properties;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/ImportBean.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/ImportBean.java
new file mode 100644
index 00000000..52739402
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/ImportBean.java
@@ -0,0 +1,22 @@
+package com.supervision.nebula.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ImportBean {
+
+ /**
+ * 图谱标识
+ */
+ private String space;
+ /**
+ * 点集合
+ */
+ private List vertices;
+ /**
+ * 边集合
+ */
+ private List edges;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/ImportDto.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/ImportDto.java
new file mode 100644
index 00000000..07a3bab8
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/ImportDto.java
@@ -0,0 +1,23 @@
+package com.supervision.nebula.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName: ImportDto
+ */
+@Data
+@ApiModel("数据导入入参")
+public class ImportDto {
+
+ @ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
+ private String space;
+
+ @ApiModelProperty(value = "attribute可选值: tag标签/edge边类型", example = "tag", required = true)
+ private String attribute;
+
+ @ApiModelProperty(value = "属性名称", example = "t1", required = true)
+ private String attributeName;
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/NebulaJsonConverter.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/NebulaJsonConverter.java
new file mode 100644
index 00000000..4ff5db67
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/NebulaJsonConverter.java
@@ -0,0 +1,156 @@
+package com.supervision.nebula.dto;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import com.google.common.collect.Sets;
+import com.supervision.nebula.constant.GqlConstant;
+import com.supervision.nebula.dto.graph.GraphData;
+import com.supervision.nebula.dto.graph.GraphEdge;
+import com.supervision.nebula.dto.graph.GraphNode;
+import com.supervision.nebula.dto.graph.NodeType;
+import com.supervision.nebula.vo.AttributeVo;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author fulin by 2022/3/30
+ */
+public class NebulaJsonConverter {
+
+ /**
+ * @param jsonArray
+ * @param attributeVos
+ * @return
+ */
+ public static GraphData toGraphDataMain(JSONArray jsonArray, List attributeVos) {
+ final JSONObject jsonObject = jsonArray.getJSONObject(0);
+ final JSONArray data = jsonObject.getJSONArray("data");
+ if (ObjectUtil.isNull(data)) {
+ return new GraphData();
+ }
+ final Set nodes = Sets.newHashSet();
+ final Set edges = Sets.newHashSet();
+ final List nodeTypeList = CollectionUtil.newArrayList();
+ final Set tagSet = CollectionUtil.newHashSet();
+
+ //List dataBeanList = attributeVos.get(0).getData();
+
+ for (int d = 0; d < data.size(); d++) {
+ final JSONObject dataJSONObject = data.getJSONObject(d);
+
+ // meta 数据结构: [[]]
+ final JSONArray meta = dataJSONObject.getJSONArray("meta");
+ final JSONArray row = dataJSONObject.getJSONArray("row");
+
+ for (int i = 0; i < meta.size(); i++) {
+ final JSONArray metaJSONArray = meta.getJSONArray(i);
+ final JSONArray rowJSONArray = row.getJSONArray(i);
+
+ for (int i1 = 0; i1 < metaJSONArray.size(); i1++) {
+ final JSONObject oneMeta = metaJSONArray.getJSONObject(i1);
+ final JSONObject oneRow = rowJSONArray.getJSONObject(i1);
+ final String type = oneMeta.getStr("type");
+ Object tagInfo = null;
+ Object edgeInfo = null;
+ switch (type) {
+ case "vertex":
+ String tag = GqlConstant.UNKNOWN;
+ String name = GqlConstant.UNKNOWN;
+ String color = "#289D73";
+ tagInfo = oneRow.entrySet();
+ for (Map.Entry entry : oneRow.entrySet()) {
+ final String key = entry.getKey();
+ if (key.endsWith("name")) {
+ final Object value = entry.getValue();
+ final String[] split = key.split("\\.");
+ tag = split[0];
+ name = value.toString();
+ break;
+ }
+ }
+ String nodeTypes = GqlConstant.UNKNOWN;
+ if (ObjectUtil.notEqual(GqlConstant.UNKNOWN, tag)) {
+ nodeTypes = tag;
+ }
+ nodes.add(GraphNode.builder()
+ .id(oneMeta.getStr("id"))
+ .tag(tag)
+ .label(name)
+ .nodeTypes(nodeTypes)
+ .tagInfo(tagInfo)
+ .build());
+
+ HashMap colorMap = MapUtil.newHashMap();
+ colorMap.put("fill", color);
+ colorMap.put("size", "50");
+
+ //for (AttributeVo.DataBean dataBean : dataBeanList) {
+ // List row1 = dataBean.getRow();
+ // if (CollectionUtil.isNotEmpty(row1)) {
+ // String tagName = row1.get(0);
+ // if (StrUtil.isNotBlank(tagName)) {
+ // if (tagName.equalsIgnoreCase(tag) && row1.size() > 1) {
+ // colorMap.put("fill", row1.get(1));
+ // colorMap.put("size", row1.get(2));
+ // }
+ // }
+ // }
+ //}
+
+ if (!tagSet.contains(tag)) {
+ nodeTypeList.add(
+ NodeType
+ .builder()
+ .id(oneMeta.getStr("id"))
+ .label(tag)
+ .style(colorMap)
+ .build()
+ );
+ }
+ tagSet.add(tag);
+ break;
+ case "edge":
+ final JSONObject id = oneMeta.getJSONObject("id");
+ edgeInfo = oneRow.entrySet();
+ int typeFX = Integer.parseInt(id.get("type").toString());
+ if (typeFX > 0) {
+ edges.add(
+ GraphEdge.builder()
+ .source(id.getStr("src"))
+ .target(id.getStr("dst"))
+ .label(id.getStr("name"))
+ .edgeInfo(edgeInfo)
+ .build()
+ );
+ }
+ if (typeFX < 0) {
+ edges.add(
+ GraphEdge.builder()
+ .source(id.getStr("dst"))
+ .target(id.getStr("src"))
+ .label(id.getStr("name"))
+ .edgeInfo(edgeInfo)
+ .build()
+ );
+ }
+ break;
+ default:
+ throw new RuntimeException("type not found");
+ }
+ }
+ }
+ }
+ return GraphData.builder()
+ .nodes(nodes)
+ .edges(edges)
+ .NodeTypes(nodeTypeList)
+ .build();
+ }
+}
+
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/NebulaVertexJsonResult.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/NebulaVertexJsonResult.java
new file mode 100644
index 00000000..7a43aa8c
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/NebulaVertexJsonResult.java
@@ -0,0 +1,74 @@
+package com.supervision.nebula.dto;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Nebula-Graph session json 查询返回结果反序列化。
+ * 该序列化非通用模式,需要具体分析 json 结果。
+ *
+ * @author fulin by 2022/3/29
+ */
+@Data
+@ApiModel("返回类")
+public class NebulaVertexJsonResult {
+ @ApiModelProperty(value = "空间名称")
+ private String spaceName;
+ @ApiModelProperty(value = "潜伏期")
+ private int latencyInUs;
+ @ApiModelProperty(value = "数据集合")
+ private List data;
+ @ApiModelProperty(value = "字段")
+ private List columns;
+
+ public Set toFailureTroubleshootingVos() {
+ final List data = this.getData();
+ final Set r = Sets.newHashSetWithExpectedSize(data.size());
+ for (OneData oneData : data) {
+ final List meta = oneData.getMeta();
+ final List> row = oneData.getRow();
+ for (int i = 0; i < meta.size(); i++) {
+ final Map oneRow = row.get(i);
+ final Map properties = Maps.newHashMapWithExpectedSize(oneRow.size());
+ String tag = "unknown";
+ for (Map.Entry entry : oneRow.entrySet()) {
+ final String key = entry.getKey();
+ final String[] split = key.split("\\.");
+ tag = split[0];
+ properties.put(split[1], entry.getValue());
+ }
+ r.add(FailureTroubleshootingVo.builder()
+ .id(meta.get(i).getId())
+ .tag(tag)
+ .properties(properties)
+ .build());
+ }
+ }
+ return r;
+ }
+
+ @Data
+ public static class OneData {
+ @ApiModelProperty(value = "元数据")
+ private List meta;
+ @ApiModelProperty(value = "属性名称: 属性值")
+ private List> row;
+ }
+
+ @Data
+ public static class OneMeta {
+ @ApiModelProperty(value = "id")
+ private String id;
+ @ApiModelProperty(value = "类型")
+ private String type;
+ }
+}
+
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/PageBeanDto.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/PageBeanDto.java
new file mode 100644
index 00000000..a394bf0c
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/PageBeanDto.java
@@ -0,0 +1,20 @@
+package com.supervision.nebula.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Descriptin: 分页参数入参
+ * @ClassName: PageBeanDto
+ */
+@ApiModel("分页参数入参")
+@Data
+public class PageBeanDto {
+
+ @ApiModelProperty(value = "页码:从1开始", example = "1", required = false)
+ private Integer pageNum = 1;
+
+ @ApiModelProperty(value = "分页条数", example = "10", required = false)
+ private Integer pageSize = 10;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/Property.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/Property.java
new file mode 100644
index 00000000..36f21648
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/Property.java
@@ -0,0 +1,19 @@
+package com.supervision.nebula.dto;
+
+import lombok.Data;
+
+@Data
+public class Property {
+ /**
+ * 属性名称
+ */
+ private String propName;
+ /**
+ * 对应CSV文件列号
+ */
+ private Integer csvIndex;
+ /**
+ * 属性类型
+ */
+ private String type;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/TemplateBean.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/TemplateBean.java
new file mode 100644
index 00000000..60003975
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/TemplateBean.java
@@ -0,0 +1,115 @@
+package com.supervision.nebula.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @ClassName= TemplateBean
+ */
+@Data
+public class TemplateBean {
+
+ private String version = "v3";
+ private String description = "web console import";
+ private Boolean removeTempFiles = false;
+ private ClientSettings clientSettings;
+ private String logPath;
+ private List files;
+
+
+ @Data
+ public static class File {
+ private String path;
+ private String failDataPath;
+ private Integer batchSize = 60;
+ private String limit;
+ private String inOrder;
+ private String type = "csv";
+ private CSV csv;
+ private Schema schema;
+ }
+
+ @Data
+ public static class CSV {
+ private Boolean withHeader = true;
+ private Boolean withLabel = false;
+ private String delimiter;
+ }
+
+ @Data
+ public static class Schema {
+ private String type = "vertex";
+ // private Vertex vertex;
+ private Edge edge;
+ }
+
+ @Data
+ public static class Edge {
+ private String name = "order";
+ private Boolean withRanking = false;
+// private List props;
+// private SrcDst srcVID;
+// private SrcDst dstVID;
+// private Integer rank;
+ }
+
+
+// @Data
+// public static class SrcDst {
+// private Integer index = 1;
+// private String function = "";
+// private String type = "string";
+// private String prefix = "";
+// }
+
+
+// @Data
+// public static class Vertex {
+// private Vid vid;
+// private List tags;
+// }
+
+
+// @Data
+// public static class Vid {
+// private Integer index = 0;
+// private String function;
+// private String type = "string";
+// private String prefix;
+// }
+
+
+// @Data
+// public static class Tag {
+// private String name = "item";
+// private List props;
+// }
+
+// @Data
+// public static class Prop {
+// private String name = "id_single_item";
+// private String type = "string";
+// private Integer index = 0;
+// }
+
+
+ @Data
+ public static class ClientSettings {
+ private Integer retry = 3;
+ private Integer concurrency = 10;
+ private Integer channelBufferSize = 128;
+ private String space = "dataImport";
+ private String postStart;
+ private String preStop;
+ private Connection connection;
+ }
+
+ @Data
+ public static class Connection {
+ private String user = "root";
+ private String password = "nebula";
+ private String address = "127.0.0.1:9669";
+ }
+
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/UserDto.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/UserDto.java
new file mode 100644
index 00000000..6e421cfb
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/UserDto.java
@@ -0,0 +1,24 @@
+package com.supervision.nebula.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @ClassName: UserDto
+ */
+
+@Data
+@ApiModel("用户入参")
+@NoArgsConstructor
+@AllArgsConstructor
+public class UserDto {
+
+ @ApiModelProperty(value = "用户名", required = true, example = "test")
+ private String username;
+
+ @ApiModelProperty(value = "密码", required = true, example = "test")
+ private String password;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/VertexCombo.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/VertexCombo.java
new file mode 100644
index 00000000..e2f197d8
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/VertexCombo.java
@@ -0,0 +1,21 @@
+package com.supervision.nebula.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class VertexCombo {
+ /**
+ * 文件id
+ */
+ private Integer fileId;
+ /**
+ * 点对应文件中的列号
+ */
+ private Integer vertexId;
+ /**
+ * 元素属性
+ */
+ private List vertexElements;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/VertexElement.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/VertexElement.java
new file mode 100644
index 00000000..4c0a015d
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/VertexElement.java
@@ -0,0 +1,17 @@
+package com.supervision.nebula.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class VertexElement {
+ /**
+ * 元素名称
+ */
+ private String elementName;
+ /**
+ * 属性集合
+ */
+ private List properties;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/AttributeBean.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/AttributeBean.java
new file mode 100644
index 00000000..547cdc7f
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/AttributeBean.java
@@ -0,0 +1,44 @@
+package com.supervision.nebula.dto.graph;
+
+import cn.hutool.core.util.StrUtil;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Descriptin:
+ * @ClassName: AttributeBean
+ */
+@ApiModel("属性入参")
+@Data
+public class AttributeBean {
+
+ /**
+ * 属性名称
+ **/
+ @ApiModelProperty(value = "tag/edge的属性名称", example = "p3", required = true)
+ private String propertyName;
+ /**
+ * 属性类型 (int bool string double .........)
+ **/
+ @ApiModelProperty(value = "索引长度:属性为string 必须有长度,其他类型不可传入 ", example = "30", required = true)
+ private String indexLength;
+
+ public String getPropertyName() {
+ return "`" + propertyName + "`" + getIndexLength();
+ }
+
+ private String getIndexLength() {
+ if (StrUtil.isNotBlank(indexLength)) {
+ return "(" + indexLength + ")";
+ }
+ return "";
+ }
+
+ private String getIndexFull() {
+ if (StrUtil.isNotBlank(indexLength)) {
+ return "(" + indexLength + ")";
+ }
+ return "";
+ }
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphAddAttribute.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphAddAttribute.java
new file mode 100644
index 00000000..502680de
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphAddAttribute.java
@@ -0,0 +1,60 @@
+package com.supervision.nebula.dto.graph;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@ApiModel("修改属性实体")
+public class GraphAddAttribute {
+
+
+ @ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
+ private String space;
+
+ @ApiModelProperty(value = "attribute可选值: tag标签/edge边类型", example = "tag", required = true)
+ private String attribute;
+
+ @ApiModelProperty(value = "属性名称", example = "t1", required = true)
+ private String attributeName;
+
+ @ApiModelProperty(value = "tag/edge的属性名称", example = "p5")
+ private String propertyName;
+
+ @ApiModelProperty(value = "属性类型,add 必传该类型 可选值: int bool string double .........", example = "string", required = false)
+ private String propertyType;
+
+ @ApiModelProperty(value = "是否可为空: NOT NULL 或者 NULL", example = "NULL")
+ private String isNull;
+
+ @ApiModelProperty(value = "默认值")
+ private Object defaultValue;
+
+ @ApiModelProperty(value = "描述")
+ private String common;
+
+ public Object getDefaultValue() {
+ if (!ObjectUtil.isNull(defaultValue)) {
+ if (defaultValue instanceof String) {
+ return "DEFAULT '" + defaultValue + "'";
+ }
+ return "DEFAULT " + defaultValue;
+ }
+ return defaultValue;
+ }
+
+ public String getCommon() {
+ if (StrUtil.isNotBlank(common)) {
+ return "COMMENT '" + common + "'";
+ }
+ return common;
+ }
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateIndex.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateIndex.java
new file mode 100644
index 00000000..2e99c463
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateIndex.java
@@ -0,0 +1,39 @@
+package com.supervision.nebula.dto.graph;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@ApiModel("创建索引入参")
+public class GraphCreateIndex {
+
+ /**
+ * 空间名称
+ **/
+ @ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
+ private String space;
+
+ @ApiModelProperty(value = "创建类型: tag/edge", example = "tag", required = true)
+ private String type;
+
+ @ApiModelProperty(value = "索引名称", example = "name_index", required = true)
+ private String indexName;
+
+ @ApiModelProperty(value = "tag/edge名称", example = "t1", required = true)
+ private String tagEdgeName;
+
+ @ApiModelProperty(value = "索引描述描述", example = "备注")
+ private String comment;
+
+ @ApiModelProperty(value = "属性集合")
+ private List attributeBeanList;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateSpace.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateSpace.java
new file mode 100644
index 00000000..e0fa1408
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateSpace.java
@@ -0,0 +1,62 @@
+package com.supervision.nebula.dto.graph;
+
+import cn.hutool.core.util.StrUtil;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@ApiModel("创建空间实体")
+public class GraphCreateSpace {
+
+ /**
+ * 空间名称
+ **/
+ @ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
+ private String space;
+
+ /**
+ * 空间中文名称
+ **/
+ @ApiModelProperty(value = "空间中文名称", example = "付琳测试", required = true)
+ private String spaceChineseName;
+ /**
+ * 分片数量
+ **/
+ @ApiModelProperty(value = "分片数量", example = "1")
+ private Integer partitionNum;
+
+ /**
+ * 分片数量
+ **/
+ @ApiModelProperty(value = "副本数量", example = "1")
+ private Integer replicaFactor;
+ /**
+ * 类型
+ **/
+ @ApiModelProperty(value = "点类型:INT64,FIXED_STRING", example = "INT64")
+ private String fixedType = "INT64";
+ /**
+ * 类型大小
+ **/
+ @ApiModelProperty(value = "类型长度,FIXED_STRING 此字段必填 如32,64")
+ private String size = "";
+ /**
+ * 描述
+ **/
+ @ApiModelProperty(value = "描述")
+ private String comment;
+
+ public String getSize() {
+ if (StrUtil.isNotBlank(size)) {
+ return "(" + size + ")";
+ }
+ return "";
+ }
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateTagEdge.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateTagEdge.java
new file mode 100644
index 00000000..39cf90db
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateTagEdge.java
@@ -0,0 +1,39 @@
+package com.supervision.nebula.dto.graph;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@ApiModel("创建tag edge入参")
+public class GraphCreateTagEdge {
+
+ /**
+ * 空间名称
+ **/
+ @ApiModelProperty(value = "空间名称", example = "flceshi")
+ private String space;
+
+ @ApiModelProperty(value = "创建类型: tag/edge", example = "tag")
+ private String type;
+
+ @ApiModelProperty(value = "tag/edge名称", example = "demo")
+ private String tagEdgeName;
+
+ @ApiModelProperty(value = "tag/edge描述", example = "备注")
+ private String tagEdgeComment;
+
+ @ApiModelProperty(value = "属性集合")
+ private List propertyList;
+
+ @ApiModelProperty(value = "颜色")
+ private String color;
+}
diff --git a/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateVertex.java b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateVertex.java
new file mode 100644
index 00000000..c28318a0
--- /dev/null
+++ b/virtual-patient-graph/src/main/java/com/supervision/nebula/dto/graph/GraphCreateVertex.java
@@ -0,0 +1,38 @@
+package com.supervision.nebula.dto.graph;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@ApiModel("创建点入参")
+public class GraphCreateVertex {
+
+ /**
+ * 空间名称
+ **/
+ @ApiModelProperty(value = "空间名称", example = "flceshi", required = true)
+ private String space;
+
+ @ApiModelProperty(value = "标签tag名称", example = "t1", required = true)
+ private String tagName;
+
+ @ApiModelProperty(value = "标签tag属性集合", required = false)
+ private List tagList;
+ /**
+ * point的key
+ **/
+ @ApiModelProperty(value = "点的VID", required = true)
+ private Object pointKey;
+
+ @ApiModelProperty(value = "标签tag的属性值集合", required = false)
+ private List
-
- org.springframework.boot
- spring-boot-starter-websocket
-
-
org.springframework.boot
spring-boot-test
diff --git a/virtual-patient-web/src/main/java/com/supervision/VirtualPatientApplication.java b/virtual-patient-web/src/main/java/com/supervision/VirtualPatientApplication.java
index f1732f2c..1d74a13b 100644
--- a/virtual-patient-web/src/main/java/com/supervision/VirtualPatientApplication.java
+++ b/virtual-patient-web/src/main/java/com/supervision/VirtualPatientApplication.java
@@ -3,13 +3,9 @@ package com.supervision;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.ComponentScans;
import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.web.socket.config.annotation.EnableWebSocket;
@SpringBootApplication
@MapperScan(basePackages = {"com.supervision.**.mapper"})
diff --git a/virtual-patient-web/src/main/java/com/supervision/config/WebSocketConfig.java b/virtual-patient-web/src/main/java/com/supervision/config/WebSocketConfig.java
deleted file mode 100644
index b2aab455..00000000
--- a/virtual-patient-web/src/main/java/com/supervision/config/WebSocketConfig.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.supervision.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.TaskScheduler;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
-import org.springframework.web.socket.server.standard.ServerEndpointExporter;
-
-@Configuration
-public class WebSocketConfig {
-
- /**
- * 注入一个ServerEndpointExporter,该Bean会自动注册使用@ServerEndpoint注解申明的websocket endpoint
- */
- @Bean
- public ServerEndpointExporter serverEndpointExporter(){
- return new ServerEndpointExporter();
- }
-
- @Bean
- public TaskScheduler taskScheduler(){
- ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
- threadPoolTaskScheduler.setThreadNamePrefix("SockJS-");
- threadPoolTaskScheduler.setPoolSize(Runtime.getRuntime().availableProcessors());
- threadPoolTaskScheduler.setRemoveOnCancelPolicy(true);
- return threadPoolTaskScheduler;
- }
-
-}