|
@@ -1,8 +1,19 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.diagbot.dto.BaseNodeDTO;
|
|
|
+import com.diagbot.dto.BaseNodeRSDTO;
|
|
|
+import com.diagbot.dto.GraphDTO;
|
|
|
+import com.diagbot.dto.GraphLabelDTO;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.KgServiceImpl;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.vo.KgQueryVO;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* @Description: 用户日志业务层
|
|
|
* @author: gaodm
|
|
@@ -10,4 +21,33 @@ import org.springframework.stereotype.Component;
|
|
|
*/
|
|
|
@Component
|
|
|
public class KgFacade extends KgServiceImpl {
|
|
|
+
|
|
|
+ public GraphLabelDTO getGraphFac(KgQueryVO kgQueryVO) {
|
|
|
+ GraphLabelDTO graphLabelDTO = new GraphLabelDTO();
|
|
|
+ List<GraphDTO> res = this.getGraph(kgQueryVO);
|
|
|
+ if (ListUtil.isEmpty(res)) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS);
|
|
|
+ } else {
|
|
|
+ List<String> allLabel = 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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ graphLabelDTO.setAllLabel(allLabel);
|
|
|
+ graphLabelDTO.setGraphDTOS(res);
|
|
|
+ }
|
|
|
+ return graphLabelDTO;
|
|
|
+ }
|
|
|
}
|