allen 2 年之前
父節點
當前提交
a0df23144f

+ 1 - 1
kgraph-framework/src/main/java/com/kgraph/framework/config/SecurityConfig.java

@@ -119,7 +119,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/**/*.ttf","/**/*.woff").permitAll()
                 .antMatchers("/entcls/tree","/knowledge/class/entcls/tree").permitAll()
                 // TODO 给算法提供的文件下载
-                .antMatchers("/upload/uploadManage/download", "/extractKnowledge","/extract/subTask/saveKnowledge","/kg/create", "/kg/getAll", "/neo4j/relation/*", "/neo4j/entity/*").permitAll()
+                .antMatchers("/upload/uploadManage/download", "/extractKnowledge","/extract/subTask/saveKnowledge","/kg/create", "/kg/getAll", "/kg/getAllGraphVO", "/neo4j/relation/*", "/neo4j/entity/*").permitAll()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()

+ 7 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/controller/KgController.java

@@ -58,6 +58,13 @@ public class KgController extends BaseController {
         return AjaxResult.success(kgService.getAllRelationList());
     }
 
+    @GetMapping("/getAllGraphVO")
+    public AjaxResult getAllGraphVO() {
+        Iterable<Neo4jRelation> relationIterable = kgService.getAllRelationList();
+        List<Neo4jRelation> relationList = Neo4j2VOUtils.iterableToList(relationIterable);
+        return AjaxResult.success(Neo4j2VOUtils.relation2GraphVO(relationList));
+    }
+
     @GetMapping("/getRelationByName")
     public AjaxResult getRelationByName(String firstName, String secondName, int length) {
         // TODO length 的最大最小值,从数据字典获取

+ 14 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/uitils/Neo4j2VOUtils.java

@@ -50,4 +50,18 @@ public class Neo4j2VOUtils {
     public static EntityVO entity2VO(Neo4jEntity entity) {
         return new EntityVO(entity.getId(), entity.getName(), entity.getContent(), entity.getAttachmentUrl());
     }
+
+    /**
+     * 慎用!!!
+     * @param iterable
+     * @param <T>
+     * @return
+     */
+    public static <T> List<T> iterableToList(Iterable<T> iterable) {
+        List<T> list = new ArrayList<>();
+        for (T item : iterable) {
+            list.add(item);
+        }
+        return list;
+    }
 }

+ 0 - 0
sql/update20230420.sql → sql/update20230423.sql