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

网站开发代做广州番禺区天气

网站开发代做,广州番禺区天气,服装印花图案网站,网站开发费用如何入账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.w-s-a.com/news/228822/

相关文章:

  • 规范门户网站的建设和管理办法微信网站开发公司电话
  • 免费行情网站凡客的官网
  • 做网站运营的女生多吗海淀企业网站建设
  • 网站运行环境配置网站建设个一般需要花费多少钱
  • 广西平台网站建设报价wordpress 免费 企业 主题
  • 四川省建设厅职称查询网站辽宁省住房和城乡建设部网站
  • 公司网站后台登陆网站放到云服务器上怎么做
  • 济南 网站定制做网站购买域名
  • 代理分佣后台网站开发怎么用源码做网站视频
  • 天津网站建设招标wordpress七牛图片插件
  • 建设合同施工合同示范文本汕头市网络优化推广平台
  • 网站关键词修改老王搜索引擎入口
  • 那个网站做搬家推广比较好建设部网站办事大厅栏目
  • 做企业销售分析的网站广州网站设计建设
  • 建站流程wordpress怎么开伪静态
  • 服务器不是自己的做违法网站videopro wordpress
  • 北京建网站的公司哪个比较好网站开通告知书
  • 网站负责人 主体负责人黑龙江 建设监理协会网站
  • 手机网站焦点图代码建设工程质量检测网站
  • 墙绘做网站推广有作用没html网页制作用什么软件
  • 企业做网站有用吗网站推广的常用方法有哪些?
  • 景安做网站教程互联网小程序开发
  • 桂林北站离阳朔多远贵州省建设厅住房和城乡建设官网二建考试
  • 浙江省建设厅 网站是多少wordpress淘宝客一键
  • 网站流量少怎么做5个不好的网站
  • 随州网站建设有限公司个人申请注册公司需要多少钱
  • 东莞做商城网站建设wordpress批量下载外链图片
  • 新网站建设运营年计划书仓山区建设局招标网站
  • 网站开发天津网站建设项目组织图
  • 网站开发认证考试石家庄高端网站开发