端到端功能 子流程节点展开后 内外节点连线处理
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.constant.SubProcessConst;
|
||||||
import com.actionsoft.apps.coe.method.process.subprocess.graph.component.AbstractDefinitionHandle;
|
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.apps.coe.method.process.subprocess.graph.util.LinkerPointCalculationHandle;
|
||||||
|
import com.actionsoft.exception.AWSException;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
@ -91,6 +92,7 @@ public class ExpandOrCloseShapeLinkerConvertHandle {
|
|||||||
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, leadNodeId, procedureId, fromBounding, toBounding);
|
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, leadNodeId, procedureId, fromBounding, toBounding);
|
||||||
// 连线属于内外交叉连线 加个特殊标识属性
|
// 连线属于内外交叉连线 加个特殊标识属性
|
||||||
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
||||||
|
linker.put("creator", "system");
|
||||||
definitionHandle.addEle(linker.getString("id"), linker);
|
definitionHandle.addEle(linker.getString("id"), linker);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -109,6 +111,7 @@ public class ExpandOrCloseShapeLinkerConvertHandle {
|
|||||||
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, scopeShapeId, procedureId, fromBounding, toBounding);
|
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, scopeShapeId, procedureId, fromBounding, toBounding);
|
||||||
// 连线属于内外交叉连线 加个特殊标识属性
|
// 连线属于内外交叉连线 加个特殊标识属性
|
||||||
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
||||||
|
linker.put("creator", "system");
|
||||||
definitionHandle.addEle(linker.getString("id"), linker);
|
definitionHandle.addEle(linker.getString("id"), linker);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -145,6 +148,7 @@ public class ExpandOrCloseShapeLinkerConvertHandle {
|
|||||||
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, procedureId, rearNodeId, fromBounding, toBounding);
|
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, procedureId, rearNodeId, fromBounding, toBounding);
|
||||||
// 连线属于内外交叉连线 加个特殊标识属性
|
// 连线属于内外交叉连线 加个特殊标识属性
|
||||||
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
||||||
|
linker.put("creator", "system");
|
||||||
definitionHandle.addEle(linker.getString("id"), linker);
|
definitionHandle.addEle(linker.getString("id"), linker);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -163,6 +167,7 @@ public class ExpandOrCloseShapeLinkerConvertHandle {
|
|||||||
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, procedureId, scopeShapeId, fromBounding, toBounding);
|
JSONObject linker = linkerPointCalculationHandle.toAssembleLinker(direction, procedureId, scopeShapeId, fromBounding, toBounding);
|
||||||
// 连线属于内外交叉连线 加个特殊标识属性
|
// 连线属于内外交叉连线 加个特殊标识属性
|
||||||
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
linker.put("elementType", ElementType.CROSS_LINKER.name());
|
||||||
|
linker.put("creator", "system");
|
||||||
definitionHandle.addEle(linker.getString("id"), linker);
|
definitionHandle.addEle(linker.getString("id"), linker);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -178,84 +183,112 @@ public class ExpandOrCloseShapeLinkerConvertHandle {
|
|||||||
* 根据节点连线保存记录信息 进行连线替换
|
* 根据节点连线保存记录信息 进行连线替换
|
||||||
*/
|
*/
|
||||||
public void shapeLinkerReplaceHandle(){
|
public void shapeLinkerReplaceHandle(){
|
||||||
JSONObject nodeLinkerRecord = definitionHandle.getNodeLinkerRecord();
|
JSONObject nodeLinkerRecord = null;
|
||||||
JSONObject elements = definitionHandle.getElements();
|
try {
|
||||||
List<JSONObject> nodeList = elements.keySet()
|
nodeLinkerRecord = definitionHandle.getNodeLinkerRecord();
|
||||||
.stream().filter(key -> "OUTER_NODE".equals(elements.getJSONObject(key).getString("elementType")) || "SCOPE_NODE".equals(elements.getJSONObject(key).getString("elementType")))
|
} catch (AWSException e) {
|
||||||
.map(key -> elements.getJSONObject(key))
|
return;
|
||||||
.collect(Collectors.toList());
|
}
|
||||||
|
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) {
|
JSONObject fromProps = linkerRecord.getJSONObject("fromProps");
|
||||||
String leadShapeId = shape.getString("id");
|
JSONObject toProps = linkerRecord.getJSONObject("toProps");
|
||||||
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 hisLeadNodeProps = linker.getJSONObject("leadNodeProps");
|
JSONObject linker = linkerRecord.getJSONObject("linker");
|
||||||
JSONObject hisRearNodeProps = linker.getJSONObject("rearNodeProps");
|
|
||||||
|
|
||||||
if (leadNodeProps.getDouble("x").doubleValue() == hisLeadNodeProps.getDouble("x").doubleValue()
|
// 根据以上信息做校验 如果存在系统创建的连线 则删除 用人为调整的替换
|
||||||
&& leadNodeProps.getDouble("y").doubleValue() == hisLeadNodeProps.getDouble("y").doubleValue()
|
JSONArray linkers = definitionHandle.getLinkers();
|
||||||
&& leadNodeProps.getDouble("w").doubleValue() == hisLeadNodeProps.getDouble("w").doubleValue()
|
List<String> toDeleteLinkerIds = linkers.stream()
|
||||||
&& leadNodeProps.getDouble("h").doubleValue() == hisLeadNodeProps.getDouble("h").doubleValue()
|
.filter(o -> {
|
||||||
&& 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 -> {
|
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
JSONObject link = (JSONObject) l;
|
JSONObject l = (JSONObject) o;
|
||||||
String fromId = link.getJSONObject("from").getString("id");
|
JSONObject tempFrom = l.getJSONObject("from");
|
||||||
JSONObject fromNode = definitionHandle.getShapeByKey(fromId);
|
String tempFromId = tempFrom.getString("id");
|
||||||
if ((fromNode.getString("elementType").equals(ElementType.OUTER_NODE.name()) || fromNode.getString("elementType").equals(ElementType.SCOPE_NODE.name())) && fromId.equals(leadShapeId)) {
|
String tempFromElementType = definitionHandle.getShapeByKey(tempFromId).getString("elementType");
|
||||||
flag = true;
|
String tempLinkerElementType = l.getString("elementType");
|
||||||
} else if (fromNode.getString("elementType").equals(ElementType.INNER_NODE.name()) && fromNode.getString("scopeShapeId").equals(leadShapeId) && link.getString("elementType").equals(ElementType.CROSS_LINKER.name())) {
|
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;
|
flag = true;
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}).map(l -> ((JSONObject) l).getString("id")).collect(Collectors.toList());
|
})
|
||||||
for (String id : toDeleteLinkerId) {
|
.map(o -> ((JSONObject) o).getString("id"))
|
||||||
definitionHandle.removeShape(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) {
|
for (Object o : linkers) {
|
||||||
JSONObject linker = (JSONObject) o;
|
JSONObject linker = (JSONObject) o;
|
||||||
linker.put("elementType", ElementType.OUTER_LINKER.name());
|
linker.put("elementType", ElementType.OUTER_LINKER.name());
|
||||||
|
linker.put("creator", "system");
|
||||||
definitionHandle.addEle(linker.getString("id"), linker);
|
definitionHandle.addEle(linker.getString("id"), linker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -185,6 +185,7 @@ public class GraphNodeExpandHandle {
|
|||||||
for (Object o : linkers) {
|
for (Object o : linkers) {
|
||||||
JSONObject linker = (JSONObject) o;
|
JSONObject linker = (JSONObject) o;
|
||||||
linker.put("elementType", ElementType.OUTER_LINKER.name());
|
linker.put("elementType", ElementType.OUTER_LINKER.name());
|
||||||
|
linker.put("creator", "system");
|
||||||
definitionHandle.addEle(linker.getString("id"), linker);
|
definitionHandle.addEle(linker.getString("id"), linker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,6 +233,7 @@ public class GraphNodeExpandHandle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ele.put("elementType", ElementType.INNER_LINKER.name());
|
ele.put("elementType", ElementType.INNER_LINKER.name());
|
||||||
|
ele.put("creator", "system");
|
||||||
}else { // 图形
|
}else { // 图形
|
||||||
JSONObject props = ele.getJSONObject("props");
|
JSONObject props = ele.getJSONObject("props");
|
||||||
props.put("x", distanceX + props.getDoubleValue("x"));
|
props.put("x", distanceX + props.getDoubleValue("x"));
|
||||||
|
|||||||
@ -176,6 +176,8 @@ public class GraphRender {
|
|||||||
|
|
||||||
linker.put("elementType", ElementType.OUTER_LINKER.name());
|
linker.put("elementType", ElementType.OUTER_LINKER.name());
|
||||||
|
|
||||||
|
linker.put("creator", "system"); // 标识系统生成
|
||||||
|
|
||||||
elements.put(linkerId, linker);
|
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()
|
.stream()
|
||||||
.filter(key -> "OUTER_LINKER".equals(elements.getJSONObject(key).getString("elementType")) || "CROSS_LINKER".equals(elements.getJSONObject(key).getString("elementType")))
|
.filter(key -> "linker".equals(elements.getJSONObject(key).getString("name")))
|
||||||
.map(key -> elements.getJSONObject(key))
|
.filter(key -> "person".equals(elements.getJSONObject(key).getString("creator")))
|
||||||
.collect(Collectors.toList());
|
.map(key -> {
|
||||||
List<JSONObject> nodeList = elements.keySet()
|
JSONObject linker = elements.getJSONObject(key);
|
||||||
.stream().filter(key -> "OUTER_NODE".equals(elements.getJSONObject(key).getString("elementType")) || "SCOPE_NODE".equals(elements.getJSONObject(key).getString("elementType")))
|
JSONObject fromNode = linker.getJSONObject("from");
|
||||||
.map(key -> elements.getJSONObject(key))
|
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());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
JSONObject nodeLinkerRecord = new JSONObject();
|
JSONObject nodeLinkerRecord = new JSONObject();
|
||||||
if (definition.containsKey("nodeLinkerRecord")){
|
if (definition.containsKey("nodeLinkerRecord")){
|
||||||
nodeLinkerRecord = definition.getJSONObject("nodeLinkerRecord");
|
nodeLinkerRecord = definition.getJSONObject("nodeLinkerRecord");
|
||||||
}
|
}
|
||||||
for (JSONObject shape : nodeList) {
|
|
||||||
String shapeId = shape.getString("id");
|
if (personLinkers.size() > 0){
|
||||||
JSONObject status = new JSONObject();
|
List<String> toDeleteKeys = new ArrayList<>();
|
||||||
if (nodeLinkerRecord.containsKey(shapeId)){
|
for (String key : nodeLinkerRecord.keySet()) {
|
||||||
status = nodeLinkerRecord.getJSONObject(shapeId);
|
JSONObject linkerRecord = nodeLinkerRecord.getJSONObject(key);
|
||||||
}
|
List<JSONObject> tempLinkers = personLinkers.stream()
|
||||||
JSONObject recordContent = new JSONObject();
|
.filter(personLinker -> linkerRecord.getString("fromElementType").equals(personLinker.getString("fromElementType"))
|
||||||
if ("OUTER_NODE".equals(shape.getString("elementType"))){ // 当前状态为闭合
|
&& linkerRecord.getString("fromId").equals(personLinker.getString("fromId"))
|
||||||
if (status.containsKey("close")){
|
&& linkerRecord.getString("linkerElementType").equals(personLinker.getString("linkerElementType"))
|
||||||
recordContent = status.getJSONObject("close");
|
&& linkerRecord.getString("toElementType").equals(personLinker.getString("toElementType"))
|
||||||
}
|
&& linkerRecord.getString("toId").equals(personLinker.getString("toId")))
|
||||||
}else { // 当前状态为展开
|
.collect(Collectors.toList());
|
||||||
if (status.containsKey("expand")){
|
if (tempLinkers.size() > 0){
|
||||||
recordContent = status.getJSONObject("expand");
|
toDeleteKeys.add(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (toDeleteKeys.size() > 0){
|
||||||
JSONArray leadLinkerInfo = new JSONArray(); // 前置连线信息
|
for (String toDeleteKey : toDeleteKeys) {
|
||||||
if (recordContent.containsKey("leadLinkerInfo")){
|
nodeLinkerRecord.remove(toDeleteKey);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recordContent.put("leadLinkerInfo", leadLinkerInfo);
|
for (JSONObject personLinker : personLinkers) {
|
||||||
recordContent.put("rearLinkerInfo", rearLinkerInfo);
|
String linkerId = personLinker.getString("linkerId");
|
||||||
|
nodeLinkerRecord.put(linkerId, personLinker);
|
||||||
if ("OUTER_NODE".equals(shape.getString("elementType"))){ // 当前状态为闭合
|
|
||||||
status.put("close", recordContent);
|
|
||||||
}else { // 当前状态为展开
|
|
||||||
status.put("expand", recordContent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeLinkerRecord.put(shapeId, status);
|
|
||||||
}
|
}
|
||||||
definition.put("nodeLinkerRecord", nodeLinkerRecord);
|
|
||||||
|
|
||||||
|
definition.put("nodeLinkerRecord", nodeLinkerRecord);
|
||||||
|
|
||||||
}else if (repositoryModel.getMethodId().equals("process.epc") || repositoryModel.getMethodId().equals("process.flowchart")){
|
}else if (repositoryModel.getMethodId().equals("process.epc") || repositoryModel.getMethodId().equals("process.flowchart")){
|
||||||
// 判断当前模型是否被某一个总图引用
|
// 判断当前模型是否被某一个总图引用
|
||||||
|
|||||||
@ -2175,6 +2175,7 @@ var Designer = {
|
|||||||
window.subProcess.linkerBoxPointerEvent();
|
window.subProcess.linkerBoxPointerEvent();
|
||||||
// 判断新建的连线是什么类型 INNER_LINKER OUTER_LINKER CROSS_LINKER
|
// 判断新建的连线是什么类型 INNER_LINKER OUTER_LINKER CROSS_LINKER
|
||||||
if (d != null){
|
if (d != null){
|
||||||
|
d.creator = "person"; // 加上人为创建的标识 区分系统创建
|
||||||
let from = d.from;
|
let from = d.from;
|
||||||
let to = d.to;
|
let to = d.to;
|
||||||
if (from.id != null && to.id != null){
|
if (from.id != null && to.id != null){
|
||||||
@ -6923,6 +6924,9 @@ var Utils = {
|
|||||||
var p = Model.getShapeById(o);
|
var p = Model.getShapeById(o);
|
||||||
Utils.selectIds.push(o);
|
Utils.selectIds.push(o);
|
||||||
if (p && p.name == "linker") {
|
if (p && p.name == "linker") {
|
||||||
|
if (methodId == 'process.subprocess'){ // 区分系统生成的连线
|
||||||
|
p.creator = 'person';
|
||||||
|
}
|
||||||
if (this.isLocked(p.id)) {
|
if (this.isLocked(p.id)) {
|
||||||
Utils.showLockers(p)
|
Utils.showLockers(p)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user