2 Incheckningar 8e8c6f9c8d ... 4debb31ae0

Upphovsman SHA1 Meddelande Datum
  zhaoyk 4debb31ae0 Merge branch 'develop' of http://39.106.8.246:3003/BDTP/digital-delivery 2 år sedan
  zhaoyk 02c1eb28d6 动态组加载和计算 2 år sedan
23 ändrade filer med 140 tillägg och 886 borttagningar
  1. 1 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/ContentParser.java
  2. 0 466
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java
  3. 0 169
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramDataLoader.java
  4. 1 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/line/LineLayoutManager.java
  5. 7 5
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/line/PathBuilder.java
  6. 1 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/ConnectPoint.java
  7. 1 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Diagram.java
  8. 3 3
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/AbstractComponent.java
  9. 57 17
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/Container.java
  10. 2 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IComponent.java
  11. 10 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IEquipHolder.java
  12. 2 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/AndFilter.java
  13. 0 123
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/CalcContext.java
  14. 1 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/DataFilter.java
  15. 6 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/DynGroup.java
  16. 2 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/MatchFilter.java
  17. 2 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/OrFilter.java
  18. 8 19
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/RelationFilter.java
  19. 3 13
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/DiagramTemplate.java
  20. 26 55
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/MainPipe.java
  21. 0 4
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DemoDiagramManager.java
  22. 2 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DiagramManager.java
  23. 5 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/TemplateManager.java

+ 1 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/ContentParser.java

@@ -8,7 +8,7 @@ import org.springframework.stereotype.Service;
  * json对象解析工具
  * @author zhaoyk
  */
-@Service
+@Service("diagramContentParser")
 public class ContentParser {
 
 	/**

+ 0 - 466
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java

@@ -1,466 +0,0 @@
-package com.persagy.adm.diagram.core;
-
-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.*;
-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.IDataBind;
-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.CalcContext;
-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.*;
-import java.util.stream.Collectors;
-
-/**
- * 处理系统图的计算逻辑
- * @author zhaoyk
- */
-public class DiagramBuilder {
-
-	/**
-	 * 设备容器限制,避免模板设置不当导致过多节点
-	 */
-	public static int equipLimit = 50;
-
-	private CalcContext context;
-
-	private Diagram diagram;
-
-	private DiagramTemplate template;
-
-	private DataStrategy dataStrategy;
-
-	private HashMap<String, List<Legend>> legendsCache = new HashMap<>();
-
-	private HashSet<String> refRelTypes = new HashSet<>();
-
-	public DiagramBuilder(CalcContext context, DataStrategy dataStrategy) {
-		this.context = context;
-		this.diagram = context.getDiagram();
-		this.template = context.getTemplate();
-		this.dataStrategy = dataStrategy;
-
-		this.context.setDataStrategy(dataStrategy);
-	}
-
-	private boolean hasDynGroup(List<Container> containers) {
-		for(Container con : containers) {
-			if(con.getDynGroup() != null){
-				return true;
-			}
-		}
-		return false;
-	}
-
-	//加载设备数据,并进行计算处理
-	public void buildEquipNodeAndContainer(List<Container> containers, List<ObjectNode> optionalObjs){
-		//去掉已经使用的数据项
-		if(context.getEquipMap().size() > 0) {
-			optionalObjs = optionalObjs.stream().filter(obj -> !context.getEquipMap().containsKey(obj.get("id").asText())).collect(Collectors.toList());
-		} else {
-			optionalObjs = new ArrayList<>(optionalObjs);
-		}
-
-		if(hasDynGroup(containers)) {
-			//TODO 动态组计算
-		}
-
-		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());
-
-							context.getEquipMap().put(mainPipe.getDataObjectId(), mainPipe);
-
-							iter.remove();
-							break;
-						}
-					}
-				}
-			}
-		}
-		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();
-					}
-				}
-			}
-		}
-
-		handleNodes();
-
-		handleContainers(containers);
-	}
-
-	private void buildMainPipe(){
-
-	}
-
-	private void addEquipNode(Container con, ObjectNode obj){
-		if(con.getChildren().size() > equipLimit) {
-			return;
-		}
-
-		EquipmentNode node = new EquipmentNode();
-		node.setId(IdUtil.fastSimpleUUID());
-		node.setDataObjectId(obj.get("id").asText());
-		node.setObjClassCode(DiagramBuilder.getClassCode(obj));
-		node.setDataObject(obj);
-
-		initNode(node, DiagramBuilder.getName(obj), con);
-
-		Legend legend = findLegend(node.getObjClassCode(), obj);
-		node.setLegendId(legend.getId());
-		node.setLegend(legend);
-	}
-
-	private void initNode(EquipmentNode node, String name, Container con){
-		con.addComp(node);
-		node.setContainerId(con.getId());
-		node.setLayoutIndex(con.getChildren().size() - 1);
-
-		Label label = new Label();
-		label.setId(IdUtil.fastSimpleUUID());
-		label.setContent(name);
-		node.setLabel(label);
-
-		diagram.getNodes().add(node);
-		context.getEquipMap().put(node.getDataObjectId(), node);
-	}
-
-	private void addPackData(Container con, ObjectNode obj){
-		PackNode pn = null;
-		String classCode = getClassCode(obj);
-		Legend legend = null;
-		//single
-		if(!con.getEquipPack().isPackByType()) {
-			String packName = con.getEquipPack().getPackName();
-			if(StrUtil.isBlank(packName)) {
-				packName = getTypeName(classCode);
-			}
-			if(con.getChildren().size() == 0) {
-				pn = newPackNode(PackNode.SINGLE_PACK, con, packName);
-			} else {
-				pn = (PackNode) con.getChildren().get(0);
-			}
-		} else { //group
-			for(IComponent comp : con.getChildren()) {
-				PackNode item = (PackNode) comp;
-				if(item.getObjClassCode().equals(classCode)){
-					pn = item;
-					break;
-				}
-			}
-			if(pn == null) {
-				pn = newPackNode(classCode, con, getTypeName(classCode));
-			}
-		}
-
-		if (pn.getLegend() == null) {
-			if(con.getEquipPack().getLegendId() != null) {
-				legend = dataStrategy.getLegend(con.getEquipPack().getLegendId(), classCode.substring(0, 4));
-			}
-			if(legend == null) {
-				legend = findLegend(classCode, null);
-			}
-
-			pn.setLegendId(legend.getId());
-			pn.setLegend(legend);
-		}
-
-		pn.add(classCode);
-	}
-
-	private PackNode newPackNode(String objClsCode, Container con, String packName){
-		PackNode pn = new PackNode();
-		pn.setId(IdUtil.fastSimpleUUID());
-		pn.setObjClassCode(objClsCode);
-
-		initNode(pn, packName, con);
-
-		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, context);
-			}
-			return true;
-		}
-		return false;
-	}
-
-	/**
-	 * 对节点进行处理,并返回图例锚点会使用到的关系类型
-	 */
-	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 void handleContainers(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 String getTypeName(String classCode){
-		//TODO
-		return classCode;
-	}
-
-	private Legend findLegend(String classCode, ObjectNode obj){
-		List<Legend> legends = legendsCache.get(classCode);
-		if (legends == null) {
-			legends = dataStrategy.getLegendsForEquipment(classCode);
-			if (legends == null) {
-				legends = new ArrayList<>();
-			}
-			legendsCache.put(classCode, legends);
-		}
-		if(legends.size() > 0) {
-			Legend l0 = null, l1 = null;
-			for(Legend legend : legends) {
-				//系统图类型匹配
-				boolean typeMatch = CollUtil.isNotEmpty(legend.getDiagramTypes()) && legend.getDiagramTypes().contains(diagram.getType());
-				//过滤条件匹配
-				boolean filterMatch;
-				if(obj != null && legend.getDataFilter() != null) {
-					filterMatch = legend.getDataFilter().filter(obj, context);
-				} else {
-					filterMatch = true;
-				}
-
-				if(typeMatch && filterMatch) {
-					return legend;
-				}
-
-				if(typeMatch && l0 == null) {
-					l0 = legend;
-				}
-				if(filterMatch && l1 == null) {
-					l1 = legend;
-				}
-			}
-			if(l0 != null) {
-				return l0;
-			}
-			if(l1 != null) {
-				return l1;
-			}
-			//没有优先匹配的话取第一个
-			return legends.get(0);
-		}
-
-		//返回一个缺省图例
-		return emptyLegend();
-	}
-	
-	public void buildLines(List<ObjectNode> optionalRels){
-		//去掉已经使用的关系项
-		if(context.getLineMap().size() > 0) {
-			optionalRels = optionalRels.stream().filter(obj -> !context.getLineMap().containsKey(obj.get("id").asText())).collect(Collectors.toList());
-		}
-
-		for(ObjectNode rel : optionalRels) {
-			IDataBind fromObj = context.getEquipMap().get(rel.get(ObjectRelation.OBJ_FROM_HUM).asText());
-			IDataBind toObj = context.getEquipMap().get(rel.get(ObjectRelation.OBJ_TO_HUM).asText());
-
-			if(fromObj != null && toObj != null) {
-				String relType = rel.get(ObjectRelation.GRAPH_CODE_HUM).asText() + '/' + rel.get(ObjectRelation.REL_CODE_HUM).asText();
-				ConnectPoint from = getConnectPoint(fromObj, relType, toObj);
-				if(from != null) {
-					ConnectPoint to = getConnectPoint(toObj, relType, fromObj);
-					if(to != null) {
-						Line line = new Line();
-						line.setFrom(from);
-						line.setTo(to);
-						line.setRelType(relType);
-						line.setDataObject(rel);
-						line.setDataObjectId(rel.get("id").asText());
-
-						addLine(line);
-					}
-				}
-			}
-		}
-
-	}
-
-	private ConnectPoint getConnectPoint(IDataBind obj, String  relType, IDataBind theOtherEnd){
-		ObjectNode theOtherData = (ObjectNode) 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, context);
-						}
-					}
-
-					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) {
-		line.setId(IdUtil.fastSimpleUUID());
-		markAnchorLine(line.getFrom(), line);
-		markAnchorLine(line.getTo(), line);
-		diagram.getLines().add(line);
-	}
-
-	private void markAnchorLine(ConnectPoint p, Line line){
-		EquipmentNode en = p.getEquipmentNode();
-		if (en != null) {
-			Anchor anchor = en.getLegend().getAnchor(p.getAnchorCode());
-			anchor.addLine(line);
-		}
-	}
-
-	public HashSet<String> getRefRelTypes() {
-		return refRelTypes;
-	}
-
-	public Diagram getDiagram() {
-		return diagram;
-	}
-
-	public DataStrategy getDataStrategy() {
-		return dataStrategy;
-	}
-
-	public static String getName(ObjectNode obj){
-		String name = null;
-		if(obj.get("localName") != null) {
-			name = obj.get("localName").asText();
-		}
-		if(StrUtil.isBlank(name) && obj.get("name") != null) {
-			name = obj.get("name").asText();
-		}
-		if(name == null)
-			System.out.println();
-		return name;
-	}
-
-	public static String getClassCode(ObjectNode obj){
-		if(obj != null && obj.get("classCode") != null) {
-			return obj.get("classCode").asText();
-		}
-		return null;
-	}
-
-	public static Legend emptyLegend(){
-		Legend l = new Legend();
-		l.setWidth(100);
-		l.setHeight(100);
-		return l;
-	}
-
-}

+ 0 - 169
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramDataLoader.java

@@ -1,169 +0,0 @@
-package com.persagy.adm.diagram.core;
-
-import cn.hutool.core.collection.CollUtil;
-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.CalcContext;
-import com.persagy.adm.diagram.core.model.template.MainPipe;
-import com.persagy.dmp.common.constant.ValidEnum;
-import com.persagy.dmp.digital.entity.ObjectRelation;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * 系统图数据加载
- * @author zhaoyk
- */
-public class DiagramDataLoader {
-
-	private Diagram diagram;
-
-	private DataStrategy dataStrategy;
-
-	public DiagramDataLoader(Diagram diagram, DataStrategy dataStrategy) {
-		this.diagram = diagram;
-		this.dataStrategy = dataStrategy;
-	}
-
-	/**
-	 * 加载已经保存的数据
-	 */
-	public void initLoad(){
-		List<String> objIds = diagram.getObjIds();
-		if(objIds.size() > 0) {
-			List<ObjectNode> objs = dataStrategy.loadObjectsById(objIds, diagram.getProjectId(), diagram.getGroupCode());
-			initNodes(objs);
-		}
-
-		List<String> relIds = diagram.getRelIds();
-		if(relIds.size() > 0) {
-			List<ObjectNode> rels = dataStrategy.loadRelationsById(relIds, diagram.getProjectId(), diagram.getGroupCode());
-			initLines(rels);
-		}
-	}
-
-	private void initNodes(List<ObjectNode> objs) {
-		HashMap<String, ObjectNode> objMap = new HashMap<>();
-		if(objs != null) {
-			objs.forEach(obj -> objMap.put(obj.get("id").asText(), obj));
-		}
-
-		for (DiagramNode node : diagram.getNodes()) {
-			ObjectNode obj = null;
-
-			if(EquipmentNode.TYPE.equals(node.getCompType())) { //设备节点
-				EquipmentNode en = (EquipmentNode) node;
-				obj = objMap.get(en.getDataObjectId());
-
-				if(en.getLegendId() != null) {
-					en.setLegend(dataStrategy.getLegend(en.getLegendId(), en.getObjSystemCode())); //TODO 批量查询优化
-				} else {
-					en.setLegend(DiagramBuilder.emptyLegend());
-				}
-
-				//设置anchorLocations
-				en.setAnchorLocations();
-			}
-
-			if(obj != null) {
-				node.setDataObject(obj);
-			}
-		}
-
-		//设备类干管
-		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);
-					}
-				}
-			}
-		}
-	}
-
-	private void initLines(List<ObjectNode> rels){
-		HashMap<String, ObjectNode> relMap = new HashMap<>();
-		if(rels != null) {
-			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);
-					line.setDataObjectId(rel.get("id").asText());
-				}
-			}
-		}
-	}
-
-	/**
-	 * 搜索数据并自动加载
-	 */
-	public void autoLoad(CalcContext context) {
-		List<ObjectNode> optionalObjs = null;
-		List<ObjectNode> optionalRels = null;
-
-		//查询备选数据
-		HashSet<String> equipTypes = new HashSet<>();
-		List<Container> containers = diagram.getTemplate().getContainers();
-		for(Container con : containers) {
-			if(con.getEquipmentTypes() != null) {
-				equipTypes.addAll(con.getEquipmentTypes());
-			}
-		}
-		if(diagram.getTemplate().getMainPipes() != null) {
-			for(MainPipe mainPipe : diagram.getTemplate().getMainPipes()) {
-				if(mainPipe.getEquipmentTypes() != null) {
-					equipTypes.addAll(mainPipe.getEquipmentTypes());
-				}
-			}
-		}
-
-		//TODO 打包设备查询性能优化
-		if(equipTypes.size() > 0) {
-			optionalObjs = dataStrategy.loadObjectsByType(new ArrayList<>(equipTypes), diagram.getProjectId(), diagram.getSystemId(), diagram.getGroupCode());
-			optionalObjs = filterValid(optionalObjs);
-		}
-		if(optionalObjs == null){
-			optionalObjs = new ArrayList<>();
-		}
-
-		DiagramBuilder builder = new DiagramBuilder(context, dataStrategy);
-		builder.buildEquipNodeAndContainer(containers, optionalObjs);
-		List<String[]> relTypes = builder.getRefRelTypes().stream().map(type -> type.split("/")).collect(Collectors.toList());
-
-		List<String> objIds = optionalObjs.stream().map(obj -> obj.get("id").asText()).collect(Collectors.toList());
-		//TODO 关系查询,需要区分打包设备
-		if(objIds.size() > 0 && relTypes.size() > 0) {
-			optionalRels = dataStrategy.loadRelationsByType(relTypes, objIds, diagram.getProjectId(), diagram.getGroupCode());
-			optionalRels = filterValid(optionalRels);
-		}
-		if(optionalRels == null){
-			optionalRels = new ArrayList<>();
-		}
-
-		builder.buildLines(optionalRels);
-	}
-
-	private List<ObjectNode> filterValid(List<ObjectNode> list){
-		if(CollUtil.isEmpty(list))
-			return list;
-
-		return list.stream().filter(obj ->
-				obj.get(ObjectRelation.PROP_VALID) == null || obj.get(ObjectRelation.PROP_VALID).asInt() == ValidEnum.TRUE.getType())
-				.collect(Collectors.toList());
-	}
-
-}

+ 1 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/line/LineLayoutManager.java

@@ -5,7 +5,7 @@ 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.XY;
-import com.persagy.adm.diagram.core.model.logic.CalcContext;
+import com.persagy.adm.diagram.core.build.CalcContext;
 import com.persagy.adm.diagram.core.model.template.MainPipe;
 import com.persagy.adm.diagram.core.util.GeomUtil;
 import org.locationtech.jts.geom.Point;

+ 7 - 5
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/line/PathBuilder.java

@@ -526,12 +526,14 @@ public class PathBuilder {
 
             if (vDirection == vEndNbr) { //当前方向与终点通道方向相同
                 if (vEndNbr == hLine) { //endLine与通道垂直
+                    int safeOffset = 5;
+                    int[] targetScope = new int[]{Math.max(lineScope[0], endNbr[0] + safeOffset), Math.min(lineScope[1], endNbr[1] - safeOffset)};
+
                     //当前点和线有偏差时,先做调整
-                    int[] targetScope = new int[]{Math.max(lineScope[0], endNbr[0]), Math.min(lineScope[1], endNbr[1])};
                     int pos = vEndNbr ? currentPoint.x : currentPoint.y;
                     if(!(pos > targetScope[0] && pos < targetScope[1])){
-                        int safeOffset = 5;//临时避免和节点边线重合
-                        int target0 = targetScope[0] + safeOffset + random.nextInt(targetScope[1] - targetScope[0] - safeOffset * 2);
+                        //临时避免和节点边线重合
+                        int target0 = targetScope[0] + random.nextInt(targetScope[1] - targetScope[0]);
                         if (vEndNbr) {
                             currentPoint.x = target0;
                         } else {
@@ -555,9 +557,9 @@ public class PathBuilder {
                 }
             } else { //当前方向与终点通道方向垂直,折线连接
                 if (vEndNbr == hLine) { //endLine与通道垂直
-                    int[] targetScope = new int[]{Math.max(lineScope[0], endNbr[0]), Math.min(lineScope[1], endNbr[1])};
                     int safeOffset = 5;//临时避免和节点边线重合
-                    int target0 = targetScope[0] + safeOffset + random.nextInt(targetScope[1] - targetScope[0] - safeOffset * 2); //TODO 调整&避免重叠
+                    int[] targetScope = new int[]{Math.max(lineScope[0], endNbr[0] + safeOffset), Math.min(lineScope[1], endNbr[1] - safeOffset)};
+                    int target0 = targetScope[0] + random.nextInt(targetScope[1] - targetScope[0]); //TODO 调整&避免重叠
                     moveTo(target0, vDirection);
                     moveTo(lineTrackPos, hLine);
                 } else { //endLine与通道平行

+ 1 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/ConnectPoint.java

@@ -3,8 +3,7 @@ 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;
-import com.persagy.adm.diagram.core.model.logic.CalcContext;
+import com.persagy.adm.diagram.core.build.CalcContext;
 import com.persagy.adm.diagram.core.model.template.MainPipe;
 
 import java.util.Objects;

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

@@ -6,7 +6,7 @@ import com.persagy.adm.diagram.core.line.LineLayoutManager;
 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.XY;
-import com.persagy.adm.diagram.core.model.logic.CalcContext;
+import com.persagy.adm.diagram.core.build.CalcContext;
 import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
 import com.persagy.adm.diagram.core.model.template.MainPipe;
 

+ 3 - 3
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/AbstractComponent.java

@@ -28,7 +28,7 @@ abstract public class AbstractComponent implements IComponent {
 	 * 使用jackson输出到web端
 	 */
 	@JsonIgnore
-	protected IContainer parent;
+	protected Container parent;
 
 	@Expose
 	protected PositionData position;
@@ -87,12 +87,12 @@ abstract public class AbstractComponent implements IComponent {
 	}
 
 	@Override
-	public IContainer getParent() {
+	public Container getParent() {
 		return parent;
 	}
 
 	@Override
-	public void setParent(IContainer parent) {
+	public void setParent(Container parent) {
 		this.parent = parent;
 	}
 

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

@@ -7,7 +7,6 @@ import com.persagy.adm.diagram.core.model.Label;
 import com.persagy.adm.diagram.core.model.logic.DataFilter;
 import com.persagy.adm.diagram.core.model.logic.DynGroup;
 import com.persagy.adm.diagram.core.model.logic.EquipPack;
-import com.persagy.adm.diagram.core.model.template.MainPipe;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -67,10 +66,10 @@ public class Container extends AbstractComponent implements IContainer, IEquipHo
 	private String dynTarget;
 
 	/**
-	 * 直接包含的干管
+	 * 适配的数据,运行时
 	 */
 	@JsonIgnore
-	private List<MainPipe> childMainPipes;
+	private List matchedData;
 
 	public Container() {
 		this.compType = TYPE;
@@ -195,6 +194,15 @@ public class Container extends AbstractComponent implements IContainer, IEquipHo
 		}
 	}
 
+	public void addComp(IComponent child, int pos){
+		children.add(pos, child);
+		child.setParent(this);
+
+		if(child.getPosition() == null) {
+			child.setPosition(child.defaultPosition());
+		}
+	}
+
 	public List<IComponent> getArrangedElements(){
 		return children.stream().filter(comp -> !comp.isAbsolutePosition()).collect(Collectors.toList());
 	}
@@ -212,10 +220,45 @@ public class Container extends AbstractComponent implements IContainer, IEquipHo
 		this.equipmentTypes = equipmentTypes;
 	}
 
+	public List<Container> listContainers(){
+		List<Container> list = new ArrayList<>();
+		getContainers(this, list);
+		return list;
+	}
+
+	private void getContainers(Container con, List<Container> list){
+		list.add(con);
+
+		if(con.getChildren() != null) {
+			for(IComponent comp : con.getChildren()) {
+				if (comp instanceof Container) {
+					getContainers((Container) comp, list);
+				}
+			}
+		}
+	}
+
 	public boolean isEquipmentBox() {
 		return CollUtil.isNotEmpty(equipmentTypes);
 	}
 
+	public void readSubContainers(List<Container> equipBoxes, List<Container> dynCons){
+		for(IComponent comp : children) {
+			if(comp instanceof Container){
+				Container con = (Container) comp;
+				if(con.isEquipmentBox()){
+					equipBoxes.add(con);
+				} else {
+					if(con.getDynGroup() == null){
+						con.readSubContainers(equipBoxes, dynCons);
+					} else {
+						dynCons.add(con);
+					}
+				}
+			}
+		}
+	}
+
 	public String getRemark() {
 		return remark;
 	}
@@ -257,6 +300,16 @@ public class Container extends AbstractComponent implements IContainer, IEquipHo
 		this.groupLabel = groupLabel;
 	}
 
+	@Override
+	public <T> List<T> getMatchedData() {
+		return matchedData;
+	}
+
+	@Override
+	public <T> void setMatchedData(List<T> matchedData) {
+		this.matchedData = matchedData;
+	}
+
 	public void initParent() {
 		List<IComponent> cs = new ArrayList<>(children);
 		children.clear();
@@ -285,7 +338,7 @@ public class Container extends AbstractComponent implements IContainer, IEquipHo
 	}
 
 	public boolean isParentOf(IComponent comp){
-		IContainer p = comp.getParent();
+		Container p = comp.getParent();
 		while (p != null) {
 			if(p == this){
 				return true;
@@ -303,19 +356,6 @@ public class Container extends AbstractComponent implements IContainer, IEquipHo
 		this.dynTarget = dynTarget;
 	}
 
-	public void addChildMainPipe(MainPipe mainPipe) {
-		if(childMainPipes == null) {
-			childMainPipes = new ArrayList<>();
-		}
-		childMainPipes.add(mainPipe);
-	}
-
-	public void removeChildMainPipe(MainPipe mainPipe) {
-		if(childMainPipes != null) {
-			childMainPipes.remove(mainPipe);
-		}
-	}
-
 	@Override
 	public PositionData defaultPosition() {
 		PositionData data = new PositionData();

+ 2 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IComponent.java

@@ -16,9 +16,9 @@ public interface IComponent {
 
     String getCompType();
 
-    IContainer getParent();
+    Container getParent();
 
-    void setParent(IContainer parent);
+    void setParent(Container parent);
 
     void layout();
 

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

@@ -19,4 +19,14 @@ public interface IEquipHolder {
 	 */
 	DataFilter getDataFilter();
 
+	/**
+	 * 获取适配的数据
+	 */
+	<T> List<T> getMatchedData();
+
+	/**
+	 * 设置适配的数据
+	 */
+	<T> void setMatchedData(List<T> matchedData);
+
 }

+ 2 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/AndFilter.java

@@ -1,5 +1,7 @@
 package com.persagy.adm.diagram.core.model.logic;
 
+import com.persagy.adm.diagram.core.build.CalcContext;
+
 /**
  * and条件
  * @author zhaoyk

+ 0 - 123
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/CalcContext.java

@@ -1,123 +0,0 @@
-package com.persagy.adm.diagram.core.model.logic;
-
-import cn.hutool.core.util.StrUtil;
-import com.persagy.adm.diagram.core.DataStrategy;
-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.base.IDataBind;
-import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
-import com.persagy.adm.diagram.core.model.template.MainPipe;
-
-import java.util.HashMap;
-
-/**
- * 系统图计算上下文
- * @author zhaoyk
- */
-public class CalcContext {
-
-	private Diagram diagram;
-
-	private DiagramTemplate template;
-
-	private DataStrategy dataStrategy;
-
-	/**
-	 * 当前动态组
-	 */
-	private Object currentGroup;
-
-	/**
-	 * 记录已经使用的数据id和对应的组件
-	 */
-	private HashMap<String, IDataBind> equipMap = new HashMap<>();
-
-	/**
-	 * 记录已经使用的关系id和对应的连线
-	 */
-	private HashMap<String, Line> lineMap = new HashMap<>();
-
-	public CalcContext(Diagram diagram) {
-		this.diagram = diagram;
-		this.template = diagram.getTemplate();
-
-		init();
-	}
-
-	private void init() {
-		//记录节点中已使用的数据id
-		diagram.getNodes().forEach(node -> {
-			if (EquipmentNode.TYPE.equals(node.getCompType())) {
-				equipMap.put(((EquipmentNode) node).getDataObjectId(), (EquipmentNode)node);
-			}
-		});
-		//记录干管中已使用的数据id
-		if(template != null && template.getMainPipes() != null) {
-			template.getMainPipes().forEach(mainPipe -> {
-				if(StrUtil.isNotBlank(mainPipe.getDataObjectId())) {
-					equipMap.put(mainPipe.getDataObjectId(), mainPipe);
-				}
-			});
-		}
-
-		diagram.getLines().forEach(line -> {
-			if (StrUtil.isNotBlank(line.getDataObjectId())){
-				lineMap.put(line.getDataObjectId(), line);
-			}
-		});
-	}
-
-	public <T> T getComp(String id, String type) {
-		//TODO 按动态组获取
-		if(MainPipe.TYPE.equals(type)) {
-			return (T)template.getMainPipeById(id);
-		} else if(EquipmentNode.TYPE.equals(type)) {
-			for(DiagramNode node : diagram.getNodes()) {
-				if(node.getId().equals(id)){
-					return (T)node;
-				}
-			}
-		} else if(Container.TYPE.equals(type)) {
-			return (T)template.getContainerById(id);
-		} else {
-			//TODO 其他类型
-		}
-		return null;
-	}
-
-	public DataStrategy getDataStrategy() {
-		return dataStrategy;
-	}
-
-	public void setDataStrategy(DataStrategy dataStrategy) {
-		this.dataStrategy = dataStrategy;
-	}
-
-	public Diagram getDiagram() {
-		return diagram;
-	}
-
-	public DiagramTemplate getTemplate() {
-		return template;
-	}
-
-	public HashMap<String, IDataBind> getEquipMap() {
-		return equipMap;
-	}
-
-	public HashMap<String, Line> getLineMap() {
-		return lineMap;
-	}
-
-	public String getProjectId() {
-		return diagram.getProjectId();
-	}
-
-	public String getGroupCode() {
-		return diagram.getGroupCode();
-	}
-
-}

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

@@ -1,6 +1,7 @@
 package com.persagy.adm.diagram.core.model.logic;
 
 import com.google.gson.annotations.Expose;
+import com.persagy.adm.diagram.core.build.CalcContext;
 
 /**
  * 设备数据过滤器

+ 6 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/DynGroup.java

@@ -1,6 +1,8 @@
 package com.persagy.adm.diagram.core.model.logic;
 
 import com.google.gson.annotations.Expose;
+import com.persagy.adm.diagram.core.model.base.Container;
+import com.persagy.adm.diagram.core.model.template.MainPipe;
 
 /**
  * 容器的动态组配置
@@ -50,4 +52,8 @@ public class DynGroup {
 		this.labelPosition = labelPosition;
 	}
 
+	public boolean isCompSrc(){
+		return Container.TYPE.equals(dynSourceType) || MainPipe.TYPE.equals(dynSourceType);
+	}
+
 }

+ 2 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/MatchFilter.java

@@ -3,7 +3,8 @@ package com.persagy.adm.diagram.core.model.logic;
 import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.gson.annotations.Expose;
-import com.persagy.adm.diagram.core.DiagramBuilder;
+import com.persagy.adm.diagram.core.build.CalcContext;
+import com.persagy.adm.diagram.core.build.DiagramBuilder;
 
 import java.util.Objects;
 

+ 2 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/OrFilter.java

@@ -1,5 +1,7 @@
 package com.persagy.adm.diagram.core.model.logic;
 
+import com.persagy.adm.diagram.core.build.CalcContext;
+
 /**
  * or条件
  * @author zhaoyk

+ 8 - 19
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/RelationFilter.java

@@ -3,10 +3,8 @@ package com.persagy.adm.diagram.core.model.logic;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.gson.annotations.Expose;
-import com.persagy.adm.diagram.core.model.EquipmentNode;
-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.template.MainPipe;
+import com.persagy.adm.diagram.core.build.CalcContext;
+import com.persagy.adm.diagram.core.model.base.IEquipHolder;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 
 import java.util.ArrayList;
@@ -58,21 +56,12 @@ public class RelationFilter extends DataFilter {
 	private void initRelations(CalcContext context) {
 		List<String> dataIds = new ArrayList<>();
 		Object o = context.getComp(relObjId, relObjType);
-		if(o instanceof MainPipe) {
-			String dataId = getDataId(((MainPipe) o).getDataObject());
-			if(dataId != null) {
-				dataIds.add(dataId);
-			}
-		} else if(o instanceof Container) {
-			Container con = (Container) o;
-			if(con.isEquipmentBox()) {
-				for(IComponent comp : con.getChildren()) {
-					if(comp instanceof EquipmentNode) {
-						String dataId = getDataId(((EquipmentNode) comp).getDataObject());
-						if(dataId != null) {
-							dataIds.add(dataId);
-						}
-					}
+		if(o instanceof IEquipHolder) {
+			List<ObjectNode> matchedData = context.getDiagramBuilder().loadMatchedData((IEquipHolder) o);
+			for(ObjectNode obj : matchedData) {
+				String dataId = getDataId(obj);
+				if(dataId != null) {
+					dataIds.add(dataId);
 				}
 			}
 		}

+ 3 - 13
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/DiagramTemplate.java

@@ -276,8 +276,7 @@ public class DiagramTemplate {
 	}
 
 	public List<Container> getContainers() {
-		List<Container> list = new ArrayList<>();
-		getContainers(frame, list);
+		List<Container> list = frame.listContainers();
 
 		if(scatteredContainers != null) {
 			list.addAll(scatteredContainers);
@@ -286,19 +285,10 @@ public class DiagramTemplate {
 		return list;
 	}
 
-	private void getContainers(Container con, List<Container> list){
-		list.add(con);
-
-		if(con.getChildren() != null) {
-			for(IComponent comp : con.getChildren()) {
-				if (comp instanceof Container) {
-					getContainers((Container) comp, list);
-				}
-			}
-		}
+	public boolean isFrameContainer(Container container) {
+		return  container != null && FRAME_ID.equals(container.getId());
 	}
 
-
 	public static DiagramTemplate defaultTemplate() {
 		DiagramTemplate template = new DiagramTemplate();
 

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

@@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.google.gson.annotations.Expose;
 import com.persagy.adm.diagram.core.model.AbstractLine;
 import com.persagy.adm.diagram.core.model.base.Container;
-import com.persagy.adm.diagram.core.model.base.IContainer;
 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;
@@ -72,10 +71,10 @@ public class MainPipe extends AbstractLine implements IEquipHolder {
 	private List<Container> relatedContainerList;
 
 	/**
-	 * 父容器对象,运行时
+	 * 适配的数据,运行时
 	 */
 	@JsonIgnore
-	private Container parentContainer;
+	private List matchedData;
 
 	public MainPipe() {
 		this.compType = TYPE;
@@ -89,66 +88,32 @@ public class MainPipe extends AbstractLine implements IEquipHolder {
 				if(con != null)
 					relatedContainerList.add(con);
 			}
-
-			calcParentContainer();
-		}
-	}
-
-	private void calcParentContainer(){
-		IContainer p = null;
-		for(Container con : relatedContainerList) {
-			if (p == null) {
-				p = con.getParent();
-			} else {
-				p = getCommonParent(p, con.getParent());
-				if(p == null){
-					break;
-				}
-			}
-		}
-		if(p instanceof Container && !DiagramTemplate.FRAME_ID.equals(p.getId())) {
-			parentContainer = (Container) p;
-			parentContainer.addChildMainPipe(this);
-		}
-	}
-
-	private IContainer getCommonParent(IContainer p1, IContainer p2){
-		IContainer cp = p1;
-		while (true){
-			IContainer tmp = p2;
-			while (true) {
-				if(cp == tmp){
-					return cp;
-				}
-				tmp = tmp.getParent();
-				if(tmp == null){
-					break;
-				}
-			}
-			cp = cp.getParent();
-			if(cp == null){
-				break;
-			}
 		}
-		return null;
 	}
 
 	public void resetRelatedCons() {
-		if(parentContainer != null) {
-			parentContainer.removeChildMainPipe(this);
-		}
-		parentContainer = null;
 		relatedContainerList = null;
 	}
 
 	public void parseLines(List<List<XY>> lines, DiagramTemplate template) {
-		List<Container> refContainers = relatedContainerList;
-		if(CollUtil.isEmpty(refContainers)) {
+		List<Container> refContainers;
+		if(CollUtil.isEmpty(relatedContainerList)) {
 			refContainers = template.getContainers();
+		} else {
+			refContainers = new ArrayList<>();
+			for(Container con : template.getContainers()) {
+				for(Container relCon : relatedContainerList) {
+					if(relCon == con || relCon.isParentOf(con)){
+						refContainers.add(con);
+						break;
+					}
+				}
+			}
 		}
+
 		List<ContainerRefPoint> allRefPoints = new ArrayList<>();
 		for(Container con : refContainers) {
-			if (!DiagramTemplate.FRAME_ID.equals(con.getId()) && !con.isAbsolutePosition()) {
+			if (!template.isFrameContainer(con) && !con.isAbsolutePosition()) {
 				allRefPoints.addAll(ContainerRefPoint.getRefPoints(con, con.locationToRoot()));
 			}
 		}
@@ -314,10 +279,6 @@ public class MainPipe extends AbstractLine implements IEquipHolder {
 		return relatedContainerList;
 	}
 
-	public Container getParentContainer() {
-		return parentContainer;
-	}
-
 	public List<List<XY>> getLocationPath() {
 		return locationPath;
 	}
@@ -334,4 +295,14 @@ public class MainPipe extends AbstractLine implements IEquipHolder {
 		this.dynTarget = dynTarget;
 	}
 
+	@Override
+	public <T> List<T> getMatchedData() {
+		return matchedData;
+	}
+
+	@Override
+	public <T> void setMatchedData(List<T> matchedData) {
+		this.matchedData = matchedData;
+	}
+
 }

+ 0 - 4
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DemoDiagramManager.java

@@ -2,12 +2,8 @@ package com.persagy.adm.diagram.manage;
 
 import cn.hutool.core.util.IdUtil;
 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.DiagramDataLoader;
 import com.persagy.adm.diagram.core.model.Diagram;
-import com.persagy.adm.diagram.core.model.logic.CalcContext;
-import com.persagy.adm.diagram.core.util.MyObjectMapper;
 import com.persagy.adm.diagram.entity.DiagramType;
 import com.persagy.adm.diagram.frame.BdtpRequest;
 import org.springframework.beans.factory.annotation.Autowired;

+ 2 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DiagramManager.java

@@ -3,9 +3,9 @@ package com.persagy.adm.diagram.manage;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.persagy.adm.diagram.core.ContentParser;
 import com.persagy.adm.diagram.core.DataStrategy;
-import com.persagy.adm.diagram.core.DiagramDataLoader;
+import com.persagy.adm.diagram.core.build.DiagramDataLoader;
 import com.persagy.adm.diagram.core.model.Diagram;
-import com.persagy.adm.diagram.core.model.logic.CalcContext;
+import com.persagy.adm.diagram.core.build.CalcContext;
 import com.persagy.adm.diagram.core.util.MyObjectMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;

+ 5 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/TemplateManager.java

@@ -6,7 +6,10 @@ import cn.hutool.core.util.StrUtil;
 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.base.*;
+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.Layout;
+import com.persagy.adm.diagram.core.model.base.XY;
 import com.persagy.adm.diagram.core.model.logic.DataFilter;
 import com.persagy.adm.diagram.core.model.logic.DynGroup;
 import com.persagy.adm.diagram.core.model.logic.EquipPack;
@@ -201,7 +204,7 @@ public class TemplateManager {
         template.init();
 
         Container con = template.getContainerById(containerId);
-        IContainer parent = con.getParent();
+        Container parent = con.getParent();
         if (parent != null) {
             List<IComponent> list = parent.getChildren();