Browse Source

Merge remote-tracking branch 'origin/develop' into develop

lijie 2 years ago
parent
commit
54d0b43cac
56 changed files with 1131 additions and 672 deletions
  1. 47 4
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DiagramController.java
  2. 26 18
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/IconController.java
  3. 284 9
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java
  4. 72 141
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramDataLoader.java
  5. 19 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/AbstractLine.java
  6. 65 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/ConnectPoint.java
  7. 42 23
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Diagram.java
  8. 15 14
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Line.java
  9. 1 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/Container.java
  10. 1 6
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IContainer.java
  11. 22 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IEquipHolder.java
  12. 31 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/legend/Anchor.java
  13. 10 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/legend/Legend.java
  14. 9 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/MainPipe.java
  15. 2 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/dao/IconMapper.java
  16. 80 70
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/entity/ModelAdapter.java
  17. 7 20
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DemoDiagramManager.java
  18. 2 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/service/IconService.java
  19. 11 5
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/service/impl/IconServiceImpl.java
  20. 3 2
      adm-business/adm-diagram/src/main/resources/db.init/schema.sql
  21. 3 0
      adm-business/adm-diagram/src/main/resources/mapper/DiagramIcon.xml
  22. 14 18
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/adm/handler/RelationReportHandler.java
  23. 19 20
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/adm/handler/SpaceRelationInfoHandler.java
  24. 7 17
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/adm/strategy/RelationObjectContext.java
  25. 10 13
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/adm/utils/AdmExcelUtil.java
  26. 13 22
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/adm/utils/JSONEntityUtil.java
  27. 3 6
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/controller/AdmMepSystemCalcController.java
  28. 3 7
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/controller/AdmLabslController.java
  29. 7 13
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/controller/AdmPlanarController.java
  30. 15 10
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/controller/DataMigrationController.java
  31. 1 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/DefineInfoMigration.java
  32. 1 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/DefineTypeMigration.java
  33. 28 13
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/MigrationAbstractServiceImpl.java
  34. 5 4
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectDigitalMigration.java
  35. 66 5
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectRelationMigration.java
  36. 3 8
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmBuildingController.java
  37. 9 9
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmComponentController.java
  38. 2 64
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmEquipmentController.java
  39. 11 12
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmLocationPointController.java
  40. 3 7
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmProjectController.java
  41. 3 6
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmPropertyController.java
  42. 5 6
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmShaftController.java
  43. 5 7
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java
  44. 5 7
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmTenantController.java
  45. 9 11
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmVirtualWallController.java
  46. 9 10
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmWindowController.java
  47. 66 2
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/service/impl/AdmEquipmentServiceImpl.java
  48. 12 9
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java
  49. 1 2
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/relation/controller/RelationShContainSpBaseController.java
  50. 3 5
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/AdmRelationController.java
  51. 2 3
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/AdmRelationObjectController.java
  52. 8 5
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/AdmReportEquipController.java
  53. 18 11
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/AdmSpaceInfoController.java
  54. 4 6
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/ComponentStatisticsController.java
  55. 3 8
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/RelationReportController.java
  56. 6 8
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/service/impl/RelationReportService.java

+ 47 - 4
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DiagramController.java

@@ -1,11 +1,14 @@
 package com.persagy.adm.diagram.controller;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.adm.diagram.core.ContentParser;
 import com.persagy.adm.diagram.core.DataStrategy;
 import com.persagy.adm.diagram.core.model.Diagram;
 import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
 import com.persagy.adm.diagram.frame.BdtpRequest;
 import com.persagy.adm.diagram.manage.DemoDiagramManager;
+import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.ResultHelper;
 import io.swagger.annotations.ApiOperation;
@@ -16,9 +19,12 @@ import org.springframework.web.bind.annotation.GetMapping;
 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.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 
 /**
  * 系统图相关接口
@@ -36,6 +42,8 @@ public class DiagramController {
     private DataStrategy dataStrategy;
     @Autowired
     private DemoDiagramManager diagramManager;
+    @Autowired
+    private ContentParser parser;
 
     /**
      * 系统图列表接口
@@ -57,14 +65,49 @@ public class DiagramController {
     }
 
     /**
-     * 新增系统图
+     * 新增或修改系统图
      *
-     * @param diagram 系统图对象信息
-     * @return 是否成功
+     * @param params    参数集合
+     * @param projectId 项目id
+     * @param systemId  系统实例id
+     * @param groupCode 集团code
+     * @return 系统图信息
      */
     @ApiOperation("新增系统图")
     @PostMapping("/newDiagram")
-    public CommonResult<Diagram> newDiagram(@RequestBody Diagram diagram) {
+    public CommonResult<Diagram> newDiagram(@RequestBody Map<String, Object> params,
+                                            @RequestParam String projectId,
+                                            @RequestParam(required = false) String systemId,
+                                            @RequestParam String groupCode) {
+        Diagram diagram = new Diagram();
+        diagram.setGroupCode(groupCode);
+        diagram.setProjectId(projectId);
+        diagram.setSystemId(systemId);
+
+        Optional.ofNullable(params).ifPresent(map -> {
+            Optional.ofNullable(map.get("id")).ifPresent(o -> diagram.setId(String.valueOf(o)));
+            Optional.ofNullable(map.get("type")).ifPresent(o -> {
+                if (String.valueOf(o).length() < 4) {
+                    throw new BusinessException(ResponseCode.A0400.getCode(), "type参数非法");
+                }
+                diagram.setType(String.valueOf(o));
+                diagram.setSystem(String.valueOf(o).substring(0, 4));
+            });
+            Optional.ofNullable(map.get("name")).ifPresent(o -> diagram.setName(String.valueOf(o)));
+            Optional.ofNullable(map.get("remark")).ifPresent(o -> diagram.setRemark(String.valueOf(o)));
+            Optional.ofNullable(map.get("templateId")).ifPresent(o -> diagram.setTemplateId(String.valueOf(o)));
+            Optional.ofNullable(map.get("extraProps")).ifPresent(s -> {
+                Map<String, Object> m = parser.parseContent(parser.toJson(s), Map.class);
+                diagram.setExtraProp("state", m.get("state"));
+            });
+            Optional.ofNullable(map.get("lines")).ifPresent(lines ->
+                    diagram.setLines(parser.parseContent(parser.toJson(lines), List.class)));
+            Optional.ofNullable(map.get("nodes")).ifPresent(nodes ->
+                    diagram.setNodes(parser.parseContent(parser.toJson(nodes), List.class)));
+            Optional.ofNullable(map.get("template")).ifPresent(s ->
+                    diagram.setTemplate(parser.parseContent(parser.toJson(s), DiagramTemplate.class)));
+        });
+
         return ResultHelper.single(dataStrategy.saveDiagram(diagram));
     }
 

+ 26 - 18
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/IconController.java

@@ -1,5 +1,6 @@
 package com.persagy.adm.diagram.controller;
 
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpUtil;
 import com.persagy.adm.diagram.entity.IconEntity;
 import com.persagy.adm.diagram.frame.BdtpRequest;
@@ -21,11 +22,9 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.imageio.ImageIO;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.awt.*;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.List;
@@ -76,30 +75,32 @@ public class IconController {
             entity.setIconName(name);
             entity.setIconType(fileType);
         });
-
         InputStream inputStream = null;
-        Image img = null;
         try {
             inputStream = file.getInputStream();
-            img = ImageIO.read(file.getInputStream());
         } catch (IOException e) {
             e.printStackTrace();
         }
-        boolean isImage = img == null || img.getWidth(null) <= 0 || img.getHeight(null) <= 0;
-        if (null == inputStream || isImage) {
+        if (null == inputStream) {
             throw new BusinessException(ResponseCode.A0400.getCode(), "文件不能为空,并且必须是图片!");
         }
-
-        FileInfo fileInfo = FileInfoCreator.of(BdtpRequest.getCurrent().getGroupCode(), null,
-                null, entity.getIconName());
-        String fileId = FileStorageHelper.uploadFile(fileInfo, inputStream);
+        //如果图例存在(已上传),那么需要替换
+        IconEntity icon = iconService.getIconsByLegendId(legendId, skin);
+        if (null != icon) {
+            String s = FileStorageHelper.replaceFile(icon.getIconFileId(), entity.getIconName(), inputStream);
+            entity.setId(icon.getId());
+            entity.setIconFileId(s);
+        } else {
+            FileInfo fileInfo = FileInfoCreator.of(BdtpRequest.getCurrent().getGroupCode(), null,
+                    null, entity.getIconName());
+            String fileId = FileStorageHelper.uploadFile(fileInfo, inputStream);
+            entity.setIconFileId(fileId);
+        }
         try {
             inputStream.close();
         } catch (IOException e) {
             e.printStackTrace();
         }
-        entity.setIconFileId(fileId);
-
         return ResultHelper.single(iconService.saveIcon(entity));
 
     }
@@ -124,7 +125,14 @@ public class IconController {
         byte[] bytes = HttpUtil.downloadBytes(fileInfo.getFileDownloadUrl());
         ServletOutputStream out = null;
         try {
-            response.setHeader("Content-Type", "image/" + info.getIconType());
+            //svg格式文件的Content-Type:svg+xml;charset=utf-8   text/xml ,都可以
+            //element图片控件需要svg+xml
+            if (StrUtil.equalsIgnoreCase(info.getIconType(), "svg")) {
+                response.setHeader("Content-Type", "image/svg+xml;charset=utf-8");
+                //response.setHeader("Content-Type", "image/svg+xml");
+            } else {
+                response.setHeader("Content-Type", "image/" + info.getIconType());
+            }
             out = response.getOutputStream();
             out.write(bytes);
             out.flush();
@@ -142,15 +150,15 @@ public class IconController {
     }
 
     /**
-     * 根据图例id获取图标列表
+     * 根据图例id获取图标
      *
      * @param legendId 图例id
      * @return
      */
-    @ApiOperation("根据图例id获取图标列表")
+    @ApiOperation("根据图例id获取图")
     @GetMapping("/icons/legend")
-    public CommonResult<List<IconEntity>> getIconsByLegendId(String legendId) {
-        return ResultHelper.multi(iconService.getIconsByLegendId(legendId));
+    public CommonResult<IconEntity> getIconsByLegendId(String legendId) {
+        return ResultHelper.single(iconService.getIconsByLegendId(legendId, null));
     }
 
     /**

+ 284 - 9
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java

@@ -4,17 +4,19 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.persagy.adm.diagram.core.model.Diagram;
-import com.persagy.adm.diagram.core.model.EquipmentNode;
-import com.persagy.adm.diagram.core.model.Label;
+import com.persagy.adm.diagram.core.model.*;
 import com.persagy.adm.diagram.core.model.base.Container;
 import com.persagy.adm.diagram.core.model.base.IComponent;
+import com.persagy.adm.diagram.core.model.base.IEquipHolder;
+import com.persagy.adm.diagram.core.model.legend.Anchor;
 import com.persagy.adm.diagram.core.model.legend.Legend;
+import com.persagy.adm.diagram.core.model.logic.DataFilter;
+import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
+import com.persagy.adm.diagram.core.model.template.MainPipe;
 import com.persagy.adm.diagram.core.model.virtual.PackNode;
+import com.persagy.dmp.digital.entity.ObjectRelation;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
 
 /**
  * 处理系统图的计算逻辑
@@ -22,18 +24,96 @@ import java.util.List;
  */
 public class DiagramBuilder {
 
+	/**
+	 * 设备容器限制,避免模板设置不当导致过多节点
+	 */
+	public static int equipLimit = 50;
+
 	private Diagram diagram;
 
+	private DiagramTemplate template;
+
 	private DataStrategy dataStrategy;
 
 	private HashMap<String, List<Legend>> legendsCache = new HashMap<>();
 
+	private HashSet<String> refRelTypes = new HashSet<>();
+
+	/**
+	 * 记录已经使用的数据id和对应的组件
+	 */
+	private HashMap<String, Object> equipMap = new HashMap<>();
+
 	public DiagramBuilder(Diagram diagram, DataStrategy dataStrategy) {
 		this.diagram = diagram;
+		this.template = diagram.getTemplate();
 		this.dataStrategy = dataStrategy;
+
+		init();
+	}
+
+	private void init(){
+		//记录节点中已使用的数据id
+		diagram.getNodes().forEach(node -> {
+			if (EquipmentNode.TYPE.equals(node.getCompType()))
+				equipMap.put(((EquipmentNode) node).getObjId(), node);
+		});
+		//记录干管中已使用的数据id
+		if(template.getMainPipes() != null) {
+			template.getMainPipes().forEach(mainPipe -> {
+				if(StrUtil.isNotBlank(mainPipe.getDataObjectId()))
+					equipMap.put(mainPipe.getDataObjectId(), mainPipe);
+			});
+		}
+	}
+
+	//加载设备数据,并进行计算处理
+	public void buildEquipNodeAndContainer(List<Container> containers, List<ObjectNode> optionalObjs){
+		for(Container con : containers) {
+			if(con.isEquipmentBox()) {
+				Iterator<ObjectNode> iter = optionalObjs.iterator();
+				while (iter.hasNext()) {
+					ObjectNode obj = iter.next();
+					if (match(obj, con)) {
+						if(con.getEquipPack() != null)
+							addPackData(con, obj);
+						else
+							addEquipNode(con, obj);
+
+						iter.remove();
+					}
+				}
+			}
+		}
+		if(template.getMainPipes() != null) {
+			for(MainPipe mainPipe : template.getMainPipes()) {
+				if (mainPipe.isBindEquipment() && mainPipe.getDataObject() == null){
+					Iterator<ObjectNode> iter = optionalObjs.iterator();
+					while (iter.hasNext()) {
+						ObjectNode obj = iter.next();
+						if(match(obj, mainPipe)) {
+							mainPipe.setDataObject(obj);
+							mainPipe.setDataObjectId(obj.get("id").asText());
+
+							equipMap.put(mainPipe.getDataObjectId(), mainPipe);
+
+							iter.remove();
+							break;
+						}
+					}
+				}
+			}
+		}
+
+		handleNodes();
+
+		buildContainers(containers);
 	}
 
-	public void addEquipNode(Container con, ObjectNode obj){
+	private void addEquipNode(Container con, ObjectNode obj){
+		if(con.getChildren().size() > equipLimit)
+			return;
+
 		EquipmentNode node = new EquipmentNode();
 		node.setId(IdUtil.simpleUUID());
 		node.setObjId(obj.get("id").asText());
@@ -47,6 +127,8 @@ public class DiagramBuilder {
 			node.setLegendId(legend.getId());
 			node.setLegend(legend);
 		}
+
+		equipMap.put(node.getObjId(), node);
 	}
 
 	private void initNode(EquipmentNode node, String name, Container con){
@@ -61,7 +143,7 @@ public class DiagramBuilder {
 		diagram.getNodes().add(node);
 	}
 
-	public void addPackData(Container con, ObjectNode obj){
+	private void addPackData(Container con, ObjectNode obj){
 		PackNode pn = null;
 		String classCode = getClassCode(obj);
 		Legend legend = null;
@@ -107,6 +189,51 @@ public class DiagramBuilder {
 		return pn;
 	}
 
+	private boolean match(ObjectNode obj, IEquipHolder equipHolder) {
+		String classCode = DiagramBuilder.getClassCode(obj);
+		if(equipHolder.getEquipmentTypes() != null && equipHolder.getEquipmentTypes().contains(classCode)) {
+			DataFilter filter = equipHolder.getDataFilter();
+			if(filter != null)
+				return filter.filter(obj);
+			return true;
+		}
+		return false;
+	}
+
+	private void buildContainers(List<Container> containers) {
+		for(Container con : containers) {
+			if(con.isEquipmentBox()) {
+				if(Boolean.TRUE.equals(con.getProp(Container.PROP_AUTO_HIDDEN)) && CollUtil.isEmpty(con.getChildren()))
+					con.setHidden(true);
+			}
+		}
+	}
+
+	/**
+	 * 对节点进行处理,并返回图例锚点会使用到的关系类型
+	 */
+	private void handleNodes() {
+		for(DiagramNode node : diagram.getNodes()) {
+			if(PackNode.TYPE.equals(node.getCompType())) {
+				PackNode pn = (PackNode)node;
+				pn.getLabel().setContent(pn.getLabel().getContent() + ":" + pn.totalCount());
+				statRelTypes(pn);
+			} else if(EquipmentNode.TYPE.equals(node.getCompType())) {
+				statRelTypes((EquipmentNode)node);
+			}
+		}
+	}
+
+	private void statRelTypes(EquipmentNode equipmentNode){
+		List<Anchor> anchors = equipmentNode.getLegend().getAnchors();
+		if(anchors != null) {
+			for(Anchor anchor : anchors) {
+				if(anchor.getAcceptRelations() != null)
+					anchor.getAcceptRelations().forEach(rel -> refRelTypes.add(rel));
+			}
+		}
+	}
+
 	private String getTypeName(String classCode){
 		//TODO
 		return classCode;
@@ -154,6 +281,154 @@ public class DiagramBuilder {
 		l.setHeight(100);
 		return l;
 	}
+	
+	public void buildLines(List<ObjectNode> optionalRels){
+		for(ObjectNode rel : optionalRels) {
+			String from = rel.get(ObjectRelation.OBJ_FROM_HUM).asText();
+			String to = rel.get(ObjectRelation.OBJ_TO_HUM).asText();
+
+			Object fromObj = equipMap.get(from);
+			Object toObj = equipMap.get(to);
+
+			if(fromObj != null && toObj != null) {
+				String relType = rel.get(ObjectRelation.GRAPH_CODE_HUM).asText() + '/' + rel.get(ObjectRelation.REL_CODE_HUM).asText();
+				ConnectPoint p1 = getConnectPoint(fromObj, relType, toObj);
+				if(p1 != null) {
+					ConnectPoint p2 = getConnectPoint(toObj, relType, fromObj);
+					if(p2 != null) {
+						Line line = new Line();
+						line.setFrom(p1);
+						line.setTo(p2);
+						line.setRelType(relType);
+						line.setDataObject(rel);
+
+						addLine(line);
+					}
+				}
+			}
+		}
+
+		//test code TODO
+		EquipmentNode n1 = null;
+		EquipmentNode n2 = null;
+		for(Object o : equipMap.values()) {
+			if(o instanceof EquipmentNode){
+				String txt = ((EquipmentNode) o).getLabel().getContent();
+				if("1#进线柜".equals(txt))
+					n1 = (EquipmentNode) o;
+				else if("1#计量柜".equals(txt))
+					n2 = (EquipmentNode) o;
+			}
+		}
+		if(n1 != null && n2 != null) {
+			ConnectPoint p1 = new ConnectPoint();
+			p1.setHostType(EquipmentNode.TYPE);
+			p1.setHostId(n1.getId());
+			p1.setAnchorCode("T3");
+			p1.setHostObj(n1);
+			ConnectPoint p2 = new ConnectPoint();
+			p2.setHostType(EquipmentNode.TYPE);
+			p2.setHostId(n2.getId());
+			p2.setAnchorCode("B3");
+			p2.setHostObj(n2);
+			Line line = new Line();
+			line.setFrom(p1);
+			line.setTo(p2);
+			addLine(line);
+		}
+	}
+
+	private ConnectPoint getConnectPoint(Object obj, String  relType, Object theOtherEnd){
+		ObjectNode theOtherData = null;
+		if(theOtherEnd instanceof EquipmentNode)
+			theOtherData = (ObjectNode) ((EquipmentNode) theOtherEnd).getDataObject();
+		else if(theOtherEnd instanceof MainPipe)
+			theOtherData = (ObjectNode) ((MainPipe) theOtherEnd).getDataObject();
+		String theOtherType = getClassCode(theOtherData);
+
+		if(obj instanceof EquipmentNode) {
+			EquipmentNode en = (EquipmentNode)obj;
+			Anchor anchor = null;
+			List<Anchor> anchors = en.getLegend().getAnchors();
+			if(CollUtil.isNotEmpty(anchors)) {
+				Anchor anchor1 = null; //部分匹配
+				for (Anchor a : anchors) {
+					Boolean relMatch = null; //关系匹配
+					Boolean equipMatch = null; //另一端设备匹配
+
+					if(CollUtil.isNotEmpty(a.getAcceptRelations()))
+						relMatch = a.getAcceptRelations().contains(relType);
+
+					if(!Boolean.FALSE.equals(relMatch)) {
+						if(CollUtil.isNotEmpty(a.getToEquipmentTypes()))
+							equipMatch = a.getToEquipmentTypes().contains(theOtherType);
+						if(!Boolean.FALSE.equals(equipMatch) && a.getToDataFilter() != null)
+							equipMatch = a.getToDataFilter().filter(theOtherData);
+					}
+
+					if(!Boolean.FALSE.equals(relMatch) && !Boolean.FALSE.equals(equipMatch)) {
+						if(relMatch == null || equipMatch == null) {
+							//部分匹配
+							if(anchor1 == null)
+								anchor1 = a;
+							else if(CollUtil.isNotEmpty(anchor1.getLines()) && CollUtil.isEmpty(a.getLines()))
+								anchor1 = a;
+						} else {
+							//完全匹配
+							if(CollUtil.isEmpty(a.getLines())) {
+								anchor = a;
+								break;
+							} else if(anchor == null)
+								anchor = a;
+						}
+					}
+				}
+				if(anchor == null && anchor1 != null)
+					anchor = anchor1;
+			}
+
+			if(anchor != null) {
+				ConnectPoint cp = new ConnectPoint();
+				cp.setHostType(EquipmentNode.TYPE);
+				cp.setHostId(en.getId());
+				cp.setAnchorCode(anchor.getCode());
+				cp.setHostObj(en);
+				return cp;
+			}
+		} else if(obj instanceof MainPipe) {
+			MainPipe mp = (MainPipe)obj;
+			if(CollUtil.isEmpty(mp.getConnectEquips()) || mp.getConnectEquips().contains(theOtherType)) {
+				ConnectPoint cp = new ConnectPoint();
+				cp.setHostType(MainPipe.TYPE);
+				cp.setHostId(mp.getId());
+				cp.setHostObj(mp);
+				return cp;
+			}
+		}
+		return null;
+	}
+
+	private void addLine(Line line) {
+		markAnchorLine(line.getFrom(), line);
+		markAnchorLine(line.getTo(), line);
+		diagram.getLines().add(line);
+	}
+
+	private void markAnchorLine(ConnectPoint p, Line line){
+		if (StrUtil.isNotBlank(p.getAnchorCode())) {
+			EquipmentNode en = (EquipmentNode) p.getHostObj();
+			Anchor anchor = en.getLegend().getAnchor(p.getAnchorCode());
+			anchor.addLine(line);
+		}
+	}
+
+	public HashMap<String, Object> getEquipMap() {
+		return equipMap;
+	}
+
+	public HashSet<String> getRefRelTypes() {
+		return refRelTypes;
+	}
 
 	public static String getName(ObjectNode obj){
 		String name = null;
@@ -165,7 +440,7 @@ public class DiagramBuilder {
 	}
 
 	public static String getClassCode(ObjectNode obj){
-		if(obj.get("classCode") != null)
+		if(obj != null && obj.get("classCode") != null)
 			return obj.get("classCode").asText();
 		return null;
 	}

+ 72 - 141
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramDataLoader.java

@@ -5,13 +5,12 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.adm.diagram.core.model.Diagram;
 import com.persagy.adm.diagram.core.model.DiagramNode;
 import com.persagy.adm.diagram.core.model.EquipmentNode;
+import com.persagy.adm.diagram.core.model.Line;
 import com.persagy.adm.diagram.core.model.base.Container;
-import com.persagy.adm.diagram.core.model.logic.DataFilter;
+import com.persagy.adm.diagram.core.model.template.MainPipe;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 系统图数据加载
@@ -23,34 +22,37 @@ public class DiagramDataLoader {
 
 	private DataStrategy dataStrategy;
 
-	private List<Container> containers;
-
-	private List<ObjectNode> objs;
-
 	private List<ObjectNode> rels;
 
 	private List<ObjectNode> optionalObjs;
 
 	private List<ObjectNode> optionalRels;
 
-	private DiagramBuilder builder;
-
 	public DiagramDataLoader(Diagram diagram, DataStrategy dataStrategy) {
 		this.diagram = diagram;
 		this.dataStrategy = dataStrategy;
-		this.builder = new DiagramBuilder(diagram, dataStrategy);
 	}
 
-	public void load(){
+	/**
+	 * 加载已经保存的数据
+	 */
+	public void initLoad(){
 		List<String> objIds = diagram.getObjIds();
-		if(objIds.size() > 0)
-			objs = dataStrategy.loadObjectsById(objIds, diagram.getProjectId(), diagram.getGroupCode());
-		else
-			objs = new ArrayList<>();
-		buildNodes();
+		if(objIds.size() > 0) {
+			List<ObjectNode> objs = dataStrategy.loadObjectsById(objIds, diagram.getProjectId(), diagram.getGroupCode());
+			if(CollUtil.isNotEmpty(objs))
+				initNodes(objs);
+		}
+
+		List<String> relIds = diagram.getRelIds();
+		if(relIds.size() > 0) {
+			List<ObjectNode> rels = dataStrategy.loadRelationsById(relIds, diagram.getProjectId(), diagram.getGroupCode());
+			if(CollUtil.isNotEmpty(rels))
+				initLines(rels);
+		}
 	}
 
-	private void buildNodes() {
+	private void initNodes(List<ObjectNode> objs) {
 		HashMap<String, ObjectNode> objMap = new HashMap<>();
 		objs.forEach(obj -> objMap.put(obj.get("id").asText(), obj));
 
@@ -68,144 +70,73 @@ public class DiagramDataLoader {
 			if(obj != null)
 				node.setDataObject(obj);
 		}
-	}
 
-	public void autoLoad() {
-		//查询备选数据
-		List<String> equipTypes = new ArrayList<>();
-		if (diagram.getTemplate() != null) {
-			containers = diagram.getTemplate().getContainers();
-			for(Container con : containers) {
-				loadEquipTypes(con, equipTypes);
-			}
-		} else
-			containers = new ArrayList<>();
-
-		//TODO 数据查询,需要区分打包设备
-		if(equipTypes.size() > 0)
-			optionalObjs = dataStrategy.loadObjectsByType(equipTypes, diagram.getProjectId(), diagram.getSystemId(), diagram.getGroupCode());
-		else
-			optionalObjs = new ArrayList<>();
-
-		//去掉已经使用的数据项
-		HashMap<String, DiagramNode> nodeMap = new HashMap<>();
-		diagram.getNodes().forEach(node -> {
-			if(EquipmentNode.TYPE.equals(node.getCompType()))
-				nodeMap.put(((EquipmentNode) node).getObjId(), node);
-		});
-		if(nodeMap.size() > 0) {
-			Iterator<ObjectNode> iter = optionalObjs.iterator();
-			while (iter.hasNext()) {
-				ObjectNode obj = iter.next();
-				if(nodeMap.containsKey(obj.get("id").asText()))
-					iter.remove();
+		//设备类干管
+		if(diagram.getTemplate().getMainPipes() != null) {
+			for(MainPipe mainPipe : diagram.getTemplate().getMainPipes()) {
+				if(mainPipe.isBindEquipment()){
+					ObjectNode obj = objMap.get(mainPipe.getDataObjectId());
+					if(obj != null)
+						mainPipe.setDataObject(obj);
+				}
 			}
 		}
-
-		addEquipNodes();
-		buildContainers();
-
-		//TODO 关系查询,需要区分打包设备
-//		if(optionalObjs.size() > 0) {
-//			List<String> objIds = new ArrayList<>(optionalObjs.size());
-//			optionalObjs.forEach(obj -> objIds.add(obj.get("id").asText()));
-//			optionalRels = dataStrategy.loadRelationsByType(null, objIds, diagram.getProjectId(), diagram.getGroupCode());
-//		} else
-//			optionalRels = new ArrayList<>();
-
-		addLines();
 	}
 
-	private void loadEquipTypes(Container con, List<String> types){
-		if (con.getEquipmentTypes() != null) {
-			for (String type : con.getEquipmentTypes()) {
-				if (!types.contains(type))
-					types.add(type);
+	private void initLines(List<ObjectNode> rels){
+		HashMap<String, ObjectNode> relMap = new HashMap<>();
+		rels.forEach(obj -> relMap.put(obj.get("id").asText(), obj));
+
+		for(Line line : diagram.getLines()) {
+			if(line.getDataObjectId() != null){
+				ObjectNode rel = relMap.get(line.getDataObjectId());
+				if(rel != null)
+					line.setDataObject(rel);
 			}
 		}
 	}
 
-	private void addEquipNodes(){
+	/**
+	 * 搜索数据并自动加载
+	 */
+	public void autoLoad(DiagramBuilder builder) {
+		//查询备选数据
+		HashSet<String> equipTypes = new HashSet<>();
+		List<Container> containers = diagram.getTemplate().getContainers();
 		for(Container con : containers) {
-			for(ObjectNode obj : optionalObjs){
-				if (match(obj, con)) {
-					if(con.getEquipPack() != null)
-						builder.addPackData(con, obj);
-					else
-						builder.addEquipNode(con, obj);
-				}
+			if(con.getEquipmentTypes() != null)
+				equipTypes.addAll(con.getEquipmentTypes());
+		}
+		if(diagram.getTemplate().getMainPipes() != null) {
+			for(MainPipe mainPipe : diagram.getTemplate().getMainPipes()) {
+				if(mainPipe.getEquipmentTypes() != null) //TODO 过滤已经初始化加载数据的干管
+					equipTypes.addAll(mainPipe.getEquipmentTypes());
 			}
 		}
 
-		//test code
-//		for(ObjectNode obj : optionalObjs){
-//			EquipmentNode node = new EquipmentNode();
-//			node.setId(IdUtil.simpleUUID());
-//			node.setObjId(obj.get("id").asText());
-//			node.setObjClassCode(obj.get("classCode").asText());
-//			node.setDataObject(obj);
-//
-//			Label label = new Label();
-//			String content = null;
-//			if(obj.get("localName") != null)
-//				content = obj.get("localName").asText();
-//			if(StrUtil.isBlank(content))
-//				content = obj.get("name").asText();
-//			label.setContent(content);
-//			node.setLabel(label);
-//
-//			Container con = findContainer(node, obj);
-//			if(con != null) {
-//				diagram.getNodes().add(node);
-//
-//				con.addComp(node);
-//				node.setContainerId(con.getId());
-//				node.setLayoutIndex(con.getChildren().size() - 1);
-//
-//				Legend legend = findLegend(node, obj);
-//				if(legend != null) {
-//					node.setLegendId(legend.getId());
-//					node.setLegend(legend);
-//				}
-//			}
-//		}
-	}
+		//TODO 打包设备查询性能优化
+		if(equipTypes.size() > 0)
+			optionalObjs = dataStrategy.loadObjectsByType(new ArrayList<>(equipTypes), diagram.getProjectId(), diagram.getSystemId(), diagram.getGroupCode());
+		else
+			optionalObjs = new ArrayList<>();
+		//记录备选对象id列表
+		List<String> objIds = optionalObjs.stream().map(obj -> obj.get("id").asText()).collect(Collectors.toList());
 
-	//test code
-//	private Container findContainer(EquipmentNode node, ObjectNode obj){
-//		if(containers != null) {
-//			for(Container con : containers) {
-//				if(con.getEquipmentTypes() != null && con.getEquipmentTypes().contains(node.getObjClassCode())) {
-//					if(con.getChildren() == null || con.getChildren().size() == 0)
-//						return con;
-//				}
-//			}
-//		}
-//		return null;
-//	}
-
-	private boolean match(ObjectNode obj, Container con) {
-		String classCode = DiagramBuilder.getClassCode(obj);
-		if(con.getEquipmentTypes() != null && con.getEquipmentTypes().contains(classCode)) {
-			DataFilter filter = con.getDataFilter();
-			if(filter != null)
-				return filter.filter(obj);
-			return true;
-		}
-		return false;
-	}
+		//去掉已经使用的数据项
+		HashMap<String, Object> equipMap = builder.getEquipMap();
+		if(equipMap.size() > 0)
+			optionalObjs = optionalObjs.stream().filter(obj -> !equipMap.containsKey(obj.get("id").asText())).collect(Collectors.toList());
 
-	private void buildContainers() {
-		for(Container con : containers) {
-			if(con.isEquipmentBox()) {
-				if(Boolean.TRUE.equals(con.getProp(Container.PROP_AUTO_HIDDEN)) && CollUtil.isEmpty(con.getChildren()))
-					con.setHidden(true);
-			}
-		}
-	}
+		builder.buildEquipNodeAndContainer(containers, optionalObjs);
+		List<String[]> relTypes = builder.getRefRelTypes().stream().map(type -> type.split("/")).collect(Collectors.toList());
+
+		//TODO 关系查询,需要区分打包设备
+		if(objIds.size() > 0 && relTypes.size() > 0)
+			optionalRels = dataStrategy.loadRelationsByType(relTypes, objIds, diagram.getProjectId(), diagram.getGroupCode());
+		else
+			optionalRels = new ArrayList<>();
 
-	private void addLines(){
-		//System.out.println(optionalRels);
+		builder.buildLines(optionalRels);
 	}
 
 }

+ 19 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/AbstractLine.java

@@ -26,6 +26,17 @@ abstract public class AbstractLine {
 	 */
 	private Object dataObject;
 
+	/**
+	 * 设备对象或者关系的id
+	 */
+	@Expose
+	private String dataObjectId;
+
+	/**
+	 * 自动布局计算
+	 */
+	abstract public void layout(Object layoutContext);
+
 	public String getId() {
 		return id;
 	}
@@ -66,4 +77,12 @@ abstract public class AbstractLine {
 		this.dataObject = dataObject;
 	}
 
+	public String getDataObjectId() {
+		return dataObjectId;
+	}
+
+	public void setDataObjectId(String dataObjectId) {
+		this.dataObjectId = dataObjectId;
+	}
+
 }

+ 65 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/ConnectPoint.java

@@ -1,7 +1,9 @@
 package com.persagy.adm.diagram.core.model;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.google.gson.annotations.Expose;
 import com.persagy.adm.diagram.core.model.base.XY;
+import com.persagy.adm.diagram.core.model.legend.Anchor;
 
 /**
  * 线和图例的连接点
@@ -39,4 +41,67 @@ public class ConnectPoint {
 	 */
 	private XY location;
 
+	/**
+	 * 连接对象,运行时
+	 */
+	@JsonIgnore
+	private Object hostObj;
+
+	public void layout(){
+		if(hostObj instanceof EquipmentNode) {
+			XY pos = ((EquipmentNode) hostObj).getAnchorLocations().get(anchorCode);
+			location = ((EquipmentNode) hostObj).locationToRoot();
+			location.x += pos.x;
+			location.y += pos.y;
+		}
+	}
+
+	public String getHostType() {
+		return hostType;
+	}
+
+	public void setHostType(String hostType) {
+		this.hostType = hostType;
+	}
+
+	public String getHostId() {
+		return hostId;
+	}
+
+	public void setHostId(String hostId) {
+		this.hostId = hostId;
+	}
+
+	public String getAnchorCode() {
+		return anchorCode;
+	}
+
+	public void setAnchorCode(String anchorCode) {
+		this.anchorCode = anchorCode;
+	}
+
+	public Object getMainPipePoint() {
+		return mainPipePoint;
+	}
+
+	public void setMainPipePoint(Object mainPipePoint) {
+		this.mainPipePoint = mainPipePoint;
+	}
+
+	public XY getLocation() {
+		return location;
+	}
+
+	public void setLocation(XY location) {
+		this.location = location;
+	}
+
+	public Object getHostObj() {
+		return hostObj;
+	}
+
+	public void setHostObj(Object hostObj) {
+		this.hostObj = hostObj;
+	}
+
 }

+ 42 - 23
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Diagram.java

@@ -1,9 +1,12 @@
 package com.persagy.adm.diagram.core.model;
 
+import cn.hutool.core.util.StrUtil;
 import com.google.gson.annotations.Expose;
+import com.persagy.adm.diagram.core.DiagramBuilder;
 import com.persagy.adm.diagram.core.model.base.Container;
 import com.persagy.adm.diagram.core.model.base.XY;
 import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
+import com.persagy.adm.diagram.core.model.template.MainPipe;
 
 import java.util.*;
 
@@ -80,7 +83,7 @@ public class Diagram {
 	 * 连线列表
 	 */
 	@Expose
-	private List lines = new ArrayList();
+	private List<Line> lines = new ArrayList();
 
 	//运行时
 	private DiagramTemplate template;
@@ -103,32 +106,33 @@ public class Diagram {
 		}
 	}
 
-	public void layout(XY location){
-		this.layout(location, false);
+	public void layout(DiagramBuilder builder){
+		this.layout(builder, false);
 	}
 
-	public void layout(XY location, boolean absoluteLocation){
-		if(template != null) {
-			//TODO
-			template.layout(location);
-
-			if(absoluteLocation) {
-				for (DiagramNode node : nodes) {
-					node.setLocation(node.locationToRoot());
-					if(node instanceof EquipmentNode) {
-						EquipmentNode en = (EquipmentNode) node;
-						if(en.getAnchorLocations() != null) {
-							for(XY point : en.getAnchorLocations().values()){
-								point.x += en.getLocation().x;
-								point.y += en.getLocation().y;
-							}
-						}
-						if(en.getLabel() != null) {
-							XY point = en.getLabel().getLocation();
+	public void layout(DiagramBuilder builder, boolean absoluteLocation){
+		template.layout(new XY(0, 0));
+
+		for(Line line : lines) {
+			line.layout(builder);
+		}
+
+		if(absoluteLocation) {
+			for (DiagramNode node : nodes) {
+				node.setLocation(node.locationToRoot());
+				if(node instanceof EquipmentNode) {
+					EquipmentNode en = (EquipmentNode) node;
+					if(en.getAnchorLocations() != null) {
+						for(XY point : en.getAnchorLocations().values()){
 							point.x += en.getLocation().x;
 							point.y += en.getLocation().y;
 						}
 					}
+					if(en.getLabel() != null) {
+						XY point = en.getLabel().getLocation();
+						point.x += en.getLocation().x;
+						point.y += en.getLocation().y;
+					}
 				}
 			}
 		}
@@ -140,6 +144,21 @@ public class Diagram {
 			if(EquipmentNode.TYPE.equals(node.getCompType()))
 				ids.add(((EquipmentNode) node).getObjId());
 		}
+		if(template.getMainPipes() != null) {
+			for(MainPipe mainPipe : template.getMainPipes()) {
+				if(mainPipe.isBindEquipment() && StrUtil.isNotBlank(mainPipe.getDataObjectId()))
+					ids.add(mainPipe.getDataObjectId());
+			}
+		}
+		return ids;
+	}
+
+	public List<String> getRelIds(){
+		List<String> ids = new ArrayList<>();
+		for(Line line : lines) {
+			if(StrUtil.isNotBlank(line.getDataObjectId()))
+				ids.add(line.getDataObjectId());
+		}
 		return ids;
 	}
 
@@ -191,11 +210,11 @@ public class Diagram {
 		this.nodes = nodes;
 	}
 
-	public List getLines() {
+	public List<Line> getLines() {
 		return lines;
 	}
 
-	public void setLines(List lines) {
+	public void setLines(List<Line> lines) {
 		this.lines = lines;
 	}
 

+ 15 - 14
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Line.java

@@ -1,8 +1,10 @@
 package com.persagy.adm.diagram.core.model;
 
 import com.google.gson.annotations.Expose;
+import com.persagy.adm.diagram.core.DiagramBuilder;
 import com.persagy.adm.diagram.core.model.base.XY;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -33,12 +35,6 @@ public class Line extends AbstractLine {
 	private List<XY> passingPoints;
 
 	/**
-	 * 绑定的关系数据id
-	 */
-	@Expose
-	private String relId;
-
-	/**
 	 * 关系数据的类型, graphCode/relCode
 	 */
 	@Expose
@@ -55,6 +51,19 @@ public class Line extends AbstractLine {
 	 */
 	private List<XY> locationPath;
 
+	@Override
+	public void layout(Object layoutContext) {
+		DiagramBuilder builder = (DiagramBuilder) layoutContext;
+
+		locationPath = new ArrayList<>();
+		from.layout();
+		to.layout();
+		if(from.getLocation() != null && to.getLocation() != null) {
+			locationPath.add(from.getLocation());
+			locationPath.add(to.getLocation());
+		}
+	}
+
 	public int getDirection() {
 		return direction;
 	}
@@ -87,14 +96,6 @@ public class Line extends AbstractLine {
 		this.passingPoints = passingPoints;
 	}
 
-	public String getRelId() {
-		return relId;
-	}
-
-	public void setRelId(String relId) {
-		this.relId = relId;
-	}
-
 	public String getRelType() {
 		return relType;
 	}

+ 1 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/Container.java

@@ -191,6 +191,7 @@ public class Container extends AbstractComponent implements IContainer {
 		this.remark = remark;
 	}
 
+	@Override
 	public DataFilter getDataFilter() {
 		return dataFilter;
 	}

+ 1 - 6
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IContainer.java

@@ -6,7 +6,7 @@ import java.util.List;
  * 容器接口
  * @author zhaoyk
  */
-public interface IContainer extends IComponent {
+public interface IContainer extends IComponent, IEquipHolder {
 
     Layout getLayout();
 
@@ -18,9 +18,4 @@ public interface IContainer extends IComponent {
 
     void removeComp(String childId);
 
-    /**
-     * 可以放置的设备类型
-     */
-    List<String> getEquipmentTypes();
-
 }

+ 22 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IEquipHolder.java

@@ -0,0 +1,22 @@
+package com.persagy.adm.diagram.core.model.base;
+
+import com.persagy.adm.diagram.core.model.logic.DataFilter;
+
+import java.util.List;
+
+/**
+ * 设备承载接口
+ */
+public interface IEquipHolder {
+
+	/**
+	 * 可以放置、绑定的设备类型
+	 */
+	List<String> getEquipmentTypes();
+
+	/**
+	 * 数据对象过滤器
+	 */
+	DataFilter getDataFilter();
+
+}

+ 31 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/legend/Anchor.java

@@ -1,9 +1,13 @@
 package com.persagy.adm.diagram.core.model.legend;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.google.gson.annotations.Expose;
 import com.persagy.adm.diagram.core.model.Const;
+import com.persagy.adm.diagram.core.model.Line;
 import com.persagy.adm.diagram.core.model.base.XY;
+import com.persagy.adm.diagram.core.model.logic.DataFilter;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -34,6 +38,9 @@ public class Anchor {
 	private List<String> toEquipmentTypes; //连线另一端的设备类型
 
 	@Expose
+	private DataFilter toDataFilter; //连线另一端的设备过滤条件
+
+	@Expose
 	private boolean attachToOutline = true; //是否自动吸附到所在方向的边框上
 
 	@Expose
@@ -47,6 +54,12 @@ public class Anchor {
 
 	private float yOffset; //布局处理后的垂直偏移量
 
+	/**
+	 * 连线列表,运行时
+	 */
+	@JsonIgnore
+	private List<Line> lines;
+
 
 	public Anchor() {
 
@@ -56,6 +69,16 @@ public class Anchor {
 		this.code = code;
 	}
 
+	public List<Line> getLines() {
+		return lines;
+	}
+
+	public void addLine(Line line) {
+		if(lines == null)
+			lines = new ArrayList<>();
+		lines.add(line);
+	}
+
 	public String getCode() {
 		return code;
 	}
@@ -96,6 +119,14 @@ public class Anchor {
 		this.toEquipmentTypes = toEquipmentTypes;
 	}
 
+	public DataFilter getToDataFilter() {
+		return toDataFilter;
+	}
+
+	public void setToDataFilter(DataFilter toDataFilter) {
+		this.toDataFilter = toDataFilter;
+	}
+
 	public boolean isAttachToOutline() {
 		return attachToOutline;
 	}

+ 10 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/legend/Legend.java

@@ -66,6 +66,16 @@ public class Legend {
 	@Expose
 	private List<String> infos;
 
+	public Anchor getAnchor(String code){
+		if(anchors != null){
+			for(Anchor anchor : anchors) {
+				if(anchor.getCode().equals(code))
+					return anchor;
+			}
+		}
+		return null;
+	}
+
 	public String getId() {
 		return id;
 	}

+ 9 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/MainPipe.java

@@ -3,6 +3,7 @@ package com.persagy.adm.diagram.core.model.template;
 import com.google.gson.annotations.Expose;
 import com.persagy.adm.diagram.core.model.base.Container;
 import com.persagy.adm.diagram.core.model.AbstractLine;
+import com.persagy.adm.diagram.core.model.base.IEquipHolder;
 import com.persagy.adm.diagram.core.model.base.XY;
 import com.persagy.adm.diagram.core.model.logic.DataFilter;
 
@@ -13,7 +14,9 @@ import java.util.List;
  * 干管/线
  * @author zhaoyk
  */
-public class MainPipe extends AbstractLine {
+public class MainPipe extends AbstractLine implements IEquipHolder {
+
+	public static final String TYPE = "mainPipe";
 
 	@Expose
 	private String remark;
@@ -95,6 +98,7 @@ public class MainPipe extends AbstractLine {
 		this.connectEquips = connectEquips;
 	}
 
+	@Override
 	public List<String> getEquipmentTypes() {
 		return equipmentTypes;
 	}
@@ -111,6 +115,7 @@ public class MainPipe extends AbstractLine {
 		this.bindEquipment = bindEquipment;
 	}
 
+	@Override
 	public DataFilter getDataFilter() {
 		return dataFilter;
 	}
@@ -135,7 +140,9 @@ public class MainPipe extends AbstractLine {
 		this.locationPath = locationPath;
 	}
 
-	public void layout(DiagramTemplate template) {
+	@Override
+	public void layout(Object layoutContext) {
+		DiagramTemplate template = (DiagramTemplate)layoutContext;
 		locationPath = new ArrayList<>(path.size());
 		for (List<MainPipePoint> line : path) {
 			ArrayList<XY> list = new ArrayList<>();

+ 2 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/dao/IconMapper.java

@@ -18,9 +18,10 @@ public interface IconMapper extends BaseMapper<IconEntity> {
      * 获取某个图例下的所有图标
      *
      * @param legendId 图例id
+     * @param skin     图例皮肤
      * @return
      */
-    List<IconEntity> getIconsByLegendId(String legendId);
+    IconEntity getIconsByLegendId(String legendId, String skin);
 
     /**
      * 获取所有图标

+ 80 - 70
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/entity/ModelAdapter.java

@@ -1,93 +1,103 @@
 package com.persagy.adm.diagram.entity;
 
-import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
 import com.persagy.adm.diagram.core.ContentParser;
 import com.persagy.adm.diagram.core.model.Diagram;
 import com.persagy.adm.diagram.core.model.legend.Legend;
+import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * 运行时模型-实体 类型转换适配器
+ *
  * @author zhaoyk
  */
 @Service
 public class ModelAdapter {
 
-	@Autowired
-	private ContentParser parser;
+    @Autowired
+    private ContentParser parser;
+
+    public DiagramTemplate toTemplate(TemplateEntity templateEntity) {
+        DiagramTemplate template = parser.parseContent(templateEntity.getTemplateContent(), DiagramTemplate.class);
+        template.setId(templateEntity.getId());
+        template.setName(templateEntity.getName());
+        template.setCode(templateEntity.getCode());
+        template.setRemark(templateEntity.getRemark());
+        template.setDiagramType(templateEntity.getDiagramType());
+        return template;
+    }
 
-	public DiagramTemplate toTemplate(TemplateEntity templateEntity){
-		DiagramTemplate template = parser.parseContent(templateEntity.getTemplateContent(), DiagramTemplate.class);
-		template.setId(templateEntity.getId());
-		template.setName(templateEntity.getName());
-		template.setCode(templateEntity.getCode());
-		template.setRemark(templateEntity.getRemark());
-		template.setDiagramType(templateEntity.getDiagramType());
-		return template;
-	}
+    public TemplateEntity toTemplateEntity(DiagramTemplate template) {
+        TemplateEntity entity = new TemplateEntity();
+        entity.setId(template.getId());
+        entity.setName(template.getName());
+        entity.setCode(template.getCode());
+        entity.setRemark(template.getRemark());
+        entity.setDiagramType(template.getDiagramType());
+        entity.setTemplateContent(parser.toJson(template));
+        return entity;
+    }
 
-	public TemplateEntity toTemplateEntity(DiagramTemplate template){
-		TemplateEntity entity = new TemplateEntity();
-		entity.setId(template.getId());
-		entity.setName(template.getName());
-		entity.setCode(template.getCode());
-		entity.setRemark(template.getRemark());
-		entity.setDiagramType(template.getDiagramType());
-		entity.setTemplateContent(parser.toJson(template));
-		return entity;
-	}
+    public Legend toLegend(LegendEntity legendEntity) {
+        Legend legend = parser.parseContent(legendEntity.getLegendContent(), Legend.class);
+        legend.setId(legendEntity.getId());
+        legend.setName(legendEntity.getName());
+        legend.setCode(legendEntity.getCode());
+        legend.setRemark(legendEntity.getRemark());
+        legend.setSystem(legendEntity.getBtSystem());
+        return legend;
+    }
 
-	public Legend toLegend(LegendEntity legendEntity){
-		Legend legend = parser.parseContent(legendEntity.getLegendContent(), Legend.class);
-		legend.setId(legendEntity.getId());
-		legend.setName(legendEntity.getName());
-		legend.setCode(legendEntity.getCode());
-		legend.setRemark(legendEntity.getRemark());
-		legend.setSystem(legendEntity.getBtSystem());
-		return legend;
-	}
+    public LegendEntity toLegendEntity(Legend legend) {
+        LegendEntity entity = new LegendEntity();
+        entity.setId(legend.getId());
+        entity.setName(legend.getName());
+        entity.setCode(legend.getCode());
+        entity.setRemark(legend.getRemark());
+        entity.setBtSystem(legend.getSystem());
+        entity.setLegendContent(parser.toJson(legend));
+        return entity;
+    }
 
-	public LegendEntity toLegendEntity(Legend legend) {
-		LegendEntity entity = new LegendEntity();
-		entity.setId(legend.getId());
-		entity.setName(legend.getName());
-		entity.setCode(legend.getCode());
-		entity.setRemark(legend.getRemark());
-		entity.setBtSystem(legend.getSystem());
-		entity.setLegendContent(parser.toJson(legend));
-		return entity;
-	}
+    public Diagram toDiagram(DiagramEntity diagramEntity) {
+        //Diagram diagram = parser.parseContent(diagramEntity.getDiagramContent(), Diagram.class);
+        Diagram diagram = new Diagram();
+        Map map = parser.parseContent(diagramEntity.getDiagramContent(), Map.class);
+        diagram.setLines(parser.parseContent(parser.toJson(map.get("lines")), List.class));
+        diagram.setNodes(parser.parseContent(parser.toJson(map.get("nodes")), List.class));
+        diagram.setTemplate(parser.parseContent(parser.toJson(map.get("template")), DiagramTemplate.class));
 
-	public Diagram toDiagram(DiagramEntity diagramEntity) {
-		Diagram diagram = parser.parseContent(diagramEntity.getDiagramContent(), Diagram.class);
-		diagram.setId(diagramEntity.getId());
-		diagram.setName(diagramEntity.getName());
-		diagram.setRemark(diagramEntity.getRemark());
-		diagram.setType(diagramEntity.getType());
-		diagram.setTemplateId(diagramEntity.getTemplateId());
-		diagram.setSystem(diagramEntity.getBtSystem());
-		diagram.setProjectId(diagramEntity.getProjectId());
-		diagram.setSystemId(diagramEntity.getSystemId());
-		diagram.setGroupCode(diagramEntity.getGroupCode());
-		diagram.setExtraProp("state", diagramEntity.getState());
-		return diagram;
-	}
+        diagram.setId(diagramEntity.getId());
+        diagram.setName(diagramEntity.getName());
+        diagram.setRemark(diagramEntity.getRemark());
+        diagram.setType(diagramEntity.getType());
+        diagram.setTemplateId(diagramEntity.getTemplateId());
+        diagram.setSystem(diagramEntity.getBtSystem());
+        diagram.setProjectId(diagramEntity.getProjectId());
+        diagram.setSystemId(diagramEntity.getSystemId());
+        diagram.setGroupCode(diagramEntity.getGroupCode());
+        diagram.setExtraProp("state", diagramEntity.getState());
+        return diagram;
+    }
 
-	public DiagramEntity toDiagramEntity(Diagram diagram) {
-		DiagramEntity entity = new DiagramEntity();
-		entity.setId(diagram.getId());
-		entity.setName(diagram.getName());
-		entity.setRemark(diagram.getRemark());
-		entity.setType(diagram.getType());
-		entity.setTemplateId(diagram.getTemplateId());
-		entity.setBtSystem(diagram.getSystem());
-		entity.setProjectId(diagram.getProjectId());
-		entity.setSystemId(diagram.getSystemId());
-		entity.setGroupCode(diagram.getGroupCode());
-		entity.setState((String) diagram.getExtraProp("state"));
-		entity.setDiagramContent(parser.toJson(diagram));
-		return entity;
-	}
+    public DiagramEntity toDiagramEntity(Diagram diagram) {
+        DiagramEntity entity = new DiagramEntity();
+        entity.setId(diagram.getId());
+        entity.setName(diagram.getName());
+        entity.setRemark(diagram.getRemark());
+        entity.setType(diagram.getType());
+        entity.setTemplateId(diagram.getTemplateId());
+        entity.setBtSystem(diagram.getSystem());
+        entity.setProjectId(diagram.getProjectId());
+        entity.setSystemId(diagram.getSystemId());
+        entity.setGroupCode(diagram.getGroupCode());
+        entity.setState((String) diagram.getExtraProp("state"));
+        entity.setDiagramContent(parser.toJson(diagram));
+        return entity;
+    }
 
 }

+ 7 - 20
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DemoDiagramManager.java

@@ -4,18 +4,11 @@ import cn.hutool.core.util.IdUtil;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.adm.diagram.core.ContentParser;
-import com.persagy.adm.diagram.core.DiagramView;
-import com.persagy.adm.diagram.core.model.ConnectPoint;
-import com.persagy.adm.diagram.core.model.Label;
-import com.persagy.adm.diagram.core.model.Line;
-import com.persagy.adm.diagram.core.model.legend.Legend;
-import com.persagy.adm.diagram.core.model.style.BaseStyle;
-import com.persagy.adm.diagram.core.model.style.LineStyle;
-import com.persagy.adm.diagram.entity.DiagramType;
 import com.persagy.adm.diagram.core.DataStrategy;
+import com.persagy.adm.diagram.core.DiagramBuilder;
 import com.persagy.adm.diagram.core.DiagramDataLoader;
 import com.persagy.adm.diagram.core.model.Diagram;
-import com.persagy.adm.diagram.core.model.base.XY;
+import com.persagy.adm.diagram.entity.DiagramType;
 import com.persagy.adm.diagram.frame.BdtpRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -87,9 +80,10 @@ public class DemoDiagramManager {
 	private void buildDiagram(Diagram diagram, boolean layout){
 		loadTemplate(diagram);
 		diagram.init();
+		new DiagramDataLoader(diagram, dataStrategy).initLoad();
 
 		if(layout)
-			diagram.layout(new XY(0, 0));
+			diagram.layout(new DiagramBuilder(diagram, dataStrategy));
 	}
 
 	/**
@@ -142,9 +136,10 @@ public class DemoDiagramManager {
 		Diagram diagram = dataStrategy.getDiagram(diagramId);
 		buildDiagram(diagram, false);
 
-		loadData(diagram, autoLoad);
+		DiagramBuilder builder = new DiagramBuilder(diagram, dataStrategy);
+		new DiagramDataLoader(diagram, dataStrategy).autoLoad(builder);
 
-		diagram.layout(new XY(0, 0));
+		diagram.layout(builder);
 
 //		//test 输出数据结构
 //		try {
@@ -173,14 +168,6 @@ public class DemoDiagramManager {
 		return diagram;
 	}
 
-	private void loadData(Diagram diagram, boolean autoLoad){
-		DiagramDataLoader loader = new DiagramDataLoader(diagram, dataStrategy);
-		loader.load();
-
-		if(autoLoad)
-			loader.autoLoad();
-	}
-
 	/**
 	 * 保存系统图
 	 */

+ 2 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/service/IconService.java

@@ -32,9 +32,10 @@ public interface IconService {
      * 根据图例id获取所有图标
      *
      * @param legendId 图例id
+     * @param skin     图例皮肤
      * @return
      */
-    List<IconEntity> getIconsByLegendId(String legendId);
+    IconEntity getIconsByLegendId(String legendId, String skin);
 
     /**
      * 获取所有图标

+ 11 - 5
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/service/impl/IconServiceImpl.java

@@ -1,9 +1,9 @@
 package com.persagy.adm.diagram.service.impl;
 
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
 import com.persagy.adm.diagram.dao.IconMapper;
 import com.persagy.adm.diagram.entity.IconEntity;
-import com.persagy.adm.diagram.frame.BdtpRequest;
 import com.persagy.adm.diagram.service.IconService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -24,10 +24,15 @@ public class IconServiceImpl implements IconService {
      */
     @Override
     public IconEntity saveIcon(IconEntity entity) {
-
+        if (StrUtil.isNotBlank(entity.getId())) {
+            IconEntity icon = iconMapper.selectById(entity.getId());
+            if (null != icon) {
+                iconMapper.updateById(entity);
+                return entity;
+            }
+        }
         entity.setId(IdUtil.simpleUUID());
         iconMapper.insert(entity);
-
         return entity;
     }
 
@@ -37,14 +42,15 @@ public class IconServiceImpl implements IconService {
     }
 
     @Override
-    public List<IconEntity> getIconsByLegendId(String legendId) {
-        return iconMapper.getIconsByLegendId(legendId);
+    public IconEntity getIconsByLegendId(String legendId, String skin) {
+        return iconMapper.getIconsByLegendId(legendId, skin);
     }
 
     @Override
     public List<IconEntity> getIcons() {
         return iconMapper.getIcons();
     }
+
     /**
      * 根据系统类型获取所有图标
      *

+ 3 - 2
adm-business/adm-diagram/src/main/resources/db.init/schema.sql

@@ -86,12 +86,13 @@ CREATE TABLE IF NOT EXISTS `diagram_icon` (
   `system_type` varchar(40) DEFAULT NULL COMMENT '图标所属系统类型',
   `icon_size` varchar(255) DEFAULT NULL COMMENT '图标大小',
   `icon_file_id` varchar(255) NOT NULL COMMENT '图标对应的文件id',
-  `icon_skin` varchar(255) DEFAULT NULL COMMENT '图标皮肤',
+  `icon_skin` varchar(255) DEFAULT null COMMENT '图标皮肤',
   `creator` varchar(32) DEFAULT NULL COMMENT '创建人',
   `creation_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
   `modifier` varchar(32) DEFAULT NULL COMMENT '最后修改人',
   `modified_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间',
   `valid` tinyint DEFAULT 1 NOT NULL COMMENT '合法标识',
   `ts` timestamp default current_timestamp on update current_timestamp NOT NULL COMMENT '乐观锁',
-  PRIMARY KEY (`id`) USING BTREE
+  PRIMARY KEY (`id`) USING BTREE,
+  UNIQUE KEY `idx_legendId_skin`(`legend_id`, `icon_skin`) USING BTREE
 ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC COMMENT='图标表结构';

+ 3 - 0
adm-business/adm-diagram/src/main/resources/mapper/DiagramIcon.xml

@@ -29,6 +29,9 @@
         <include refid="baseSql"/>
         FROM diagram_icon
         WHERE valid = 1 AND legend_id=#{legendId}
+        <if test="null != skin and skin.length > 0">
+            AND icon_skin=#{skin}
+        </if>
     </select>
 
     <select id="getIcons" resultMap="iconBaseMap">

+ 14 - 18
adm-business/adm-middleware/src/main/java/com/persagy/proxy/adm/handler/RelationReportHandler.java

@@ -6,8 +6,6 @@ import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import com.persagy.dmp.define.entity.ObjectInfoDefine;
 import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.digital.entity.ObjectDigital;
@@ -49,13 +47,13 @@ public class RelationReportHandler {
 	 */
 	public List<EquipmentExcel> findEquipByNotSpace(String groupCode, String projectId) {
 		String equipment = AdmObjectType.EQUIPMENT.getIndex();
-		HashSet<String> equipments = Sets.newHashSet(equipment);
+		HashSet<String> equipments = CollUtil.newHashSet(equipment);
 		
 		// 1.获取所有的设备对象数据
 		List<OrderItem> classCodeAsc = Arrays.asList(OrderItem.asc("classCode"));
 		List<ObjectNode> equipList = this.relationReportService.queryObjects(null, groupCode, projectId, null, null, equipments, classCodeAsc);
 		if (CollectionUtil.isEmpty(equipList)) {
-			return Lists.newArrayList();
+			return CollUtil.newArrayList();
 		}
 				
 		// 2.获取所有的设备类定义的className
@@ -91,20 +89,20 @@ public class RelationReportHandler {
 		List<OrderItem> classCodeAsc = Arrays.asList(OrderItem.asc("classCode"));
 		
 		// 1.获取项目名称
-		List<ObjectNode> projects = this.relationReportService.queryObjects(null, groupCode, projectId, Sets.newHashSet(projectId), Sets.newHashSet(AdmObjectType.PROJECT.getIndex()), null, null);
+		List<ObjectNode> projects = this.relationReportService.queryObjects(null, groupCode, projectId, CollUtil.newHashSet(projectId), CollUtil.newHashSet(AdmObjectType.PROJECT.getIndex()), null, null);
 		if (CollectionUtil.isEmpty(projects)) {
-			return Lists.newArrayList();
+			return CollUtil.newArrayList();
 		}
 		String projectName = projects.get(0).has("localName") ? projects.get(0).get("localName").asText() : null;
 		
 		// 2.获取所有的设备对象数据
-		List<ObjectNode> equipList = this.relationReportService.queryObjects(null, groupCode, projectId, null, null, Sets.newHashSet(equipment), classCodeAsc);
+		List<ObjectNode> equipList = this.relationReportService.queryObjects(null, groupCode, projectId, null, null, CollUtil.newHashSet(equipment), classCodeAsc);
 		if (CollectionUtil.isEmpty(equipList)) {
-			return Lists.newArrayList();
+			return CollUtil.newArrayList();
 		}
 		
 		// 3.获取所有的设备、系统类定义信息
-		List<ObjectTypeDefine> classInfo = this.relationReportService.queryClassList(groupCode, projectId, null, Sets.newHashSet(equipment, AdmObjectType.SYSTEM.getIndex()), null);
+		List<ObjectTypeDefine> classInfo = this.relationReportService.queryClassList(groupCode, projectId, null, CollUtil.newHashSet(equipment, AdmObjectType.SYSTEM.getIndex()), null);
 		/** key-equipCode, value-equipName */
 		Map<String, String> equipTemp = new HashMap<String, String>();
 		/** key-systemCode, value-systemName */
@@ -131,28 +129,26 @@ public class RelationReportHandler {
 	 * @return
 	 */
 	public List<EquipmentCountExcel> countClassCodeEquip(String groupCode, String projectId) {
-		String equipment = AdmObjectType.EQUIPMENT.getIndex();
-		
 		List<OrderItem> classCodeAsc = Collections.singletonList(OrderItem.asc("classCode"));
 		
 		// 1.获取项目名称
 		List<ObjectNode> projects = this.relationReportService.queryObjects(null, groupCode, projectId,
-				Sets.newHashSet(projectId), Sets.newHashSet(AdmObjectType.PROJECT.getIndex()), null, null);
+				CollUtil.newHashSet(projectId), CollUtil.newHashSet(AdmObjectType.PROJECT.getIndex()), null, null);
 		if (CollectionUtil.isEmpty(projects)) {
-			return Lists.newArrayList();
+			return CollUtil.newArrayList();
 		}
 		String projectName = projects.get(0).has("localName") ? projects.get(0).get("localName").asText() : null;
 		
 		// 2.获取所有的设备对象数据
 		List<ObjectNode> equipList = this.relationReportService.queryObjects(null, groupCode, projectId,
-				null, null, Sets.newHashSet(equipment), classCodeAsc);
+				null, null, CollUtil.newHashSet(AdmObjectType.EQUIPMENT.getIndex()), classCodeAsc);
 		if (CollectionUtil.isEmpty(equipList)) {
-			return Lists.newArrayList();
+			return CollUtil.newArrayList();
 		}
 		
 		// 3.获取所有的设备、系统类定义信息
 		List<ObjectTypeDefine> classInfo = this.relationReportService.queryClassList(groupCode, projectId,
-				null, Sets.newHashSet(equipment, AdmObjectType.SYSTEM.getIndex()), null);
+				null, CollUtil.newHashSet(AdmObjectType.EQUIPMENT.getIndex(), AdmObjectType.SYSTEM.getIndex()), null);
 		/** key-equipCode, value-equipName */
 		Map<String, String> equipTemp = new HashMap<String, String>();
 		/** key-systemCode, value-systemName */
@@ -266,7 +262,7 @@ public class RelationReportHandler {
 			if (infoCodes.containsKey(classCode)) {
 				infoCodes.get(classCode).add(infoDefine.getCode());
 			} else {
-				infoCodes.put(classCode, Sets.newHashSet(infoDefine.getCode()));
+				infoCodes.put(classCode, CollUtil.newHashSet(infoDefine.getCode()));
 			}
 		}
 		
@@ -367,7 +363,7 @@ public class RelationReportHandler {
 			if (infoCodes.containsKey(classCode)) {
 				infoCodes.get(classCode).add(infoDefine.getCode());
 			} else {
-				infoCodes.put(classCode, Sets.newHashSet(infoDefine.getCode()));
+				infoCodes.put(classCode, CollUtil.newHashSet(infoDefine.getCode()));
 			}
 		}
 		funidList.clear(); 	//即时清空

+ 19 - 20
adm-business/adm-middleware/src/main/java/com/persagy/proxy/adm/handler/SpaceRelationInfoHandler.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.adm.handler;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.util.StrUtil;
@@ -7,8 +8,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.digital.entity.ObjectDigital;
@@ -60,13 +59,13 @@ public class SpaceRelationInfoHandler {
 		
 		String floorId = request.getFloorId();
 		String buildingId = request.getBuildingId();
-		Set<String> zoneTypeList = StrUtil.isNotEmpty(request.getZoneType()) ? Sets.newHashSet(request.getZoneType()) 
-				: (request.getZoneTypeList() == null ? Sets.newHashSet() : request.getZoneTypeList());
+		Set<String> zoneTypeList = StrUtil.isNotEmpty(request.getZoneType()) ? CollUtil.newHashSet(request.getZoneType())
+				: (request.getZoneTypeList() == null ? CollUtil.newHashSet() : request.getZoneTypeList());
 		
 		if (StrUtil.isNotBlank(buildingId) && StrUtil.isNotBlank(floorId) && !"isnull".equals(floorId)) {
 			// 当建筑ID不为空、楼层ID不为空时
 			String graphAndRelKey = GraphCodeEnum.ArchForArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Sp2Fl.name();
-			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId), null);
+			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, CollUtil.newHashSet(buildingId), null);
 			if (CollectionUtil.isNotEmpty(allRelations)) {
 				resultList = this.transferSpaceInfo(allRelations, buildingId, floorId);
 			}
@@ -78,7 +77,7 @@ public class SpaceRelationInfoHandler {
 		} else if (StrUtil.isNotBlank(buildingId) && StrUtil.isBlank(floorId) && !"isnull".equals(buildingId)) {
 			// 当建筑ID不为空、楼层ID为空时
 			String graphAndRelKey = GraphCodeEnum.ArchForArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Sp2Bd.name();
-			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId), null);
+			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, CollUtil.newHashSet(buildingId), null);
 			if (CollectionUtil.isNotEmpty(allRelations)) {
 				resultList = this.transferSpaceInfo(allRelations, buildingId, null);
 			}
@@ -89,15 +88,15 @@ public class SpaceRelationInfoHandler {
 			
 		} else if (StrUtil.isBlank(buildingId) && StrUtil.isBlank(floorId)) {
 			// 直接获取所有的空间数据
-			List<ObjectNode> spacelist = this.relationReportService.queryObjects(criteria, groupCode, projectId, null, zoneTypeList, 
-					Sets.newHashSet(AdmObjectType.SPACE.getIndex()), orderItem);
+			List<ObjectNode> spacelist = this.relationReportService.queryObjects(criteria, groupCode, projectId, null, zoneTypeList,
+					CollUtil.newHashSet(AdmObjectType.SPACE.getIndex()), orderItem);
 			resultList = this.fillSpaceInfo(spacelist, null, null);
 		}
 		
 		result.put("zoneType", request.getZoneType());
 		result.put("floorId", request.getFloorId());
 		result.put("total", CollectionUtil.isEmpty(resultList) ? 0 : resultList.size());
-		result.put("content", CollectionUtil.isEmpty(resultList) ? Lists.newArrayList() : resultList);
+		result.put("content", CollectionUtil.isEmpty(resultList) ? CollUtil.newArrayList() : resultList);
 		return result;
 	}
 	
@@ -118,7 +117,7 @@ public class SpaceRelationInfoHandler {
 		Set<String> floorIds = new HashSet<String>();
 		Set<String> notBuildSpace = new HashSet<String>();
 		// 获取所有的楼层ID集合
-		List<ObjectRelation> relationObjects = this.queryObjectRelation(groupCode, projectId, GraphCodeEnum.ArchForArch.name(), RelCodeEnum.Fl2Bd.name(), null, Sets.newHashSet(buildingId));
+		List<ObjectRelation> relationObjects = this.queryObjectRelation(groupCode, projectId, GraphCodeEnum.ArchForArch.name(), RelCodeEnum.Fl2Bd.name(), null, CollUtil.newHashSet(buildingId));
 		
 		// 获取所有楼层下的空间数据
 		if (CollectionUtil.isNotEmpty(relationObjects)) {
@@ -132,7 +131,7 @@ public class SpaceRelationInfoHandler {
 				spaceIds.add(objectRelation.getObjFrom());
 			}
 			// 再获取此建筑下,不是这些空间的空间
-			relationObjects = this.queryObjectRelation(groupCode, projectId, GraphCodeEnum.ArchForArch.name(), RelCodeEnum.Sp2Bd.name(), null, Sets.newHashSet(buildingId));
+			relationObjects = this.queryObjectRelation(groupCode, projectId, GraphCodeEnum.ArchForArch.name(), RelCodeEnum.Sp2Bd.name(), null, CollUtil.newHashSet(buildingId));
 			for (ObjectRelation objectRelation : relationObjects) {
 				if (!spaceIds.contains(objectRelation.getObjFrom())) {
 					notBuildSpace.add(objectRelation.getObjFrom());
@@ -141,14 +140,14 @@ public class SpaceRelationInfoHandler {
 			
 			if (CollectionUtil.isNotEmpty(notBuildSpace)){
 				// 获取所有的对象数据
-				resultList = this.relationReportService.queryObjects(null, groupCode, projectId, notBuildSpace, zoneTypeList, 
-    					Sets.newHashSet(AdmObjectType.SPACE.getIndex()), orderItem);
+				resultList = this.relationReportService.queryObjects(null, groupCode, projectId, notBuildSpace, zoneTypeList,
+						CollUtil.newHashSet(AdmObjectType.SPACE.getIndex()), orderItem);
     			this.fillSpaceInfo(resultList, buildingId, null);
             }
 		} else {
 			// 获取所有的空间数据
 			String graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Fl.name();
-			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId), null);
+			List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, CollUtil.newHashSet(buildingId), null);
 			if (CollectionUtil.isNotEmpty(allRelations)) {
 				resultList = this.transferSpaceInfo(allRelations, buildingId, null);
 			}
@@ -172,14 +171,14 @@ public class SpaceRelationInfoHandler {
 			Set<String> zoneTypeList, List<OrderItem> orderItem) {
 		List<ObjectNode> resultList = null;
 		// 获取所有的建筑ID集合
-		List<ObjectNode> buildList = this.relationReportService.queryObjects(null, groupCode, projectId, null, null, 
-				Sets.newHashSet(AdmObjectType.BUILDING.getIndex()), orderItem);
+		List<ObjectNode> buildList = this.relationReportService.queryObjects(null, groupCode, projectId, null, null,
+				CollUtil.newHashSet(AdmObjectType.BUILDING.getIndex()), orderItem);
 		if (CollectionUtil.isNotEmpty(buildList)) {
 			for (ObjectNode objectNode : buildList) {
 				String buildingId = objectNode.get("id").asText();
 				// 获取所有的空间数据
 				String graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Fl.name();
-				List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, Sets.newHashSet(buildingId), null);
+				List<ObjectDigital> allRelations = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey, null, CollUtil.newHashSet(buildingId), null);
 				if (CollectionUtil.isNotEmpty(allRelations)) {
 					// 获取所有的对象数据
 					resultList = this.transferSpaceInfo(allRelations, buildingId, null);
@@ -187,8 +186,8 @@ public class SpaceRelationInfoHandler {
 			}
 		} else {
 			// 获取所有的空间数据
-			List<ObjectNode> spacelist = this.relationReportService.queryObjects(criteria, groupCode, projectId, null, zoneTypeList, 
-					Sets.newHashSet(AdmObjectType.SPACE.getIndex()), orderItem);
+			List<ObjectNode> spacelist = this.relationReportService.queryObjects(criteria, groupCode, projectId, null, zoneTypeList,
+					CollUtil.newHashSet(AdmObjectType.SPACE.getIndex()), orderItem);
 			resultList = this.fillSpaceInfo(spacelist, null, null);
 		}
 		
@@ -299,7 +298,7 @@ public class SpaceRelationInfoHandler {
 	 */
 	private List<ObjectRelation> queryObjectRelation(String groupCode, String projectId, String graphCode, String relCode, Set<String> objFroms, Set<String> objTos) {
 		List<ObjectRelation> relationObjects = this.relationReportService.findRelationObjects(groupCode, projectId, graphCode, relCode, objFroms, objTos);
-		return CollectionUtil.isEmpty(relationObjects) ? Lists.newArrayList() : relationObjects;
+		return CollectionUtil.isEmpty(relationObjects) ? CollUtil.newArrayList() : relationObjects;
 	}
 
 }

+ 7 - 17
adm-business/adm-middleware/src/main/java/com/persagy/proxy/adm/strategy/RelationObjectContext.java

@@ -1,20 +1,18 @@
 package com.persagy.proxy.adm.strategy;
 
-import java.util.*;
-
-import javax.annotation.Resource;
-
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
-import org.springframework.stereotype.Component;
-
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Lists;
 import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.proxy.adm.constant.AdmRelationType;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.strategy.relationdata.RelationObjectStrategy;
 import com.persagy.proxy.report.model.AdmRelationObject;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.*;
 
 /**
  * 获取关系对象的上下文类
@@ -50,7 +48,7 @@ public class RelationObjectContext {
 	 */
 	public List<AdmRelationObject> exportRelationObject(String groupCode, String projectId, String relType) {
 		RelationObjectStrategy strategy = this.relationObjectStrategyMap.get(relType);
-		return strategy == null ? Lists.newArrayList() : strategy.exportRelationObject(groupCode, projectId);
+		return strategy == null ? CollUtil.newArrayList() : strategy.exportRelationObject(groupCode, projectId);
 	}
 	
 	/**
@@ -61,7 +59,6 @@ public class RelationObjectContext {
 	 * @param projectId
 	 * @param relType graphCode_relCode
 	 * @param code 获取对象的依据
-	 * @param admRelType ADM定义的类型
 	 * @return String - 校验失败的原因, ObjectNode -- BDTP接口的参数,不会返回null,请用instanceOf 判断返回值
 	 */
 	public Object checkRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String relType, String code, AdmRelationTypeEnum typeEnum) {
@@ -101,8 +98,6 @@ public class RelationObjectContext {
 
 	/**
 	 * 批量保存对象之间的关系
-	 * 
-	 * @param admRelationObject
 	 * @param groupCode
 	 * @param projectId
 	 * @param relType graphCode_relCode
@@ -134,9 +129,6 @@ public class RelationObjectContext {
 
 	/**
 	 * 查询全部的关系对象数据
-	 * 
-	 * @param masterObjs 查询的数据集存储地方
-	 * @param requestData 请求参数
 	 * @param groupCode 集团编码
 	 * @param projectId 项目ID
 	 * @param relType  graphCode_relCode
@@ -148,13 +140,11 @@ public class RelationObjectContext {
 		if (strategy == null && typeEnum != null) {
 			strategy = this.relationObjectStrategyMap.get(AdmRelationType.DEFAULT_RELATION_OBJECT);
 		}
-		return strategy == null ? Lists.newArrayList() : strategy.queryAllRelations(groupCode, projectId, mainContent, slaveContent, typeEnum);
+		return strategy == null ? CollUtil.newArrayList() : strategy.queryAllRelations(groupCode, projectId, mainContent, slaveContent, typeEnum);
 	}
 	
 	/**
 	 * 分页查询关系对象数据
-	 * 
-	 * @param masterObjs 查询的数据集存储地方
 	 * @param requestData 请求参数
 	 * @param groupCode 集团编码
 	 * @param projectId 项目ID

+ 10 - 13
adm-business/adm-middleware/src/main/java/com/persagy/proxy/adm/utils/AdmExcelUtil.java

@@ -1,5 +1,13 @@
 package com.persagy.proxy.adm.utils;
 
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.request.AdmResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.util.ResourceUtils;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -7,17 +15,6 @@ import java.io.IOException;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 
-import org.apache.poi.ss.usermodel.Workbook;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.springframework.util.ResourceUtils;
-
-import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Lists;
-import com.persagy.proxy.adm.constant.AdmCommonConstant;
-import com.persagy.proxy.adm.request.AdmResponse;
-
-import lombok.extern.slf4j.Slf4j;
-
 /**
  * 
  * @version 1.0.0
@@ -142,7 +139,7 @@ public class AdmExcelUtil {
 		content.put("failCount", failCount);
 		
 		AdmResponse failure = AdmResponse.failure(message);
-		failure.setContent(Lists.newArrayList(content));
+		failure.setContent(CollUtil.newArrayList(content));
 		return failure;
 	}
 	
@@ -159,7 +156,7 @@ public class AdmExcelUtil {
 		content.put("state", getState(successCount, failCount));
 		content.put("successCount", successCount);
 		content.put("failCount", failCount);
-		AdmResponse success = AdmResponse.success(Lists.newArrayList(content));
+		AdmResponse success = AdmResponse.success(CollUtil.newArrayList(content));
 		success.setMessage(message);
 		return success;
 	}

+ 13 - 22
adm-business/adm-middleware/src/main/java/com/persagy/proxy/adm/utils/JSONEntityUtil.java

@@ -1,32 +1,23 @@
 package com.persagy.proxy.adm.utils;
 
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.lang.Filter;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.ReflectUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.*;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Sets;
 import com.persagy.dmp.common.constant.ResponseCode;
 import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.proxy.object.model.AdmSpace;
 
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.lang.Filter;
-import cn.hutool.core.map.MapUtil;
-import cn.hutool.core.util.ReflectUtil;
-import cn.hutool.core.util.StrUtil;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.*;
 
 /**
  * 
@@ -49,13 +40,13 @@ public class JSONEntityUtil {
 		
 		JsonNode readTree = objectMapper.readTree(temp);
 		ObjectNode objectNode = (ObjectNode)readTree;
-		AdmSpace entity = toEntity(objectNode, AdmSpace.class, Sets.newHashSet("infos"), null);
+		AdmSpace entity = toEntity(objectNode, AdmSpace.class, CollUtil.newHashSet("infos"), null);
 		System.out.println(entity.getBuildingId());
 		
 		temp = "[{\"id\":\"Sp120901020301e9cc2ebdb24afeb89e3048153342d0\",\"projectId\":\"Pj1209010203\",\"name\":\"空间-M8Z77\",\"localId\":\"45343555\",\"localName\":\"12.11.43413.\",\"classCode\":\"DomesticWaterSupplyZone\",\"groupCode\":\"QKZZ\",\"infos\":{\"floorId\":\"Fl1209010203008c60dd3fcf45d5bc361d46989f1dab\",\"zoneType\":\"DomesticWaterSupplyZone\",\"buildingId\":\"Bd120901020324de2bf7c9b4442d907c6f5400945894\",\"height\":1.0},\"createTime\":1634983298000,\"objectType\":\"space\"}]";
 		readTree = objectMapper.readTree(temp);
 		ArrayNode arrayNode = (ArrayNode)readTree;
-		List<AdmSpace> list = toEntity(arrayNode, AdmSpace.class, Sets.newHashSet("infos"));
+		List<AdmSpace> list = toEntity(arrayNode, AdmSpace.class, CollUtil.newHashSet("infos"));
 		System.out.println(list.get(0).getBuildingId());
 	}
 	
@@ -108,7 +99,7 @@ public class JSONEntityUtil {
      * @throws IOException
      */
     public static <T> List<T> toEntity(ArrayNode array, Class<T> clazz, String extraColumn) throws JsonParseException, JsonMappingException, IOException {
-        return toEntity(array, clazz, Sets.newHashSet(extraColumn));
+        return toEntity(array, clazz, CollUtil.newHashSet(extraColumn));
     }
     
 	/**

+ 3 - 6
adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/controller/AdmMepSystemCalcController.java

@@ -1,16 +1,13 @@
 package com.persagy.proxy.calculation.controller;
 
-import com.persagy.proxy.calculation.model.AdmMepSourceTypeEntity;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.calculation.service.AdmMepSystemCalcService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
+import com.persagy.proxy.calculation.model.AdmMepSourceTypeEntity;
+import com.persagy.proxy.calculation.service.AdmMepSystemCalcService;
 import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
-
 /***
  * Description: 机电管网系统关系计算
  * @author : lijie
@@ -45,7 +42,7 @@ public class AdmMepSystemCalcController {
      * Update By lijie 2021/9/14 23:20
      */
     @GetMapping("query")
-    public AdmResponse query(@QueryParam("calcName") String calcName) {
+    public AdmResponse query(@RequestParam(value = "calcName") String calcName) {
         return admMepSystemCalcService.query(AdmContextUtil.toDmpContext(), calcName);
     }
 

+ 3 - 7
adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/controller/AdmLabslController.java

@@ -19,12 +19,8 @@ import com.persagy.proxy.report.service.IAdmLabslService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 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 org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -82,7 +78,7 @@ public class AdmLabslController {
      * @throws Exception
      */
     @PostMapping("/building/floor")
-    public AdmResponse queryBuildFloor(@QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse queryBuildFloor(@RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return service.queryBuildFloor(context, AdmObjectInfo.class);
     }
@@ -203,7 +199,7 @@ public class AdmLabslController {
      * @throws Exception
      */
     @PostMapping("/major/category")
-    public AdmResponse queryMajorCategory(@QueryParam("projectId") String projectId,
+    public AdmResponse queryMajorCategory(@RequestParam(value = "projectId",required = false) String projectId,
                                           @RequestBody List<String> ids) throws Exception {
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         if(CollUtil.isEmpty(ids)){

+ 7 - 13
adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/controller/AdmPlanarController.java

@@ -1,21 +1,15 @@
 package com.persagy.proxy.dictionary.controller;
 
-import com.persagy.proxy.object.model.AdmEquipment;
-import com.persagy.proxy.dictionary.model.AdmPlanarEquipRequests;
-import com.persagy.proxy.object.model.AdmSpace;
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.dictionary.service.IAdmPlanarService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.dictionary.model.AdmPlanarEquipRequests;
+import com.persagy.proxy.dictionary.service.IAdmPlanarService;
+import com.persagy.proxy.object.model.AdmEquipment;
+import com.persagy.proxy.object.model.AdmSpace;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-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 javax.ws.rs.QueryParam;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @ClassName AdmLabslController
@@ -38,7 +32,7 @@ public class AdmPlanarController {
      * @throws Exception
      */
     @PostMapping("/equip")
-    public AdmResponse queryPlanarEquip(@QueryParam("projectId") String projectId,
+    public AdmResponse queryPlanarEquip(@RequestParam(value = "projectId",required = false) String projectId,
                                           @RequestBody AdmPlanarEquipRequests requests) throws Exception {
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         if(requests == null){
@@ -53,7 +47,7 @@ public class AdmPlanarController {
      * @throws Exception
      */
     @PostMapping("/space")
-    public AdmResponse queryPlanarSpace(@QueryParam("projectId") String projectId,
+    public AdmResponse queryPlanarSpace(@RequestParam(value = "projectId",required = false) String projectId,
                                   @RequestBody AdmPlanarEquipRequests requests) throws Exception {
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         if(requests == null){

+ 15 - 10
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/controller/DataMigrationController.java

@@ -35,6 +35,7 @@ import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 import java.io.BufferedOutputStream;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
@@ -156,9 +157,22 @@ public class DataMigrationController {
         //设置响应的内容类型
         response.setContentType("text/plain");
         //设置文件的名称和格式
+
+        String encode = StandardCharsets.UTF_8.name();
+        response.setCharacterEncoding(encode);
+        // 防止中文乱码
+        String fileName = context.getProjectId()+"_迁移sql";
+
+        try {
+            fileName = URLEncoder.encode(fileName, encode);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
         response.addHeader("Content-Disposition","attachment;filename="
-                + genAttachmentFileName( context.getProjectId(), "JSON_FOR_UCC_")//设置名称格式,没有这个中文名称无法显示
+                + fileName
                 + ".sql");
+
         BufferedOutputStream buff = null;
         ServletOutputStream outStr = null;
         try {
@@ -179,15 +193,6 @@ public class DataMigrationController {
     }
 
 
-    public  String genAttachmentFileName(String cnName, String defaultName) {
-        try {
-            cnName = new String(cnName.getBytes("gb2312"), "ISO8859-1");
-        } catch (Exception e) {
-            cnName = defaultName;
-        }
-        return cnName;
-    }
-
     /**
      * 获取迁移数据日志
      *

+ 1 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/DefineInfoMigration.java

@@ -200,7 +200,7 @@ public class DefineInfoMigration extends MigrationAbstractServiceImpl<ObjectInfo
                 sqls.append("'").append(infoDefine.getModifiedTime()).append(",");
             }
             sqls.append(infoDefine.getValid());
-            sqls.append("),");
+            sqls.append(")\n ,");
         });
         String sql = sqls.toString();
         sql = sql.substring(0, sql.lastIndexOf(","));

+ 1 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/DefineTypeMigration.java

@@ -190,7 +190,7 @@ public class DefineTypeMigration extends MigrationAbstractServiceImpl<ObjectType
             }
 
             sqls.append(typeDefine.getValid());
-            sqls.append("),");
+            sqls.append(")\n ,");
         });
         String sql = sqls.toString();
         sql = sql.substring(0, sql.lastIndexOf(","));

+ 28 - 13
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/MigrationAbstractServiceImpl.java

@@ -7,7 +7,6 @@ import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONUtil;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Sets;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
 import com.persagy.dmp.common.constant.ResponseCode;
@@ -56,7 +55,7 @@ public class MigrationAbstractServiceImpl<T> implements IMigrationAbstractServic
         if(CollUtil.isEmpty(from) || CollUtil.isEmpty(to)){
             return null;
         }
-        Sets.SetView<String> intersection = Sets.intersection(from.keySet(), to.keySet());
+        Set<String> intersection = CollUtil.intersectionDistinct(from.keySet(), to.keySet());
         if(CollUtil.isEmpty(intersection)){
             return null;
         }
@@ -75,13 +74,10 @@ public class MigrationAbstractServiceImpl<T> implements IMigrationAbstractServic
      */
     @Override
     public Map<String, Object> doIntersectionGetTo(Map<String, Object> from, Map<String, Object> to) {
-        if(CollUtil.isEmpty(from)){
-            return null;
-        }
-        if(CollUtil.isEmpty(to)){
+        if(CollUtil.isEmpty(from) || CollUtil.isEmpty(to)){
             return null;
         }
-        Sets.SetView<String> intersection = Sets.intersection(from.keySet(), to.keySet());
+        Set<String> intersection = CollUtil.intersectionDistinct(from.keySet(), to.keySet());
         if(CollUtil.isEmpty(intersection)){
             return null;
         }
@@ -107,8 +103,8 @@ public class MigrationAbstractServiceImpl<T> implements IMigrationAbstractServic
         if(CollUtil.isEmpty(to)){
             return from;
         }
-        Sets.SetView<String> diffA = Sets.difference(from.keySet(), to.keySet());
-        return getValueForMapByKeys(diffA, from);
+        Set<String> diff = difference(from.keySet(), to.keySet());
+        return getValueForMapByKeys(diff, from);
     }
 
     /**
@@ -130,8 +126,28 @@ public class MigrationAbstractServiceImpl<T> implements IMigrationAbstractServic
         if(CollUtil.isEmpty(to)){
             return null;
         }
-        Sets.SetView<String> diffB = Sets.difference(to.keySet(), from.keySet());
-        return getValueForMapByKeys(diffB, to);
+        Set<String> diff = difference(from.keySet(), to.keySet());
+        return getValueForMapByKeys(diff, to);
+    }
+
+    /**
+     * 筛选出所有不同的元素
+     * @param from
+     * @param to
+     * @return
+     */
+    private Set<String> difference(Set<String> from, Set<String> to) {
+        if(CollUtil.isEmpty(from)){
+            return to;
+        }
+        if(CollUtil.isEmpty(to)){
+            return from;
+        }
+        Set<String> all = CollUtil.newHashSet(from);
+        all.addAll(to);
+        Set<String> intersection = CollUtil.intersectionDistinct(from, to);
+        Collection<String> diff = CollUtil.subtract(all, intersection);
+        return CollUtil.isEmpty(diff)?CollUtil.newHashSet():CollUtil.newHashSet(diff);
     }
 
     /**
@@ -329,8 +345,7 @@ public class MigrationAbstractServiceImpl<T> implements IMigrationAbstractServic
         Set<String> formSets = from.entrySet().stream().map(en -> String.join(MigrationConstant.SPLITER_UNION,en.getKey(),en.getValue().toString())).collect(Collectors.toSet());
         Set<String> toSets = to.entrySet().stream().map(en -> String.join(MigrationConstant.SPLITER_UNION,en.getKey(),en.getValue().toString())).collect(Collectors.toSet());
 
-        Sets.SetView<String> difference = Sets.difference(formSets, toSets);
-
+        Set<String> difference = difference(formSets, toSets);
         if(CollUtil.isEmpty(difference)){
             return null;
         }

+ 5 - 4
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectDigitalMigration.java

@@ -103,14 +103,14 @@ public class ObjectDigitalMigration extends MigrationAbstractServiceImpl<ObjectD
     public String migrateForSql(InstanceUrlParam context) {
         StringBuffer sqls = new StringBuffer(" \n -- 数据迁移  dt_object ------ \n");
         //获取已经采集的数据
-        StringBuffer sqls_temp = new StringBuffer();
+        String sqls_temp = "";
         for(MigrationObjType objType : MigrationObjType.values()){
             QueryCriteria queryCriteria = getQueryCriteria(objType.getCode());
             List<ObjectNode> admData = getAdmData(context,queryCriteria);
             if(CollUtil.isEmpty(admData)){
                 continue;
             }
-            appendValues(admData, sqls_temp);
+            sqls_temp += appendValues(admData).toString();
         }
         if(sqls_temp.length() == 0){
             return "";
@@ -124,7 +124,8 @@ public class ObjectDigitalMigration extends MigrationAbstractServiceImpl<ObjectD
         return sql;
     }
 
-    private StringBuffer appendValues(List<ObjectNode> admData, StringBuffer sqls){
+    private StringBuffer appendValues(List<ObjectNode> admData){
+        StringBuffer sqls = new StringBuffer();
         admData.forEach(obj -> {
             ObjectDigital objectDigital = JsonNodeUtils.toEntity(obj, ObjectDigital.class, "infos");
             sqls.append("(");
@@ -171,7 +172,7 @@ public class ObjectDigitalMigration extends MigrationAbstractServiceImpl<ObjectD
             sqls.append("'").append(objectDigital.getModifier()).append("',");
             sqls.append("'").append(objectDigital.getModifiedTime()).append("',");
             sqls.append(objectDigital.getValid());
-            sqls.append("),");
+            sqls.append(")\n ,");
         });
         return sqls;
     }

+ 66 - 5
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectRelationMigration.java

@@ -8,8 +8,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
 import com.persagy.dmp.common.constant.ResponseCode;
-import com.persagy.dmp.common.model.entity.AuditableEntity;
 import com.persagy.dmp.common.model.entity.BaseEntity;
+import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.define.client.DigitalGraphDefineFacade;
 import com.persagy.dmp.define.client.DigitalRelationDefineFacade;
 import com.persagy.dmp.define.entity.GraphDefine;
@@ -20,6 +20,7 @@ import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.dmp.rwd.migrate.entity.SyncData;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.migration.constant.*;
 import com.persagy.proxy.migration.model.DataMigrationExcel;
@@ -136,7 +137,7 @@ public class ObjectRelationMigration extends MigrationAbstractServiceImpl<Object
     }
 
     /**
-     * 数据迁移
+     * 数据迁移 数据量超过1w 分页 多线程处理
      *
      * @param context
      * @return sql 文件
@@ -145,15 +146,50 @@ public class ObjectRelationMigration extends MigrationAbstractServiceImpl<Object
     public String migrateForSql(InstanceUrlParam context) {
         StringBuffer sqls = new StringBuffer(" \n -- 数据迁移  dt_relation ------ \n");
         //获取已经采集的数据
-        StringBuffer sqls_temp = new StringBuffer();
+        /* StringBuffer sqls_temp = new StringBuffer();
         for (MiGrationRelCode miGrationRelCode: MiGrationRelCode.values()){
             QueryCriteria queryCriteria = getQueryCriteria(miGrationRelCode.getCode());
             List<ObjectRelation> admData = getAdmData(context,queryCriteria);
             if(CollUtil.isEmpty(admData)){
                 continue;
             }
-            appendValues(admData, sqls_temp);
+        }*/
+
+        String sqls_temp = "";
+        ExecutorService service = getExcecutor();
+        List<Future<StringBuffer>> futureList = new ArrayList<>();
+        for (MiGrationRelCode miGrationRelCode: MiGrationRelCode.values()){
+            QueryCriteria queryCriteria = getQueryCriteria(miGrationRelCode.getCode());
+            queryCriteria.setSize(10000L);
+            CommonResult<List<ObjectRelation>> admDatas = getAdmDataPage(context,queryCriteria);
+            if (admDatas.getResult().equals(DmpResult.SUCCESS) && admDatas.getCount() > queryCriteria.getSize()) {
+                long pages = admDatas.getCount() / queryCriteria.getSize() + 1;
+                for(long i = 2;i < pages; i++){
+                    queryCriteria.setPage(i);
+                    List<ObjectRelation> admData = getAdmData(context,queryCriteria);
+                    appendValuesBefore(service,admData,futureList);
+                }
+            }else{
+                List<ObjectRelation> admData = admDatas.getData();
+                appendValuesBefore(service,admData,futureList);
+            }
         }
+        service.shutdown();
+        for (Future<StringBuffer> future : futureList) {
+            try {
+                StringBuffer stringBuffer = future.get();
+                if(StrUtil.isNotEmpty(stringBuffer)){
+                    sqls_temp += stringBuffer.toString();
+                }
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                log.error("######################### dt_relation 数据迁移sql失败"+e.getMessage());
+            } catch (ExecutionException e) {
+                e.printStackTrace();
+                log.error("######################### dt_relation 数据迁移sql失败"+e.getMessage());
+            }
+        }
+
         if(sqls_temp.length() == 0){
             return "";
         }
@@ -165,6 +201,26 @@ public class ObjectRelationMigration extends MigrationAbstractServiceImpl<Object
         return sql;
     }
 
+    private void appendValuesBefore(ExecutorService service, List<ObjectRelation> admData, List<Future<StringBuffer>> futureList){
+        if(CollUtil.isEmpty(admData)){
+            return;
+        }
+        StringBuffer sqls_temp = new StringBuffer();
+        Future<StringBuffer> future = service.submit(new Callable<StringBuffer>(){
+            @Override
+            public StringBuffer call() throws Exception {
+                return appendValues(admData, sqls_temp);
+            }
+        });
+        futureList.add(future);
+    }
+
+    /**
+     * 拼接sql字符串
+     * @param admData
+     * @param sqls
+     * @return
+     */
     private StringBuffer appendValues(List<ObjectRelation> admData, StringBuffer sqls){
         admData.forEach(relation -> {
             sqls.append("(");
@@ -200,7 +256,7 @@ public class ObjectRelationMigration extends MigrationAbstractServiceImpl<Object
             sqls.append("'").append(relation.getModifier()).append("',");
             sqls.append("'").append(relation.getModifiedTime()).append("',");
             sqls.append(relation.getValid());
-            sqls.append("),");
+            sqls.append(")\n ,");
         });
         return sqls;
     }
@@ -344,6 +400,11 @@ public class ObjectRelationMigration extends MigrationAbstractServiceImpl<Object
         return relations;
     }
 
+    public CommonResult<List<ObjectRelation>> getAdmDataPage(InstanceUrlParam context, QueryCriteria queryCriteria) {
+        CommonResult<List<ObjectRelation>> relations = DigitalRelationFacade.queryPrototype(context.getGroupCode(),context.getProjectId(),context.getUserId(),context.getUserId(),queryCriteria);
+        return relations;
+    }
+
     /**
      * 根据map转为需要处理的对象集合
      * 使用 MigrationConstant.spliter 作为拼接符

+ 3 - 8
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmBuildingController.java

@@ -14,12 +14,8 @@ import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.object.model.*;
 import com.persagy.proxy.object.service.*;
 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 org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.util.List;
 import java.util.Map;
 
@@ -153,10 +149,9 @@ public class AdmBuildingController {
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
+    public AdmResponse query(@RequestParam(value = "projectId",required = false) String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmBuilding.OBJ_TYPE);
-
         return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmBuilding.class);
     }
 
@@ -168,7 +163,7 @@ public class AdmBuildingController {
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
+    public AdmResponse count(@RequestParam(value = "projectId",required = false) String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmBuilding.OBJ_TYPE);
         request.setOnlyCount(true);

+ 9 - 9
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmComponentController.java

@@ -9,8 +9,10 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.common.constant.CommonConstant;
 import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
-import com.persagy.dmp.digital.entity.ObjectRelation;
-import com.persagy.proxy.adm.constant.*;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmDictCategoryEnum;
+import com.persagy.proxy.adm.constant.GraphCodeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmCreateResponse;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
@@ -25,12 +27,8 @@ import com.persagy.proxy.object.model.AdmComponent;
 import com.persagy.proxy.object.service.IAdmComponentService;
 import lombok.extern.slf4j.Slf4j;
 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 org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -69,7 +67,8 @@ public class AdmComponentController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmCreateResponse create(@RequestBody AdmCreateRequest<AdmComponent> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmCreateResponse create(@RequestBody AdmCreateRequest<AdmComponent> createRequest,
+                                    @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         List<AdmComponent> vos = CollUtil.newArrayList(createRequest.getContent());
         if(CollUtil.isEmpty(vos)){
             return AdmCreateResponse.success();
@@ -165,7 +164,8 @@ public class AdmComponentController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmComponent> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmComponent> createRequest,
+                              @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         List<AdmComponent> vos = CollUtil.newArrayList(createRequest.getContent());
         vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmComponent.class, vos);
         return AdmResponse.success(vos);

+ 2 - 64
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmEquipmentController.java

@@ -4,8 +4,6 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.IoUtil;
-import cn.hutool.core.map.MapUtil;
-import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.poi.excel.ExcelReader;
@@ -31,7 +29,6 @@ import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
-import com.persagy.proxy.adm.constant.AdmDictCategoryEnum;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.request.*;
 import com.persagy.proxy.adm.service.IAdmRelationService;
@@ -41,8 +38,6 @@ import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.common.entity.RelationDTO;
-import com.persagy.proxy.dictionary.model.AdmDict;
-import com.persagy.proxy.dictionary.model.AdmObjectType;
 import com.persagy.proxy.dictionary.service.IAdmDictService;
 import com.persagy.proxy.object.model.AdmEquipment;
 import com.persagy.proxy.object.model.AdmProject;
@@ -115,51 +110,8 @@ public class AdmEquipmentController {
 		if(CollUtil.isEmpty(vos)){
 			return AdmCreateResponse.success();
 		}
-		// 查询所有设备类型
-		AdmDict dictCond = AdmDict.builder().type(AdmDictCategoryEnum.EQUIPMENT.getValue()).build();
-		AdmResponse dictResponse = dictService.queryCategory(AdmContextUtil.toDmpContext(), dictCond, AdmObjectType.class);
-		List<AdmObjectType> dicts = (List<AdmObjectType>) dictResponse.getContent();
-		// 转换为Map,key为编码后4位。用于适配旧类型编码
-		Map<String, AdmObjectType> shortDictMap = new HashMap<>();
-		Map<String, AdmObjectType> fullDictMap = new HashMap<>();
-		for(int i = 0,j = CollUtil.size(dicts);i < j;i++) {
-			AdmObjectType dict = dicts.get(i);
-			shortDictMap.put(StrUtil.subSufByLength(dict.getCode(), 4), dict);
-			fullDictMap.put(dict.getCode(), dict);
-		}
-		// 设备属性调整
-		List<AdmEquipment> filterVOs = new ArrayList<>();
-		for(AdmEquipment equipment:vos) {
-			// 如果不是Eq开头,则重新生成ID
-			if(StrUtil.startWith(equipment.getId(), "Eq")) {
-				equipment.setId("Eq"+ IdUtil.simpleUUID());
-			}
-			// 类型编码适配
-			String classCode = equipment.getClassCode();
-			// 如果编码为空,或在4位、6位里都不存在,则报错
-			if(StrUtil.isBlank(classCode) ||
-					(shortDictMap.get(classCode) == null && fullDictMap.get(classCode) == null)) {
-				log.error(StrUtil.format("没有找到对象类型【{}】!", equipment.getClassCode()));
-				continue;
-			}
-			filterVOs.add(equipment);
-			// 如果少于6位,则需要适配新编码
-			if(classCode.length() < 6) {
-				AdmObjectType dict = MapUtil.get(shortDictMap, classCode, AdmObjectType.class);
-				equipment.setClassCode(dict.getCode());
-			}
-			// 如果名称为空,则提供默认名称
-			if (StrUtil.isEmpty(equipment.getName())){
-				AdmObjectType dict = MapUtil.get(fullDictMap, equipment.getClassCode(), AdmObjectType.class);
-				String preName = dict == null ? "设备" : dict.getName();
-				equipment.setName(ObjectNameUtil.objectName(preName + "-"));
-			}
-		}
-		if(CollUtil.isEmpty(filterVOs)){
-			return AdmCreateResponse.success();
-		}
-		filterVOs = service.doInsert(AdmContextUtil.toDmpContext(), AdmEquipment.class, filterVOs);
-		return AdmCreateResponse.success(filterVOs);
+		vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
+		return AdmCreateResponse.success(vos);
 	}
 
 	/**
@@ -187,20 +139,6 @@ public class AdmEquipmentController {
 		if(CollUtil.isEmpty(vos)) {
 			return AdmResponse.success(vos);
 		}
-		for(AdmEquipment vo:vos) {
-			if(StrUtil.isNotBlank(vo.getFlowBuild())) {
-				// 处理建筑-楼层信息点
-				List<String> flows = StrUtil.splitTrim(vo.getFlowBuild(), "-");
-				for(String flow:flows) {
-					if(StrUtil.startWith(flow, "Bd")) {
-						vo.setBuildingId(flow);
-					} else if(StrUtil.startWith(flow, "fl")) {
-						vo.setFloorId(flow);
-					}
-				}
-				vo.setFlowBuild(null);
-			}
-		}
 		vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
 		return AdmResponse.success(vos);
 	}

+ 11 - 12
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmLocationPointController.java

@@ -13,13 +13,8 @@ import com.persagy.proxy.object.model.AdmPointImage;
 import com.persagy.proxy.object.service.IAdmLocationPointService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-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 org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -46,7 +41,7 @@ public class AdmLocationPointController {
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
+    public AdmResponse count(@RequestParam(value = "projectId",required = false) String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
@@ -63,7 +58,7 @@ public class AdmLocationPointController {
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
+    public AdmResponse query(@RequestParam(value = "projectId",required = false) String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
@@ -82,7 +77,8 @@ public class AdmLocationPointController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmCreateResponse create(@RequestBody AdmCreateRequest<AdmLocationPoint> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmCreateResponse create(@RequestBody AdmCreateRequest<AdmLocationPoint> createRequest,
+                                    @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmLocationPoint> vos = CollUtil.newArrayList(createRequest.getContent());
@@ -99,7 +95,8 @@ public class AdmLocationPointController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmLocationPoint> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmLocationPoint> createRequest,
+                              @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmLocationPoint> vos = CollUtil.newArrayList(createRequest.getContent());
@@ -115,7 +112,8 @@ public class AdmLocationPointController {
      * @throws Exception
      */
     @PostMapping("/delete")
-    public AdmResponse delete(@QueryParam("projectId") String projectId, @RequestBody List<AdmLocationPoint> vos) throws Exception {
+    public AdmResponse delete(@RequestParam(value = "projectId",required = false) String projectId,
+                              @RequestBody List<AdmLocationPoint> vos) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         service.doDelete(context, vos);
@@ -129,7 +127,8 @@ public class AdmLocationPointController {
      * @throws Exception
      */
     @PostMapping("/delete-image")
-    public AdmResponse deleteImage(@QueryParam("projectId") String projectId, @RequestBody List<AdmPointImage> vos) throws Exception {
+    public AdmResponse deleteImage(@RequestParam(value = "projectId",required = false) String projectId,
+                                   @RequestBody List<AdmPointImage> vos) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         // 删除图片参数转换

+ 3 - 7
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmProjectController.java

@@ -6,12 +6,7 @@ import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.object.model.AdmProject;
 import com.persagy.proxy.object.service.IAdmProjectService;
 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 javax.ws.rs.QueryParam;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * ADM 项目 API
@@ -32,7 +27,8 @@ public class AdmProjectController {
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request) throws Exception {
+    public AdmResponse query(@RequestParam(value = "projectId",required = false) String projectId,
+                             @RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmProject.OBJ_TYPE);
         return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmProject.class);
     }

+ 3 - 6
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmPropertyController.java

@@ -9,12 +9,8 @@ import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.object.model.AdmProperty;
 import com.persagy.proxy.object.service.IAdmPropertyService;
 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 org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.util.List;
 
 /**
@@ -62,7 +58,8 @@ public class AdmPropertyController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmProperty> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmProperty> createRequest,
+                              @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         List<AdmProperty> vos = CollUtil.newArrayList(createRequest.getContent());
         vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmProperty.class, vos);
         return AdmResponse.success(vos);

+ 5 - 6
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmShaftController.java

@@ -35,7 +35,6 @@ import com.persagy.proxy.object.service.IAdmSpaceService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -213,10 +212,11 @@ public class AdmShaftController {
             failureList = spaceIds;
         }
 
-        if(CollUtil.isNotEmpty(failureList))
-            return AdmResponse.failure("元空间 " +failureList.stream().collect(Collectors.joining(","))+ " 不存在");
-        else
+        if(CollUtil.isNotEmpty(failureList)) {
+            return AdmResponse.failure("元空间 " + failureList.stream().collect(Collectors.joining(",")) + " 不存在");
+        } else {
             return AdmResponse.success();
+        }
     }
 
     /**
@@ -448,13 +448,12 @@ public class AdmShaftController {
     /**
      * 查询和当前竖井没有关联的业务空间
      * shaftId 为竖井id
-     * 
      * @param request
      * @return
      * @throws Exception
      */
     @PostMapping("/un-shaft-zoneSpaceBaseTable")
-    public AdmResponse queryUnZoneSp(@QueryParam("shaftId") String shaftId,
+    public AdmResponse queryUnZoneSp(@RequestParam(value = "shaftId") String shaftId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装条件
         if(!StrUtil.isNotEmpty(shaftId)) {

+ 5 - 7
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -26,12 +26,8 @@ import com.persagy.proxy.object.service.IAdmBuildingService;
 import com.persagy.proxy.object.service.IAdmFloorService;
 import com.persagy.proxy.object.service.IAdmSpaceService;
 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 org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.lang.reflect.Field;
 import java.util.*;
 
@@ -124,7 +120,8 @@ public class AdmSpaceController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmSpace> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmSpace> createRequest,
+                              @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
         // 特殊处理一下AdmSpace的infos
         if (CollUtil.isEmpty(vos)){
@@ -237,7 +234,8 @@ public class AdmSpaceController {
      * @throws Exception
      */
     @PostMapping("/update-fl-bd")
-    public AdmResponse updateFlBd(@RequestBody List<AdmUpDataFloorAndBuildingRequests> voList, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse updateFlBd(@RequestBody List<AdmUpDataFloorAndBuildingRequests> voList,
+                                  @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         if(CollUtil.isEmpty(voList)){
             return AdmResponse.failure("不可以传入空数据");
         }

+ 5 - 7
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmTenantController.java

@@ -11,12 +11,8 @@ import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.object.model.AdmTenant;
 import com.persagy.proxy.object.service.IAdmTenantService;
 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 org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.util.List;
 
 /**
@@ -51,7 +47,8 @@ public class AdmTenantController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmCreateResponse create(@RequestBody AdmCreateRequest<AdmTenant> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmCreateResponse create(@RequestBody AdmCreateRequest<AdmTenant> createRequest,
+                                    @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         List<AdmTenant> vos = CollUtil.newArrayList(createRequest.getContent());
         vos.stream().forEach(admTenant -> {
             if (StrUtil.isEmpty(admTenant.getName())){
@@ -81,7 +78,8 @@ public class AdmTenantController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmTenant> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmTenant> createRequest,
+                              @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         List<AdmTenant> vos = CollUtil.newArrayList(createRequest.getContent());
         vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmTenant.class, vos);
         return AdmResponse.success(vos);

+ 9 - 11
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmVirtualWallController.java

@@ -10,13 +10,8 @@ import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.object.model.AdmVirtualWall;
 import com.persagy.proxy.object.service.IAdmVirtualWallService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-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 org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.util.List;
 
 /**
@@ -38,7 +33,8 @@ public class AdmVirtualWallController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmResponse create(@RequestBody AdmCreateRequest<AdmVirtualWall> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse create(@RequestBody AdmCreateRequest<AdmVirtualWall> createRequest,
+                              @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmVirtualWall> vos = CollUtil.newArrayList(createRequest.getContent());
@@ -53,7 +49,8 @@ public class AdmVirtualWallController {
      * @throws Exception
      */
     @PostMapping("/create_ignore")
-    public AdmCreateResponse createIgnore(@RequestBody AdmCreateRequest<AdmVirtualWall> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmCreateResponse createIgnore(@RequestBody AdmCreateRequest<AdmVirtualWall> createRequest,
+                                          @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         createRequest.getContent().forEach(it->{
@@ -81,7 +78,8 @@ public class AdmVirtualWallController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmVirtualWall> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmVirtualWall> createRequest,
+                              @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmVirtualWall> vos = CollUtil.newArrayList(createRequest.getContent());
@@ -97,7 +95,7 @@ public class AdmVirtualWallController {
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
+    public AdmResponse query(@RequestParam(value = "projectId",required = false) String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
@@ -114,7 +112,7 @@ public class AdmVirtualWallController {
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
+    public AdmResponse count(@RequestParam(value = "projectId",required = false) String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();

+ 9 - 10
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmWindowController.java

@@ -10,12 +10,8 @@ import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.object.model.AdmWindow;
 import com.persagy.proxy.object.service.IAdmWindowService;
 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 org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.util.List;
 
 /**
@@ -37,7 +33,8 @@ public class AdmWindowController {
      * @throws Exception
      */
     @PostMapping("/create")
-    public AdmCreateResponse create(@RequestBody AdmCreateRequest<AdmWindow> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmCreateResponse create(@RequestBody AdmCreateRequest<AdmWindow> createRequest,
+                                    @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmWindow> vos = CollUtil.newArrayList(createRequest.getContent());
@@ -52,7 +49,8 @@ public class AdmWindowController {
      * @throws Exception
      */
     @PostMapping("/create_ignore")
-    public AdmResponse createIgnore(@RequestBody AdmCreateRequest<AdmWindow> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse createIgnore(@RequestBody AdmCreateRequest<AdmWindow> createRequest,
+                                    @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         createRequest.getContent().forEach(request->{
@@ -80,7 +78,8 @@ public class AdmWindowController {
      * @throws Exception
      */
     @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmWindow> createRequest, @QueryParam("projectId") String projectId) throws Exception {
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmWindow> createRequest,
+                              @RequestParam(value = "projectId",required = false) String projectId) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         List<AdmWindow> vos = CollUtil.newArrayList(createRequest.getContent());
@@ -96,7 +95,7 @@ public class AdmWindowController {
      * @throws Exception
      */
     @PostMapping("/query")
-    public AdmResponse query(@QueryParam("projectId") String projectId,
+    public AdmResponse query(@RequestParam(value = "projectId",required = false) String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
@@ -113,7 +112,7 @@ public class AdmWindowController {
      * @throws Exception
      */
     @PostMapping("/count")
-    public AdmResponse count(@QueryParam("projectId") String projectId,
+    public AdmResponse count(@RequestParam(value = "projectId",required = false) String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();

+ 66 - 2
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/service/impl/AdmEquipmentServiceImpl.java

@@ -1,6 +1,8 @@
 package com.persagy.proxy.object.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -14,6 +16,7 @@ import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmDictCategoryEnum;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
@@ -21,6 +24,7 @@ import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
+import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.calculation.service.AdmRelCalService;
 import com.persagy.proxy.common.client.DmpRwdClient;
 import com.persagy.proxy.common.entity.DmpResult;
@@ -102,12 +106,72 @@ public class AdmEquipmentServiceImpl extends AbstractAdmBaseServiceImpl<AdmEquip
 
     @Override
     public List<AdmEquipment> doInsert(InstanceUrlParam context, Class<AdmEquipment> clazz, List<AdmEquipment> voList) {
-        processFloorRelations(context, voList, false);
-        return super.doInsert(context, clazz, voList);
+        // 查询所有设备类型
+        AdmDict dictCond = AdmDict.builder().type(AdmDictCategoryEnum.EQUIPMENT.getValue()).build();
+        AdmResponse dictResponse = dictService.queryCategory(AdmContextUtil.toDmpContext(), dictCond, AdmObjectType.class);
+        List<AdmObjectType> dicts = (List<AdmObjectType>) dictResponse.getContent();
+        // 转换为Map,key为编码后4位。用于适配旧类型编码
+        Map<String, AdmObjectType> shortDictMap = new HashMap<>();
+        Map<String, AdmObjectType> fullDictMap = new HashMap<>();
+        for(int i = 0,j = CollUtil.size(dicts);i < j;i++) {
+            AdmObjectType dict = dicts.get(i);
+            shortDictMap.put(StrUtil.subSufByLength(dict.getCode(), 4), dict);
+            fullDictMap.put(dict.getCode(), dict);
+        }
+        // 设备属性调整
+        List<AdmEquipment> filterVOs = new ArrayList<>();
+        for(AdmEquipment equipment:voList) {
+            // 如果不是Eq开头,则重新生成ID
+            if(!StrUtil.startWith(equipment.getId(), "Eq")) {
+                equipment.setId("Eq"+ IdUtil.simpleUUID());
+            }
+            // 类型编码适配
+            String classCode = equipment.getClassCode();
+            // 如果编码为空,或在4位、6位里都不存在,则报错
+            if(StrUtil.isBlank(classCode) ||
+                    (shortDictMap.get(classCode) == null && fullDictMap.get(classCode) == null)) {
+                log.error(StrUtil.format("没有找到对象类型【{}】!", equipment.getClassCode()));
+                continue;
+            }
+            filterVOs.add(equipment);
+            // 如果少于6位,则需要适配新编码
+            if(classCode.length() < 6) {
+                AdmObjectType dict = MapUtil.get(shortDictMap, classCode, AdmObjectType.class);
+                equipment.setClassCode(dict.getCode());
+            }
+            // 如果名称为空,则提供默认名称
+            if (StrUtil.isEmpty(equipment.getName())){
+                AdmObjectType dict = MapUtil.get(fullDictMap, equipment.getClassCode(), AdmObjectType.class);
+                String preName = dict == null ? "设备" : dict.getName();
+                equipment.setName(ObjectNameUtil.objectName(preName + "-"));
+            }
+        }
+        if(CollUtil.isEmpty(filterVOs)) {
+            return null;
+        }
+        // 处理楼层关系
+        processFloorRelations(context, filterVOs, false);
+        return super.doInsert(context, clazz, filterVOs);
     }
 
     @Override
     public List<AdmEquipment> doUpdate(InstanceUrlParam context, Class<AdmEquipment> clazz, List<AdmEquipment> voList) {
+        // 处理楼层属性
+        for(AdmEquipment vo:voList) {
+            if(StrUtil.isNotBlank(vo.getFlowBuild())) {
+                // 处理建筑-楼层信息点
+                List<String> flows = StrUtil.splitTrim(vo.getFlowBuild(), "-");
+                for(String flow:flows) {
+                    if(StrUtil.startWith(flow, "Bd")) {
+                        vo.setBuildingId(flow);
+                    } else if(StrUtil.startWith(flow, "fl")) {
+                        vo.setFloorId(flow);
+                    }
+                }
+                vo.setFlowBuild(null);
+            }
+        }
+        // 处理楼层关系
         processFloorRelations(context, voList, false);
         List<AdmEquipment> equipmentList = super.doUpdate(context, clazz, voList);
         // 处理关系标记

+ 12 - 9
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java

@@ -14,7 +14,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Sets;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
 import com.persagy.dmp.common.constant.CommonConstant;
@@ -28,7 +27,10 @@ import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
 import com.persagy.proxy.adm.annotations.CascadeColumn;
-import com.persagy.proxy.adm.constant.*;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.GraphCodeEnum;
+import com.persagy.proxy.adm.constant.RelCodeEnum;
 import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
@@ -537,7 +539,7 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
     private AdmResponse query(AdmDCSQueryRequest request) {
     	String orders = request.getOrders();
     	List<OrderItem> orderItem = AdmQueryCriteriaHelper.toOrderItem(orders);
-    	Set<String> classCodes = StrUtil.isBlank(request.getZoneType()) ? request.getZoneTypeList() : Sets.newHashSet(request.getZoneType());
+    	Set<String> classCodes = StrUtil.isBlank(request.getZoneType()) ? request.getZoneTypeList() : CollUtil.newHashSet(request.getZoneType());
     	/*ObjectNode objectNode = objectMapper.createObjectNode();
     	ObjectNode condition = objectMapper.createObjectNode();
     	condition.put("$null", true);
@@ -545,7 +547,7 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
     	QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
     	ObjectNode criteria = queryCriteria.getCriteria();
     	List<ObjectNode> queryObjects = this.relationReportService.queryObjects(criteria, AppContext.getContext().getGroupCode(), AppContext.getContext().getProjectId(),
-    			null, classCodes, Sets.newHashSet("space"), orderItem);
+    			null, classCodes, CollUtil.newHashSet("space"), orderItem);
     	
         List<AdmSpace> admVOs = AdmEntityTransferUtil.toAdmMultiEntity(queryObjects, request.getProjection(), AdmSpace.class);
         // 级联查询
@@ -590,8 +592,9 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
                 relationTo.set("objFrom", criteria.get("floorId"));
                 criteria.set("relationTo", relationTo);
                 criteria.remove("floorId");
-                if (criteria.has("buildingId"))
+                if (criteria.has("buildingId")) {
                     criteria.remove("buildingId");
+                }
                 return;
             }
         }
@@ -623,11 +626,11 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
         ObjectNode objectNode = objectMapper.createObjectNode();
         if (StrUtil.isNotBlank(AppContext.getContext().getProjectId())){
-            objectNode.putPOJO("projectIds", Sets.newHashSet(AppContext.getContext().getProjectId()));
+            objectNode.putPOJO("projectIds", CollUtil.newHashSet(AppContext.getContext().getProjectId()));
         }
-        objectNode.putPOJO("graphCodes", Sets.newHashSet(GraphCodeEnum.ArchSubset.name()));
-        objectNode.putPOJO("relCodes", Sets.newHashSet(relCode));
-        objectNode.putPOJO("groups", Sets.newHashSet("objTo"));
+        objectNode.putPOJO("graphCodes", CollUtil.newHashSet(GraphCodeEnum.ArchSubset.name()));
+        objectNode.putPOJO("relCodes", CollUtil.newHashSet(relCode));
+        objectNode.putPOJO("groups", CollUtil.newHashSet("objTo"));
         return objectNode;
     }
 

+ 1 - 2
adm-business/adm-middleware/src/main/java/com/persagy/proxy/relation/controller/RelationShContainSpBaseController.java

@@ -11,7 +11,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Sets;
 import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.context.AppContext;
@@ -295,7 +294,7 @@ public class RelationShContainSpBaseController {
 		String projectId = AppContext.getContext().getProjectId();
 		
         List<ObjectTypeDefine> classList = this.relationReportService.queryClassList(groupCode, projectId,
-                null, Sets.newHashSet(AdmObjectType.SPACE.getIndex()), null);
+                null, CollUtil.newHashSet(AdmObjectType.SPACE.getIndex()), null);
         if (CollectionUtil.isEmpty(classList)) {
         	return AdmResponse.success();
 		}

+ 3 - 5
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/AdmRelationController.java

@@ -1,17 +1,15 @@
 package com.persagy.proxy.report.controller;
 
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.dictionary.service.IAdmGraphicTypeService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.dictionary.service.IAdmGraphicTypeService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.ws.rs.QueryParam;
-
 /**
  * ADM 窗户 API
  * @author xujiaheng
@@ -31,7 +29,7 @@ public class AdmRelationController {
      * @throws Exception
      */
     @PostMapping("/equip/category")
-    public AdmResponse equipRel(@QueryParam("projectId") String projectId) {
+    public AdmResponse equipRel(@RequestParam(value = "projectId",required = false) String projectId) {
         //组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         AdmResponse res = service.query(context);

+ 2 - 3
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/AdmRelationObjectController.java

@@ -9,10 +9,9 @@ import com.persagy.proxy.relation.service.IAdmDtRelationService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.ws.rs.QueryParam;
-
 /**
  * ADM 窗户 API
  * @author xujiaheng
@@ -32,7 +31,7 @@ public class AdmRelationObjectController {
      * @throws Exception
      */
     @PostMapping("/equip/query")
-    public AdmResponse equipRel(@QueryParam("projectId") String projectId) {
+    public AdmResponse equipRel(@RequestParam(value = "projectId",required = false) String projectId) {
         //组装上下文条件
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         AdmQueryCriteria criteria = new AdmQueryCriteria();

+ 8 - 5
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/AdmReportEquipController.java

@@ -43,7 +43,6 @@ import com.persagy.proxy.report.model.AdmInfoPoint;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.ws.rs.QueryParam;
 import java.lang.reflect.Field;
 import java.util.*;
 
@@ -196,7 +195,8 @@ public class AdmReportEquipController {
      * @param   category    分类
      */
     @GetMapping("/equip-compon")
-    public AdmResponse getEquipCompon(@QueryParam("id") String id, @QueryParam("category") String category){
+    public AdmResponse getEquipCompon(@RequestParam(value = "id") String id,
+                                      @RequestParam(value = "category") String category){
         //return  rEquipComponService.getEquipCompon(id,category)
         RequestData requestData = new RequestData();
         if(StrUtil.isNotEmpty(id)){
@@ -322,7 +322,7 @@ public class AdmReportEquipController {
     public AdmResponse create(@RequestBody AdmCreateRequest<AdmEquipment> createRequest){
         //return EquipmentProSyService.createList(request)
         List<AdmEquipment> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = equipmentService.doInsertEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
+        vos = equipmentService.doInsert(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
         return AdmResponse.success(vos);
     }
 
@@ -330,7 +330,8 @@ public class AdmReportEquipController {
      * 查询不在当前系统下的设备
      */
     @PostMapping("/equip-sys")
-    public AdmResponse pageQueryEquipSys(@RequestBody AdmQueryCriteria request,@QueryParam("sysId") String sysId){
+    public AdmResponse pageQueryEquipSys(@RequestBody AdmQueryCriteria request,
+                                         @RequestParam(value = "sysId") String sysId){
         //return EquipmentService.queryBeforeEquipSy(sysId,request)
         QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
         ObjectNode criteriaEquip = JsonNodeFactory.instance.objectNode();
@@ -435,7 +436,9 @@ public class AdmReportEquipController {
      *  TODO 资产相关功能暂时不提供,之后根据业务进行需求处理
      */
     @PostMapping("/equip-category-property")
-    public AdmResponse equipProperty(@QueryParam("category") String category, @RequestBody AdmQueryCriteria request, @RequestBody List<String>  spaceIdList, @QueryParam("spacrType") String spacrType){
+    public AdmResponse equipProperty(@RequestParam(value = "category") String category,
+                                     @RequestBody AdmQueryCriteria request, @RequestBody List<String>  spaceIdList,
+                                     @RequestParam(value = "spacrType") String spacrType){
         //return EquipmentComService.equipProperty(category, request, spaceIdList, spacrType)
         return null;
     }

+ 18 - 11
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/AdmSpaceInfoController.java

@@ -21,13 +21,9 @@ import com.persagy.proxy.object.model.AdmSpace;
 import com.persagy.proxy.object.model.AdmSystem;
 import com.persagy.proxy.object.service.*;
 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 org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.QueryParam;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
@@ -86,7 +82,9 @@ public class AdmSpaceInfoController {
 	 * @author lxy
 	 */
 	@RequestMapping("/unspace-in-sys")
-	public AdmResponse unSpaceSys(@QueryParam("type") String type, @QueryParam("spaceId") String spaceId, @RequestBody AdmQueryCriteria request){
+	public AdmResponse unSpaceSys(@RequestParam(value = "type") String type,
+								  @RequestParam("spaceId") String spaceId,
+								  @RequestBody AdmQueryCriteria request){
 		request.setName(AdmSystem.OBJ_TYPE);
 		// 设置关系条件
 		request.resetRelationCond(true, "MechInArch", "Sy2Sp", spaceId, false);
@@ -99,7 +97,9 @@ public class AdmSpaceInfoController {
 	 * @return
 	 */
 	@PostMapping("/unspace-in-eq")
-	public AdmResponse unSpaceEq(@QueryParam("type") String type, @QueryParam("spaceId") String spaceId, @RequestBody AdmQueryCriteria request) {
+	public AdmResponse unSpaceEq(@RequestParam(value = "type") String type,
+								 @RequestParam(value = "spaceId") String spaceId,
+								 @RequestBody AdmQueryCriteria request) {
 		return queryEquipmentUnSpaceDirectly(type, spaceId, "MechInArch", request);
 	}
 
@@ -111,14 +111,18 @@ public class AdmSpaceInfoController {
 	 * @return
 	 */
 	@PostMapping("/unspace-for-eq")
-	public AdmResponse unSpaceForEq(@QueryParam("type") String type, @QueryParam("spaceId") String spaceId, @RequestBody AdmQueryCriteria request) {
+	public AdmResponse unSpaceForEq(@RequestParam(value = "type") String type,
+									@RequestParam(value = "spaceId") String spaceId,
+									@RequestBody AdmQueryCriteria request) {
 		return queryEquipmentUnSpaceDirectly(type, spaceId, "MechForArch", request);
 	}
 	/**
 	 * 空间内没有服务于当前空间的设备
 	 */
 	@PostMapping("/unspace-for-eq-point")
-	public AdmResponse unSpaceForEqPoint(@QueryParam("type") String type, @QueryParam("spaceId") String spaceId, @RequestBody AdmQueryCriteria request) {
+	public AdmResponse unSpaceForEqPoint(@RequestParam(value = "type") String type,
+										 @RequestParam(value = "spaceId") String spaceId,
+										 @RequestBody AdmQueryCriteria request) {
 		return queryEquipmentUnSpacePolygon(type, spaceId, "MechForArch", request);
 	}
 
@@ -126,7 +130,9 @@ public class AdmSpaceInfoController {
 	 * 根据空间轮廓 计算设备的坐标是否在空间内
 	 */
 	@PostMapping("/unspace-fIn-eq-point")
-	public AdmResponse unSpaceInEqPoint(@QueryParam("type") String type, @QueryParam("spaceId") String spaceId, @RequestBody AdmQueryCriteria request) {
+	public AdmResponse unSpaceInEqPoint(@RequestParam(value = "type") String type,
+										@RequestParam(value = "spaceId") String spaceId,
+										@RequestBody AdmQueryCriteria request) {
 		return queryEquipmentUnSpacePolygon(type, spaceId, "MechInArch", request);
 	}
 
@@ -134,7 +140,8 @@ public class AdmSpaceInfoController {
 	 * 未关联业务空间的元空间  Sp2Si
 	 */
 	@PostMapping("/unspace-ispace")
-	public AdmResponse unSpaceIspace(@QueryParam("objectType") String objectType, @RequestBody AdmDCSQueryRequest request) {
+	public AdmResponse unSpaceIspace(@RequestParam(value = "objectType") String objectType,
+									 @RequestBody AdmDCSQueryRequest request) {
 		//因现有floor没有轮廓线,先不做元空间和floor的轮廓的判断,使用关系查询
 		request.setName(AdmISpace.OBJ_TYPE);
 		// 设置关系条件

+ 4 - 6
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/ComponentStatisticsController.java

@@ -2,8 +2,6 @@ package com.persagy.proxy.report.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import com.persagy.proxy.adm.constant.AdmObjectType;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.constant.SpaceTypeEnum;
@@ -108,7 +106,7 @@ public class ComponentStatisticsController {
 	public AdmResponse spObjectTypeCount(HttpServletRequest request) {
 		InstanceUrlParam context = AdmContextUtil.toDmpContext();
 		List<Map<String,Object>> list = this.relationReportService.queryObjectCountByObjInfos(context.getGroupCode(), null,
-				Sets.newHashSet(AdmObjectType.SPACE.getIndex()), Lists.newArrayList("classCode"));
+				CollUtil.newHashSet(AdmObjectType.SPACE.getIndex()), CollUtil.newArrayList("classCode"));
 		for (Map<String, Object> map : list) {
 //			map.put("name", map.get("classCode"));
 			map.put("name", SpaceTypeEnum.valueOf((String)map.get("classCode")).getDesc());
@@ -125,8 +123,8 @@ public class ComponentStatisticsController {
 	public AdmResponse generalSpFunctypeCount(HttpServletRequest request) {
 		InstanceUrlParam context = AdmContextUtil.toDmpContext();
 		List<Map<String,Object>> list = this.relationReportService.queryObjectCountByObjInfos(context.getGroupCode(),
-				Sets.newHashSet(SpaceTypeEnum.GeneralZone.getCode()),
-				Sets.newHashSet(AdmObjectType.SPACE.getIndex()), Lists.newArrayList("roomFuncType"));
+				CollUtil.newHashSet(SpaceTypeEnum.GeneralZone.getCode()),
+				CollUtil.newHashSet(AdmObjectType.SPACE.getIndex()), CollUtil.newArrayList("roomFuncType"));
 		for (Map<String, Object> map : list) {
 			map.put("name", map.get("roomFuncType"));
 		}
@@ -170,7 +168,7 @@ public class ComponentStatisticsController {
 	public AdmResponse shaftFunctypeCount(HttpServletRequest request) {
 		InstanceUrlParam context = AdmContextUtil.toDmpContext();
 		List<Map<String,Object>> list = this.relationReportService.queryObjectCountByObjInfos(context.getGroupCode(), null,
-				Sets.newHashSet(AdmObjectType.SHAFT.getIndex()), Lists.newArrayList("shaftFuncType"));
+				CollUtil.newHashSet(AdmObjectType.SHAFT.getIndex()), CollUtil.newArrayList("shaftFuncType"));
 		for (Map<String, Object> map : list) {
 			map.put("name", map.get("shaftFuncType"));
 		}

+ 3 - 8
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/controller/RelationReportController.java

@@ -14,7 +14,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Lists;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.helper.SpringHelper;
@@ -40,10 +39,6 @@ import com.persagy.proxy.report.service.IRelationReportService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.xssf.usermodel.XSSFCell;
-import org.apache.poi.xssf.usermodel.XSSFRow;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.util.ResourceUtils;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -105,7 +100,7 @@ public class RelationReportController {
 	public AdmResponse countRelationObjects(@RequestParam String type, HttpServletRequest request) {
 		InstanceUrlParam context = AdmContextUtil.toDmpContext();
 		JSONObject objectNode = this.relationReportService.getRelationProjectCal(context.getGroupCode(), context.getProjectId(), type);
- 		return AdmResponse.success(Lists.newArrayList(objectNode));
+ 		return AdmResponse.success(CollUtil.newArrayList(objectNode));
 	}
 	
 	/**
@@ -509,7 +504,7 @@ public class RelationReportController {
 			int rowCount = excelReader.getRowCount();
 			if (rowCount<=5){
 				// 没有数据,直接返回成功
-				return AdmResponse.success(Lists.newArrayList(AdmExcelUtil.getImportResult(graphId, successNum, failurNum)));
+				return AdmResponse.success(CollUtil.newArrayList(AdmExcelUtil.getImportResult(graphId, successNum, failurNum)));
 			}
 			String code = StrUtil.utf8Str(excelReader.readCellValue(1,2));
 			if (StrUtil.isBlank(code)){
@@ -575,7 +570,7 @@ public class RelationReportController {
 			} catch (Exception e) {
 				log.error("文件存储失败", e);
 			}
-        	return AdmResponse.success(Lists.newArrayList(AdmExcelUtil.getImportResult(graphId, successNum, failurNum)));
+        	return AdmResponse.success(CollUtil.newArrayList(AdmExcelUtil.getImportResult(graphId, successNum, failurNum)));
 		} catch (Exception e) {
 			log.error("文件导入失败", e);
 			failure = e.getMessage();

+ 6 - 8
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/service/impl/RelationReportService.java

@@ -14,8 +14,6 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import com.persagy.dmp.basic.dto.GraphParentMes;
 import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
@@ -95,7 +93,7 @@ public class RelationReportService implements IRelationReportService {
 		requestData.setObjTypes(objTypes);
 		requestData.setGroups(groups);
 		List<Map<String,Object>> list = DigitalObjectSimpleFacade.queryObjectCountByObjInfos(groupCode, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
-		return CollectionUtil.isEmpty(list) ? Lists.newArrayList() : list;
+		return CollectionUtil.isEmpty(list) ? CollUtil.newArrayList() : list;
 	}
 	
 	@Override
@@ -134,9 +132,9 @@ public class RelationReportService implements IRelationReportService {
 		// 查询出对应项目关系计算数据
 		List<ObjectNode> projectList = DigitalRelationProjectCalFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
 		if (CollectionUtil.isEmpty(projectList)) {
-			return Lists.newArrayList();
+			return CollUtil.newArrayList();
 		}
-		List<JSONObject> result = Lists.newArrayList();
+		List<JSONObject> result = CollUtil.newArrayList();
 		Map<String, AdmRelationTypeEnum> graphRelTypeMap = AdmCommonConstant.GRAPH_RELATION_TYPE_MAP;
 		Map<String, RelationDefine> relationDefineMap = queryAllRelationDefineMap(groupCode, projectId);
 		Map<String, Integer> relCountMap = queryAllRelationCountMap(groupCode,projectId);
@@ -188,7 +186,7 @@ public class RelationReportService implements IRelationReportService {
 		QueryCriteria secondCriteria = new QueryCriteria();
 		List<GraphDefine> secondList = DigitalGraphDefineFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, secondCriteria);
 		if (CollectionUtil.isEmpty(secondList)) {
-			return Lists.newArrayList();
+			return CollUtil.newArrayList();
 		}
 		// 获取此图类型对应项目计算数据
 		List<JSONObject> resultList = new ArrayList<>();
@@ -203,7 +201,7 @@ public class RelationReportService implements IRelationReportService {
 			// 查询出对应项目关系计算数据
 			List<ObjectNode> projectList = graphCodeMap.getOrDefault(graphCode,new ArrayList<>());
 			if (CollectionUtil.isEmpty(projectList)) {
-				graphObject.put("relationTypeProjectList", Lists.newArrayList());
+				graphObject.put("relationTypeProjectList", CollUtil.newArrayList());
 				continue;
 			}
 			// 再根据图类型、边类型,统计此类型下的数量
@@ -420,7 +418,7 @@ public class RelationReportService implements IRelationReportService {
 		// 获取关联对象的本地名称
 		ObjectRelation objectRelation = objectRelations.get(0);
 		String relationId = StrUtil.isBlank(objFrom) ? objectRelation.getObjFrom() : objectRelation.getObjTo();
-		List<ObjectNode> objectNodes = this.getObjectNode(null, groupCode, projectId, Sets.newHashSet(relationId));
+		List<ObjectNode> objectNodes = this.getObjectNode(null, groupCode, projectId, CollUtil.newHashSet(relationId));
 		return CollectionUtil.isEmpty(objectNodes) ? objectMapper.createObjectNode() : objectNodes.get(0);
 	}