| | |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.flowable.engine.runtime.ProcessInstance; |
| | | import org.flowable.task.api.Task; |
| | | import org.springblade.core.launch.constant.FlowConstant; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.mdm.flow.constants.FlowContants; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | String taskId = getCurrentTaskIdByProcessInstanceId(processInstanceId); |
| | | backWithAssigneeService.backToTaskWithNewAssignee(taskId,targetActivityId,targetAssignee,"流程撤回",new HashMap<>()); |
| | | } |
| | | /* |
| | | String getprocessDefinitionKey(String processInstanceId){ |
| | | Task task = taskService.createTaskQuery() |
| | | .taskId(taskId) |
| | | .singleResult(); |
| | | |
| | | ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() |
| | | .processDefinitionId(task.getProcessDefinitionId()) |
| | | .singleResult(); |
| | | |
| | | String taskId = getCurrentTaskIdByProcessInstanceId(processInstanceId); |
| | | if (processDefinition == null) { |
| | | throw new RuntimeException("流程定义不存在,processDefinitionId: " + task.getProcessDefinitionId()); |
| | | } |
| | | |
| | | return processDefinition.getKey(); |
| | | }*/ |
| | | |
| | | public String getCurrentTaskIdByProcessInstanceId(String processInstanceId) { |
| | | Optional<String> optTaskId = taskService.createTaskQuery() |
| | |
| | | |
| | | return processDefinition.getKey(); |
| | | } |
| | | |
| | | /** |
| | | * 取回到组长派工 |
| | | * @param processInstanceId |
| | | */ |
| | | public void takeBackToDispatch(String processInstanceId) { |
| | | String targetAssignee = ""+AuthUtil.getUserId(); |
| | | |
| | | final String targetActivityId = "teamLeaderTask";//组长派工 |
| | | String taskId = getCurrentTaskIdByProcessInstanceId(processInstanceId); |
| | | backWithAssigneeService.backToTaskWithNewAssignee(taskId,targetActivityId,targetAssignee,"组长取回",new HashMap<>()); |
| | | } |
| | | } |
| | | |
| | | |