🔖 Releasing / Version tags. 5.2

🔖 Releasing / Version tags. 5.2
This commit is contained in:
lbw committed 2023-09-13 10:28:40 +08:00
1 parent 95371f54a8
commit 2c6a700154
100 files changed
+507 -439

No files matched your search

@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow-engine</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-engine-api</artifactId>
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow-engine</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-engine-biz</artifactId>
@@ -28,9 +28,9 @@ import java.util.List;
*/
@Slf4j
public class ModelUtil {
/**
* 构建模型
*
* @param nodeDto 前端传输节点
* @return
*/
@@ -42,17 +42,16 @@ public class ModelUtil {
process.setId(flowId);
process.setName(processName);
//流程监听器
// 流程监听器
ArrayList<EventListener> eventListeners = new ArrayList<>();
{
//流程实例监听器
// 流程实例监听器
EventListener eventListener = new EventListener();
eventListener.setImplementationType("class");
eventListener.setImplementation(FlowProcessEventListener.class.getCanonicalName());
eventListeners.add(eventListener);
}
@@ -60,24 +59,20 @@ public class ModelUtil {
NodeUtil.addEndNode(nodeDto);
//创建所有的节点
// 创建所有的节点
buildAllNode(process, nodeDto, flowId);
//创建所有的内部节点连接线
// 创建所有的内部节点连接线
buildAllNodeInnerSequence(process, nodeDto, flowId);
//创建节点间连线
// 创建节点间连线
buildAllNodeOuterSequence(process, nodeDto, null);
//处理分支和下级连线
// 处理分支和下级连线
bpmnModel.addProcess(process);
return bpmnModel;
}
/**
* 先创建所有的节点
*
* @param process
* @param nodeDto
* @param flowId
@@ -87,7 +82,6 @@ public class ModelUtil {
return;
}
List<FlowElement> flowElementList = buildNode(nodeDto, flowId);
for (FlowElement flowElement : flowElementList) {
if (process.getFlowElement(flowElement.getId()) == null) {
@@ -95,36 +89,33 @@ public class ModelUtil {
}
}
//子节点
// 子节点
Node children = nodeDto.getChildren();
if (NodeTypeEnum.getByValue(nodeDto.getType()).getBranch()) {
//条件分支
// 条件分支
List<Node> branchs = nodeDto.getConditionNodes();
for (Node branch : branchs) {
buildAllNode(process, branch.getChildren(),
flowId);
buildAllNode(process, branch.getChildren(), flowId);
}
if (NodeUtil.isNode(children)) {
buildAllNode(process, children, flowId);
}
} else {
}
else {
if (NodeUtil.isNode(children)) {
buildAllNode(process, children, flowId);
}
}
}
/**
* 先创建所有的内部节点连接线
*
* @param process
* @param nodeDto
* @param flowId
@@ -134,41 +125,37 @@ public class ModelUtil {
return;
}
//画内部线
// 画内部线
List<SequenceFlow> flowList = buildInnerSequenceFlow(nodeDto, flowId);
for (SequenceFlow sequenceFlow : flowList) {
process.addFlowElement(sequenceFlow);
}
//子节点
// 子节点
Node children = nodeDto.getChildren();
if (NodeTypeEnum.getByValue(nodeDto.getType()).getBranch() ) {
//条件分支
if (NodeTypeEnum.getByValue(nodeDto.getType()).getBranch()) {
// 条件分支
List<Node> branchs = nodeDto.getConditionNodes();
for (Node branch : branchs) {
buildAllNodeInnerSequence(process, branch.getChildren(),
flowId);
buildAllNodeInnerSequence(process, branch.getChildren(), flowId);
}
if (NodeUtil.isNode(children)) {
buildAllNodeInnerSequence(process, children, flowId);
}
} else {
}
else {
if (NodeUtil.isNode(children)) {
buildAllNodeInnerSequence(process, children, flowId);
}
}
}
/**
* 递归创建节点间连线
*
* @param process 流程
* @param nodeDto 节点对象
* @param nextId
@@ -179,85 +166,81 @@ public class ModelUtil {
return;
}
//子节点
// 子节点
Node children = nodeDto.getChildren();
if (NodeTypeEnum.getByValue(nodeDto.getType()).getBranch() ) {
// children = children.getChildren();
//条件分支
if (NodeTypeEnum.getByValue(nodeDto.getType()).getBranch()) {
// children = children.getChildren();
// 条件分支
List<Node> branchs = nodeDto.getConditionNodes();
int ord = 1;
int size = branchs.size();
for (Node branch : branchs) {
buildAllNodeOuterSequence(process, branch.getChildren(), nodeDto.getTailId());
String expression = null;
if (nodeDto.getType() == NodeTypeEnum.EXCLUSIVE_GATEWAY.getValue().intValue() ) {
if (nodeDto.getType() == NodeTypeEnum.EXCLUSIVE_GATEWAY.getValue().intValue()) {
if (ord == size) {
expression = NodeExpressionStrategyFactory.handleDefaultBranch(branchs, ord - 1);
} else if (nodeDto.getType() == NodeTypeEnum.EXCLUSIVE_GATEWAY.getValue().intValue() && ord > 1) {
}
else if (nodeDto.getType() == NodeTypeEnum.EXCLUSIVE_GATEWAY.getValue().intValue() && ord > 1) {
expression = NodeExpressionStrategyFactory.handleDefaultBranch(branchs, ord - 1);
} else {
}
else {
expression = NodeExpressionStrategyFactory.handle(branch);
}
}
//添加连线
// 添加连线
if (!NodeUtil.isNode(branch.getChildren())) {
//当前分支 没有其他节点了 所有就是网关和网关后面节点直接连线
// 当前分支 没有其他节点了 所有就是网关和网关后面节点直接连线
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getId(), nodeDto.getTailId(),
expression,
StrUtil.format("{}->{}", nodeDto.getName(), nodeDto.getName())
);
expression, StrUtil.format("{}->{}", nodeDto.getName(), nodeDto.getName()));
process.addFlowElement(sequenceFlow);
} else {
}
else {
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getId(), branch.getChildren().getHeadId(),
expression,
StrUtil.format("{}->{}", nodeDto.getName(), branch.getChildren().getName())
);
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getId(),
branch.getChildren().getHeadId(), expression,
StrUtil.format("{}->{}", nodeDto.getName(), branch.getChildren().getName()));
process.addFlowElement(sequenceFlow);
}
ord++;
}
//分支结尾的合并分支节点-》下一个节点
if (children != null && StrUtil.isNotBlank(children.getHeadId()) && StrUtil.isNotBlank(nodeDto.getTailId())) {
// 分支结尾的合并分支节点-》下一个节点
if (children != null && StrUtil.isNotBlank(children.getHeadId())
&& StrUtil.isNotBlank(nodeDto.getTailId())) {
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getTailId(), children.getHeadId(),
"",
StrUtil.format("{}->{}", nodeDto.getName(), children.getName())
);
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getTailId(), children.getHeadId(), "",
StrUtil.format("{}->{}", nodeDto.getName(), children.getName()));
process.addFlowElement(sequenceFlow);
} else if (StrUtil.isAllNotBlank(nodeDto.getTailId(), nextId)) {
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getTailId(), nextId,
"",
StrUtil.format("{}->{}", nodeDto.getName(), nextId)
);
}
else if (StrUtil.isAllNotBlank(nodeDto.getTailId(), nextId)) {
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeDto.getTailId(), nextId, "",
StrUtil.format("{}->{}", nodeDto.getName(), nextId));
process.addFlowElement(sequenceFlow);
}
buildAllNodeOuterSequence(process, children, nextId);
} else {
//添加连线
}
else {
// 添加连线
if (NodeUtil.isNode(children)) {
List<SequenceFlow> sequenceFlowList = buildSequenceFlow(children, nodeDto, "");
for (SequenceFlow sequenceFlow : sequenceFlowList) {
process.addFlowElement(sequenceFlow);
}
buildAllNodeOuterSequence(process, children, nextId);
} else if (nodeDto.getType() != NodeTypeEnum.END.getValue().intValue()) {
SequenceFlow seq = buildSingleSequenceFlow(nodeDto.getTailId(), nextId, "", StrUtil.format("{}->{}",
nodeDto.getName(), nextId));
}
else if (nodeDto.getType() != NodeTypeEnum.END.getValue().intValue()) {
SequenceFlow seq = buildSingleSequenceFlow(nodeDto.getTailId(), nextId, "",
StrUtil.format("{}->{}", nodeDto.getName(), nextId));
process.addFlowElement(seq);
@@ -266,11 +249,9 @@ public class ModelUtil {
}
/**
* 构建节点
*
* @param node 前端传输节点
* @param node 前端传输节点
* @param flowId
* @return
*/
@@ -280,13 +261,13 @@ public class ModelUtil {
return flowElementList;
}
//设置节点的连线头节点
// 设置节点的连线头节点
node.setHeadId(node.getId());
//设置节点的连线尾节点
// 设置节点的连线尾节点
node.setTailId(node.getId());
node.setName(StrUtil.format("{}[{}]", node.getName(), RandomUtil.randomNumbers(5)));
//存储节点数据
// 存储节点数据
RemoteFlowTaskService remoteFlowTaskService = SpringUtil.getBean(RemoteFlowTaskService.class);
ProcessNodeDataDto processNodeDataDto = new ProcessNodeDataDto();
processNodeDataDto.setFlowId(flowId);
@@ -294,32 +275,31 @@ public class ModelUtil {
processNodeDataDto.setData(JSONUtil.toJsonStr(node));
remoteFlowTaskService.saveNodeOriData(processNodeDataDto);
//开始
// 开始
if (node.getType() == NodeTypeEnum.ROOT.getValue().intValue()) {
flowElementList.addAll(buildStartNode(node));
}
//结束
// 结束
if (node.getType() == NodeTypeEnum.END.getValue().intValue()) {
flowElementList.add(buildEndNode(node, false));
}
//审批
// 审批
if (node.getType() == NodeTypeEnum.APPROVAL.getValue().intValue()) {
flowElementList.addAll(buildApproveNode(node));
}
//抄送
// 抄送
if (node.getType() == NodeTypeEnum.CC.getValue().intValue()) {
flowElementList.add(buildCCNode(node));
}
//条件分支
// 条件分支
if (node.getType() == NodeTypeEnum.EXCLUSIVE_GATEWAY.getValue().intValue()) {
flowElementList.addAll(buildInclusiveGatewayNode(node));
}
//并行分支
// 并行分支
if (node.getType() == NodeTypeEnum.PARALLEL_GATEWAY.getValue().intValue()) {
flowElementList.addAll(buildParallelGatewayNode(node));
}
@@ -328,9 +308,7 @@ public class ModelUtil {
}
/**
* 构建开始节点
* 添加一个自动完成任务的用户任务节点
*
* 构建开始节点 添加一个自动完成任务的用户任务节点
* @param node 前端传输节点
* @return
*/
@@ -338,22 +316,17 @@ public class ModelUtil {
List<FlowElement> flowElementList = new ArrayList<>();
StartEvent startEvent = new StartEvent();
startEvent.setId(node.getId());
startEvent.setName(node.getName());
flowElementList.add(startEvent);
return flowElementList;
}
/**
* 构建审批节点
*
* @param node
* @return
*/
@@ -361,21 +334,17 @@ public class ModelUtil {
List<FlowElement> flowElementList = new ArrayList<>();
node.setTailId(StrUtil.format("approve_service_task_{}", node.getId()));
//创建了任务执行监听器
//先执行指派人 后创建
//https://tkjohn.github.io/flowable-userguide/#eventDispatcher
// 创建了任务执行监听器
// 先执行指派人 后创建
// https://tkjohn.github.io/flowable-userguide/#eventDispatcher
FlowableListener createListener = new FlowableListener();
createListener.setImplementation(ApprovalCreateListener.class.getCanonicalName());
createListener.setImplementationType("class");
createListener.setEvent("create");
UserTask userTask = buildUserTask(node, createListener);
flowElementList.add(userTask);
ServiceTask serviceTask = new ServiceTask();
serviceTask.setId(StrUtil.format("approve_service_task_{}", node.getId()));
serviceTask.setName(StrUtil.format("{}_服务任务", node.getName()));
@@ -383,36 +352,31 @@ public class ModelUtil {
serviceTask.setImplementation(ApproveServiceTask.class.getCanonicalName());
serviceTask.setAsynchronous(false);
flowElementList.add(serviceTask);
{
//执行人处理
// 执行人处理
String inputDataItem = "${multiInstanceHandler.resolveAssignee(execution)}";
//串行
// 串行
boolean isSequential = true;
Integer multipleMode = node.getMultipleMode();
//多人
// 多人
if ((multipleMode == ProcessInstanceConstant.MULTIPLE_MODE_AL_SAME)) {
//并行会签
// 并行会签
isSequential = false;
}
if ((multipleMode == ProcessInstanceConstant.MULTIPLE_MODE_ALL_SORT)) {
//串行会签
// 串行会签
}
if ((multipleMode == ProcessInstanceConstant.MULTIPLE_MODE_ONE)) {
//或签
// 或签
isSequential = false;
}
@@ -431,11 +395,8 @@ public class ModelUtil {
return flowElementList;
}
/**
* 创建用户任务
*
* @param node 前端传输节点
* @return
*/
@@ -459,13 +420,11 @@ public class ModelUtil {
/**
* 构建简单的包容网关
*
* @param node
* @return
*/
private static FlowElement buildSimpleExclusiveGatewayNode(Node node) {
ExclusiveGateway exclusiveGateway = new ExclusiveGateway();
exclusiveGateway.setId(node.getId());
exclusiveGateway.setName(node.getName());
@@ -474,10 +433,8 @@ public class ModelUtil {
}
/**
* 构建并行网关
*
* @param node
* @return
*/
@@ -490,7 +447,7 @@ public class ModelUtil {
inclusiveGateway.setName(node.getName());
flowElementList.add(inclusiveGateway);
//合并网关
// 合并网关
ParallelGateway parallelGateway = new ParallelGateway();
parallelGateway.setId(StrUtil.format("{}_merge_gateway", node.getId()));
parallelGateway.setName(StrUtil.format("{}_合并网关", node.getName()));
@@ -501,7 +458,6 @@ public class ModelUtil {
/**
* 构建包容网关
*
* @param node
* @return
*/
@@ -516,7 +472,7 @@ public class ModelUtil {
inclusiveGateway.setName(node.getName());
flowElementList.add(inclusiveGateway);
//合并网关
// 合并网关
InclusiveGateway gateway = new InclusiveGateway();
gateway.setId(StrUtil.format("{}_merge_gateway", node.getId()));
gateway.setName(StrUtil.format("{}_合并网关", node.getName()));
@@ -527,8 +483,7 @@ public class ModelUtil {
/**
* 构建结束节点
*
* @param node 前端传输节点
* @param node 前端传输节点
* @param terminateAll
* @return
*/
@@ -537,7 +492,6 @@ public class ModelUtil {
endEvent.setId(node.getId());
endEvent.setName(node.getName());
List<EventDefinition> definitionList = new ArrayList<>();
TerminateEventDefinition definition = new TerminateEventDefinition();
definition.setTerminateAll(terminateAll);
@@ -549,16 +503,14 @@ public class ModelUtil {
/**
* 创建连接线
*
* @param node 子级节点
* @param node 子级节点
* @param parentNode 父级节点
* @param expression
* @return 所有连接线
*/
private static List<SequenceFlow> buildSequenceFlow(Node node, Node parentNode, String expression
) {
private static List<SequenceFlow> buildSequenceFlow(Node node, Node parentNode, String expression) {
List<SequenceFlow> sequenceFlowList = new ArrayList<>();
//没有子级了
// 没有子级了
if (!NodeUtil.isNode(node)) {
return sequenceFlowList;
}
@@ -569,19 +521,15 @@ public class ModelUtil {
return sequenceFlowList;
}
SequenceFlow sequenceFlow = buildSingleSequenceFlow(parentNode.getTailId(), node.getHeadId(), expression,
StrUtil.format("{}->{}", parentNode.getName(), node.getName())
);
StrUtil.format("{}->{}", parentNode.getName(), node.getName()));
sequenceFlowList.add(sequenceFlow);
return sequenceFlowList;
}
/**
* 生成扩展数据
*
* @param key
* @param val
* @return
@@ -596,7 +544,6 @@ public class ModelUtil {
/**
* 创建抄送节点
*
* @param node
* @return
*/
@@ -612,9 +559,8 @@ public class ModelUtil {
ExtensionElement e = new ExtensionElement();
{
e.setName("flowable:failedJobRetryTimeCycle");
//上面的例子会让作业执行器重试5次,并在每次重试前等待1分钟。
// 上面的例子会让作业执行器重试5次,并在每次重试前等待1分钟。
e.setElementText("R5/PT1M");
}
@@ -623,57 +569,42 @@ public class ModelUtil {
return serviceTask;
}
/**
* 创建连接线
*
* @param node 父级节点
* @param node 父级节点
* @param flowId
* @return 所有连接线
*/
private static List<SequenceFlow> buildInnerSequenceFlow(Node node, String flowId
) {
private static List<SequenceFlow> buildInnerSequenceFlow(Node node, String flowId) {
List<SequenceFlow> sequenceFlowList = new ArrayList<>();
if (!NodeUtil.isNode(node)) {
return sequenceFlowList;
}
String nodeId = node.getId();
if (StrUtil.hasBlank(nodeId)) {
return sequenceFlowList;
}
if (node.getType() == NodeTypeEnum.APPROVAL.getValue().intValue()) {
String gatewayId = StrUtil.format("approve_service_task_{}", nodeId);
{
SequenceFlow sequenceFlow = buildSingleSequenceFlow(nodeId, gatewayId, "${12==12}", null);
sequenceFlowList.add(sequenceFlow);
}
}
return sequenceFlowList;
}
/**
* 创建单个连接线
*
* @param pId 父级id
* @param childId 子级id
* @param pId 父级id
* @param childId 子级id
* @param expression 表达式
* @param name
* @return
@@ -693,5 +624,4 @@ public class ModelUtil {
return sequenceFlow;
}
}
@@ -506,7 +506,7 @@ public abstract class AbstractEngineConfiguration {
databaseTypeMappings.setProperty("DB2/PTX", DATABASE_TYPE_DB2);
databaseTypeMappings.setProperty("DB2/2", DATABASE_TYPE_DB2);
databaseTypeMappings.setProperty("DB2 UDB AS400", DATABASE_TYPE_DB2);
databaseTypeMappings.setProperty("DM DBMS",DATABASE_TYPE_MYSQL);//扩展支持达梦数据
databaseTypeMappings.setProperty("DM DBMS", DATABASE_TYPE_MYSQL);// 扩展支持达梦数据
databaseTypeMappings.setProperty(PRODUCT_NAME_CRDB, DATABASE_TYPE_COCKROACHDB);
return databaseTypeMappings;
}
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-engine</artifactId>
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow-task</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-task-api</artifactId>
@@ -115,7 +115,6 @@ public interface RemoteFlowEngineService {
@PostMapping("/task/delegateTask")
R<String> delegateTask(@RequestBody TaskParamDto taskParamDto);
/**
* 查询任务
* @param taskId 任务ID
@@ -10,8 +10,8 @@ import lombok.Data;
@Data
public class SelectValue {
private String key;
private String key;
private String value;
private String value;
}
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow-task</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-task-biz</artifactId>
@@ -52,7 +52,6 @@ public interface IProcessInstanceService {
*/
R queryMineCC(TaskQueryParamDto taskQueryParamDto);
/**
* 格式化流程显示
* @param nodeFormatParamVo
@@ -289,7 +289,6 @@ public class ProcessInstanceServiceImpl implements IProcessInstanceService {
return R.ok(p);
}
/**
* 格式化流程显示
* @param nodeFormatParamVo
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-flow</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow-task</artifactId>
+1 -1
View File
@@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-flow</artifactId>