dongyukun
6 天以前 ed8fc5f674544d3af63c6f68093ffc038385c493
iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/framework/flowable/core/listener/BpmProcessInstanceEventListener.java
@@ -21,27 +21,20 @@
@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());
    }
}