博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JBPM3 获得待办列表 1:未接收;2:办理中;3:已办结;4:全部工作
阅读量:7009 次
发布时间:2019-06-28

本文共 3873 字,大约阅读时间需要 12 分钟。

hot3.png

这是很早写工作流时写的一个方法,今天正好整理下资料,顺便共享下吧。

/**  * get all the task instances for a given actor. type 1:未接收;2:办理中;3:已办结;4:全部工作  */ public List
findTaskInstances(String[] actorIds, String type) { //结果1 List result1 = null; try { String hql = ""; if ("1".equals(type)) {// 1:未接收 hql = "select distinct ti " + "from org.jbpm.taskmgmt.exe.TaskInstance as ti " + "where ti.actorId in (:actorIds)" + " and ti.isSuspended <> 1" + " and ti.isOpen = 1" + " and ti.start is null" + " and ti.end is null" + " order by ti.id desc"; } else if ("2".equals(type)) {// 2:办理中 hql = "select distinct ti " + "from org.jbpm.taskmgmt.exe.TaskInstance as ti " + "where ti.actorId in (:actorIds)" + " and ti.isSuspended <> 1" + " and ti.isOpen = 1" + " and ti.start is not null" + " and ti.end is null" + " order by ti.id desc"; } else if ("3".equals(type)) {// 3:已办结 hql = "select distinct ti " + "from org.jbpm.taskmgmt.exe.TaskInstance as ti " + "where ti.id in (" + " select max(t.id) from org.jbpm.taskmgmt.exe.TaskInstance as t" + " where t.actorId in (:actorIds) and t.isOpen <> 1" + " and t.start is not null and t.end is not null group by t.processInstance.id)" + " order by ti.id desc"; } else {// 4:全部工作 hql = "select distinct ti " + "from org.jbpm.taskmgmt.exe.TaskInstance as ti " + "where ti.id in (" + " select max(t.id) from org.jbpm.taskmgmt.exe.TaskInstance as t" + " where t.actorId in (:actorIds) group by t.processInstance.id)" + " order by ti.id desc"; } Query query = session.createQuery(hql); query.setParameterList("actorIds", actorIds); result1 = query.list(); } catch (Exception e) { log.error(e); jbpmSession.handleException(); throw new JbpmException("couldn't get task instances list for actor '" + actorIds + "'", e); } //结果2 List result2 = null; try { String hql = ""; if ("1".equals(type)) {// 1:未接收 hql = "select distinct ti " + "from org.jbpm.taskmgmt.exe.PooledActor pa join pa.taskInstances ti " + "where pa.actorId in (:actorIds)" + " and ti.actorId is null" + " and ti.isSuspended <> 1" + " and ti.isOpen = 1" + " and ti.start is null" + " and ti.end is null" + " order by ti.id desc"; } else if ("2".equals(type)) {// 2:办理中 hql = "select distinct ti " + "from org.jbpm.taskmgmt.exe.PooledActor pa join pa.taskInstances ti " + "where pa.actorId in (:actorIds)" + " and ti.actorId is null" + " and ti.isSuspended <> 1" + " and ti.isOpen = 1" + " and ti.start is not null" + " and ti.end is null" + " order by ti.id desc"; } else if ("3".equals(type)) {// 3:已办结 hql = "select distinct ti " + "from org.jbpm.taskmgmt.exe.TaskInstance as ti " + "where ti.id in ( select max(t.id)" + " from org.jbpm.taskmgmt.exe.PooledActor pa join pa.taskInstances t" + " where pa.actorId in (:actorIds) and t.actorId is null and t.isOpen <> 1" + " and t.start is not null and t.end is not null group by t.processInstance.id" + " )order by ti.id desc"; } else {// 4:全部工作 hql = "select distinct ti " + "from org.jbpm.taskmgmt.exe.TaskInstance as ti " + "where ti.id in ( select max(t.id)" + " from org.jbpm.taskmgmt.exe.PooledActor pa join pa.taskInstances t" + " where pa.actorId in (:actorIds) and t.actorId is null group by t.processInstance.id" + " )order by ti.id desc"; } Query query = session.createQuery(hql); query.setParameterList("actorIds", actorIds); result2 = query.list(); } catch (Exception e) { log.error(e); jbpmSession.handleException(); throw new JbpmException("couldn't get pooled task instances list for actor '" + actorIds + "'", e); } //合并结果 Set set = new HashSet(); set.addAll(result1); set.addAll(result2); return new ArrayList(set); }
 

 

转载于:https://my.oschina.net/thinkgem/blog/713460

你可能感兴趣的文章
Liftbridge为NATS提供了类Kafka的日志API
查看>>
Realm为Node.js发布对象数据库
查看>>
[译] 如何运用新技术提升网页速度和性能
查看>>
全域赋能和智慧全球,阿里巴巴大数据技术前瞻与案例
查看>>
90%炒币者亏钱,区块链“撒币时代”结束了
查看>>
冬天来了,让Sleep System智能床垫帮你暖床!
查看>>
2017洛客大会成功落幕, 全球“洛客”开启“想象力时代”
查看>>
关于区块链革命你必须知道的事实
查看>>
开源 |蚂蚁金服启动分布式中间件开源计划,用于快速构建金融级云原生架构...
查看>>
Go语言之基准测试
查看>>
win10_x64更新错误解决: 安装一些更新时出现问题,但我们稍后会重试。如果持续出现这些问题,并且你想要搜索Web或联系支持人员以获取相关信息,以下信息可能会对你有帮助:...
查看>>
keepalived vrrp_script的一些实例配置
查看>>
《数字逻辑设计与计算机组成》一 3.4 减法器
查看>>
Chrome浏览器也开启Material Design风格
查看>>
《系统分析与设计方法及实践》一2.1 软件生命周期
查看>>
Oracle Logminer 日志挖掘
查看>>
印媒:全球科技巨头竞相角逐印度“智能城市”项目
查看>>
《Servlet和JSP学习指南》一2.2 隐藏域
查看>>
[干货]基础机器学习算法
查看>>
12月14日全球域名商解析量22强:爱名网升至十七
查看>>