Browse Source

获取图谱接口

gaodm 5 years ago
parent
commit
438cb90566

+ 1 - 1
ltkg-service/src/main/java/com/diagbot/dto/GraphLabelDTO.java

@@ -13,6 +13,6 @@ import java.util.List;
 @Getter
 @Setter
 public class GraphLabelDTO {
-    private List<String> allLabel;
+    private List<String> allRs;
     private List<GraphDTO> graphDTOS;
 }

+ 4 - 12
ltkg-service/src/main/java/com/diagbot/facade/KgFacade.java

@@ -1,6 +1,5 @@
 package com.diagbot.facade;
 
-import com.diagbot.dto.BaseNodeDTO;
 import com.diagbot.dto.BaseNodeRSDTO;
 import com.diagbot.dto.GraphDTO;
 import com.diagbot.dto.GraphLabelDTO;
@@ -28,24 +27,17 @@ public class KgFacade extends KgServiceImpl {
         if (ListUtil.isEmpty(res)) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS);
         } else {
-            List<String> allLabel = new ArrayList<>();
+            List<String> allRs = new ArrayList<>();
             for (GraphDTO graphDTO : res) {
-                if (!allLabel.contains(graphDTO.getLabel())) {
-                    allLabel.add(graphDTO.getLabel());
-                }
                 if (ListUtil.isNotEmpty(graphDTO.getENodeRSDTOS())) {
                     for (BaseNodeRSDTO baseNodeRSDTO : graphDTO.getENodeRSDTOS()) {
-                        if (ListUtil.isNotEmpty(baseNodeRSDTO.getENodeDTOS())) {
-                            for (BaseNodeDTO baseNodeDTO : baseNodeRSDTO.getENodeDTOS()) {
-                                if (!allLabel.contains(baseNodeDTO.getLabel())) {
-                                    allLabel.add(baseNodeDTO.getLabel());
-                                }
-                            }
+                        if (!allRs.contains(baseNodeRSDTO.getRType())) {
+                            allRs.add(baseNodeRSDTO.getRType());
                         }
                     }
                 }
             }
-            graphLabelDTO.setAllLabel(allLabel);
+            graphLabelDTO.setAllRs(allRs);
             graphLabelDTO.setGraphDTOS(res);
         }
         return graphLabelDTO;