houzhongyi
2024-07-11 e7c1260db32209a078a962aaa0ad5492c35774fb
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.bpm.event;
H 2
3 import cn.hutool.core.util.StrUtil;
4 import org.springframework.context.ApplicationListener;
5
6 /**
7  * {@link BpmProcessInstanceStatusEvent} 的监听器
8  *
9  * @author iailab
10  */
11 public abstract class BpmProcessInstanceStatusEventListener
12         implements ApplicationListener<BpmProcessInstanceStatusEvent> {
13
14     @Override
15     public final void onApplicationEvent(BpmProcessInstanceStatusEvent event) {
16         if (!StrUtil.equals(event.getProcessDefinitionKey(), getProcessDefinitionKey())) {
17             return;
18         }
19         onEvent(event);
20     }
21
22     /**
23      * @return 返回监听的流程定义 Key
24      */
25     protected abstract String getProcessDefinitionKey();
26
27     /**
28      * 处理事件
29      *
30      * @param event 事件
31      */
32     protected abstract void onEvent(BpmProcessInstanceStatusEvent event);
33
34 }