| | |
| | | import com.ycl.domain.entity.ProjectInfo; |
| | | import com.ycl.domain.entity.ProjectProcess; |
| | | import com.ycl.domain.form.RejectTaskForm; |
| | | import com.ycl.domain.form.TaskDelegationForm; |
| | | import com.ycl.domain.vo.CustomerTaskVO; |
| | | import com.ycl.domain.vo.ProjectProcessDetailVO; |
| | | import com.ycl.mapper.ProjectInfoMapper; |
| | |
| | | import org.flowable.engine.runtime.ProcessInstance; |
| | | import org.flowable.identitylink.api.IdentityLink; |
| | | import org.flowable.identitylink.api.IdentityLinkInfo; |
| | | import org.flowable.identitylink.api.IdentityLinkType; |
| | | import org.flowable.identitylink.api.history.HistoricIdentityLink; |
| | | import org.flowable.task.api.Task; |
| | | import org.flowable.task.api.TaskQuery; |
| | |
| | | TaskQuery taskQuery = taskService.createTaskQuery() |
| | | .active() |
| | | .includeProcessVariables() |
| | | .includeIdentityLinks() |
| | | .orderByTaskCreateTime().desc(); |
| | | |
| | | if (StringUtils.isNotBlank(taskName)) { |
| | |
| | | this.setPromoterInfo(taskVO); |
| | | |
| | | // 流程处理人信息 |
| | | List<IdentityLink> identityLinksForTask = taskService.getIdentityLinksForTask(task.getId()); |
| | | for (IdentityLink identityLink : identityLinksForTask) { |
| | | List<? extends IdentityLinkInfo> identityLinks = task.getIdentityLinks(); |
| | | for (IdentityLinkInfo identityLink : identityLinks) { |
| | | // 绑定的是用户,查出用户姓名、部门 |
| | | if (StringUtils.isNotBlank(identityLink.getUserId())) { |
| | | taskVO.setHandlerType(HandlerTypeEnum.USER); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Result rejectTask(RejectTaskForm form) { |
| | | Task task = taskService.createTaskQuery().taskId(form.getTaskId()).singleResult(); |
| | | taskCommonService.reject(form.getRejectedTaskDefKey(), task.getTaskDefinitionKey(), task.getProcessInstanceId(), form.getTaskId(), form.getAuditOpinion()); |
| | | return Result.ok("驳回成功"); |
| | | public Result taskDelegation(TaskDelegationForm form) { |
| | | Task task = taskService.createTaskQuery().taskId(form.getTaskId()).includeIdentityLinks().singleResult(); |
| | | if (Objects.isNull(task)) { |
| | | throw new RuntimeException("未在运行任务中找到该任务,无法执行转办操作"); |
| | | } |
| | | // 需要先移除之前的处理人 |
| | | for (IdentityLinkInfo identityLink : task.getIdentityLinks()) { |
| | | if (StringUtils.isNotBlank(identityLink.getUserId())) { |
| | | taskService.deleteCandidateUser(task.getId(), identityLink.getUserId()); |
| | | } else if (StringUtils.isNotBlank(identityLink.getGroupId())) { |
| | | taskService.deleteCandidateGroup(task.getId(), identityLink.getGroupId()); |
| | | } |
| | | } |
| | | // 再新增处理人 |
| | | switch (form.getPeopleType()) { |
| | | case FIX_USER: |
| | | // 指定用户的话,只能选一个用户 |
| | | taskService.delegateTask(task.getId(), form.getTargetId()); |
| | | break; |
| | | case USER: |
| | | // 用户组的话,可以选多个用户,严格来说这里的用户组并不是flowable中的组的概念,只是开源框架有这个定义 |
| | | break; |
| | | case DEPT: |
| | | taskService.addCandidateGroup(task.getId(), form.getTargetId()); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | return Result.ok("转办成功"); |
| | | } |
| | | |
| | | /** |