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

全球可以做外贸的社交网站有哪些wordpress主题离线编辑

全球可以做外贸的社交网站有哪些,wordpress主题离线编辑,齐齐哈尔市建设局网站,中铁建门户网登录入口flowable流程结束触发监听器 | flowable流程结束获取结束节点 | flowable流程结束事件响应监听器 下面代码是该监听器是对每个到达结束事件后执行的。 原本的流程定义是如果其中任意某个节点进行了驳回,则直接结束流程。 所以在每个节点的驳回对应的排他网关都设…

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();List<Task> 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();List<Execution> 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作对比List<FlowElement> flowElements = (List<FlowElement>) 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();List<Task> 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();List<Execution> 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);//如果当前节点是最后一岗List<SequenceFlow> outFlows = flowNode.getOutgoingFlows(); //此处需要获取他的下一个节点是否为EndEventfor (SequenceFlow sequenceFlow : outFlows) { //遍历outFlowssequenceFlow.getTargetFlowElement();//用该flow节点与EndEvent进行对比判断,也就是当前节点的下一个节点和EndEvent判断是否一致,是则说明当前节点就是最后一岗,且它的下一个节点就是结束事件}}
http://www.yayakq.cn/news/135600/

相关文章:

  • 深圳品牌网站制作多少钱湖南营销型网站建设
  • 模板网站免费视频app开发制作多少钱
  • 物流网站建设wordpress分类目录在
  • 英文网站的建设意义热点营销案例
  • 购物网站前台模板建设部二级结构工程师注销网站
  • 建网站对企业的作用私家网站ip地址大全
  • 游戏类网站怎么做手把手教你做网站视频
  • 网站页面设计公司龙岩会员系统小程序定制开发
  • 元气森林的网络营销方式关于公司网络优化方案
  • 重庆的网站建设公司wordpress 去掉评论
  • 做站用什么网站程序网站推广软件哪个最实惠
  • 龙泉市建设局门户网站网络规划设计师教程第四版
  • 建设网站对服务器有什么要求吗怎么按照屏幕比例做网站适应
  • 宁波微网站建设wordpress 中文文档下载
  • 有自己的网站做淘宝联盟号做吗关键词拓展工具有哪些
  • 响应式网站的发展现状自响应式网站建设清单
  • 国家工信部网站备案查询系统网站开发前景
  • 炫酷网站界面设计小说类网站功能建设
  • 开封府景点网站建设的目的南昌seo方案
  • 房产信息查询系统官方网站qq空间网站
  • mvc5 网站开发之美 pdf网站建设佛山拓客科技公司
  • 深圳网站建设 制作元桂林象鼻山介绍
  • 怎么电话销售网站建设网站建设多久可以建成
  • 网页设计与网站建设选择题网络营销实训报告
  • 南宁网站托管济南网站建设联系方式
  • 网站建设的资料的准备下拉框关键词软件
  • 十大在线编程网站designspiration
  • 北京医疗机构网站前置审批需要的材料有哪些怎么给自己公司做网站
  • 网站架构设计师待遇怎么样手机微信怎么建立公众号
  • 提高网页加载速度的方式长春网络推广seo