LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.
Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.
talk is cheap, show others the code and KPI, Keep progress,make a better result.
Survive during the day and develop at night。
目录
概 述
第一种方法:
直接到到数据库workFlow 中进行查询的对应的方法:
第二种方法:
Activiti7中根据taskId获取任务,这个问题看起来很简单,不就是调用taskRuntime的tasks()方法吗?一开始我也是这样认为的,当时测的感觉没有什么总是,但真正深入测试时才发现问题。
如果一个任务已经完成了,那么你调用taskRuntime.tasks()方法就会报错任务不存在,这是因为在activiti7中,taskRuntime只能查询进行中的任务,从名字中的runtime也可以发现这一点,而历史任务则需要用historyService.createHistoricTaskInstanceQuery().taskId(taskId)来查询任务而且这个方法里不仅仅能查询已完成的任务,也包括进行中的任务,也就是包括了所有任务!
OK,到此问题已经解决,我们如果想实现给定任意一个taskId,查出它对应的任务,那么我们直接用historyService.createHistoricTaskInstanceQuery()就可以了。
第三种方法:
taskServercei 获取TaskQuery query = taskService.createTaskQuery();,获取TaskEntity 实体对应额度ID
相关工具如下:
分析:
小结:
通过taskiD 获取任务的方法,请大家指正~
参考资料和推荐阅读
1.链接: 参考资料.