当前位置: 首页 > news >正文

八大员继续教育入口优化大师网页版

八大员继续教育入口,优化大师网页版,滴滴优惠券网站怎么做的,2023年国内十大新闻flowable流程结束触发监听器 | flowable流程结束获取结束节点 | flowable流程结束事件响应监听器 下面代码是该监听器是对每个到达结束事件后执行的。 原本的流程定义是如果其中任意某个节点进行了驳回#xff0c;则直接结束流程。 所以在每个节点的驳回对应的排他网关都设…flowable流程结束触发监听器 | flowable流程结束获取结束节点 | flowable流程结束事件响应监听器 下面代码是该监听器是对每个到达结束事件后执行的。 原本的流程定义是如果其中任意某个节点进行了驳回则直接结束流程。 所以在每个节点的驳回对应的排他网关都设置了EndEvent import cn.hutool.extra.spring.SpringUtil; import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; import org.flowable.bpmn.model.BpmnModel; import org.flowable.bpmn.model.EndEvent; import org.flowable.bpmn.model.FlowNode; import org.flowable.common.engine.api.delegate.event.FlowableEvent; import org.flowable.common.engine.api.delegate.event.FlowableEventListener; import org.flowable.engine.RuntimeService; import org.flowable.engine.TaskService; import org.flowable.engine.delegate.event.impl.FlowableEntityEventImpl; import org.flowable.engine.impl.util.ProcessDefinitionUtil; import org.flowable.engine.runtime.Execution; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.task.api.Task; import org.springframework.stereotype.Component;import java.util.List;/*** description 全局监听器判断流程是不是运行到了最后一个EndEvent* since 2024/1/15*/ Slf4j Component public class ProcessEndListener implements FlowableEventListener {Overridepublic void onEvent(FlowableEvent event) {log.info(ProcessEndListener:{}, JSON.toJSONString(event.getType()));TaskService taskService SpringUtil.getBean(TaskService.class);RuntimeService runtimeService SpringUtil.getBean(RuntimeService.class);FlowableEntityEventImpl flowableEntityEvent ((FlowableEntityEventImpl) event);ProcessInstance pi (ProcessInstance) flowableEntityEvent.getEntity();ListTask tasks taskService.createTaskQuery().active().processInstanceId(pi.getId()).list();Task t tasks.get(0);String bizKey pi.getBusinessKey();log.info(ProcessEndListener#bizKey:{}, bizKey);String procDefId pi.getProcessDefinitionId();ListExecution exes runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).processDefinitionId(procDefId).executionId(t.getExecutionId()).list();String curActId exes.get(0).getActivityId();//获得当前执行器的活动IDBpmnModel bm ProcessDefinitionUtil.getBpmnModel(t.getProcessDefinitionId());FlowNode flowNode (FlowNode) bm.getFlowElement(curActId);//获得当前节点if (flowNode instanceof EndEvent) {//判断当前节点是否为结束事件if (flowNode.getId().equals(end)) {//end是自定义的EndEvent节点的ID//todo 通知回调log.info(当前节点是结束节点:{}, JSON.toJSONString(flowNode));}}}Overridepublic boolean isFailOnException() {return false;}Overridepublic boolean isFireOnTransactionLifecycleEvent() {return false;}Overridepublic String getOnTransaction() {return null;}} 百度关于该问题答案出来的几乎清一色全是同一个答案给了三种方法但是每个方法的代码都有他自定义的部分是不完整的东西。 下面是网上找的东西里面的flowableService是这个比玩意自定义的。 下面这段代码是被转载多次的代码 它监听的是指向结束事件的上一个节点。 也就是他的当前节点可能是最后一岗。 然后最后一岗—EndEvent Component public class ProcessEndListener implements FlowableEventListener {AutowiredFlowableService flowableService;Overridepublic void onEvent(FlowableEvent event) {// 当前节点任务实体,TaskEntity taskEntity (TaskEntity) ((FlowableEntityEventImpl) event).getEntity();String taskId taskEntity.getId();String curActId flowableService.getNodeId(taskId);String procDefId ProcUtils.getProcessDefinitionByTaskId(taskEntity.getId()).getId();Process process ProcessDefinitionUtil.getProcess(procDefId);//遍历整个process,找到endEventId是什么与当前taskId作对比ListFlowElement flowElements (ListFlowElement) process.getFlowElements();for (FlowElement flowElement : flowElements) {if (flowElement instanceof SequenceFlow) {SequenceFlow flow (SequenceFlow) flowElement;FlowElement sourceFlowElement flow.getSourceFlowElement();FlowElement targetFlowElement flow.getTargetFlowElement();//如果当前边的下一个节点是endEvent那么获取当前边if(targetFlowElement instanceof EndEvent sourceFlowElement.getId().equals(curActId)){System.out.println(下一个是结束节点);}}}}Overridepublic boolean isFailOnException() {return false;}Overridepublic boolean isFireOnTransactionLifecycleEvent() {return false;}Overridepublic String getOnTransaction() {return null;} }用我上面的代码实现示例这个b的代码 Overridepublic void onEvent(FlowableEvent event) {log.info(ProcessEndListener:{}, JSON.toJSONString(event.getType()));TaskService taskService SpringUtil.getBean(TaskService.class);RuntimeService runtimeService SpringUtil.getBean(RuntimeService.class);FlowableEntityEventImpl flowableEntityEvent ((FlowableEntityEventImpl) event);ProcessInstance pi (ProcessInstance) flowableEntityEvent.getEntity();ListTask tasks taskService.createTaskQuery().active().processInstanceId(pi.getId()).list();Task t tasks.get(0);String bizKey pi.getBusinessKey();log.info(ProcessEndListener#bizKey:{}, bizKey);String procDefId pi.getProcessDefinitionId();ListExecution exes runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).processDefinitionId(procDefId).executionId(t.getExecutionId()).list();String curActId exes.get(0).getActivityId();BpmnModel bm ProcessDefinitionUtil.getBpmnModel(t.getProcessDefinitionId());FlowNode flowNode (FlowNode) bm.getFlowElement(curActId);//如果当前节点是最后一岗ListSequenceFlow outFlows flowNode.getOutgoingFlows(); //此处需要获取他的下一个节点是否为EndEventfor (SequenceFlow sequenceFlow : outFlows) { //遍历outFlowssequenceFlow.getTargetFlowElement();//用该flow节点与EndEvent进行对比判断也就是当前节点的下一个节点和EndEvent判断是否一致是则说明当前节点就是最后一岗且它的下一个节点就是结束事件}}
http://www.pierceye.com/news/320375/

相关文章:

  • 建设银行网站最近都打不开吗在线设计网名生成器
  • 淮滨网站建设公司建设银行有招投标网站吗
  • 岳阳做公司网站可以做司法考试题的网站
  • 深圳做网站联雅asp.net网站很快吗
  • 网站制作公司交接网站网站建设 上海浦东
  • 甘肃省住房和建设厅网站移动网站登录入口
  • 垦利区建设局网站如何零基础学编程
  • wordpress金融小学生班级优化大师
  • 网站链接怎么做标记在哪个网做免费网站好
  • 山西响应式网站建设制作营销网站建设公司排名
  • 商学院网站建设建议深圳市宝安网站建设
  • 营销型网站建设报价方案中国建设银行舟山分行网站
  • 建游戏网站建筑工程公司管理制度
  • 网站风格配置怎么做wordpress下载弹窗插件
  • 合肥建设工会网站做试管网站
  • 商丘市有没有做网站建设工程检测预约网站
  • 网站产品内容在数据库wordpress都可以干什么
  • 宿州哪家做网站不做西安家电商城网站建设
  • 广安门外网站建设wordpress权限不能更新
  • 可以查企业备案的网站吗重庆建网站多少钱
  • 做网站如何分工中国十大企业
  • 网站开发和前端和数据媒体wordpress关闭主题
  • 怎样开网站卖东西龙华网站制作公司
  • 网站制作公司南宁怎样大力开发公司网站建设
  • 香橼做空机构网站广州地铁运营时间
  • 怎么用Visio studio做网站软件开发需要哪些人员
  • emlog做企业网站建设教育网站费用
  • 有做火币网这种网站的吗对红色网站建设的建议
  • 聚美优品网站建设导向北郊网站建设
  • 一键建站免费公司网页如何建立