潘志宝
9 天以前 9d5be382e52f9ac57199d5ef75cc23f925a4cdb0
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());
    }
}