update - 为所有事件,添加日志标识,方便后续快速排查问题
This commit is contained in:
parent
18d7e84fd6
commit
a7e4914dc1
@ -17,17 +17,17 @@ import java.util.List;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getApproverSpecify;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* 自定义的推测用户任务的审批人的命令实现
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2023/12/11 17:56
|
||||
*/
|
||||
public class CustomCalcAssigneeCmd implements Command<List<BpmnTaskDelegateAssigner>>, Serializable {
|
||||
private String processInstanceId;
|
||||
private UserTask userTask;
|
||||
private EngineExecutionStartListener engineExecutionStartListener;
|
||||
public class CustomForecastUserTaskAssigneeCmd implements Command<List<BpmnTaskDelegateAssigner>>, Serializable {
|
||||
private final String processInstanceId;
|
||||
private final UserTask userTask;
|
||||
private final EngineExecutionStartListener engineExecutionStartListener;
|
||||
|
||||
public CustomCalcAssigneeCmd(String processInstanceId, UserTask userTask,
|
||||
public CustomForecastUserTaskAssigneeCmd(String processInstanceId, UserTask userTask,
|
||||
EngineExecutionStartListener engineExecutionStartListener) {
|
||||
this.processInstanceId = processInstanceId;
|
||||
this.userTask = userTask;
|
||||
@ -8,6 +8,7 @@ import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
|
||||
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener;
|
||||
import org.flowable.engine.delegate.event.FlowableActivityCancelledEvent;
|
||||
import org.flowable.engine.delegate.event.FlowableActivityEvent;
|
||||
import org.flowable.engine.delegate.event.FlowableMultiInstanceActivityCancelledEvent;
|
||||
import org.flowable.engine.delegate.event.FlowableMultiInstanceActivityCompletedEvent;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,6 +21,8 @@ import java.util.Set;
|
||||
import static org.flowable.common.engine.api.delegate.event.FlowableEngineEventType.ACTIVITY_CANCELLED;
|
||||
import static org.flowable.common.engine.api.delegate.event.FlowableEngineEventType.ACTIVITY_COMPLETED;
|
||||
import static org.flowable.common.engine.api.delegate.event.FlowableEngineEventType.ACTIVITY_STARTED;
|
||||
import static org.flowable.common.engine.api.delegate.event.FlowableEngineEventType.MULTI_INSTANCE_ACTIVITY_CANCELLED;
|
||||
import static org.flowable.common.engine.api.delegate.event.FlowableEngineEventType.MULTI_INSTANCE_ACTIVITY_COMPLETED;
|
||||
import static org.flowable.common.engine.api.delegate.event.FlowableEngineEventType.MULTI_INSTANCE_ACTIVITY_COMPLETED_WITH_CONDITION;
|
||||
|
||||
/**
|
||||
@ -40,6 +43,8 @@ public class EngineActivityEventListener extends AbstractFlowableEngineEventList
|
||||
.add(ACTIVITY_STARTED)
|
||||
.add(ACTIVITY_COMPLETED)
|
||||
.add(MULTI_INSTANCE_ACTIVITY_COMPLETED_WITH_CONDITION)
|
||||
.add(MULTI_INSTANCE_ACTIVITY_COMPLETED)
|
||||
.add(MULTI_INSTANCE_ACTIVITY_CANCELLED)
|
||||
.add(ACTIVITY_CANCELLED)
|
||||
.build();
|
||||
|
||||
@ -65,13 +70,19 @@ public class EngineActivityEventListener extends AbstractFlowableEngineEventList
|
||||
}
|
||||
|
||||
/**
|
||||
* 多实例 UserTask 通过,
|
||||
* 多实例 UserTask 条件通过
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@Override
|
||||
protected void multiInstanceActivityCompletedWithCondition(FlowableMultiInstanceActivityCompletedEvent event) {
|
||||
log.info("activityCompleted: activityId: {} activityName: {}", event.getActivityId(), event.getActivityName());
|
||||
log.info("multiInstanceActivityCompletedWithCondition: activityId: {} activityName: {}", event.getActivityId(), event.getActivityName());
|
||||
getOrderedListeners().forEach(i -> i.onCompleted(event));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void multiInstanceActivityCompleted(FlowableMultiInstanceActivityCompletedEvent event) {
|
||||
log.info("multiInstanceActivityCompleted: activityId: {} activityName: {}", event.getActivityId(), event.getActivityName());
|
||||
getOrderedListeners().forEach(i -> i.onCompleted(event));
|
||||
}
|
||||
|
||||
@ -81,6 +92,11 @@ public class EngineActivityEventListener extends AbstractFlowableEngineEventList
|
||||
getOrderedListeners().forEach(i -> i.onCancelled(event));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void multiInstanceActivityCancelled(FlowableMultiInstanceActivityCancelledEvent event) {
|
||||
log.info("multiInstanceActivityCancelled: activityId: {} activityName: {}", event.getActivityId(), event.getActivityName());
|
||||
getOrderedListeners().forEach(i -> i.onCancelled(event));
|
||||
}
|
||||
|
||||
private List<BpmnActivityEventListener> getOrderedListeners() {
|
||||
List<BpmnActivityEventListener> orderListeners = new ArrayList<>();
|
||||
|
||||
@ -91,7 +91,7 @@ public class EngineExecutionStartListener implements ExecutionListener {
|
||||
switch (method) {
|
||||
case autoPassed:
|
||||
case autoRejection:
|
||||
// Do nothing,
|
||||
// Do nothing.
|
||||
// 统一由 cn.axzo.workflow.server.controller.listener.task.AutoOperatorEventListener 来处理
|
||||
break;
|
||||
default:
|
||||
@ -132,15 +132,10 @@ public class EngineExecutionStartListener implements ExecutionListener {
|
||||
log.info("当前节点: id: {}, name: {} 审批人为空", userTask.getId(), userTask.getName());
|
||||
getApproverEmptyHandleType(userTask).ifPresent(type -> {
|
||||
switch (type) {
|
||||
// 自动通过和驳回, 统一由 cn.axzo.workflow.server.controller.listener.task.AutoOperatorEventListener 来处理
|
||||
case autoPassed:
|
||||
// 自动通过的默认引擎参数必须设置为 true
|
||||
// execution.setTransientVariable(BpmnConstants.FLOWABLE_SKIP_EXPRESSION_ENABLE, true);
|
||||
// 设置当前 UserTask 使用的 skip 表达式
|
||||
// execution.setTransientVariable(BPM_ALLOW_SKIP_USER_TASK, true);
|
||||
// break;
|
||||
case autoRejection:
|
||||
// execution.setTransientVariable(BPM_ALLOW_AUTO_REJECTION, true);
|
||||
// Do nothing.
|
||||
// 自动通过和驳回, 统一由 cn.axzo.workflow.server.controller.listener.task.AutoOperatorEventListener 来处理
|
||||
break;
|
||||
case transferToAdmin:
|
||||
assigners.addAll(approverSelect(ApproverEmptyHandleTypeEnum.transferToAdmin.getType(), userTask,
|
||||
@ -168,7 +163,23 @@ public class EngineExecutionStartListener implements ExecutionListener {
|
||||
public List<BpmnTaskDelegateAssigner> approverSelect(String type, UserTask userTask, DelegateExecution execution) {
|
||||
List<BpmnTaskDelegateAssigner> assigners = new ArrayList<>();
|
||||
|
||||
// 如果开启了 mock 模式(workflow.mock=true), 则直接返回 mock 的审批人
|
||||
// 如果开启了 mock 模式(workflow.mock=true), 则根据 mock 配置去选择审批人
|
||||
/*
|
||||
* nacos 中的的示例配置
|
||||
* workflow:
|
||||
* mock: true # 默认为 false, 开启 mock
|
||||
* assignee:
|
||||
* global: false # 默认为 true, 是否开启所有流程都使用该配置,
|
||||
* category: '16' # 只有 global=false 时,只针对这一个业务分类编号的流程实例有效
|
||||
* # 自定义节点的审批人。【当节点配置的审批方式不等于自动通过或拒绝时,优先级最高!同时上面的 mock 也必须为 true】
|
||||
* # map 中的 key = activityId = taskDefinitionKey; value 是 List<BpmnTaskDelegateAssigner> 的 JSON 字符串
|
||||
* map: "{
|
||||
* node_747571121516: '[{\"assignerName\":\"王庆\",\"ouId\":\"5140\",\"tenantId\":\"195\",\"personId\":\"85047\",\"assignee\":\"2001205\",\"assigneeType\":\"3\"}]',
|
||||
* node_747618945956: '[{\"assignerName\":\"杨秋菊\",\"ouId\":\"5140\",\"tenantId\":\"195\",\"personId\":\"80792\",\"assignee\":\"2000028\",\"assigneeType\":\"3\"}]',
|
||||
* node_747602616511: '[{\"assignerName\":\"杨凯\",\"ouId\":\"5140\",\"tenantId\":\"195\",\"personId\":\"2390\",\"assignee\":\"2004125\",\"assigneeType\":\"3\"}]',
|
||||
* node_868689511037: '[{\"assignerName\":\"邓九洲\",\"ouId\":\"5140\",\"tenantId\":\"195\",\"personId\":\"89508\",\"assignee\":\"2000560\",\"assigneeType\":\"3\"}]'
|
||||
* }"
|
||||
*/
|
||||
if ((mock && global) ||
|
||||
(mock && !global && Objects.equals(category, execution.getProcessDefinitionId().split(":")[0]))) {
|
||||
assigners.addAll(new MockTaskAssigneeSelector(assigneeMap, global, category).select(userTask, execution));
|
||||
|
||||
@ -19,7 +19,7 @@ import cn.axzo.workflow.core.common.enums.BpmnProcessTaskResultEnum;
|
||||
import cn.axzo.workflow.core.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.core.common.utils.BpmnCollectionUtils;
|
||||
import cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomCalcAssigneeCmd;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomForecastUserTaskAssigneeCmd;
|
||||
import cn.axzo.workflow.core.engine.listener.EngineExecutionStartListener;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessDefinitionService;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessInstanceService;
|
||||
@ -596,19 +596,10 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
} else if (userTask.getBehavior() instanceof UserTaskActivityBehavior) {
|
||||
node.setNodeMode(BpmnFlowNodeMode.GENERAL);
|
||||
}
|
||||
List<BpmnTaskDelegateAssigner> forecastAssigners =
|
||||
springProcessEngineConfiguration.getCommandExecutor().execute(new CustomCalcAssigneeCmd(processInstanceId, userTask, engineExecutionStartListener));
|
||||
// 推测当前节点的审批人
|
||||
List<BpmnTaskDelegateAssigner> forecastAssigners = springProcessEngineConfiguration.getCommandExecutor()
|
||||
.execute(new CustomForecastUserTaskAssigneeCmd(processInstanceId, userTask, engineExecutionStartListener));
|
||||
node.setForecastAssigners(forecastAssigners);
|
||||
// List<BpmnTaskDelegateAssigner> forecastAssigners = new ArrayList<>();
|
||||
// DelegateExecution execution = (DelegateExecution) runtimeService
|
||||
// .createExecutionQuery().processInstanceId(processInstanceId)
|
||||
// .activityId(userTask.getId()).singleResult();
|
||||
|
||||
// getApproverSpecify(userTask).ifPresent(specify -> {
|
||||
// forecastAssigners.addAll(engineExecutionStartListener
|
||||
// .approverSelect(specify.getType(), userTask,
|
||||
// (DelegateExecution) list.get(0)));
|
||||
// });
|
||||
} else if (i instanceof ReceiveTask) {
|
||||
ReceiveTask receiveTask = (ReceiveTask) i;
|
||||
node.setId(receiveTask.getId())
|
||||
|
||||
@ -27,6 +27,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>workflow-engine-core</artifactId>
|
||||
|
||||
@ -2,26 +2,33 @@ package cn.axzo.workflow.server.common.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 自定义注解防止表单重复提交
|
||||
*
|
||||
* @author wangli
|
||||
*/
|
||||
@Inherited
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface RepeatSubmit {
|
||||
|
||||
/**
|
||||
* 间隔时间(ms),小于此时间视为重复提交
|
||||
*/
|
||||
int interval() default 5000;
|
||||
|
||||
TimeUnit timeUnit() default TimeUnit.MILLISECONDS;
|
||||
|
||||
/**
|
||||
* 提示消息
|
||||
* 提示消息 支持国际化 格式为 {code}
|
||||
*/
|
||||
String message() default "不允许重复提交,请稍后再试";
|
||||
String message() default "请勿重复提交,正在处理中";
|
||||
|
||||
}
|
||||
|
||||
@ -3,8 +3,10 @@ package cn.axzo.workflow.server.common.intercepter.impl;
|
||||
import cn.axzo.workflow.server.common.annotation.RepeatSubmit;
|
||||
import cn.axzo.workflow.server.common.intercepter.RepeatSubmitInterceptor;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.HashMap;
|
||||
@ -23,6 +25,8 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor {
|
||||
public final String REPEAT_TIME = "repeatTime";
|
||||
|
||||
public final String SESSION_REPEAT_KEY = "repeatData";
|
||||
@Resource
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@ -36,6 +40,7 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor {
|
||||
// 请求地址(作为存放session的key值)
|
||||
String url = request.getRequestURI();
|
||||
|
||||
|
||||
HttpSession session = request.getSession();
|
||||
Object sessionObj = session.getAttribute(SESSION_REPEAT_KEY);
|
||||
if (sessionObj != null) {
|
||||
|
||||
@ -60,7 +60,7 @@ public class RocketMqBpmActivityEventListener implements BpmnActivityEventListen
|
||||
@Override
|
||||
public void onStarted(FlowableEngineEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmActivityEventListener#onStarted...");
|
||||
log.debug("RocketMqBpmActivityEventListener#onStarted...activityId: {}", ((FlowableActivityEvent) event).getActivityId());
|
||||
}
|
||||
ProcessActivityDTO dto = new ProcessActivityDTO();
|
||||
dto.setType(PROCESS_ACTIVITY_STARTED);
|
||||
@ -82,14 +82,14 @@ public class RocketMqBpmActivityEventListener implements BpmnActivityEventListen
|
||||
BpmnMetaParserHelper.getNoticeConfig(mainProcess).ifPresent(dto::setNoticeConf);
|
||||
sendMessageQueue(dto, PROCESS_ACTIVITY_STARTED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmActivityEventListener#onStarted...end");
|
||||
log.debug("RocketMqBpmActivityEventListener#onStarted...end, activityId: {}", ((FlowableActivityEvent) event).getActivityId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(FlowableEngineEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmActivityEventListener#onCompleted...");
|
||||
log.debug("RocketMqBpmActivityEventListener#onCompleted...activityId: {}", ((FlowableActivityEvent) event).getActivityId());
|
||||
}
|
||||
ProcessActivityDTO dto = new ProcessActivityDTO();
|
||||
dto.setType(PROCESS_ACTIVITY_COMPLETED);
|
||||
@ -114,14 +114,14 @@ public class RocketMqBpmActivityEventListener implements BpmnActivityEventListen
|
||||
|
||||
sendMessageQueue(dto, PROCESS_ACTIVITY_COMPLETED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmActivityEventListener#onCompleted...end");
|
||||
log.debug("RocketMqBpmActivityEventListener#onCompleted...end, activityId: {}", ((FlowableActivityEvent) event).getActivityId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FlowableEngineEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqMessagePushEventListener#onCancelled...");
|
||||
log.debug("RocketMqMessagePushEventListener#onCancelled...activityId: {}", ((FlowableActivityEvent) event).getActivityId());
|
||||
}
|
||||
ProcessActivityDTO dto = new ProcessActivityDTO();
|
||||
dto.setType(PROCESS_ACTIVITY_CANCELLED);
|
||||
@ -146,7 +146,7 @@ public class RocketMqBpmActivityEventListener implements BpmnActivityEventListen
|
||||
|
||||
sendMessageQueue(dto, PROCESS_ACTIVITY_CANCELLED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmActivityEventListener#onCancelled...end");
|
||||
log.debug("RocketMqBpmActivityEventListener#onCancelled...end, activityId: {}", ((FlowableActivityEvent) event).getActivityId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -116,13 +116,13 @@ public class RocketMqMessagePushEventListener implements BpmnMessagePushEventLis
|
||||
return;
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqMessagePushEventListener#onNotice...");
|
||||
log.debug("RocketMqMessagePushEventListener#onNotice...msgTemplateId: {}, receivePerson: {}", event.getNoticeConfig().getNotice().getNoticeMessageId(), JSON.toJSONString(event.getAssigner()));
|
||||
}
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getNotice().getNoticeMessageId(), PROCESS_PUSH_NOTICE, event,
|
||||
collectionVariable(event));
|
||||
sendMessageQueue(dto, PROCESS_PUSH_NOTICE);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqMessagePushEventListener#onNotice...end");
|
||||
log.debug("RocketMqMessagePushEventListener#onNotice...end, msgTemplateId: {}, receivePerson: {}", event.getNoticeConfig().getNotice().getNoticeMessageId(), JSON.toJSONString(event.getAssigner()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,14 +136,14 @@ public class RocketMqMessagePushEventListener implements BpmnMessagePushEventLis
|
||||
return;
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqMessagePushEventListener#onPendingPush...");
|
||||
log.debug("RocketMqMessagePushEventListener#onPendingPush...msgTemplateId: {}, receivePerson: {}", event.getNoticeConfig().getNotice().getNoticeMessageId(), JSON.toJSONString(event.getAssigner()));
|
||||
}
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getPending().getPendingMessageId(), PROCESS_PUSH_PENDING,
|
||||
event,
|
||||
collectionVariable(event));
|
||||
sendMessageQueue(dto, PROCESS_PUSH_PENDING);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqMessagePushEventListener#onPendingPush...end");
|
||||
log.debug("RocketMqMessagePushEventListener#onPendingPush...end, msgTemplateId: {}, receivePerson: {}", event.getNoticeConfig().getNotice().getNoticeMessageId(), JSON.toJSONString(event.getAssigner()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,13 +155,13 @@ public class RocketMqMessagePushEventListener implements BpmnMessagePushEventLis
|
||||
return;
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqMessagePushEventListener#onPendingComplete...");
|
||||
log.debug("RocketMqMessagePushEventListener#onPendingComplete...msgTemplateId: {}, receivePerson: {}", event.getNoticeConfig().getNotice().getNoticeMessageId(), JSON.toJSONString(event.getAssigner()));
|
||||
}
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getPending().getPendingMessageId(), PROCESS_PUSH_PENDING_COMPLETE,
|
||||
event, null);
|
||||
sendMessageQueue(dto, PROCESS_PUSH_PENDING_COMPLETE);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqMessagePushEventListener#onPendingComplete...end");
|
||||
log.debug("RocketMqMessagePushEventListener#onPendingComplete...end, msgTemplateId: {}, receivePerson: {}", event.getNoticeConfig().getNotice().getNoticeMessageId(), JSON.toJSONString(event.getAssigner()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,13 +174,13 @@ public class RocketMqMessagePushEventListener implements BpmnMessagePushEventLis
|
||||
return;
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqMessagePushEventListener#onSms...");
|
||||
log.debug("RocketMqMessagePushEventListener#onSms...msgTemplateId: {}, receivePerson: {}", event.getNoticeConfig().getNotice().getNoticeMessageId(), JSON.toJSONString(event.getAssigner()));
|
||||
}
|
||||
MessagePushDTO dto = build(event.getNoticeConfig().getSms().getSmsId(), PROCESS_PUSH_SMS, event,
|
||||
collectionVariable(event));
|
||||
sendMessageQueue(dto, PROCESS_PUSH_SMS);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqMessagePushEventListener#onSms...end");
|
||||
log.debug("RocketMqMessagePushEventListener#onSms...end, msgTemplateId: {}, receivePerson: {}", event.getNoticeConfig().getNotice().getNoticeMessageId(), JSON.toJSONString(event.getAssigner()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,33 +33,33 @@ public class MessagePushProcessEventListener implements BpmnProcessEventListener
|
||||
@Override
|
||||
public void onCancelled(FlowableCancelledEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCancelled...");
|
||||
log.debug("MessagePushProcessEventListener#onCancelled...{}", event.getProcessInstanceId());
|
||||
}
|
||||
pendingComplete(event);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCancelled...end");
|
||||
log.debug("MessagePushProcessEventListener#onCancelled...end: {}", event.getProcessInstanceId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRejected(FlowableCancelledEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onRejected...");
|
||||
log.debug("MessagePushProcessEventListener#onRejected...{}", event.getProcessInstanceId());
|
||||
}
|
||||
pendingComplete(event);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onRejected...end");
|
||||
log.debug("MessagePushProcessEventListener#onRejected...end: {}", event.getProcessInstanceId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(FlowableEngineEntityEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCompleted...");
|
||||
log.debug("MessagePushProcessEventListener#onCompleted...{}", event.getProcessInstanceId());
|
||||
}
|
||||
pendingComplete(event);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCompleted...end");
|
||||
log.debug("MessagePushProcessEventListener#onCompleted...end: {}", event.getProcessInstanceId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ public class RocketMqBpmnProcessEventListener implements BpmnProcessEventListene
|
||||
@Override
|
||||
public void onCreated(FlowableEngineEntityEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCreated...");
|
||||
log.debug("MessagePushProcessEventListener#onCreated...{}", event.getProcessInstanceId());
|
||||
}
|
||||
Deployment deployment =
|
||||
repositoryService.createDeploymentQuery().deploymentId(((ExecutionEntityImpl) event.getEntity()).getDeploymentId()).singleResult();
|
||||
@ -73,14 +73,14 @@ public class RocketMqBpmnProcessEventListener implements BpmnProcessEventListene
|
||||
BpmnMetaParserHelper.getNoticeConfig(mainProcess).ifPresent(dto::setNoticeConf);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_CREATED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCreated...end");
|
||||
log.debug("MessagePushProcessEventListener#onCreated...end: {}", event.getProcessInstanceId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStarted(FlowableProcessStartedEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onStarted...");
|
||||
log.debug("MessagePushProcessEventListener#onStarted...{}", ((ExecutionEntityImpl) event.getEntity()).getProcessInstanceId());
|
||||
}
|
||||
Deployment deployment =
|
||||
repositoryService.createDeploymentQuery().deploymentId(((ExecutionEntityImpl) event.getEntity()).getDeploymentId())
|
||||
@ -105,14 +105,14 @@ public class RocketMqBpmnProcessEventListener implements BpmnProcessEventListene
|
||||
BpmnMetaParserHelper.getNoticeConfig(mainProcess).ifPresent(dto::setNoticeConf);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_STARTED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onStarted...end");
|
||||
log.debug("MessagePushProcessEventListener#onStarted...end: {}", ((ExecutionEntityImpl) event.getEntity()).getProcessInstanceId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(FlowableCancelledEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCancelled...");
|
||||
log.debug("MessagePushProcessEventListener#onCancelled...{}", event.getProcessInstanceId());
|
||||
}
|
||||
Deployment deployment =
|
||||
repositoryService.createDeploymentQuery().deploymentId(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getDeploymentId())
|
||||
@ -136,7 +136,7 @@ public class RocketMqBpmnProcessEventListener implements BpmnProcessEventListene
|
||||
BpmnMetaParserHelper.getNoticeConfig(mainProcess).ifPresent(dto::setNoticeConf);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_CANCELLED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCancelled...end");
|
||||
log.debug("MessagePushProcessEventListener#onCancelled...end: {}", event.getProcessInstanceId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ public class RocketMqBpmnProcessEventListener implements BpmnProcessEventListene
|
||||
@Override
|
||||
public void onRejected(FlowableCancelledEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onRejected...");
|
||||
log.debug("MessagePushProcessEventListener#onRejected...{}", event.getProcessInstanceId());
|
||||
}
|
||||
Deployment deployment =
|
||||
repositoryService.createDeploymentQuery().deploymentId(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getDeploymentId())
|
||||
@ -172,14 +172,14 @@ public class RocketMqBpmnProcessEventListener implements BpmnProcessEventListene
|
||||
BpmnMetaParserHelper.getNoticeConfig(mainProcess).ifPresent(dto::setNoticeConf);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_REJECTED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onRejected...end");
|
||||
log.debug("MessagePushProcessEventListener#onRejected...end: {}", event.getProcessInstanceId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(FlowableEngineEntityEvent event) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCompleted...");
|
||||
log.debug("MessagePushProcessEventListener#onCompleted...{}", event.getProcessInstanceId());
|
||||
}
|
||||
Deployment deployment =
|
||||
repositoryService.createDeploymentQuery().deploymentId(((ExecutionEntityImpl) event.getEntity()).getDeploymentId())
|
||||
@ -203,7 +203,7 @@ public class RocketMqBpmnProcessEventListener implements BpmnProcessEventListene
|
||||
BpmnMetaParserHelper.getNoticeConfig(mainProcess).ifPresent(dto::setNoticeConf);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_COMPLETED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCompleted...end");
|
||||
log.debug("MessagePushProcessEventListener#onCompleted...end: {}", event.getProcessInstanceId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ public class AutoOperatorEventListener implements BpmnTaskEventListener, Ordered
|
||||
@Override
|
||||
public void onCreated(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("AutoOperatorEventListener#onCreated...");
|
||||
log.debug("AutoOperatorEventListener#onCreated...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
Process mainProcess = repositoryService.getBpmnModel(delegateTask.getProcessDefinitionId()).getMainProcess();
|
||||
UserTask userTask = (UserTask) mainProcess.getFlowElement(delegateTask.getTaskDefinitionKey());
|
||||
@ -92,13 +92,13 @@ public class AutoOperatorEventListener implements BpmnTaskEventListener, Ordered
|
||||
});
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("AutoOperatorEventListener#onCreated...end");
|
||||
log.debug("AutoOperatorEventListener#onCreated...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
|
||||
private void autoReject(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("AutoOperatorEventListener#autoReject...");
|
||||
log.debug("AutoOperatorEventListener#autoReject...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), COMMENT_TYPE_ADVICE, "自动驳回");
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
@ -111,14 +111,20 @@ public class AutoOperatorEventListener implements BpmnTaskEventListener, Ordered
|
||||
// 删除流程实例,以实现驳回任务时,取消整个审批流程
|
||||
processInstanceService.deleteProcessInstance(delegateTask.getProcessInstanceId(), REJECTION_AUTO_COMPLETED.getDesc());
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("AutoOperatorEventListener#autoReject...end");
|
||||
log.debug("AutoOperatorEventListener#autoReject...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void autoPass(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("AutoOperatorEventListener#autoPass...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), COMMENT_TYPE_AUTO_PASSED,
|
||||
"自动通过");
|
||||
taskService.complete(delegateTask.getId(), runtimeService.getVariables(delegateTask.getExecutionId()));
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("AutoOperatorEventListener#autoPass...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public class MessagePushTaskEventListener implements BpmnTaskEventListener, Orde
|
||||
@Override
|
||||
public void onAssigned(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushTaskEventListener#onAssigned...");
|
||||
log.debug("MessagePushTaskEventListener#onAssigned...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
if (Objects.equals(TASK_ASSIGNEE_SKIP_FLAT, delegateTask.getAssignee())) {
|
||||
// 转交功能原审批人完成待办, 由于在流程引擎侧, 任务是不会在转交时立即结束, 但待办消息需要立即完成,
|
||||
@ -61,18 +61,18 @@ public class MessagePushTaskEventListener implements BpmnTaskEventListener, Orde
|
||||
}
|
||||
pendingPush(delegateTask);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushTaskEventListener#onAssigned...end");
|
||||
log.debug("MessagePushTaskEventListener#onAssigned...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleted(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushTaskEventListener#onDeleted...");
|
||||
log.debug("MessagePushTaskEventListener#onDeleted...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
pendingComplete(delegateTask);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushTaskEventListener#onDeleted...end");
|
||||
log.debug("MessagePushTaskEventListener#onDeleted...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -53,48 +53,48 @@ public class RocketMqBpmnTaskEventListener implements BpmnTaskEventListener, Ord
|
||||
@Override
|
||||
public void onCreated(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmnTaskEventListener#onCreated...");
|
||||
log.debug("RocketMqBpmnTaskEventListener#onCreated...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
ProcessTaskDTO dto = build(delegateTask, PROCESS_TASK_CREATED);
|
||||
sendMessageQueue(dto, PROCESS_TASK_CREATED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmnTaskEventListener#onCreated...end");
|
||||
log.debug("RocketMqBpmnTaskEventListener#onCreated...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAssigned(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmnTaskEventListener#onAssigned...");
|
||||
log.debug("RocketMqBpmnTaskEventListener#onAssigned...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
ProcessTaskDTO dto = build(delegateTask, PROCESS_TASK_ASSIGNED);
|
||||
sendMessageQueue(dto, PROCESS_TASK_ASSIGNED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmnTaskEventListener#onAssigned...end");
|
||||
log.debug("RocketMqBpmnTaskEventListener#onAssigned...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmnTaskEventListener#onCompleted...");
|
||||
log.debug("RocketMqBpmnTaskEventListener#onCompleted...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
ProcessTaskDTO dto = build(delegateTask, PROCESS_TASK_COMPLETED);
|
||||
sendMessageQueue(dto, PROCESS_TASK_COMPLETED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmnTaskEventListener#onCompleted...end");
|
||||
log.debug("RocketMqBpmnTaskEventListener#onCompleted...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleted(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmnTaskEventListener#onDeleted...");
|
||||
log.debug("RocketMqBpmnTaskEventListener#onDeleted...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
ProcessTaskDTO dto = build(delegateTask, PROCESS_TASK_DELETED);
|
||||
sendMessageQueue(dto, PROCESS_TASK_DELETED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("RocketMqBpmnTaskEventListener#onDeleted...end");
|
||||
log.debug("RocketMqBpmnTaskEventListener#onDeleted...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ public class SnapshotBpmnTaskTaskEventListener implements BpmnTaskEventListener,
|
||||
@Override
|
||||
public void onAssigned(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("SnapshotBpmnTaskTaskEventListener#onAssigned...");
|
||||
log.debug("SnapshotBpmnTaskTaskEventListener#onAssigned...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
List<BpmnTaskDelegateAssigner> assignerList = runtimeService.getVariable(delegateTask.getProcessInstanceId(),
|
||||
INTERNAL_ACTIVITY_RELATION_ASSIGNEE_LIST_INFO_SNAPSHOT + delegateTask.getTaskDefinitionKey(),
|
||||
@ -48,7 +48,7 @@ public class SnapshotBpmnTaskTaskEventListener implements BpmnTaskEventListener,
|
||||
delegateTask.setVariable(INTERNAL_TASK_RELATION_ASSIGNEE_INFO + delegateTask.getId(), i);
|
||||
});
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("SnapshotBpmnTaskTaskEventListener#onAssigned...end");
|
||||
log.debug("SnapshotBpmnTaskTaskEventListener#onAssigned...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ public class StartNodeAutoCompleteEventListener implements BpmnTaskEventListener
|
||||
@Override
|
||||
public void onCreated(DelegateTask delegateTask) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("StartNodeAutoCompleteEventListener#onCreated...");
|
||||
log.debug("StartNodeAutoCompleteEventListener#onCreated...{}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
Process mainProcess = repositoryService.getBpmnModel(delegateTask.getProcessDefinitionId()).getMainProcess();
|
||||
UserTask userTask = (UserTask) mainProcess.getFlowElement(delegateTask.getTaskDefinitionKey());
|
||||
@ -59,7 +59,7 @@ public class StartNodeAutoCompleteEventListener implements BpmnTaskEventListener
|
||||
}
|
||||
});
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("StartNodeAutoCompleteEventListener#onCreated...end");
|
||||
log.debug("StartNodeAutoCompleteEventListener#onCreated...end: {}", delegateTask.getTaskDefinitionKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package cn.axzo.workflow.server.controller.web.bpmn;
|
||||
|
||||
import cn.axzo.workflow.client.feign.bpmn.ProcessActivityApi;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessActivityService;
|
||||
import cn.axzo.workflow.server.common.annotation.RepeatSubmit;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -36,6 +37,7 @@ public class BpmnProcessActivityController implements ProcessActivityApi {
|
||||
*/
|
||||
@GetMapping("/trigger")
|
||||
@Override
|
||||
@RepeatSubmit
|
||||
public CommonResponse<Boolean> trigger(@RequestParam @NotBlank(message = "触发 ID 不能为空") String triggerId) {
|
||||
bpmnProcessActivityService.trigger(triggerId);
|
||||
return CommonResponse.success(true);
|
||||
|
||||
@ -15,6 +15,7 @@ import cn.axzo.workflow.common.model.response.bpmn.process.HistoricProcessInstan
|
||||
import cn.axzo.workflow.common.model.response.bpmn.process.ProcessNodeDetailVO;
|
||||
import cn.axzo.workflow.core.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessInstanceService;
|
||||
import cn.axzo.workflow.server.common.annotation.RepeatSubmit;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
@ -67,6 +68,7 @@ public class BpmnProcessInstanceController implements ProcessInstanceApi {
|
||||
*/
|
||||
@PostMapping("/create")
|
||||
@Override
|
||||
@RepeatSubmit
|
||||
public CommonResponse<String> createProcessInstance(@Validated @RequestBody BpmnProcessInstanceCreateDTO dto) {
|
||||
log.info("发起审核createProcessInstance===>>>参数:{}", JSON.toJSONString(dto));
|
||||
String result = bpmnProcessInstanceService.createProcessInstance(dto);
|
||||
@ -89,6 +91,7 @@ public class BpmnProcessInstanceController implements ProcessInstanceApi {
|
||||
*/
|
||||
@DeleteMapping("/cancel")
|
||||
@Override
|
||||
@RepeatSubmit
|
||||
public CommonResponse<Boolean> cancelProcessInstance(@Validated @RequestBody BpmnProcessInstanceCancelDTO dto) {
|
||||
log.info("取消审核cancelProcessInstant===>>>参数:{}", JSON.toJSONString(dto));
|
||||
if (!StringUtils.hasLength(dto.getId()) && !StringUtils.hasLength(dto.getBusinessKey())) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user