调整部份方法命名
This commit is contained in:
@@ -71,7 +71,7 @@ public abstract class FlowableManager {
|
|||||||
repository.saveInstance(instance);
|
repository.saveInstance(instance);
|
||||||
|
|
||||||
if (FlowableNode.Type.AUTOMATIC.equals(node.getType())) {
|
if (FlowableNode.Type.AUTOMATIC.equals(node.getType())) {
|
||||||
autoAction(instance, node, MapHelper.empty());
|
automaticAction(instance, node, MapHelper.empty());
|
||||||
}
|
}
|
||||||
return instance.getInstanceId();
|
return instance.getInstanceId();
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ public abstract class FlowableManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void approve(String instanceId, String comment) {
|
public void approve(String instanceId, String comment) {
|
||||||
action(instanceId, FlowableAction.APPROVE, comment);
|
manualAction(instanceId, FlowableAction.APPROVE, comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reject(String instanceId) {
|
public void reject(String instanceId) {
|
||||||
@@ -89,7 +89,7 @@ public abstract class FlowableManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reject(String instanceId, String comment) {
|
public void reject(String instanceId, String comment) {
|
||||||
action(instanceId, FlowableAction.REJECT, comment);
|
manualAction(instanceId, FlowableAction.REJECT, comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void terminal(String instanceId) {
|
public void terminal(String instanceId) {
|
||||||
@@ -97,23 +97,23 @@ public abstract class FlowableManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void terminal(String instanceId, String comment) {
|
public void terminal(String instanceId, String comment) {
|
||||||
action(instanceId, FlowableAction.TERMINAL, comment);
|
manualAction(instanceId, FlowableAction.TERMINAL, comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void action(String instanceId, FlowableAction action, String comment) {
|
public void manualAction(String instanceId, FlowableAction action, String comment) {
|
||||||
action(instanceId, action, comment, MapHelper.empty());
|
manualAction(instanceId, action, comment, MapHelper.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void autoAction(FlowableInstance instance, FlowableNode node, Map<String, Object> metadata) {
|
private void manualAction(String instanceId, FlowableAction action, String comment, Map<String, Object> metadata) {
|
||||||
action(instance, node, null, "系统自动执行", metadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void action(String instanceId, FlowableAction action, String comment, Map<String, Object> metadata) {
|
|
||||||
FlowableInstance instance = repository.getInstance(instanceId);
|
FlowableInstance instance = repository.getInstance(instanceId);
|
||||||
FlowableNode node = repository.getNode(instance.getCurrentNodeId());
|
FlowableNode node = repository.getNode(instance.getCurrentNodeId());
|
||||||
action(instance, node, action, comment, metadata);
|
action(instance, node, action, comment, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void automaticAction(FlowableInstance instance, FlowableNode node, Map<String, Object> metadata) {
|
||||||
|
action(instance, node, null, "系统自动执行", metadata);
|
||||||
|
}
|
||||||
|
|
||||||
private void action(FlowableInstance instance, FlowableNode node, FlowableAction action, String comment, Map<String, Object> metadata) {
|
private void action(FlowableInstance instance, FlowableNode node, FlowableAction action, String comment, Map<String, Object> metadata) {
|
||||||
if (FlowableInstance.Status.COMPLETED.equals(instance.getStatus()) || FlowableInstance.Status.ERROR.equals(instance.getStatus())) {
|
if (FlowableInstance.Status.COMPLETED.equals(instance.getStatus()) || FlowableInstance.Status.ERROR.equals(instance.getStatus())) {
|
||||||
throw new IllegalArgumentException("ID为" + instance.getInstanceId() + "的流程已结束,无法操作");
|
throw new IllegalArgumentException("ID为" + instance.getInstanceId() + "的流程已结束,无法操作");
|
||||||
@@ -125,6 +125,9 @@ public abstract class FlowableManager {
|
|||||||
}
|
}
|
||||||
FlowableHandler handler = createBean(handlerClass);
|
FlowableHandler handler = createBean(handlerClass);
|
||||||
action = handler.handle(action, instance, node, metadata);
|
action = handler.handle(action, instance, node, metadata);
|
||||||
|
if (Objects.isNull(action)) {
|
||||||
|
throw new IllegalArgumentException("节点执行结果不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
if (FlowableAction.TERMINAL.equals(action)) {
|
if (FlowableAction.TERMINAL.equals(action)) {
|
||||||
saveInstance(instance, FlowableInstance.Status.ERROR, metadata, action, comment);
|
saveInstance(instance, FlowableInstance.Status.ERROR, metadata, action, comment);
|
||||||
@@ -142,7 +145,7 @@ public abstract class FlowableManager {
|
|||||||
saveInstance(instance, FlowableInstance.Status.RUNNING, metadata, action, comment);
|
saveInstance(instance, FlowableInstance.Status.RUNNING, metadata, action, comment);
|
||||||
|
|
||||||
if (FlowableNode.Type.AUTOMATIC.equals(nextNode.getType())) {
|
if (FlowableNode.Type.AUTOMATIC.equals(nextNode.getType())) {
|
||||||
autoAction(instance, node, metadata);
|
automaticAction(instance, node, metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ package com.lanyuanxiaoyao.flowable.core.model;
|
|||||||
* @version 20241231
|
* @version 20241231
|
||||||
*/
|
*/
|
||||||
public interface FlowableAccessor {
|
public interface FlowableAccessor {
|
||||||
void access(Object accessor);
|
boolean access(Object accessor);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user