golang 撤回_Activiti6.0版本流程撤回、跳转、回退等操作
public void revoke(String objId) throws Exception {
Task task = taskService.createTaskQuery().processInstanceBusinessKey(objId).singleResult();
if(task==null) {
throw new ServiceException("流程未启动或已执行完成,无法撤回");
}
LoginUser loginUser = SessionContext.getLoginUser();
List htiList = historyService.createHistoricTaskInstanceQuery()
.processInstanceBusinessKey(objId)
.orderByTaskCreateTime()
.asc()
.list();
String myTaskId = null;
HistoricTaskInstance myTask = null;
for(HistoricTaskInstance hti : htiList) {
if(loginUser.getUsername().equals(hti.getAssignee())) {
myTaskId = hti.getId();
myTask = hti;
break;
}
}
if(null==myTaskId) {
throw new ServiceException("该任务非当前用户提交,无法撤回");
}
String processDefinitionId = myTask.getProcessDefinitionId();
ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
//变量
//Map variables = runtimeService.getVariableInstances(currentTask.getExecutionId());
String myActivityId = null;
List haiList = historyService.createHistoricActivityInstanceQuery()
.executionId(myTask.getExecutionId()).finished().list();
for(HistoricActivityInstance hai : haiList) {
if(myTaskId.equals(hai.getTaskId())) {
myActivityId = hai.getActivityId();
break;
}
}
FlowNode myFlowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(myActivityId);
Execution execution = runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult();
String activityId = execution.getActivityId();
logger.warn("------->> activityId:" + activityId);
FlowNode flowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(activityId);
//记录原活动方向
List oriSequenceFlows = new ArrayList();
oriSequenceFlows.addAll(flowNode.getOutgoingFlows());
//清理活动方向
flowNode.getOutgoingFlows().clear();
//建立新方向
List newSequenceFlowList = new ArrayList();
SequenceFlow newSequenceFlow = new SequenceFlow();
newSequenceFlow.setId("newSequenceFlowId");
newSequenceFlow.setSourceFlowElement(flowNode);
newSequenceFlow.setTargetFlowElement(myFlowNode);
newSequenceFlowList.add(newSequenceFlow);
flowNode.setOutgoingFlows(newSequenceFlowList);
Authentication.setAuthenticatedUserId(loginUser.getUsername());
taskService.addComment(task.getId(), task.getProcessInstanceId(), "撤回");
Map currentVariables = new HashMap();
currentVariables.put("applier", loginUser.getUsername());
//完成任务
taskService.complete(task.getId(),currentVariables);
//恢复原方向
flowNode.setOutgoingFlows(oriSequenceFlows);
}
https://blog.csdn.net/yongboyhood/article/details/70833021
golang 撤回_Activiti6.0版本流程撤回、跳转、回退等操作相关推荐
- 风吹雨互赞系统源码V1.0版本-免费发布啦-后续包更新操作,跟香橙互赞宝功能,界面一样
介绍: 互赞系统系统配置: 网站名称,SEO,关键词,logo,等等基础配置后台直接配置: 互赞系统前台:后台一键设置底部,头部公告,按键,轮播,包括颜色,小图,全部后台直接更改添加[互赞系统全部无需 ...
- activity流程撤回功能实现
activity流程撤回功能实现 在日常的流程审批过程中,经常会出现操作失误需要撤回重新办理. 使用版本为7.1.0.M2 基本逻辑: 找到此流程的所有审批意见,把撤回节点的之后的意见和办理记录删除. ...
- Activit 流程撤回功能
/** * 流程撤回功能 * @param taskId 要撤回的任务id,可为空,为空的情况下根据流程实例去获取当前的任务 * @param processInstanceId 流程实例id */ ...
- Tasker 微信防撤回2.0
Tasker,安卓神器,不多介绍. 之前的一个配置https://blog.csdn.net/h137242126/article/details/81235926,微信消息播报+基础版的防撤回,考虑 ...
- activiti7 流程撤回的两种实现思路
一.使用BpmnModel /** * @param processInstanceBusinessKey BUSINESS_KEY_ * @param userName 当前用户 **/ publi ...
- git 撤回 (git版本回退处理)
项目中,我们会遇到 提交的项目代码有问题,需要执行撤回命令,但是发现撤回之后还是会运行失败. 下边是一个好方法,亲测比 git reset --hard 版本号 有效. 下面我们详细解说一下. 一: ...
- php yii2支付宝开发,yii2 支付宝支付教程 [ 2.0 版本 ]
yii2 支付宝支付教程 [ 2.0 版本 ] 支付宝支付流程个人理解大致就这三步 1.前台页面将支付信息数据通过立即支付按钮 ajax提交到订单处理层 2.在订单处理层引用支付宝的接口 将支付数据写 ...
- 网易云信SDK V3.1.0版本发布啦
最近天气渐冷,小伙伴们要注意保暖:有女朋友的抱紧女朋友,没女朋友的就抱紧主机. -from 贴心的云小信 10月26日,网易云信SDK V3.1.0版发布,本次版本主要发布功能为:群组聊天室禁言,聊天 ...
- oauth2.0协议流程_正确的工作流程:我应该使用哪个OAuth 2.0流程?
oauth2.0协议流程 什么是OAuth 2.0 OAuth 2.0是一个已被广泛采用的委托授权框架,已经存在了很多年,并且似乎已经存在. 如果您不熟悉OAuth 2.0的基本概念,可以使用 川崎孝 ...
最新文章
- [深入React] 2.综述
- 第一款鸿蒙摄像头,随时随地看一看!华为首款鸿蒙智能摄像头发布
- C++中的内存管理(new、delete、内存泄漏)
- 用于matplotlib对齐很有用的算法,可用于面试笔试
- java成员初始化顺序_Java成员初始化顺序
- Sgen.exe: Speed up XmlSerializer's Startup Performance [.NET 2.0, XML Serialization]
- Bootstrap 缩略图
- 鸿蒙系统对小米的影响,“小米用鸿蒙系统”乌龙会对后续有影响吗
- Visual Studio 2019设置透明背景图片
- 圣诞帽php,教你用ps给自己头像p圣诞帽
- 接口测试--接口基础概念、HTTP协议、接口测试风格、接口测试流程
- 迷宫(Maze)项目实现
- 008 使用MyBatis,easyUI实现CRUD操作样例-CUD(CRUD完毕)
- 深拷⻉浅拷⻉的区别?如何实现一个深拷贝?
- Android 意图(Intent)和过滤器(Filter)
- opencv形态学-开操作和闭操作
- 自制MyEclipse豆沙绿主题
- linux 运行脚本时报错:语法错误: 未预期的文件结尾
- 最小生成树-python实现
- Python数据可视化第 3 讲:matplotlib绘图之函数plot()