mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 10:13:28 +08:00
update 调整注释
This commit is contained in:
parent
ed66fbf38e
commit
5bb3f65bae
@ -16,12 +16,12 @@ import java.lang.annotation.*;
|
|||||||
public @interface FlowListenerAnnotation {
|
public @interface FlowListenerAnnotation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程定义
|
* 流程定义key
|
||||||
*/
|
*/
|
||||||
String processDefinitionKey();
|
String processDefinitionKey();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 节点定义
|
* 节点id
|
||||||
*/
|
*/
|
||||||
String taskDefId() default "";
|
String taskDefId() default "";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -107,8 +107,8 @@ public class GlobalFlowableListener implements FlowableEventListener {
|
|||||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(entity.getProcessDefinitionId()).singleResult();
|
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(entity.getProcessDefinitionId()).singleResult();
|
||||||
String processDefinitionKey = processDefinition.getKey();
|
String processDefinitionKey = processDefinition.getKey();
|
||||||
String taskDefinitionKey = entity.getTaskDefinitionKey();
|
String taskDefinitionKey = entity.getTaskDefinitionKey();
|
||||||
String beanName = processDefinitionKey + "_" + taskDefinitionKey;
|
String key = processDefinitionKey + "_" + taskDefinitionKey;
|
||||||
FlowTaskEventHandler handler = flowEventStrategy.getTaskHandler(beanName);
|
FlowTaskEventHandler handler = flowEventStrategy.getTaskHandler(key);
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
handler.handleTask(entity);
|
handler.handleTask(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public class FlowEventStrategy implements BeanPostProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||||
if (bean instanceof FlowTaskEventHandler || bean instanceof FlowProcessEventHandler) {
|
if (bean instanceof FlowTaskEventHandler) {
|
||||||
FlowListenerAnnotation annotation = bean.getClass().getAnnotation(FlowListenerAnnotation.class);
|
FlowListenerAnnotation annotation = bean.getClass().getAnnotation(FlowListenerAnnotation.class);
|
||||||
if (null != annotation) {
|
if (null != annotation) {
|
||||||
if (StringUtils.isNotBlank(annotation.processDefinitionKey()) && StringUtils.isNotBlank(annotation.taskDefId())) {
|
if (StringUtils.isNotBlank(annotation.processDefinitionKey()) && StringUtils.isNotBlank(annotation.taskDefId())) {
|
||||||
@ -32,6 +32,11 @@ public class FlowEventStrategy implements BeanPostProcessor {
|
|||||||
flowTaskEventHandlers.put(id, (FlowTaskEventHandler) bean);
|
flowTaskEventHandlers.put(id, (FlowTaskEventHandler) bean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bean instanceof FlowProcessEventHandler) {
|
||||||
|
FlowListenerAnnotation annotation = bean.getClass().getAnnotation(FlowListenerAnnotation.class);
|
||||||
|
if (null != annotation) {
|
||||||
if (StringUtils.isNotBlank(annotation.processDefinitionKey()) && StringUtils.isBlank(annotation.taskDefId())) {
|
if (StringUtils.isNotBlank(annotation.processDefinitionKey()) && StringUtils.isBlank(annotation.taskDefId())) {
|
||||||
if (!flowProcessEventHandlers.containsKey(annotation.processDefinitionKey())) {
|
if (!flowProcessEventHandlers.containsKey(annotation.processDefinitionKey())) {
|
||||||
flowProcessEventHandlers.put(annotation.processDefinitionKey(), (FlowProcessEventHandler) bean);
|
flowProcessEventHandlers.put(annotation.processDefinitionKey(), (FlowProcessEventHandler) bean);
|
||||||
@ -45,24 +50,24 @@ public class FlowEventStrategy implements BeanPostProcessor {
|
|||||||
/**
|
/**
|
||||||
* 获取可执行bean
|
* 获取可执行bean
|
||||||
*
|
*
|
||||||
* @param beanName beanName
|
* @param key key
|
||||||
*/
|
*/
|
||||||
public FlowTaskEventHandler getTaskHandler(String beanName) {
|
public FlowTaskEventHandler getTaskHandler(String key) {
|
||||||
if (!flowTaskEventHandlers.containsKey(beanName)) {
|
if (!flowTaskEventHandlers.containsKey(key)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return flowTaskEventHandlers.get(beanName);
|
return flowTaskEventHandlers.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取可执行bean
|
* 获取可执行bean
|
||||||
*
|
*
|
||||||
* @param beanName beanName
|
* @param key key
|
||||||
*/
|
*/
|
||||||
public FlowProcessEventHandler getProcessHandler(String beanName) {
|
public FlowProcessEventHandler getProcessHandler(String key) {
|
||||||
if (!flowProcessEventHandlers.containsKey(beanName)) {
|
if (!flowProcessEventHandlers.containsKey(key)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return flowProcessEventHandlers.get(beanName);
|
return flowProcessEventHandlers.get(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user