不论是flowable还是activiti,都可以快速的实现节点超时自动跳过,主要是使用边缘事件
flowable:
#启动定时任务JOB
async-executor-activate: true
check-process-definitions: false
rest-api-enabled: false
database-schema-update: true
idm:
enabled: false
注意: async-executor-activate就是开关
<userTask id="N5" name="审批" flowable:async="true" flowable:assignee="1,2,3">
<multiInstanceLoopCharacteristics isSequential="false" flowable:collection="{starmark_emptycollection}" flowable:elementVariable="starmark_atuser"></multiInstanceLoopCharacteristics>
</userTask>
<boundaryEvent id="BoundaryEvent_N5" name="审批" attachedToRef="N5" cancelActivity="true">
<extensionElements>
<flowable:executionListener event="end" class="com.starmark.oa.workflow.activiti.listener.ProcessDueTimeListener"></flowable:executionListener>
</extensionElements>
<timerEventDefinition>
<timeDate>PT1H</timeDate>
</timerEventDefinition>
</boundaryEvent>
上述就配置了1个小时自动跳过
/**
* 流程节点超时自动跳过
*/
public class ProcessDueTimeListener implements ExecutionListener {
private IActHiCommentService actHiCommentService=null;
private IActHiCommentService getActHiCommentService(){
if(actHiCommentService==null){
actHiCommentService=SpringContextUtils.getBean(IActHiCommentService.class);
}
return actHiCommentService;
}
@Override
public void notify(DelegateExecution execution) {
CommentEntity comment = new CommentEntityImpl();
comment.setId(IdWorker.getIdStr());
comment.setProcessInstanceId(execution.getProcessInstanceId());
comment.setType("comment");
comment.setAction(execution.getCurrentFlowElement().getName()+"超时自动跳过");
comment.setTime(new Date());
comment.setUserId("system");
comment.setMessage("");
System.out.println(execution.getProcessInstanceId());
System.out.println( execution.getCurrentActivityId());
getActHiCommentService().insert(comment);
}
}