diff --git a/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar b/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar index 9b7bac39..bb2ed9c0 100644 Binary files a/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar and b/com.actionsoft.apps.coe.method.process.subprocess/lib/com.actionsoft.apps.coe.method.process.subprocess.jar differ diff --git a/com.actionsoft.apps.coe.method.process.subprocess/manifest.xml b/com.actionsoft.apps.coe.method.process.subprocess/manifest.xml index 06b6e944..311922e5 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/manifest.xml +++ b/com.actionsoft.apps.coe.method.process.subprocess/manifest.xml @@ -25,6 +25,6 @@ {"process.epc":{"code": "&#xe605;","color": "#4E7FF9"}} - 伊利/流程制度/专门存放端到端总图 + 伊利/流程制度/端到端流程 diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java index eb83400f..107ceb96 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java +++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/SubProcessController.java @@ -8,6 +8,7 @@ import com.actionsoft.bpms.server.bind.annotation.Controller; import com.actionsoft.bpms.server.bind.annotation.Mapping; import com.actionsoft.exception.AWSException; import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import java.util.List; @@ -103,9 +104,9 @@ public class SubProcessController { public String vertexPreHandleIndependentNode(UserContext uc, String processIdJsonArr){ try { SubProcessWeb processWeb = new SubProcessWeb(uc); - List independentNodeVos = processWeb.vertexPreHandleIndependentNode(processIdJsonArr); + JSONObject data = processWeb.vertexPreHandleIndependentNode(processIdJsonArr); ResponseObject ro = ResponseObject.newOkResponse(); - ro.put("independentNodeVos",independentNodeVos); + ro.setData(data); return ro.toString(); } catch (AWSException e) { return ResponseObject.newErrResponse(e.getMessage()).toString(); @@ -136,9 +137,9 @@ public class SubProcessController { * @return */ @Mapping("com.actionsoft.apps.coe.method.process.subprocess.generator_end_to_end_model") - public String generatorEndToEndModel(UserContext uc, String processIdJsonArr, String locationId, String direction, String modelName){ + public String generatorEndToEndModel(UserContext uc, String processIdJsonArr, String locationId, String direction, String modelName, String excludeProcessIdArr){ SubProcessWeb processWeb = new SubProcessWeb(uc); - processWeb.generatorEndToEndModel(processIdJsonArr, locationId, direction, modelName); + processWeb.generatorEndToEndModel(processIdJsonArr, locationId, direction, modelName, excludeProcessIdArr); return ResponseObject.newOkResponse().toString(); } diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphAdjMatrix.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphAdjMatrix.java index 88709782..843b87ad 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphAdjMatrix.java +++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphAdjMatrix.java @@ -75,23 +75,22 @@ public class GraphAdjMatrix { /** * 构建邻接矩阵 - * @param nodeIndexMap 索引映射 节点ID与节点在列表中索引的映射关系 */ - public void buildAdjMatrix(Map nodeIndexMap){ + public void buildAdjMatrix(){ for (int i = 0; i < vertexList.size(); i++) { Node currentNode = vertexList.get(i); // 处理当前节点到后置节点的边 - if (currentNode.getRearModeList() != null && currentNode.getRearModeList().size() > 0){ - List rearModeList = currentNode.getRearModeList(); - for (DesignerShapeRelationModel rearModel : rearModeList) { - addEdge(i, nodeIndexMap.get(rearModel.getRelationFileId()).intValue()); + if (currentNode.getRearNodeList() != null && currentNode.getRearNodeList().size() > 0){ + List rearNodeList = currentNode.getRearNodeList(); + for (Node rearNode : rearNodeList) { + addEdge(i, vertexList.indexOf(rearNode)); } } // 处理当前节点与前置节点的边 - if (currentNode.getLearModeList() != null && currentNode.getLearModeList().size() > 0){ - List learModeList = currentNode.getLearModeList(); - for (DesignerShapeRelationModel learModel : learModeList) { - addEdge(nodeIndexMap.get(learModel.getRelationFileId()).intValue(), i); + if (currentNode.getLeadNodeList() != null && currentNode.getLeadNodeList().size() > 0){ + List leadNodeList = currentNode.getLeadNodeList(); + for (Node leadNode : leadNodeList) { + addEdge(vertexList.indexOf(leadNode), i); } } } diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphLayout.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphLayout.java index b4a6672a..59bfe92a 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphLayout.java +++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphLayout.java @@ -96,32 +96,32 @@ public class GraphLayout { * 节点布局 */ public double[][] layOut(){ - double tempY = 0.0; // 记录第一列的高度 + double realTimeY = 0.0; // 实时记录图形最高的Y for (int i = 0; i < nodeList.size(); i++) { // 第一个节点直接放到画布的左上角 if (i == 0) { position[i][0] = 100.0; position[i][1] = 100.0; - tempY = 100.0; // 更新第一列的高度 + realTimeY = 100.0; isPosition[i] = true; if (existOutLink(i)){ // 如果存在后置节点 并且后置节点还未渲染 - calculationRearNodePosition(i); + realTimeY = calculationRearNodePosition(i, realTimeY); } continue; } if (!isPosition[i]){ position[i][0] = 100.0; - position[i][1] = tempY + shapeH + vertInterval; - tempY = position[i][1]; // 更新第一列的高度 + position[i][1] = realTimeY + shapeH + vertInterval; + realTimeY = position[i][1]; // 存在后置节点 if (existOutLink(i)){ - calculationRearNodePosition(i); + realTimeY = calculationRearNodePosition(i, realTimeY); } } } // 确定画布的宽度与高度 - double w = Arrays.stream(position).mapToDouble(position -> position[0]).max().getAsDouble(); - double h = Arrays.stream(position).mapToDouble(position -> position[1]).max().getAsDouble(); + double w = Arrays.stream(position).mapToDouble(position -> position[0]).max().orElse(0.0); + double h = Arrays.stream(position).mapToDouble(position -> position[1]).max().orElse(0.0); this.canvasWidth = w + 200.0; this.canvasHeight = h + 200.0; @@ -139,7 +139,7 @@ public class GraphLayout { * 计算当前节点所有后置节点的位置 * @param nodeIndex */ - private void calculationRearNodePosition(int nodeIndex){ + private double calculationRearNodePosition(int nodeIndex, double realTimeY){ // 获取后置节点的索引 List rearNodeIndexSet = getRearNodeIndex(nodeIndex); for (int i = 0; i < rearNodeIndexSet.size(); i++) { @@ -149,15 +149,17 @@ public class GraphLayout { if (i == 0) { position[rearNodeIndex][1] = position[nodeIndex][1]; // 上一个节点的y坐标 与 第一个后置节点的y坐标一致 }else { - position[rearNodeIndex][1] = position[nodeIndex][1] + shapeH + i * vertInterval; // 非第一个后置节点的y坐标 = 上一个节点的y坐标 + 后置节点索引 * 垂直间隔 + position[rearNodeIndex][1] = realTimeY + shapeH + i * vertInterval; // 非第一个后置节点的y坐标 = 上一个节点的y坐标 + 图形高度 + 后置节点索引 * 垂直间隔 + realTimeY = position[rearNodeIndex][1]; } isPosition[rearNodeIndex] = true; if (existOutLink(rearNodeIndex)) { - calculationRearNodePosition(rearNodeIndex); + realTimeY = calculationRearNodePosition(rearNodeIndex, realTimeY); } } } + return realTimeY; } diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphLinkerRender.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphLinkerRender.java new file mode 100644 index 00000000..dcaee95b --- /dev/null +++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/GraphLinkerRender.java @@ -0,0 +1,38 @@ +package com.actionsoft.apps.coe.method.process.subprocess.graph; + +import com.actionsoft.apps.coe.method.process.subprocess.mode.Node; + +/** + * 图形节点连线渲染 + */ +public class GraphLinkerRender { + + private String linkerId; + private Node fromNode; + private Node toNode; + private double[] fromPoi; + private double[] toPoi; + private double[][] vertexPosition; // 所有节点的坐标 + private String linkerDefine; + + public GraphLinkerRender(double[][] vertexPosition) { + this.vertexPosition = vertexPosition; + } + + /** + * 计算两个坐标之间的折点 + * @param fromPoi + * @param toPoi + * @return + */ + private double[][] calculationTurningPoint(double[] fromPoi, double[] toPoi){ + double fromX = fromPoi[0]; + double fromY = fromPoi[1]; + + double toX = toPoi[0]; + double toY = toPoi[1]; + + + return new double[2][2]; + } +} diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/VertexPreHandle.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/VertexPreHandle.java index b43656aa..cc239c93 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/VertexPreHandle.java +++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/graph/VertexPreHandle.java @@ -11,9 +11,8 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.Design import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; import com.actionsoft.exception.AWSException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 模型节点预处理 @@ -31,78 +30,124 @@ public class VertexPreHandle { /** * 收集独立子流程 + * 既没有前置也没有后置 同时也未被引用 * @param processIdList * @return * @throws AWSException */ - public List collectIndependentNode(List processIdList) throws AWSException{ + public Map> collectIndependentNode(List processIdList) throws AWSException{ - List independentNodeVos = new ArrayList<>(); + List nodeVoList = new ArrayList<>(); List attrIdList = new ArrayList<>(); attrIdList.add(SubProcessConst.LEAD_PROCESS_ATTR_ID); attrIdList.add(SubProcessConst.REAR_PROCESS_ATTR_ID); for (String processId : processIdList) { + PALRepositoryModel repositoryModel = PALRepositoryCache.getCache().get(processId); + IndependentNodeVo independentNodeVo = new IndependentNodeVo(processId, repositoryModel.getName(), false); // 1. 该子流程是否存在前置或后置流程 List leadProcessList = DesignerShapeRelationCache.getByFileId(processId, SubProcessConst.LEAD_PROCESS_ATTR_ID); - if (leadProcessList != null && leadProcessList.size() > 0) continue; + if (leadProcessList != null && leadProcessList.size() > 0) { + List nodeVos = leadProcessList.stream().map(relationModel -> { + PALRepositoryModel model = PALRepositoryCache.getCache().get(relationModel.getRelationFileId()); + IndependentNodeVo nodeVo = new IndependentNodeVo(relationModel.getRelationFileId(), model.getName()); + return nodeVo; + }).collect(Collectors.toList()); + independentNodeVo.setLeadNodeVo(nodeVos); + }; List rearProcessList = DesignerShapeRelationCache.getByFileId(processId, SubProcessConst.REAR_PROCESS_ATTR_ID); - if (rearProcessList != null && rearProcessList.size() > 0) continue; + if (rearProcessList != null && rearProcessList.size() > 0) { + List nodeVos = rearProcessList.stream().map(relationModel -> { + PALRepositoryModel model = PALRepositoryCache.getCache().get(relationModel.getRelationFileId()); + IndependentNodeVo nodeVo = new IndependentNodeVo(relationModel.getRelationFileId(), model.getName()); + return nodeVo; + }).collect(Collectors.toList()); + independentNodeVo.setRearNodeVo(nodeVos); + }; // 2. 该节点是否被别的节点 DesignerShapeRelationDao relationDao = new DesignerShapeRelationDao(); List relationModels = relationDao.getModelListByRelationFileIdAndAttrIds(processId, attrIdList); - if (relationModels != null && relationModels.size() > 0) continue; + if (relationModels != null && relationModels.size() > 0) { + independentNodeVo.setBeReference(true); + }; // 3. 收集独立节点信息返回给前台 - PALRepositoryModel repositoryModel = PALRepositoryCache.getCache().get(processId); - IndependentNodeVo independentNodeVo = new IndependentNodeVo(processId, repositoryModel.getName()); - independentNodeVos.add(independentNodeVo); + nodeVoList.add(independentNodeVo); } - return independentNodeVos; + Map> map = new HashMap<>(); + List independentNodeVos = new ArrayList<>(); + List leadAndRearNotInRange = new ArrayList<>(); + for (IndependentNodeVo nodeVo : nodeVoList) { + if (nodeVo.isBeReference()) continue; // 被引用了 不管有没有前置或后置 都保留 + if (nodeVo.getLeadNodeVo() == null && nodeVo.getRearNodeVo() == null && !nodeVo.isBeReference()){ // 完全独立 + independentNodeVos.add(nodeVo); + continue; + } + + List leadNodeVos = nodeVo.getLeadNodeVo(); + if (leadNodeVos != null && leadNodeVos.size() > 0){ + List nodeIds = leadNodeVos.stream().map(leadNodeVo -> leadNodeVo.getId()).collect(Collectors.toList()); + if (!processIdList.containsAll(nodeIds)){ + leadAndRearNotInRange.add(nodeVo); + continue; + } + } + List rearNodeVos = nodeVo.getRearNodeVo(); + if (rearNodeVos != null && rearNodeVos.size() > 0){ + List nodeIds = rearNodeVos.stream().map(rearNodeVo -> rearNodeVo.getId()).collect(Collectors.toList()); + if (!processIdList.containsAll(nodeIds)){ + leadAndRearNotInRange.add(nodeVo); + continue; + } + } + } + map.put("independentNodeVos", independentNodeVos); + map.put("leadAndRearNotInRange", leadAndRearNotInRange); + + return map; } - /** - * 包含进总图中 - * @param processIdList 选择的若干子流程ID - * @param nodeIndexMap 存放子流程在集合中的索引 - * @return + * 对于节点的前置或者后置流程 + * 如果未在选择的范围内 则忽略 + * + * 同时处理节点的前后置关系 + * @param processIdList + * @param nodeIndexMap + * @return 按照节点前置流程数量 从小到大排序 * @throws AWSException */ - public List includeLearAndRearNode(List processIdList, Map nodeIndexMap) throws AWSException { + public List excludeLearAndRearNode(List processIdList, Map nodeIndexMap) throws AWSException { List nodeList = new ArrayList<>(); - for (int i = 0; i < processIdList.size(); i++) { Node node = new Node(processIdList.get(i)); // 前置流程 - List learProcessList = DesignerShapeRelationCache.getByFileId(processIdList.get(i), SubProcessConst.LEAD_PROCESS_ATTR_ID); - learProcessList.stream().forEach(model -> { - if (!processIdList.contains(model.getRelationFileId())){ - Node learNode = new Node(model.getRelationFileId()); - nodeList.add(learNode); - nodeIndexMap.put(model.getRelationFileId(), nodeList.size() - 1); + List leadProcessList = DesignerShapeRelationCache.getByFileId(processIdList.get(i), SubProcessConst.LEAD_PROCESS_ATTR_ID); + List leadNodeList = new ArrayList<>(); + leadProcessList.stream().forEach(model -> { + if (processIdList.contains(model.getRelationFileId())){ + Node leadNode = new Node(model.getRelationFileId()); + leadNodeList.add(leadNode); } }); - node.setLearModeList(learProcessList); + node.setLeadNodeList(leadNodeList); // 后置流程 List rearProcessList = DesignerShapeRelationCache.getByFileId(processIdList.get(i), SubProcessConst.REAR_PROCESS_ATTR_ID); + List rearNodeList = new ArrayList<>(); rearProcessList.stream().forEach(model -> { - if (!processIdList.contains(model.getRelationFileId())){ + if (processIdList.contains(model.getRelationFileId())){ Node rearNode = new Node(model.getRelationFileId()); - nodeList.add(rearNode); - nodeIndexMap.put(model.getRelationFileId(), nodeList.size() - 1); + rearNodeList.add(rearNode); } }); - node.setRearModeList(rearProcessList); + node.setRearNodeList(rearNodeList); + nodeList.add(node); nodeIndexMap.put(node.getId(), nodeList.size() - 1); } + + Collections.sort(nodeList); return nodeList; } - - @Deprecated - public void excludeLearAndRearNode(List processIdList) throws AWSException { - - } } diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/mode/Node.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/mode/Node.java index 753f8e91..b870a4b4 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/mode/Node.java +++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/mode/Node.java @@ -1,42 +1,23 @@ package com.actionsoft.apps.coe.method.process.subprocess.mode; -import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel; - import java.util.List; +import java.util.Objects; /** * @author oYang * @create 2023-05-11 17:21 */ -public class Node { +public class Node implements Comparable { private String id; - private double x; - private double y; - private double vx; - private double vy; - private List learModeList; - private List rearModeList; + private List leadNodeList; + private List rearNodeList; public Node(String id) { this.id = id; } - public Node(String id, double x, double y) { - this.id = id; - this.x = x; - this.y = y; - } - - public Node(String id, double x, double y, double vx, double vy) { - this.id = id; - this.x = x; - this.y = y; - this.vx = vx; - this.vy = vy; - } - public String getId() { return id; } @@ -45,61 +26,37 @@ public class Node { this.id = id; } - public double getX() { - return x; + public List getLeadNodeList() { + return leadNodeList; } - public void setX(double x) { - this.x = x; + public void setLeadNodeList(List leadNodeList) { + this.leadNodeList = leadNodeList; } - public double getY() { - return y; + public List getRearNodeList() { + return rearNodeList; } - public void setY(double y) { - this.y = y; - } - - public List getLearModeList() { - return learModeList; - } - - public void setLearModeList(List learModeList) { - this.learModeList = learModeList; - } - - public List getRearModeList() { - return rearModeList; - } - - public void setRearModeList(List rearModeList) { - this.rearModeList = rearModeList; - } - - - public double getVx() { - return vx; - } - - public void setVx(double vx) { - this.vx = vx; - } - - public double getVy() { - return vy; - } - - public void setVy(double vy) { - this.vy = vy; + public void setRearNodeList(List rearNodeList) { + this.rearNodeList = rearNodeList; } @Override - public String toString() { - return "Node{" + - "id='" + id + '\'' + - ", x=" + x + - ", y=" + y + - '}'; + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Node node = (Node) o; + return Objects.equals(id, node.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public int compareTo(Node node) { + return Integer.compare(this.leadNodeList.size(), node.getLeadNodeList().size()); } } diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/mode/vo/IndependentNodeVo.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/mode/vo/IndependentNodeVo.java index c5fabd37..3fae9606 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/mode/vo/IndependentNodeVo.java +++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/mode/vo/IndependentNodeVo.java @@ -1,5 +1,7 @@ package com.actionsoft.apps.coe.method.process.subprocess.mode.vo; +import java.util.List; + /** * @author oYang * @create 2023-05-17 15:13 @@ -8,12 +10,23 @@ public class IndependentNodeVo { private String id; private String name; + private List leadNodeVo; + private List rearNodeVo; + private boolean isBeReference; + private String leadNodeNames; + private String rearNodeNames; public IndependentNodeVo(String id, String name) { this.id = id; this.name = name; } + public IndependentNodeVo(String id, String name, boolean isBeReference) { + this.id = id; + this.name = name; + this.isBeReference = isBeReference; + } + public String getId() { return id; } @@ -29,4 +42,28 @@ public class IndependentNodeVo { public void setName(String name) { this.name = name; } + + public List getLeadNodeVo() { + return leadNodeVo; + } + + public void setLeadNodeVo(List leadNodeVo) { + this.leadNodeVo = leadNodeVo; + } + + public List getRearNodeVo() { + return rearNodeVo; + } + + public void setRearNodeVo(List rearNodeVo) { + this.rearNodeVo = rearNodeVo; + } + + public boolean isBeReference() { + return isBeReference; + } + + public void setBeReference(boolean beReference) { + isBeReference = beReference; + } } diff --git a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java index e35d34e3..14fd695a 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java +++ b/com.actionsoft.apps.coe.method.process.subprocess/src/com/actionsoft/apps/coe/method/process/subprocess/web/SubProcessWeb.java @@ -31,6 +31,7 @@ import com.actionsoft.bpms.util.UtilString; import com.actionsoft.exception.AWSException; import com.actionsoft.i18n.I18nRes; import com.actionsoft.sdk.local.SDK; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.apache.commons.collections4.IteratorUtils; @@ -234,44 +235,32 @@ public class SubProcessWeb extends ActionWeb { * @param processIdJsonArr * @return */ - public List vertexPreHandleIndependentNode(String processIdJsonArr) throws AWSException{ + public JSONObject vertexPreHandleIndependentNode(String processIdJsonArr) throws AWSException{ List processIdList = JSONArray.parseArray(processIdJsonArr, String.class); // 节点预处理 VertexPreHandle vertexPreHandle = new VertexPreHandle(); - return vertexPreHandle.collectIndependentNode(processIdList); + return (JSONObject) JSON.toJSON(vertexPreHandle.collectIndependentNode(processIdList)); } - /** - * 生成图->前置处理 - * 前置流程或后置流程是否在所选的范围内 - * @param uc - * @param processIdJsonArr - * @param excludeProcessIdJsonArr - * @return - */ - public void vertexPreHandle2(String processIdJsonArr, String excludeProcessIdJsonArr){ - - List processIdList = JSONArray.parseArray(processIdJsonArr, String.class); - - List excludeProcessIdList = JSONArray.parseArray(excludeProcessIdJsonArr, String.class); - - } - - public void generatorEndToEndModel(String processIdJsonArr, String locationId, String direction, String modelName) throws AWSException{ + public void generatorEndToEndModel(String processIdJsonArr, String locationId, String direction, String modelName, String excludeProcessIdArr) throws AWSException{ + // 忽略独立的节点 List processIdList = JSONArray.parseArray(processIdJsonArr, String.class); + List excludeProcessIdList = JSONArray.parseArray(excludeProcessIdArr, String.class); + if (excludeProcessIdList != null && excludeProcessIdList.size() > 0) { + processIdList = processIdList.stream().filter(id -> !excludeProcessIdList.contains(id)).collect(Collectors.toList()); + } // 节点预处理 VertexPreHandle vertexPreHandle = new VertexPreHandle(); - Map nodeIndexMap = new HashMap<>(); - List nodeList = vertexPreHandle.includeLearAndRearNode(processIdList, nodeIndexMap); + List nodeList = vertexPreHandle.excludeLearAndRearNode(processIdList, nodeIndexMap); // 构建有向图邻接矩阵 GraphAdjMatrix graphAdjMatrix = new GraphAdjMatrix(nodeList); - graphAdjMatrix.buildAdjMatrix(nodeIndexMap); + graphAdjMatrix.buildAdjMatrix(); graphAdjMatrix.printAdjMatrix(); // 获取节点分布 diff --git a/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml b/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml index 1444ac1c..5afc1f7f 100644 --- a/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml +++ b/com.actionsoft.apps.coe.method.process.subprocess/web/com.actionsoft.apps.coe.method.process.subprocess/action.xml @@ -25,5 +25,6 @@ + \ No newline at end of file