Merge remote-tracking branch 'refs/remotes/origin/REQ-2324' into feature/merged_all_req
This commit is contained in:
commit
d23135e06c
@ -2,7 +2,6 @@ package cn.axzo.workflow.server.controller.listener.error;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.bpmn.BpmnNoticeConf;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditDTO;
|
||||
import cn.axzo.workflow.core.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper;
|
||||
import cn.axzo.workflow.core.engine.event.MessagePushEvent;
|
||||
import cn.axzo.workflow.core.engine.event.MessagePushEventBuilder;
|
||||
@ -15,7 +14,7 @@ import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEvent;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher;
|
||||
import org.flowable.common.engine.impl.event.FlowableEntityExceptionEventImpl;
|
||||
import org.flowable.common.engine.impl.event.FlowableEntityEventImpl;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
import org.flowable.engine.impl.util.ProcessDefinitionUtil;
|
||||
@ -54,10 +53,10 @@ public class ApproveErrorReporterEventListener implements BpmnAsyncJobEventListe
|
||||
@Override
|
||||
public void notify(FlowableEvent flowableEvent) {
|
||||
log.info("ApproveErrorReporterEventListener-flowableEvent: {}", JSONUtil.toJsonStr(flowableEvent));
|
||||
if (!(flowableEvent instanceof FlowableEntityExceptionEventImpl)) {
|
||||
if (!(flowableEvent instanceof FlowableEntityEventImpl)) {
|
||||
return;
|
||||
}
|
||||
FlowableEntityExceptionEventImpl jobEvent = (FlowableEntityExceptionEventImpl) flowableEvent;
|
||||
FlowableEntityEventImpl jobEvent = (FlowableEntityEventImpl) flowableEvent;
|
||||
JobInfo jobInfo = (JobInfo) jobEvent.getEntity();
|
||||
String handlerType = jobInfo.getJobHandlerType();
|
||||
//只处理审批类型任务
|
||||
@ -71,19 +70,14 @@ public class ApproveErrorReporterEventListener implements BpmnAsyncJobEventListe
|
||||
}
|
||||
|
||||
BpmnTaskAuditDTO dto = JSONUtil.toBean(jobInfo.getCustomValues(), BpmnTaskAuditDTO.class);
|
||||
if (jobEvent.getCause() instanceof WorkflowEngineException) {
|
||||
WorkflowEngineException exception = (WorkflowEngineException) jobEvent.getCause();
|
||||
if (!IGNORE_ERROR_CODES.contains(exception.getCode())) {
|
||||
Process process = ProcessDefinitionUtil.getProcess(((FlowableEntityExceptionEventImpl) flowableEvent).getProcessDefinitionId());
|
||||
//获取消息配置
|
||||
Optional<BpmnNoticeConf> noticeConfig = BpmnMetaParserHelper.getNoticeConfig(process);
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
||||
FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();
|
||||
MessagePushEvent event = MessagePushEventBuilder.createPendingRollbackEvent(jobEvent.getProcessInstanceId(), jobInfo.getTenantId(), dto.getTaskId(), noticeConfig.orElse(new BpmnNoticeConf()));
|
||||
log.info("发送恢复待办的流程事件消息: taskDto:{},event:{}", JSONUtil.toJsonStr(dto), JSONUtil.toJsonStr(event));
|
||||
eventDispatcher.dispatchEvent(event, processEngineConfiguration.getEngineCfgKey());
|
||||
}
|
||||
}
|
||||
Process process = ProcessDefinitionUtil.getProcess(jobEvent.getProcessDefinitionId());
|
||||
//获取消息配置
|
||||
Optional<BpmnNoticeConf> noticeConfig = BpmnMetaParserHelper.getNoticeConfig(process);
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
|
||||
FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();
|
||||
MessagePushEvent event = MessagePushEventBuilder.createPendingRollbackEvent(jobEvent.getProcessInstanceId(), jobInfo.getTenantId(), dto.getTaskId(), noticeConfig.orElse(new BpmnNoticeConf()));
|
||||
log.info("发送恢复待办的流程事件消息: taskDto:{},event:{}", JSONUtil.toJsonStr(dto), JSONUtil.toJsonStr(event));
|
||||
eventDispatcher.dispatchEvent(event, processEngineConfiguration.getEngineCfgKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.flowable.common.engine.api.delegate.event.FlowableEngineEventType.JOB_MOVED_TO_DEADLETTER;
|
||||
import static org.flowable.common.engine.api.delegate.event.FlowableEngineEventType.JOB_EXECUTION_FAILURE;
|
||||
|
||||
/**
|
||||
* 异步任务执行异常的扩展监听器
|
||||
@ -33,7 +33,7 @@ public class ErrorReporterEventListener implements BpmnAsyncJobEventListener {
|
||||
|
||||
@Override
|
||||
public boolean support(FlowableEngineEventType eventType) {
|
||||
return Objects.equals(JOB_MOVED_TO_DEADLETTER, eventType);
|
||||
return Objects.equals(JOB_EXECUTION_FAILURE, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user