端到端功能部分代码提交

This commit is contained in:
qinoy 2023-05-18 17:45:19 +08:00
parent 6ca569f7c0
commit 057c4762b8
11 changed files with 222 additions and 153 deletions

View File

@ -25,6 +25,6 @@
<requires/> <requires/>
<palMethodIcon>{"process.epc":{"code": "&amp;#xe605;","color": "#4E7FF9"}}</palMethodIcon> <palMethodIcon>{"process.epc":{"code": "&amp;#xe605;","color": "#4E7FF9"}}</palMethodIcon>
<properties> <properties>
<property action="disabled" group="功能入口相关" name="SUB_PROCESS_MODEL_LOCATION" title="端到端模型存放目录" type="input" isSystem="false" desc="指定生成的端到端模型存放的根目录&lt;br&gt;{资产库名称}/{根目录}/{一级目录} " ref="">伊利/流程制度/专门存放端到端总图</property> <property action="disabled" group="功能入口相关" name="SUB_PROCESS_MODEL_LOCATION" title="端到端模型存放目录" type="input" isSystem="false" desc="指定生成的端到端模型存放的根目录&lt;br&gt;{资产库名称}/{根目录}/{一级目录} " ref="">伊利/流程制度/端到端流程</property>
</properties> </properties>
</app> </app>

View File

@ -8,6 +8,7 @@ import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping; import com.actionsoft.bpms.server.bind.annotation.Mapping;
import com.actionsoft.exception.AWSException; import com.actionsoft.exception.AWSException;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.List; import java.util.List;
@ -103,9 +104,9 @@ public class SubProcessController {
public String vertexPreHandleIndependentNode(UserContext uc, String processIdJsonArr){ public String vertexPreHandleIndependentNode(UserContext uc, String processIdJsonArr){
try { try {
SubProcessWeb processWeb = new SubProcessWeb(uc); SubProcessWeb processWeb = new SubProcessWeb(uc);
List<IndependentNodeVo> independentNodeVos = processWeb.vertexPreHandleIndependentNode(processIdJsonArr); JSONObject data = processWeb.vertexPreHandleIndependentNode(processIdJsonArr);
ResponseObject ro = ResponseObject.newOkResponse(); ResponseObject ro = ResponseObject.newOkResponse();
ro.put("independentNodeVos",independentNodeVos); ro.setData(data);
return ro.toString(); return ro.toString();
} catch (AWSException e) { } catch (AWSException e) {
return ResponseObject.newErrResponse(e.getMessage()).toString(); return ResponseObject.newErrResponse(e.getMessage()).toString();
@ -136,9 +137,9 @@ public class SubProcessController {
* @return * @return
*/ */
@Mapping("com.actionsoft.apps.coe.method.process.subprocess.generator_end_to_end_model") @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); SubProcessWeb processWeb = new SubProcessWeb(uc);
processWeb.generatorEndToEndModel(processIdJsonArr, locationId, direction, modelName); processWeb.generatorEndToEndModel(processIdJsonArr, locationId, direction, modelName, excludeProcessIdArr);
return ResponseObject.newOkResponse().toString(); return ResponseObject.newOkResponse().toString();
} }

View File

@ -75,23 +75,22 @@ public class GraphAdjMatrix {
/** /**
* 构建邻接矩阵 * 构建邻接矩阵
* @param nodeIndexMap 索引映射 节点ID与节点在列表中索引的映射关系
*/ */
public void buildAdjMatrix(Map<String, Integer> nodeIndexMap){ public void buildAdjMatrix(){
for (int i = 0; i < vertexList.size(); i++) { for (int i = 0; i < vertexList.size(); i++) {
Node currentNode = vertexList.get(i); Node currentNode = vertexList.get(i);
// 处理当前节点到后置节点的边 // 处理当前节点到后置节点的边
if (currentNode.getRearModeList() != null && currentNode.getRearModeList().size() > 0){ if (currentNode.getRearNodeList() != null && currentNode.getRearNodeList().size() > 0){
List<DesignerShapeRelationModel> rearModeList = currentNode.getRearModeList(); List<Node> rearNodeList = currentNode.getRearNodeList();
for (DesignerShapeRelationModel rearModel : rearModeList) { for (Node rearNode : rearNodeList) {
addEdge(i, nodeIndexMap.get(rearModel.getRelationFileId()).intValue()); addEdge(i, vertexList.indexOf(rearNode));
} }
} }
// 处理当前节点与前置节点的边 // 处理当前节点与前置节点的边
if (currentNode.getLearModeList() != null && currentNode.getLearModeList().size() > 0){ if (currentNode.getLeadNodeList() != null && currentNode.getLeadNodeList().size() > 0){
List<DesignerShapeRelationModel> learModeList = currentNode.getLearModeList(); List<Node> leadNodeList = currentNode.getLeadNodeList();
for (DesignerShapeRelationModel learModel : learModeList) { for (Node leadNode : leadNodeList) {
addEdge(nodeIndexMap.get(learModel.getRelationFileId()).intValue(), i); addEdge(vertexList.indexOf(leadNode), i);
} }
} }
} }

View File

@ -96,32 +96,32 @@ public class GraphLayout {
* 节点布局 * 节点布局
*/ */
public double[][] layOut(){ public double[][] layOut(){
double tempY = 0.0; // 记录第一列的高度 double realTimeY = 0.0; // 实时记录图形最高的Y
for (int i = 0; i < nodeList.size(); i++) { for (int i = 0; i < nodeList.size(); i++) {
// 第一个节点直接放到画布的左上角 // 第一个节点直接放到画布的左上角
if (i == 0) { if (i == 0) {
position[i][0] = 100.0; position[i][0] = 100.0;
position[i][1] = 100.0; position[i][1] = 100.0;
tempY = 100.0; // 更新第一列的高度 realTimeY = 100.0;
isPosition[i] = true; isPosition[i] = true;
if (existOutLink(i)){ // 如果存在后置节点 并且后置节点还未渲染 if (existOutLink(i)){ // 如果存在后置节点 并且后置节点还未渲染
calculationRearNodePosition(i); realTimeY = calculationRearNodePosition(i, realTimeY);
} }
continue; continue;
} }
if (!isPosition[i]){ if (!isPosition[i]){
position[i][0] = 100.0; position[i][0] = 100.0;
position[i][1] = tempY + shapeH + vertInterval; position[i][1] = realTimeY + shapeH + vertInterval;
tempY = position[i][1]; // 更新第一列的高度 realTimeY = position[i][1];
// 存在后置节点 // 存在后置节点
if (existOutLink(i)){ if (existOutLink(i)){
calculationRearNodePosition(i); realTimeY = calculationRearNodePosition(i, realTimeY);
} }
} }
} }
// 确定画布的宽度与高度 // 确定画布的宽度与高度
double w = Arrays.stream(position).mapToDouble(position -> position[0]).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().getAsDouble(); double h = Arrays.stream(position).mapToDouble(position -> position[1]).max().orElse(0.0);
this.canvasWidth = w + 200.0; this.canvasWidth = w + 200.0;
this.canvasHeight = h + 200.0; this.canvasHeight = h + 200.0;
@ -139,7 +139,7 @@ public class GraphLayout {
* 计算当前节点所有后置节点的位置 * 计算当前节点所有后置节点的位置
* @param nodeIndex * @param nodeIndex
*/ */
private void calculationRearNodePosition(int nodeIndex){ private double calculationRearNodePosition(int nodeIndex, double realTimeY){
// 获取后置节点的索引 // 获取后置节点的索引
List<Integer> rearNodeIndexSet = getRearNodeIndex(nodeIndex); List<Integer> rearNodeIndexSet = getRearNodeIndex(nodeIndex);
for (int i = 0; i < rearNodeIndexSet.size(); i++) { for (int i = 0; i < rearNodeIndexSet.size(); i++) {
@ -149,15 +149,17 @@ public class GraphLayout {
if (i == 0) { if (i == 0) {
position[rearNodeIndex][1] = position[nodeIndex][1]; // 上一个节点的y坐标 第一个后置节点的y坐标一致 position[rearNodeIndex][1] = position[nodeIndex][1]; // 上一个节点的y坐标 第一个后置节点的y坐标一致
}else { }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; isPosition[rearNodeIndex] = true;
if (existOutLink(rearNodeIndex)) { if (existOutLink(rearNodeIndex)) {
calculationRearNodePosition(rearNodeIndex); realTimeY = calculationRearNodePosition(rearNodeIndex, realTimeY);
} }
} }
} }
return realTimeY;
} }

View File

@ -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];
}
}

View File

@ -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.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.exception.AWSException; import com.actionsoft.exception.AWSException;
import java.util.ArrayList; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.Map;
/** /**
* 模型节点预处理 * 模型节点预处理
@ -31,78 +30,124 @@ public class VertexPreHandle {
/** /**
* 收集独立子流程 * 收集独立子流程
* 既没有前置也没有后置 同时也未被引用
* @param processIdList * @param processIdList
* @return * @return
* @throws AWSException * @throws AWSException
*/ */
public List<IndependentNodeVo> collectIndependentNode(List<String> processIdList) throws AWSException{ public Map<String, List<IndependentNodeVo>> collectIndependentNode(List<String> processIdList) throws AWSException{
List<IndependentNodeVo> independentNodeVos = new ArrayList<>(); List<IndependentNodeVo> nodeVoList = new ArrayList<>();
List<String> attrIdList = new ArrayList<>(); List<String> attrIdList = new ArrayList<>();
attrIdList.add(SubProcessConst.LEAD_PROCESS_ATTR_ID); attrIdList.add(SubProcessConst.LEAD_PROCESS_ATTR_ID);
attrIdList.add(SubProcessConst.REAR_PROCESS_ATTR_ID); attrIdList.add(SubProcessConst.REAR_PROCESS_ATTR_ID);
for (String processId : processIdList) { for (String processId : processIdList) {
PALRepositoryModel repositoryModel = PALRepositoryCache.getCache().get(processId);
IndependentNodeVo independentNodeVo = new IndependentNodeVo(processId, repositoryModel.getName(), false);
// 1. 该子流程是否存在前置或后置流程 // 1. 该子流程是否存在前置或后置流程
List<DesignerShapeRelationModel> leadProcessList = DesignerShapeRelationCache.getByFileId(processId, SubProcessConst.LEAD_PROCESS_ATTR_ID); List<DesignerShapeRelationModel> leadProcessList = DesignerShapeRelationCache.getByFileId(processId, SubProcessConst.LEAD_PROCESS_ATTR_ID);
if (leadProcessList != null && leadProcessList.size() > 0) continue; if (leadProcessList != null && leadProcessList.size() > 0) {
List<IndependentNodeVo> 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<DesignerShapeRelationModel> rearProcessList = DesignerShapeRelationCache.getByFileId(processId, SubProcessConst.REAR_PROCESS_ATTR_ID); List<DesignerShapeRelationModel> rearProcessList = DesignerShapeRelationCache.getByFileId(processId, SubProcessConst.REAR_PROCESS_ATTR_ID);
if (rearProcessList != null && rearProcessList.size() > 0) continue; if (rearProcessList != null && rearProcessList.size() > 0) {
List<IndependentNodeVo> 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. 该节点是否被别的节点 // 2. 该节点是否被别的节点
DesignerShapeRelationDao relationDao = new DesignerShapeRelationDao(); DesignerShapeRelationDao relationDao = new DesignerShapeRelationDao();
List<DesignerShapeRelationModel> relationModels = relationDao.getModelListByRelationFileIdAndAttrIds(processId, attrIdList); List<DesignerShapeRelationModel> relationModels = relationDao.getModelListByRelationFileIdAndAttrIds(processId, attrIdList);
if (relationModels != null && relationModels.size() > 0) continue; if (relationModels != null && relationModels.size() > 0) {
independentNodeVo.setBeReference(true);
};
// 3. 收集独立节点信息返回给前台 // 3. 收集独立节点信息返回给前台
PALRepositoryModel repositoryModel = PALRepositoryCache.getCache().get(processId); nodeVoList.add(independentNodeVo);
IndependentNodeVo independentNodeVo = new IndependentNodeVo(processId, repositoryModel.getName());
independentNodeVos.add(independentNodeVo);
} }
return independentNodeVos; Map<String, List<IndependentNodeVo>> map = new HashMap<>();
List<IndependentNodeVo> independentNodeVos = new ArrayList<>();
List<IndependentNodeVo> 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<IndependentNodeVo> leadNodeVos = nodeVo.getLeadNodeVo();
if (leadNodeVos != null && leadNodeVos.size() > 0){
List<String> nodeIds = leadNodeVos.stream().map(leadNodeVo -> leadNodeVo.getId()).collect(Collectors.toList());
if (!processIdList.containsAll(nodeIds)){
leadAndRearNotInRange.add(nodeVo);
continue;
}
}
List<IndependentNodeVo> rearNodeVos = nodeVo.getRearNodeVo();
if (rearNodeVos != null && rearNodeVos.size() > 0){
List<String> 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 * @throws AWSException
*/ */
public List<Node> includeLearAndRearNode(List<String> processIdList, Map<String, Integer> nodeIndexMap) throws AWSException { public List<Node> excludeLearAndRearNode(List<String> processIdList, Map<String, Integer> nodeIndexMap) throws AWSException {
List<Node> nodeList = new ArrayList<>(); List<Node> nodeList = new ArrayList<>();
for (int i = 0; i < processIdList.size(); i++) { for (int i = 0; i < processIdList.size(); i++) {
Node node = new Node(processIdList.get(i)); Node node = new Node(processIdList.get(i));
// 前置流程 // 前置流程
List<DesignerShapeRelationModel> learProcessList = DesignerShapeRelationCache.getByFileId(processIdList.get(i), SubProcessConst.LEAD_PROCESS_ATTR_ID); List<DesignerShapeRelationModel> leadProcessList = DesignerShapeRelationCache.getByFileId(processIdList.get(i), SubProcessConst.LEAD_PROCESS_ATTR_ID);
learProcessList.stream().forEach(model -> { List<Node> leadNodeList = new ArrayList<>();
if (!processIdList.contains(model.getRelationFileId())){ leadProcessList.stream().forEach(model -> {
Node learNode = new Node(model.getRelationFileId()); if (processIdList.contains(model.getRelationFileId())){
nodeList.add(learNode); Node leadNode = new Node(model.getRelationFileId());
nodeIndexMap.put(model.getRelationFileId(), nodeList.size() - 1); leadNodeList.add(leadNode);
} }
}); });
node.setLearModeList(learProcessList); node.setLeadNodeList(leadNodeList);
// 后置流程 // 后置流程
List<DesignerShapeRelationModel> rearProcessList = DesignerShapeRelationCache.getByFileId(processIdList.get(i), SubProcessConst.REAR_PROCESS_ATTR_ID); List<DesignerShapeRelationModel> rearProcessList = DesignerShapeRelationCache.getByFileId(processIdList.get(i), SubProcessConst.REAR_PROCESS_ATTR_ID);
List<Node> rearNodeList = new ArrayList<>();
rearProcessList.stream().forEach(model -> { rearProcessList.stream().forEach(model -> {
if (!processIdList.contains(model.getRelationFileId())){ if (processIdList.contains(model.getRelationFileId())){
Node rearNode = new Node(model.getRelationFileId()); Node rearNode = new Node(model.getRelationFileId());
nodeList.add(rearNode); rearNodeList.add(rearNode);
nodeIndexMap.put(model.getRelationFileId(), nodeList.size() - 1);
} }
}); });
node.setRearModeList(rearProcessList); node.setRearNodeList(rearNodeList);
nodeList.add(node); nodeList.add(node);
nodeIndexMap.put(node.getId(), nodeList.size() - 1); nodeIndexMap.put(node.getId(), nodeList.size() - 1);
} }
Collections.sort(nodeList);
return nodeList; return nodeList;
} }
@Deprecated
public void excludeLearAndRearNode(List<String> processIdList) throws AWSException {
}
} }

View File

@ -1,42 +1,23 @@
package com.actionsoft.apps.coe.method.process.subprocess.mode; 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.List;
import java.util.Objects;
/** /**
* @author oYang * @author oYang
* @create 2023-05-11 17:21 * @create 2023-05-11 17:21
*/ */
public class Node { public class Node implements Comparable<Node> {
private String id; private String id;
private double x; private List<Node> leadNodeList;
private double y; private List<Node> rearNodeList;
private double vx;
private double vy;
private List<DesignerShapeRelationModel> learModeList;
private List<DesignerShapeRelationModel> rearModeList;
public Node(String id) { public Node(String id) {
this.id = 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() { public String getId() {
return id; return id;
} }
@ -45,61 +26,37 @@ public class Node {
this.id = id; this.id = id;
} }
public double getX() { public List<Node> getLeadNodeList() {
return x; return leadNodeList;
} }
public void setX(double x) { public void setLeadNodeList(List<Node> leadNodeList) {
this.x = x; this.leadNodeList = leadNodeList;
} }
public double getY() { public List<Node> getRearNodeList() {
return y; return rearNodeList;
} }
public void setY(double y) { public void setRearNodeList(List<Node> rearNodeList) {
this.y = y; this.rearNodeList = rearNodeList;
}
public List<DesignerShapeRelationModel> getLearModeList() {
return learModeList;
}
public void setLearModeList(List<DesignerShapeRelationModel> learModeList) {
this.learModeList = learModeList;
}
public List<DesignerShapeRelationModel> getRearModeList() {
return rearModeList;
}
public void setRearModeList(List<DesignerShapeRelationModel> 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;
} }
@Override @Override
public String toString() { public boolean equals(Object o) {
return "Node{" + if (this == o) return true;
"id='" + id + '\'' + if (o == null || getClass() != o.getClass()) return false;
", x=" + x + Node node = (Node) o;
", y=" + y + 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());
} }
} }

View File

@ -1,5 +1,7 @@
package com.actionsoft.apps.coe.method.process.subprocess.mode.vo; package com.actionsoft.apps.coe.method.process.subprocess.mode.vo;
import java.util.List;
/** /**
* @author oYang * @author oYang
* @create 2023-05-17 15:13 * @create 2023-05-17 15:13
@ -8,12 +10,23 @@ public class IndependentNodeVo {
private String id; private String id;
private String name; private String name;
private List<IndependentNodeVo> leadNodeVo;
private List<IndependentNodeVo> rearNodeVo;
private boolean isBeReference;
private String leadNodeNames;
private String rearNodeNames;
public IndependentNodeVo(String id, String name) { public IndependentNodeVo(String id, String name) {
this.id = id; this.id = id;
this.name = name; this.name = name;
} }
public IndependentNodeVo(String id, String name, boolean isBeReference) {
this.id = id;
this.name = name;
this.isBeReference = isBeReference;
}
public String getId() { public String getId() {
return id; return id;
} }
@ -29,4 +42,28 @@ public class IndependentNodeVo {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public List<IndependentNodeVo> getLeadNodeVo() {
return leadNodeVo;
}
public void setLeadNodeVo(List<IndependentNodeVo> leadNodeVo) {
this.leadNodeVo = leadNodeVo;
}
public List<IndependentNodeVo> getRearNodeVo() {
return rearNodeVo;
}
public void setRearNodeVo(List<IndependentNodeVo> rearNodeVo) {
this.rearNodeVo = rearNodeVo;
}
public boolean isBeReference() {
return isBeReference;
}
public void setBeReference(boolean beReference) {
isBeReference = beReference;
}
} }

View File

@ -31,6 +31,7 @@ import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSException; import com.actionsoft.exception.AWSException;
import com.actionsoft.i18n.I18nRes; import com.actionsoft.i18n.I18nRes;
import com.actionsoft.sdk.local.SDK; import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections4.IteratorUtils; import org.apache.commons.collections4.IteratorUtils;
@ -234,44 +235,32 @@ public class SubProcessWeb extends ActionWeb {
* @param processIdJsonArr * @param processIdJsonArr
* @return * @return
*/ */
public List<IndependentNodeVo> vertexPreHandleIndependentNode(String processIdJsonArr) throws AWSException{ public JSONObject vertexPreHandleIndependentNode(String processIdJsonArr) throws AWSException{
List<String> processIdList = JSONArray.parseArray(processIdJsonArr, String.class); List<String> processIdList = JSONArray.parseArray(processIdJsonArr, String.class);
// 节点预处理 // 节点预处理
VertexPreHandle vertexPreHandle = new VertexPreHandle(); VertexPreHandle vertexPreHandle = new VertexPreHandle();
return vertexPreHandle.collectIndependentNode(processIdList); return (JSONObject) JSON.toJSON(vertexPreHandle.collectIndependentNode(processIdList));
} }
/** public void generatorEndToEndModel(String processIdJsonArr, String locationId, String direction, String modelName, String excludeProcessIdArr) throws AWSException{
* 生成图->前置处理
* 前置流程或后置流程是否在所选的范围内
* @param uc
* @param processIdJsonArr
* @param excludeProcessIdJsonArr
* @return
*/
public void vertexPreHandle2(String processIdJsonArr, String excludeProcessIdJsonArr){
List<String> processIdList = JSONArray.parseArray(processIdJsonArr, String.class);
List<String> excludeProcessIdList = JSONArray.parseArray(excludeProcessIdJsonArr, String.class);
}
public void generatorEndToEndModel(String processIdJsonArr, String locationId, String direction, String modelName) throws AWSException{
// 忽略独立的节点
List<String> processIdList = JSONArray.parseArray(processIdJsonArr, String.class); List<String> processIdList = JSONArray.parseArray(processIdJsonArr, String.class);
List<String> 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(); VertexPreHandle vertexPreHandle = new VertexPreHandle();
Map<String, Integer> nodeIndexMap = new HashMap<>(); Map<String, Integer> nodeIndexMap = new HashMap<>();
List<Node> nodeList = vertexPreHandle.includeLearAndRearNode(processIdList, nodeIndexMap); List<Node> nodeList = vertexPreHandle.excludeLearAndRearNode(processIdList, nodeIndexMap);
// 构建有向图邻接矩阵 // 构建有向图邻接矩阵
GraphAdjMatrix graphAdjMatrix = new GraphAdjMatrix(nodeList); GraphAdjMatrix graphAdjMatrix = new GraphAdjMatrix(nodeList);
graphAdjMatrix.buildAdjMatrix(nodeIndexMap); graphAdjMatrix.buildAdjMatrix();
graphAdjMatrix.printAdjMatrix(); graphAdjMatrix.printAdjMatrix();
// 获取节点分布 // 获取节点分布

View File

@ -25,5 +25,6 @@
<param name="locationId"/> <param name="locationId"/>
<param name="direction"/> <param name="direction"/>
<param name="modelName"/> <param name="modelName"/>
<param name="excludeProcessIdArr"/>
</cmd-bean> </cmd-bean>
</aws-actions> </aws-actions>