端到端功能 子流程节点展开后 内外节点连线处理
This commit is contained in:
parent
1953a9aa1a
commit
e380479207
Binary file not shown.
@ -4,6 +4,7 @@ import com.actionsoft.apps.coe.method.process.subprocess.constant.ElementType;
|
||||
import com.actionsoft.apps.coe.method.process.subprocess.constant.SubProcessConst;
|
||||
import com.actionsoft.apps.coe.method.process.subprocess.graph.component.AbstractDefinitionHandle;
|
||||
import com.actionsoft.apps.coe.method.process.subprocess.graph.util.LinkerPointCalculationHandle;
|
||||
import com.actionsoft.exception.AWSException;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
@ -91,6 +92,7 @@ public class ExpandOrCloseShapeLinkerConvertHandle {
|
||||
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, leadNodeId, procedureId, fromBounding, toBounding);
|
||||
// 连线属于内外交叉连线 加个特殊标识属性
|
||||
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
||||
linker.put("creator", "system");
|
||||
definitionHandle.addEle(linker.getString("id"), linker);
|
||||
break;
|
||||
}
|
||||
@ -109,6 +111,7 @@ public class ExpandOrCloseShapeLinkerConvertHandle {
|
||||
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, scopeShapeId, procedureId, fromBounding, toBounding);
|
||||
// 连线属于内外交叉连线 加个特殊标识属性
|
||||
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
||||
linker.put("creator", "system");
|
||||
definitionHandle.addEle(linker.getString("id"), linker);
|
||||
break;
|
||||
}
|
||||
@ -145,6 +148,7 @@ public class ExpandOrCloseShapeLinkerConvertHandle {
|
||||
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, procedureId, rearNodeId, fromBounding, toBounding);
|
||||
// 连线属于内外交叉连线 加个特殊标识属性
|
||||
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
||||
linker.put("creator", "system");
|
||||
definitionHandle.addEle(linker.getString("id"), linker);
|
||||
break;
|
||||
}
|
||||
@ -163,6 +167,7 @@ public class ExpandOrCloseShapeLinkerConvertHandle {
|
||||
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, procedureId, scopeShapeId, fromBounding, toBounding);
|
||||
// 连线属于内外交叉连线 加个特殊标识属性
|
||||
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
||||
linker.put("creator", "system");
|
||||
definitionHandle.addEle(linker.getString("id"), linker);
|
||||
break;
|
||||
}
|
||||
@ -178,84 +183,112 @@ public class ExpandOrCloseShapeLinkerConvertHandle {
|
||||
* 根据节点连线保存记录信息 进行连线替换
|
||||
*/
|
||||
public void shapeLinkerReplaceHandle(){
|
||||
JSONObject nodeLinkerRecord = definitionHandle.getNodeLinkerRecord();
|
||||
JSONObject elements = definitionHandle.getElements();
|
||||
List<JSONObject> nodeList = elements.keySet()
|
||||
.stream().filter(key -> "OUTER_NODE".equals(elements.getJSONObject(key).getString("elementType")) || "SCOPE_NODE".equals(elements.getJSONObject(key).getString("elementType")))
|
||||
.map(key -> elements.getJSONObject(key))
|
||||
.collect(Collectors.toList());
|
||||
JSONObject nodeLinkerRecord = null;
|
||||
try {
|
||||
nodeLinkerRecord = definitionHandle.getNodeLinkerRecord();
|
||||
} catch (AWSException e) {
|
||||
return;
|
||||
}
|
||||
for (String linkerRecordKey : nodeLinkerRecord.keySet()) {
|
||||
JSONObject linkerRecord = nodeLinkerRecord.getJSONObject(linkerRecordKey);
|
||||
String fromId = linkerRecord.getString("fromId");
|
||||
String fromElementType = linkerRecord.getString("fromElementType");
|
||||
String linkerElementType = linkerRecord.getString("linkerElementType");
|
||||
String toElementType = linkerRecord.getString("toElementType");
|
||||
String toId = linkerRecord.getString("toId");
|
||||
|
||||
for (JSONObject shape : nodeList) {
|
||||
String leadShapeId = shape.getString("id");
|
||||
JSONObject nodeLinkerInfo = nodeLinkerRecord.getJSONObject(leadShapeId);
|
||||
JSONObject status = null;
|
||||
String fromNodeType = "close";
|
||||
if (definitionHandle.getElementTypeByKey(leadShapeId).name().equals(ElementType.OUTER_NODE.name())){ // 当前节点是闭合的
|
||||
if (!nodeLinkerInfo.containsKey("close")){
|
||||
continue; // 不处理
|
||||
}
|
||||
status = nodeLinkerInfo.getJSONObject("close");
|
||||
}else {
|
||||
if (!nodeLinkerInfo.containsKey("expand")){
|
||||
continue; // 不处理
|
||||
}
|
||||
status = nodeLinkerInfo.getJSONObject("expand");
|
||||
fromNodeType = "expand";
|
||||
}
|
||||
JSONObject leadNodeProps = shape.getJSONObject("props");
|
||||
JSONArray rearLinkerInfo = status.getJSONArray("rearLinkerInfo");
|
||||
if (rearLinkerInfo.size() > 0){
|
||||
List<JSONObject> linkerList = new ArrayList<>();
|
||||
for (Object o : rearLinkerInfo) {
|
||||
JSONObject linker = (JSONObject) o;
|
||||
String rearNodeId = linker.getString("rearNodeId");
|
||||
String hisFromNodeType = linker.getString("fromNodeType");
|
||||
String hisToNodeType = linker.getString("toNodeType");
|
||||
String toNodeType = "close";
|
||||
if (!definitionHandle.getElementTypeByKey(rearNodeId).name().equals(ElementType.OUTER_NODE.name())){
|
||||
toNodeType = "expand";
|
||||
}
|
||||
JSONObject rearNodeProps = definitionHandle.getShapeByProps(rearNodeId);
|
||||
JSONObject fromProps = linkerRecord.getJSONObject("fromProps");
|
||||
JSONObject toProps = linkerRecord.getJSONObject("toProps");
|
||||
|
||||
JSONObject hisLeadNodeProps = linker.getJSONObject("leadNodeProps");
|
||||
JSONObject hisRearNodeProps = linker.getJSONObject("rearNodeProps");
|
||||
JSONObject linker = linkerRecord.getJSONObject("linker");
|
||||
|
||||
if (leadNodeProps.getDouble("x").doubleValue() == hisLeadNodeProps.getDouble("x").doubleValue()
|
||||
&& leadNodeProps.getDouble("y").doubleValue() == hisLeadNodeProps.getDouble("y").doubleValue()
|
||||
&& leadNodeProps.getDouble("w").doubleValue() == hisLeadNodeProps.getDouble("w").doubleValue()
|
||||
&& leadNodeProps.getDouble("h").doubleValue() == hisLeadNodeProps.getDouble("h").doubleValue()
|
||||
&& rearNodeProps.getDouble("x").doubleValue() == hisRearNodeProps.getDouble("x").doubleValue()
|
||||
&& rearNodeProps.getDouble("y").doubleValue() == hisRearNodeProps.getDouble("y").doubleValue()
|
||||
&& rearNodeProps.getDouble("w").doubleValue() == hisRearNodeProps.getDouble("w").doubleValue()
|
||||
&& rearNodeProps.getDouble("h").doubleValue() == hisRearNodeProps.getDouble("h").doubleValue()
|
||||
&& fromNodeType.equals(hisFromNodeType) && toNodeType.equals(hisToNodeType)){
|
||||
|
||||
|
||||
JSONObject tempLinker = linker.getJSONObject("linker");
|
||||
linkerList.add(tempLinker);
|
||||
|
||||
}
|
||||
}
|
||||
if (linkerList.size() > 0){
|
||||
// 删除当前节点的后置连线
|
||||
JSONArray linkers = definitionHandle.getLinkers();
|
||||
List<String> toDeleteLinkerId = linkers.stream().filter(l -> {
|
||||
// 根据以上信息做校验 如果存在系统创建的连线 则删除 用人为调整的替换
|
||||
JSONArray linkers = definitionHandle.getLinkers();
|
||||
List<String> toDeleteLinkerIds = linkers.stream()
|
||||
.filter(o -> {
|
||||
boolean flag = false;
|
||||
JSONObject link = (JSONObject) l;
|
||||
String fromId = link.getJSONObject("from").getString("id");
|
||||
JSONObject fromNode = definitionHandle.getShapeByKey(fromId);
|
||||
if ((fromNode.getString("elementType").equals(ElementType.OUTER_NODE.name()) || fromNode.getString("elementType").equals(ElementType.SCOPE_NODE.name())) && fromId.equals(leadShapeId)) {
|
||||
flag = true;
|
||||
} else if (fromNode.getString("elementType").equals(ElementType.INNER_NODE.name()) && fromNode.getString("scopeShapeId").equals(leadShapeId) && link.getString("elementType").equals(ElementType.CROSS_LINKER.name())) {
|
||||
JSONObject l = (JSONObject) o;
|
||||
JSONObject tempFrom = l.getJSONObject("from");
|
||||
String tempFromId = tempFrom.getString("id");
|
||||
String tempFromElementType = definitionHandle.getShapeByKey(tempFromId).getString("elementType");
|
||||
String tempLinkerElementType = l.getString("elementType");
|
||||
JSONObject tempTo = l.getJSONObject("to");
|
||||
String tempToId = tempTo.getString("id");
|
||||
String tempToElementType = definitionHandle.getShapeByKey(tempToId).getString("elementType");
|
||||
if (fromId.equals(tempFromId)
|
||||
&& fromElementType.equals(tempFromElementType)
|
||||
&& linkerElementType.equals(tempLinkerElementType)
|
||||
&& toElementType.equals(tempToElementType)
|
||||
&& toId.equals(tempToId) && "system".equals(l.getString("creator"))) {
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}).map(l -> ((JSONObject) l).getString("id")).collect(Collectors.toList());
|
||||
for (String id : toDeleteLinkerId) {
|
||||
definitionHandle.removeShape(id);
|
||||
})
|
||||
.map(o -> ((JSONObject) o).getString("id"))
|
||||
.collect(Collectors.toList());
|
||||
if (toDeleteLinkerIds.size() > 0){
|
||||
for (String toDeleteLinkerId : toDeleteLinkerIds) {
|
||||
definitionHandle.removeShape(toDeleteLinkerId);
|
||||
}
|
||||
}
|
||||
|
||||
// 根据上面信息做判断 是否将人为连线放入 define
|
||||
JSONObject elements = definitionHandle.getElements();
|
||||
JSONObject fromNode = elements.getJSONObject(fromId);
|
||||
JSONObject toNode = elements.getJSONObject(toId);
|
||||
if (elements.containsKey(fromId)
|
||||
&& fromNode.getString("elementType").equals(fromElementType)
|
||||
&& elements.containsKey(toId)
|
||||
&& toNode.getString("elementType").equals(toElementType)){
|
||||
// 将人为连线放入 define 还需判断 from to 节点位置是否发生变化 进而判断是否需要重新绘制连线
|
||||
JSONObject tempFromProps = fromNode.getJSONObject("props");
|
||||
JSONObject tempToProps = toNode.getJSONObject("props");
|
||||
if (fromProps.getDouble("x").doubleValue() == tempFromProps.getDouble("x").doubleValue()
|
||||
&& fromProps.getDouble("y").doubleValue() == tempFromProps.getDouble("y").doubleValue()
|
||||
&& toProps.getDouble("x").doubleValue() == tempToProps.getDouble("x").doubleValue()
|
||||
&& toProps.getDouble("y").doubleValue() == tempToProps.getDouble("y").doubleValue()){ // 当前坐标记录的坐标一致 不用重新渲染连线 直接加入 define
|
||||
|
||||
definitionHandle.addEle(linker.getString("id"), linker);
|
||||
}else {
|
||||
// 重新绘制连线 在添加
|
||||
double fromDistanceX = tempFromProps.getDoubleValue("x") - fromProps.getDoubleValue("x");
|
||||
double fromDistanceY = tempFromProps.getDoubleValue("y") - fromProps.getDoubleValue("y");
|
||||
|
||||
double toDistanceX = tempToProps.getDoubleValue("x") - toProps.getDoubleValue("x");
|
||||
double toDistanceY = tempToProps.getDoubleValue("y") - toProps.getDoubleValue("y");
|
||||
|
||||
// 计算连线起始点
|
||||
JSONObject from = linker.getJSONObject("from");
|
||||
from.put("x", from.getDoubleValue("x") + fromDistanceX);
|
||||
from.put("y", from.getDoubleValue("y") + fromDistanceY);
|
||||
JSONObject to = linker.getJSONObject("to");
|
||||
to.put("x", to.getDoubleValue("x") + toDistanceX);
|
||||
to.put("y", to.getDoubleValue("y") + toDistanceY);
|
||||
|
||||
// 计算连线拐点
|
||||
JSONArray points = linker.getJSONArray("points");
|
||||
if (fromDistanceX == toDistanceX){ // 两个节点水平移动距离一致
|
||||
for (Object o : points) {
|
||||
JSONObject point = (JSONObject) o;
|
||||
point.put("x", point.getDoubleValue("x") + fromDistanceX);
|
||||
}
|
||||
}else if (fromDistanceX == 0 && toDistanceX != 0){
|
||||
for (Object o : points) {
|
||||
JSONObject point = (JSONObject) o;
|
||||
point.put("x", point.getDoubleValue("x") + toDistanceX);
|
||||
}
|
||||
}
|
||||
for (JSONObject tempLinker : linkerList) {
|
||||
definitionHandle.addEle(tempLinker.getString("id"), tempLinker);
|
||||
|
||||
if (fromDistanceY == toDistanceY){
|
||||
for (Object o : points) {
|
||||
JSONObject point = (JSONObject) o;
|
||||
point.put("y", point.getDoubleValue("y") + fromDistanceY);
|
||||
}
|
||||
}else if (fromDistanceY == 0 && toDistanceY != 0){
|
||||
for (Object o : points) {
|
||||
JSONObject point = (JSONObject) o;
|
||||
point.put("y", point.getDoubleValue("y") + toDistanceY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,6 +124,7 @@ public class GraphNodeCloseHandle {
|
||||
for (Object o : linkers) {
|
||||
JSONObject linker = (JSONObject) o;
|
||||
linker.put("elementType", ElementType.OUTER_LINKER.name());
|
||||
linker.put("creator", "system");
|
||||
definitionHandle.addEle(linker.getString("id"), linker);
|
||||
}
|
||||
|
||||
|
||||
@ -185,6 +185,7 @@ public class GraphNodeExpandHandle {
|
||||
for (Object o : linkers) {
|
||||
JSONObject linker = (JSONObject) o;
|
||||
linker.put("elementType", ElementType.OUTER_LINKER.name());
|
||||
linker.put("creator", "system");
|
||||
definitionHandle.addEle(linker.getString("id"), linker);
|
||||
}
|
||||
|
||||
@ -232,6 +233,7 @@ public class GraphNodeExpandHandle {
|
||||
}
|
||||
|
||||
ele.put("elementType", ElementType.INNER_LINKER.name());
|
||||
ele.put("creator", "system");
|
||||
}else { // 图形
|
||||
JSONObject props = ele.getJSONObject("props");
|
||||
props.put("x", distanceX + props.getDoubleValue("x"));
|
||||
|
||||
@ -176,6 +176,8 @@ public class GraphRender {
|
||||
|
||||
linker.put("elementType", ElementType.OUTER_LINKER.name());
|
||||
|
||||
linker.put("creator", "system"); // 标识系统生成
|
||||
|
||||
elements.put(linkerId, linker);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@ -6118,163 +6118,66 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
}
|
||||
|
||||
// 维护节点连线信息
|
||||
List<JSONObject> linkers = elements.keySet()
|
||||
List<JSONObject> personLinkers = elements.keySet()
|
||||
.stream()
|
||||
.filter(key -> "OUTER_LINKER".equals(elements.getJSONObject(key).getString("elementType")) || "CROSS_LINKER".equals(elements.getJSONObject(key).getString("elementType")))
|
||||
.map(key -> elements.getJSONObject(key))
|
||||
.collect(Collectors.toList());
|
||||
List<JSONObject> nodeList = elements.keySet()
|
||||
.stream().filter(key -> "OUTER_NODE".equals(elements.getJSONObject(key).getString("elementType")) || "SCOPE_NODE".equals(elements.getJSONObject(key).getString("elementType")))
|
||||
.map(key -> elements.getJSONObject(key))
|
||||
.filter(key -> "linker".equals(elements.getJSONObject(key).getString("name")))
|
||||
.filter(key -> "person".equals(elements.getJSONObject(key).getString("creator")))
|
||||
.map(key -> {
|
||||
JSONObject linker = elements.getJSONObject(key);
|
||||
JSONObject fromNode = linker.getJSONObject("from");
|
||||
String fromNodeId = fromNode.getString("id");
|
||||
String fromElementType = UtilString.isNotEmpty(fromNodeId) ? elements.getJSONObject(fromNodeId).getString("elementType") : "";
|
||||
JSONObject toNode = linker.getJSONObject("to");
|
||||
String toNodeId = toNode.getString("id");
|
||||
String toElementType = UtilString.isNotEmpty(toNodeId) ? elements.getJSONObject(toNodeId).getString("elementType") : "";
|
||||
JSONObject personLinker = new JSONObject();
|
||||
personLinker.put("linkerId", linker.getString("id"));
|
||||
personLinker.put("fromId", fromNodeId);
|
||||
personLinker.put("fromProps", UtilString.isNotEmpty(fromNodeId) ? JSONObject.parse(elements.getJSONObject(fromNodeId).getJSONObject("props").toString()) : "");
|
||||
personLinker.put("fromElementType", fromElementType);
|
||||
personLinker.put("toId", toNodeId);
|
||||
personLinker.put("toProps", UtilString.isNotEmpty(toNodeId) ? JSONObject.parse(elements.getJSONObject(toNodeId).getJSONObject("props").toString()) : "");
|
||||
personLinker.put("toElementType", toElementType);
|
||||
personLinker.put("creator", linker.getString("creator"));
|
||||
personLinker.put("linker", JSONObject.parse(linker.toString()));
|
||||
personLinker.put("linkerElementType", linker.getString("elementType"));
|
||||
return personLinker;
|
||||
})
|
||||
.filter(personLinker -> !("INNER_NODE".equals(personLinker.getString("fromElementType")) && "INNER_NODE".equals(personLinker.getString("toElementType"))))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
JSONObject nodeLinkerRecord = new JSONObject();
|
||||
if (definition.containsKey("nodeLinkerRecord")){
|
||||
nodeLinkerRecord = definition.getJSONObject("nodeLinkerRecord");
|
||||
}
|
||||
for (JSONObject shape : nodeList) {
|
||||
String shapeId = shape.getString("id");
|
||||
JSONObject status = new JSONObject();
|
||||
if (nodeLinkerRecord.containsKey(shapeId)){
|
||||
status = nodeLinkerRecord.getJSONObject(shapeId);
|
||||
}
|
||||
JSONObject recordContent = new JSONObject();
|
||||
if ("OUTER_NODE".equals(shape.getString("elementType"))){ // 当前状态为闭合
|
||||
if (status.containsKey("close")){
|
||||
recordContent = status.getJSONObject("close");
|
||||
}
|
||||
}else { // 当前状态为展开
|
||||
if (status.containsKey("expand")){
|
||||
recordContent = status.getJSONObject("expand");
|
||||
|
||||
if (personLinkers.size() > 0){
|
||||
List<String> toDeleteKeys = new ArrayList<>();
|
||||
for (String key : nodeLinkerRecord.keySet()) {
|
||||
JSONObject linkerRecord = nodeLinkerRecord.getJSONObject(key);
|
||||
List<JSONObject> tempLinkers = personLinkers.stream()
|
||||
.filter(personLinker -> linkerRecord.getString("fromElementType").equals(personLinker.getString("fromElementType"))
|
||||
&& linkerRecord.getString("fromId").equals(personLinker.getString("fromId"))
|
||||
&& linkerRecord.getString("linkerElementType").equals(personLinker.getString("linkerElementType"))
|
||||
&& linkerRecord.getString("toElementType").equals(personLinker.getString("toElementType"))
|
||||
&& linkerRecord.getString("toId").equals(personLinker.getString("toId")))
|
||||
.collect(Collectors.toList());
|
||||
if (tempLinkers.size() > 0){
|
||||
toDeleteKeys.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray leadLinkerInfo = new JSONArray(); // 前置连线信息
|
||||
if (recordContent.containsKey("leadLinkerInfo")){
|
||||
leadLinkerInfo = recordContent.getJSONArray("leadLinkerInfo");
|
||||
}
|
||||
JSONArray rearLinkerInfo = new JSONArray(); // 后置连线信息
|
||||
if (recordContent.containsKey("rearLinkerInfo")){
|
||||
rearLinkerInfo = recordContent.getJSONArray("rearLinkerInfo");
|
||||
}
|
||||
|
||||
for (JSONObject linker : linkers) {
|
||||
JSONObject from = linker.getJSONObject("from");
|
||||
JSONObject to = linker.getJSONObject("to");
|
||||
JSONObject fromNode = elements.getJSONObject(from.getString("id"));
|
||||
JSONObject toNode = elements.getJSONObject(to.getString("id"));
|
||||
|
||||
JSONObject linkerInfo = new JSONObject();
|
||||
linkerInfo.put("linker", JSONObject.parse(linker.toString()));
|
||||
linkerInfo.put("fromNodeType", fromNode.getString("elementType").equals("OUTER_NODE") ? "close" : "expand");
|
||||
linkerInfo.put("toNodeType", toNode.getString("elementType").equals("OUTER_NODE") ? "close" : "expand");
|
||||
linkerInfo.put("actualLeadNodeId", fromNode.getString("id"));
|
||||
linkerInfo.put("actualRearNodeId", toNode.getString("id"));
|
||||
if ("OUTER_NODE".equals(shape.getString("elementType"))){ // 当前节点闭合
|
||||
if (shapeId.equals(to.getString("id"))){ // 当前节点的前置连线信息
|
||||
linkerInfo.put("leadNodeId", "OUTER_NODE".equals(fromNode.getString("elementType")) || "SCOPE_NODE".equals(fromNode.getString("elementType")) ? from.getString("id") : fromNode.getString("scopeShapeId"));
|
||||
linkerInfo.put("rearNodeId", shapeId);
|
||||
JSONObject fromProps = null;
|
||||
if (fromNode.getString("elementType").equals("OUTER_NODE") || fromNode.getString("elementType").equals("SCOPE_NODE")){
|
||||
fromProps = fromNode.getJSONObject("props");
|
||||
}else {
|
||||
fromProps = elements.getJSONObject(fromNode.getString("scopeShapeId")).getJSONObject("props");
|
||||
}
|
||||
linkerInfo.put("leadNodeProps", JSONObject.parse(fromProps.toString()));
|
||||
linkerInfo.put("rearNodeProps", JSONObject.parse(shape.getJSONObject("props").toString()));
|
||||
|
||||
// if (leadLinkerInfo.size() > 0){
|
||||
// leadLinkerInfo = leadLinkerInfo.stream()
|
||||
// .filter(o -> !(((JSONObject)o).getString("fromNodeType").equals(linkerInfo.getString("fromNodeType"))
|
||||
// && ((JSONObject)o).getString("toNodeType").equals(linkerInfo.getString("toNodeType"))
|
||||
// && ((JSONObject)o).getString("actualLeadNodeId").equals(fromNode.getString("id"))
|
||||
// && ((JSONObject)o).getString("actualRearNodeId").equals(shapeId)
|
||||
// && ((JSONObject)o).getString("leadNodeId").equals(linkerInfo.getString("leadNodeId"))
|
||||
// && ((JSONObject)o).getString("rearNodeId").equals(linkerInfo.getString("rearNodeId"))))
|
||||
// .map(o -> ((JSONObject)o)).collect(Collectors.toCollection(JSONArray::new));
|
||||
// }
|
||||
leadLinkerInfo.add(linkerInfo);
|
||||
}else if (shapeId.equals(from.getString("id"))){ // 当前节点的后置连线信息
|
||||
linkerInfo.put("leadNodeId", shapeId);
|
||||
linkerInfo.put("rearNodeId", "OUTER_NODE".equals(toNode.getString("elementType")) || "SCOPE_NODE".equals(toNode.getString("elementType")) ? to.getString("id") : toNode.getString("scopeShapeId"));
|
||||
linkerInfo.put("leadNodeProps", JSONObject.parse(shape.getJSONObject("props").toString()));
|
||||
JSONObject toProps = null;
|
||||
if (toNode.getString("elementType").equals("OUTER_NODE") || toNode.getString("elementType").equals("SCOPE_NODE")){
|
||||
toProps = toNode.getJSONObject("props");
|
||||
}else {
|
||||
toProps = elements.getJSONObject(toNode.getString("scopeShapeId")).getJSONObject("props");
|
||||
}
|
||||
linkerInfo.put("rearNodeProps", JSONObject.parse(toProps.toString()));
|
||||
// if (rearLinkerInfo.size() > 0){
|
||||
// rearLinkerInfo = rearLinkerInfo.stream()
|
||||
// .filter(o -> !(((JSONObject)o).getString("fromNodeType").equals(linkerInfo.getString("fromNodeType"))
|
||||
// && ((JSONObject)o).getString("toNodeType").equals(linkerInfo.getString("toNodeType"))
|
||||
// && ((JSONObject)o).getString("actualLeadNodeId").equals(shapeId)
|
||||
// && ((JSONObject)o).getString("actualRearNodeId").equals(toNode.getString("id"))
|
||||
// && ((JSONObject)o).getString("leadNodeId").equals(linkerInfo.getString("leadNodeId"))
|
||||
// && ((JSONObject)o).getString("rearNodeId").equals(linkerInfo.getString("rearNodeId")))).map(o -> ((JSONObject)o)).collect(Collectors.toCollection(JSONArray::new));
|
||||
// }
|
||||
rearLinkerInfo.add(linkerInfo);
|
||||
}
|
||||
}else {
|
||||
if (shapeId.equals("INNER_NODE".equals(toNode.getString("elementType")) ? toNode.getString("scopeShapeId") : toNode.getString("id"))){
|
||||
linkerInfo.put("leadNodeId", "OUTER_NODE".equals(fromNode.getString("elementType")) || "SCOPE_NODE".equals(fromNode.getString("elementType")) ? from.getString("id") : fromNode.getString("scopeShapeId"));
|
||||
linkerInfo.put("rearNodeId", shapeId);
|
||||
JSONObject fromProps = null;
|
||||
if (fromNode.getString("elementType").equals("OUTER_NODE") || fromNode.getString("elementType").equals("SCOPE_NODE")){
|
||||
fromProps = fromNode.getJSONObject("props");
|
||||
}else {
|
||||
fromProps = elements.getJSONObject(fromNode.getString("scopeShapeId")).getJSONObject("props");
|
||||
}
|
||||
linkerInfo.put("leadNodeProps", JSONObject.parse(fromProps.toString()));
|
||||
linkerInfo.put("rearNodeProps", JSONObject.parse(shape.getJSONObject("props").toString()));
|
||||
// if (leadLinkerInfo.size() > 0){
|
||||
// leadLinkerInfo = leadLinkerInfo.stream()
|
||||
// .filter(o -> !(((JSONObject)o).getString("fromNodeType").equals(linkerInfo.getString("fromNodeType"))
|
||||
// && ((JSONObject)o).getString("toNodeType").equals(linkerInfo.getString("toNodeType"))
|
||||
// && ((JSONObject)o).getString("actualLeadNodeId").equals(fromNode.getString("id"))
|
||||
// && ((JSONObject)o).getString("actualRearNodeId").equals(shapeId)
|
||||
// && ((JSONObject)o).getString("leadNodeId").equals(linkerInfo.getString("leadNodeId"))
|
||||
// && ((JSONObject)o).getString("rearNodeId").equals(linkerInfo.getString("rearNodeId")))).map(o -> ((JSONObject)o)).collect(Collectors.toCollection(JSONArray::new));
|
||||
// }
|
||||
leadLinkerInfo.add(linkerInfo);
|
||||
}else if (shapeId.equals("INNER_NODE".equals(fromNode.getString("elementType")) ? fromNode.getString("scopeShapeId") : fromNode.getString("id"))){
|
||||
linkerInfo.put("leadNodeId", shapeId);
|
||||
linkerInfo.put("rearNodeId", "OUTER_NODE".equals(toNode.getString("elementType")) || "SCOPE_NODE".equals(toNode.getString("elementType")) ? to.getString("id") : toNode.getString("scopeShapeId"));
|
||||
linkerInfo.put("leadNodeProps", JSONObject.parse(shape.getJSONObject("props").toString()));
|
||||
JSONObject toProps = null;
|
||||
if (toNode.getString("elementType").equals("OUTER_NODE") || toNode.getString("elementType").equals("SCOPE_NODE")){
|
||||
toProps = toNode.getJSONObject("props");
|
||||
}else {
|
||||
toProps = elements.getJSONObject(toNode.getString("scopeShapeId")).getJSONObject("props");
|
||||
}
|
||||
linkerInfo.put("rearNodeProps", JSONObject.parse(toProps.toString()));
|
||||
// if (rearLinkerInfo.size() > 0){
|
||||
// rearLinkerInfo = rearLinkerInfo.stream()
|
||||
// .filter(o -> !(((JSONObject)o).getString("fromNodeType").equals(linkerInfo.getString("fromNodeType"))
|
||||
// && ((JSONObject)o).getString("toNodeType").equals(linkerInfo.getString("toNodeType"))
|
||||
// && ((JSONObject)o).getString("actualLeadNodeId").equals(shapeId)
|
||||
// && ((JSONObject)o).getString("actualRearNodeId").equals(toNode.getString("id"))
|
||||
// && ((JSONObject)o).getString("leadNodeId").equals(linkerInfo.getString("leadNodeId"))
|
||||
// && ((JSONObject)o).getString("rearNodeId").equals(linkerInfo.getString("rearNodeId")))).map(o -> ((JSONObject)o)).collect(Collectors.toCollection(JSONArray::new));
|
||||
// }
|
||||
rearLinkerInfo.add(linkerInfo);
|
||||
}
|
||||
if (toDeleteKeys.size() > 0){
|
||||
for (String toDeleteKey : toDeleteKeys) {
|
||||
nodeLinkerRecord.remove(toDeleteKey);
|
||||
}
|
||||
}
|
||||
recordContent.put("leadLinkerInfo", leadLinkerInfo);
|
||||
recordContent.put("rearLinkerInfo", rearLinkerInfo);
|
||||
|
||||
if ("OUTER_NODE".equals(shape.getString("elementType"))){ // 当前状态为闭合
|
||||
status.put("close", recordContent);
|
||||
}else { // 当前状态为展开
|
||||
status.put("expand", recordContent);
|
||||
for (JSONObject personLinker : personLinkers) {
|
||||
String linkerId = personLinker.getString("linkerId");
|
||||
nodeLinkerRecord.put(linkerId, personLinker);
|
||||
}
|
||||
|
||||
nodeLinkerRecord.put(shapeId, status);
|
||||
}
|
||||
definition.put("nodeLinkerRecord", nodeLinkerRecord);
|
||||
|
||||
definition.put("nodeLinkerRecord", nodeLinkerRecord);
|
||||
|
||||
}else if (repositoryModel.getMethodId().equals("process.epc") || repositoryModel.getMethodId().equals("process.flowchart")){
|
||||
// 判断当前模型是否被某一个总图引用
|
||||
|
||||
@ -2175,6 +2175,7 @@ var Designer = {
|
||||
window.subProcess.linkerBoxPointerEvent();
|
||||
// 判断新建的连线是什么类型 INNER_LINKER OUTER_LINKER CROSS_LINKER
|
||||
if (d != null){
|
||||
d.creator = "person"; // 加上人为创建的标识 区分系统创建
|
||||
let from = d.from;
|
||||
let to = d.to;
|
||||
if (from.id != null && to.id != null){
|
||||
@ -6923,6 +6924,9 @@ var Utils = {
|
||||
var p = Model.getShapeById(o);
|
||||
Utils.selectIds.push(o);
|
||||
if (p && p.name == "linker") {
|
||||
if (methodId == 'process.subprocess'){ // 区分系统生成的连线
|
||||
p.creator = 'person';
|
||||
}
|
||||
if (this.isLocked(p.id)) {
|
||||
Utils.showLockers(p)
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user