Commit 0bde4d3b by huangfusuper

工作流被添加进实例表事件定义和事件监听

parent c331a6ce
package com.byit.event;
import org.springframework.context.ApplicationEvent;
/**
* 创建工作流处理完毕事件
* 作用:主要是工作流处理完毕后需要将对应的工作流改为不扫描
* @author huangfu
*/
public class FlowScanEndEvent extends ApplicationEvent {
private Integer flowId;
/**
* 创建工作流添加进实例表完毕后的事件
*
* @param source the object on which the event initially occurred (never {@code null})
* @param flowId 工作流id
*/
public FlowScanEndEvent(Object source,Integer flowId) {
super(source);
this.flowId = flowId;
}
public Integer getFlowId() {
return flowId;
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.byit.listener;
import com.byit.enums.FlowPropertyEnum;
import com.byit.event.EndFlowEvent;
import com.byit.event.FlowScanEndEvent;
import com.byit.model.Flow;
import com.byit.service.FlowService;
import lombok.extern.slf4j.Slf4j;
......@@ -23,11 +24,25 @@ public class FlowEventListener {
}
/**
* 工作添加进实例表后的事件监听
* @param flowScanEndEvent 事假信息
*/
@EventListener
public void flowScanEndEventListener(FlowScanEndEvent flowScanEndEvent){
log.info("-----------监听到事件{},工作流添加进实例完成事件-------",flowScanEndEvent);
Flow flow = Flow.builder()
.flowId(flowScanEndEvent.getFlowId())
.scanMark(FlowPropertyEnum.NOT_SCAN.getCode())
.build();
flowService.updateByIdSelective(flow);
}
/**
* 工作流完成事件监听
* @param endFlowEvent 事件信息
*/
@EventListener
public void flowEndEvent(EndFlowEvent endFlowEvent){
public void flowEndEventListener(EndFlowEvent endFlowEvent){
log.info("-----------监听到事件{},工作流实例完成事件-------",endFlowEvent);
Flow flow = Flow.builder()
.flowId(endFlowEvent.getFlowId())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment