1. 支持多流程定义实例监听回调复用实现类
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.api.event;
|
package cn.iocoder.yudao.module.bpm.api.event;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link BpmProcessInstanceStatusEvent} 的监听器
|
* {@link BpmProcessInstanceStatusEvent} 的监听器
|
||||||
*
|
*
|
||||||
@@ -13,8 +14,8 @@ public abstract class BpmProcessInstanceStatusEventListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void onApplicationEvent(BpmProcessInstanceStatusEvent event) {
|
public final void onApplicationEvent(BpmProcessInstanceStatusEvent event) {
|
||||||
if (!StrUtil.equals(event.getProcessDefinitionKey(), getProcessDefinitionKey())) {
|
if (getProcessDefinitionKey().contains(event.getProcessDefinitionKey())){
|
||||||
return;
|
onEvent(event);
|
||||||
}
|
}
|
||||||
onEvent(event);
|
onEvent(event);
|
||||||
}
|
}
|
||||||
@@ -22,7 +23,7 @@ public abstract class BpmProcessInstanceStatusEventListener
|
|||||||
/**
|
/**
|
||||||
* @return 返回监听的流程定义 Key
|
* @return 返回监听的流程定义 Key
|
||||||
*/
|
*/
|
||||||
protected abstract String getProcessDefinitionKey();
|
protected abstract List<String> getProcessDefinitionKey();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理事件
|
* 处理事件
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.bpm.service.oa.BpmOALeaveServiceImpl;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OA 请假单的结果的监听器实现类
|
* OA 请假单的结果的监听器实现类
|
||||||
*
|
*
|
||||||
@@ -19,8 +21,8 @@ public class BpmOALeaveStatusListener extends BpmProcessInstanceStatusEventListe
|
|||||||
private BpmOALeaveService leaveService;
|
private BpmOALeaveService leaveService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getProcessDefinitionKey() {
|
protected List<String> getProcessDefinitionKey() {
|
||||||
return BpmOALeaveServiceImpl.PROCESS_KEY;
|
return List.of(BpmOALeaveServiceImpl.PROCESS_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user