| | |
| | | @Component |
| | | public class BpmProcessInstanceEventListener extends AbstractFlowableEngineEventListener { |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private BpmProcessInstanceService processInstanceService; |
| | | |
| | | public static final Set<FlowableEngineEventType> PROCESS_INSTANCE_EVENTS = ImmutableSet.<FlowableEngineEventType>builder() |
| | | .add(FlowableEngineEventType.PROCESS_CANCELLED) |
| | | .add(FlowableEngineEventType.PROCESS_COMPLETED) |
| | | .build(); |
| | | .add(FlowableEngineEventType.PROCESS_COMPLETED) |
| | | .build(); |
| | | |
| | | @Resource |
| | | @Lazy // 延迟加载,避免循环依赖 |
| | | private BpmProcessInstanceService processInstanceService; |
| | | |
| | | public BpmProcessInstanceEventListener(){ |
| | | super(PROCESS_INSTANCE_EVENTS); |
| | | } |
| | | |
| | | @Override |
| | | protected void processCancelled(FlowableCancelledEvent event) { |
| | | processInstanceService.updateProcessInstanceWhenCancel(event); |
| | | } |
| | | |
| | | @Override |
| | | protected void processCompleted(FlowableEngineEntityEvent event) { |
| | | processInstanceService.updateProcessInstanceWhenApprove((ProcessInstance)event.getEntity()); |
| | | processInstanceService.processProcessInstanceCompleted((ProcessInstance)event.getEntity()); |
| | | } |
| | | |
| | | } |