mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	BPM: 实现业务流程结果监听器
This commit is contained in:
		| @@ -0,0 +1,35 @@ | ||||
| package cn.iocoder.yudao.module.bpm.framework.bpm.listener; | ||||
|  | ||||
| import cn.hutool.core.util.StrUtil; | ||||
| import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||||
| import cn.iocoder.yudao.module.bpm.api.listener.BpmResultListenerApi; | ||||
| import cn.iocoder.yudao.module.bpm.api.listener.dto.BpmResultListenerRespDTO; | ||||
| import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEvent; | ||||
| import jakarta.annotation.Resource; | ||||
| import org.springframework.context.ApplicationListener; | ||||
| import org.springframework.stereotype.Component; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 业务流程结果监听器实现类 | ||||
|  * | ||||
|  * @author HUIHUI | ||||
|  */ | ||||
| @Component | ||||
| public class BpmServiceResultListener implements ApplicationListener<BpmProcessInstanceResultEvent> { | ||||
|  | ||||
|     @Resource | ||||
|     private List<BpmResultListenerApi> bpmResultListenerApis; | ||||
|  | ||||
|     @Override | ||||
|     public final void onApplicationEvent(BpmProcessInstanceResultEvent event) { | ||||
|         bpmResultListenerApis.forEach(bpmResultListenerApi -> { | ||||
|             if (!StrUtil.equals(event.getProcessDefinitionKey(), bpmResultListenerApi.getProcessDefinitionKey())) { | ||||
|                 return; | ||||
|             } | ||||
|             bpmResultListenerApi.onEvent(BeanUtils.toBean(event, BpmResultListenerRespDTO.class)); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 puhui999
					puhui999