瀏覽代碼

fix bug:全部关系总览页出现重复的边类型数据

lijie 3 年之前
父節點
當前提交
9a679808d9

+ 1 - 1
src/main/java/com/persagy/proxy/adm/constant/AdmRelationTypeEnum.java

@@ -250,7 +250,7 @@ public enum AdmRelationTypeEnum {
     /**
      *业务空间内的元空间关系 20210914新增-不对请修改
      */
-    SP2SI("","MechInArch","Sp2Si","","",false,true,false,false,false,false);
+    SP2SI("sp2si","MechInArch","Sp2Si","","",false,true,false,false,false,false);
     /**数据中心的关系类型*/
     private String relationType;
     /**图类型编码*/

+ 4 - 9
src/main/java/com/persagy/proxy/adm/service/impl/RelationReportService.java

@@ -1,14 +1,7 @@
 package com.persagy.proxy.adm.service.impl;
 
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 import org.springframework.beans.factory.annotation.Value;
@@ -558,12 +551,14 @@ public class RelationReportService implements IRelationReportService {
 		}
 		// 3.使用图类型定义的二级标签作为第一级
 		List<JSONObject> topList = new ArrayList<>();
+		Set<String> categoryIds = new HashSet<>();
 		for (GraphDefine graphDefine : graphDefines) {
 			GraphParentMes secondCategoryMes = graphDefine.getSecondCategoryMes();
 			if (null==secondCategoryMes){
 				continue;
 			}
-			if (!levelMap.containsKey(secondCategoryMes.getId())){
+			if (!categoryIds.contains(secondCategoryMes.getId())){
+				categoryIds.add(secondCategoryMes.getId());
 				topList.add(this.transfer(secondCategoryMes));
 			}
 			List<JSONObject> threeLevelList = levelMap.getOrDefault(graphDefine.getCode(), new ArrayList<>());