activiti7消息撤回接口及消息通知实现思路

更新时间:2023-07-25 17:31:04 阅读: 评论:0

activiti7消息撤回接⼝及消息通知实现思路
消息撤回:
⽤户开启审批流程后,想撤回该条流程,可以在想撤回的节点添加消息边界事件,画图如下:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="www.w3/2001/XMLSchema-instance" xmlns:bpmn2="/spec/BPMN/20100524/MODEL" xmlns:bpmndi=  <bpmn2:process id="verifyNotifyV1" name="⽂档审阅" isExecutable="true">
<bpmn2:startEvent id="StartEvent_1" name="开始">
<bpmn2:outgoing>Flow_125gy0d</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:urTask id="Activity_06hj36k" name="⽂档审阅" activiti:formKey="Activity_06hj36k" activiti:assignee="${verify}">
<bpmn2:extensionElements>
<activiti:formProperty id="FormProperty_3v9ukk1--__!!radio--__!!审批意见--__!!i--__!!同意--__--不同意" />
<activiti:executionListener class="cn.piesat.document.listener.VerifyTaskListener" event="end">
<activiti:field name="state">
现在几点钟<activiti:string>0</activiti:string>
</activiti:field>
</activiti:executionListener>
<activiti:taskListener class="cn.piesat.document.listener.NotifyListener" event="create" />
</bpmn2:extensionElements>
<bpmn2:incoming>Flow_125gy0d</bpmn2:incoming>
<bpmn2:incoming>Flow_125gy0d</bpmn2:incoming>
<bpmn2:outgoing>Flow_03pvffh</bpmn2:outgoing>安康什么意思
<bpmn2:multiInstanceLoopCharacteristics activiti:collection="${verifies}" activiti:elementVariable="verify">
<bpmn2:loopCardinality xsi:type="bpmn2:tFormalExpression">${num}</bpmn2:loopCardinality>
<bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression">${nrOfCompletedInstances/nrOfInstances==1}</bpmn2:completionCondition>      </bpmn2:multiInstanceLoopCharacteristics>
</bpmn2:urTask>
<bpmn2:endEvent id="Event_11jqygc" name="结束">
<bpmn2:incoming>Flow_03pvffh</bpmn2:incoming>
<bpmn2:incoming>Flow_14edxvs</bpmn2:incoming>
</bpmn2:endEvent>
goldrush
<bpmn2:quenceFlow id="Flow_03pvffh" name="监听" sourceRef="Activity_06hj36k" targetRef="Event_11jqygc">
<bpmn2:extensionElements>
<activiti:executionListener class="cn.piesat.document.listener.VerifyStateListener" event="take" />
</bpmn2:extensionElements>
</bpmn2:quenceFlow>
gre雅思托福区别
<bpmn2:quenceFlow id="Flow_14edxvs" sourceRef="Event_1km4ti7" targetRef="Event_11jqygc" />
<bpmn2:boundaryEvent id="Event_1km4ti7" name="消息撤回" attachedToRef="Activity_06hj36k">
<bpmn2:outgoing>Flow_14edxvs</bpmn2:outgoing>
<bpmn2:messageEventDefinition id="MessageEventDefinition_0lylqlx" messageRef="Message_06usbn7" />
</bpmn2:boundaryEvent>
<bpmn2:quenceFlow id="Flow_125gy0d" name="存储消息撤回任务节点" sourceRef="StartEvent_1" targetRef="Activity_06hj36k">
<bpmn2:extensionElements>
<activiti:executionListener class="cn.piesat.document.listener.FileWithDrawExecutionListener" event="take">
<activiti:field name="withdrawTask">
<activiti:string>Activity_06hj36k:Message_2vb9r75</activiti:string>
</activiti:field>
<activiti:field name="countersigned">
<activiti:string>0</activiti:string>
</activiti:field>
</activiti:executionListener>
</bpmn2:extensionElements>
</bpmn2:quenceFlow>
</bpmn2:process>
<bpmn2:message id="Message_0o9mw30" name="Message_2fg586j" />
<bpmn2:message id="Message_1vz3ayq" name="Message_3e0avui" />
<bpmn2:message id="Message_06usbn7" name="Message_2vb9r75" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="verifyNotify">从不放弃英文
<bpmndi:BPMNEdge id="Flow_03pvffh_di" bpmnElement="Flow_03pvffh">
shootingstar
<di:waypoint x="570" y="258" />
<di:waypoint x="722" y="258" />
<bpmndi:BPMNLabel>
<dc:Bounds x="629" y="243" width="22" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_14edxvs_di" bpmnElement="Flow_14edxvs">
<di:waypoint x="550" y="316" />考研考场查询>successful
<di:waypoint x="550" y="340" />
<di:waypoint x="740" y="340" />
<di:waypoint x="740" y="276" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_125gy0d_di" bpmnElement="Flow_125gy0d">
<di:waypoint x="378" y="258" />
<di:waypoint x="470" y="258" />
<bpmndi:BPMNLabel>
<dc:Bounds x="387" y="226" width="77" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="342" y="240" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="349" y="283" width="22" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_11jqygc_di" bpmnElement="Event_11jqygc">
<dc:Bounds x="722" y="240" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="729" y="216" width="22" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_06hj36k_di" bpmnElement="Activity_06hj36k">
<dc:Bounds x="470" y="218" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1j1exxy_di" bpmnElement="Event_1km4ti7">
<dc:Bounds x="532" y="280" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="568" y="303" width="44" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
在流程图中我配置了监听器,绘制BPMN图时,将能撤回的任务节点编号(任务节点的key)和消息名称通过注⼊字段存储⾄数据库(也可以存储到redis等,⽅便获取就⾏),从执⾏监听器中可以获取。此处是会签多实例任务,在任务节点配置了代理⼈、完成条件等参数信息,同时配置了任务监听和执⾏监听,任务监听实现消息通知,当到达该节点时,触发事件类型为create,也就是任务创建的时候触发,通过监听器获取到当前任务执⾏⼈,这⾥在监听器⾥通过websocket给执⾏⼈推送消息通知(也可以换成别的⽅式⽐如发送短信等)这⾥没有贴消息推送代码,有点多,需要的话⾃⾏百度⼀下哈,执⾏监听器在这⾥注⼊执⾏⼈的审批状态信息,触发事件为任务完成时,通过监听器字段注⼊获取状态,修改审批⼈的状态信息。
如果测试可改为普通任务节点,不需要加完成条件,代理⼈可暂时写审批⼈的⽤户名,若不需要消息通知,可将任务监听器去掉。
执⾏监听器代码如下:
package cn.piesat.document.listener;
import stant.ProcessVariableConstant;
import stant.UrConstants;
import utils.spring.SpringUtils;
import cn.piesat.document.domain.FileBaInfo;
import cn.piesat.document.rvice.IFileBaInfoService;
import ine.delegate.DelegateExecution;
import ine.delegate.ExecutionListener;
import ine.delegate.Expression;
/**
* ⽂档字段注⼊撤回监听器
*/
public class FileWithDrawExecutionListener implements ExecutionListener {
//撤回节点注⼊字段信息
private Expression withdrawTask;
/
/注⼊会签任务key
private Expression countersigned;
@Override
public void notify(DelegateExecution execution) {
le creut//存储撤回消息名称
Object withdrawTaskValue = Value(execution);
Object countersignedValue = Value(execution);
execution.tVariable(ProcessVariableConstant.ACT_COUNTERSIGNED, String());        execution.tVariable(ProcessVariableConstant.ACT_WITHDRAW_TASK, String());        FileBaInfo baInfo = FileBaInfo.builder()
//设置消息撤回状态为撤回
.
String() + ":" + UrConstants.NORMAL)
.id(Long.ProcessInstanceBusinessKey()))
.build();
}
}
温度计英文

本文发布于:2023-07-25 17:31:04,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/78/1116760.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:任务   消息   撤回   节点
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图