项目地址 | https://gitee.com/lwj/flowable.git |
---|
代码分支 | flowable-base |
视频讲解地址 | https://www.bilibili.com/video/av78411429/ |
用户名 | 密码 |
---|
0000001 | test |
0000002 | test |
0000003 | test |
0000004 | test |
一、 演示
签收:一般情况就是多个候选人,或者候选组的情况下,要先把这个任务签收下来,以免别人又做了同样的任务。
反签收:就是把执行人设置为空
注意事项:反签收的时候,一定要先确定是否有候选人或者候选组,如果没有的话,不能反签收。因为会导致这个任务无法认领。
1.1. 签收
public ReturnVo<String> claimTask(ClaimTaskVo claimTaskVo) {ReturnVo<String> returnVo = null;TaskEntityImpl currTask = (TaskEntityImpl) taskService.createTaskQuery().taskId(claimTaskVo.getTaskId()).singleResult();if (currTask != null) {//1.添加审批意见this.addComment(claimTaskVo.getTaskId(), claimTaskVo.getProcessInstanceId(), CommentTypeEnum.QS.toString(), claimTaskVo.getMessage());//2.签收taskService.claim(claimTaskVo.getTaskId(), claimTaskVo.getUserCode());returnVo = new ReturnVo<>(ReturnCode.SUCCESS, "签收成功");} else {returnVo = new ReturnVo<>(ReturnCode.FAIL, "签收失败");}return returnVo;}
1.2. 反签收
public ReturnVo<String> unClaimTask(ClaimTaskVo claimTaskVo) {ReturnVo<String> returnVo = null;TaskEntityImpl currTask = (TaskEntityImpl) taskService.createTaskQuery().taskId(claimTaskVo.getTaskId()).singleResult();if (currTask != null) {//1.添加审批意见this.addComment(claimTaskVo.getTaskId(), claimTaskVo.getProcessInstanceId(), CommentTypeEnum.QS.toString(), claimTaskVo.getMessage());List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(claimTaskVo.getTaskId());boolean flag = false;if (CollectionUtils.isNotEmpty(identityLinks)) {for (IdentityLink link : identityLinks) {if (IdentityLinkType.CANDIDATE.equals(link.getTaskId())) {flag = true;break;}}}//2.签收if (flag) {taskService.claim(claimTaskVo.getTaskId(), null);returnVo = new ReturnVo<>(ReturnCode.SUCCESS, "签收成功");} else {returnVo = new ReturnVo<>(ReturnCode.FAIL, "由于没有候选人或候选组,会导致任务无法认领,请确认.");}} else {returnVo = new ReturnVo<>(ReturnCode.FAIL, "签收失败");}return returnVo;}