mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-30 15:16:41 +08:00
update 调整任务驳回后设置审批人
This commit is contained in:
parent
7847a80bc2
commit
cfc29bfd45
@ -13,6 +13,7 @@ import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.workflow.domain.bo.*;
|
||||
import org.dromara.workflow.domain.vo.TaskVo;
|
||||
import org.dromara.workflow.service.IActTaskService;
|
||||
import org.dromara.workflow.utils.WorkflowUtils;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -200,4 +201,15 @@ public class ActTaskController extends BaseController {
|
||||
return R.ok(iActTaskService.backProcess(backProcessBo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程状态
|
||||
*
|
||||
* @param taskId 任务id
|
||||
*/
|
||||
@GetMapping("/getBusinessStatus/{taskId}")
|
||||
public R<String> getBusinessStatus(@PathVariable String taskId) {
|
||||
return R.ok("操作成功", WorkflowUtils.getBusinessStatus(taskId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -529,6 +529,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
||||
* @param backProcessBo 参数
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String backProcess(BackProcessBo backProcessBo) {
|
||||
Task task = taskService.createTaskQuery().taskId(backProcessBo.getTaskId()).taskTenantId(TenantHelper.getTenantId())
|
||||
.taskAssignee(String.valueOf(LoginHelper.getUserId())).singleResult();
|
||||
@ -548,6 +549,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
||||
//申请人节点
|
||||
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().finished().orderByHistoricTaskInstanceEndTime().asc().list().get(0);
|
||||
String backTaskDefinitionKey = historicTaskInstance.getTaskDefinitionKey();
|
||||
taskService.addComment(task.getId(), processInstanceId, StringUtils.isNotBlank(backProcessBo.getMessage()) ? backProcessBo.getMessage() : "退回");
|
||||
if (taskList.size() > 1) {
|
||||
//当前多个任务驳回到单个节点
|
||||
runtimeService.createChangeActivityStateBuilder().processInstanceId(processInstanceId)
|
||||
@ -559,7 +561,10 @@ public class ActTaskServiceImpl implements IActTaskService {
|
||||
.moveActivityIdTo(task.getTaskDefinitionKey(), backTaskDefinitionKey)
|
||||
.changeState();
|
||||
}
|
||||
taskService.setAssignee(task.getId(), historicTaskInstance.getAssignee());
|
||||
List<Task> list = taskService.createTaskQuery().processInstanceId(processInstanceId).taskTenantId(TenantHelper.getTenantId()).list();
|
||||
for (Task t : list) {
|
||||
taskService.setAssignee(t.getId(), historicTaskInstance.getAssignee());
|
||||
}
|
||||
runtimeService.updateBusinessStatus(processInstanceId, BusinessStatusEnum.BACK.getStatus());
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
|
@ -25,10 +25,12 @@ import org.flowable.bpmn.model.*;
|
||||
import org.flowable.common.engine.api.delegate.Expression;
|
||||
import org.flowable.editor.language.json.converter.BpmnJsonConverter;
|
||||
import org.flowable.engine.ProcessEngine;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior;
|
||||
import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior;
|
||||
import org.flowable.identitylink.api.history.HistoricIdentityLink;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
||||
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
@ -260,4 +262,16 @@ public class WorkflowUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前流程状态
|
||||
*
|
||||
* @param taskId 任务id
|
||||
*/
|
||||
public static String getBusinessStatus(String taskId) {
|
||||
HistoricTaskInstance historicTaskInstance = PROCESS_ENGINE.getHistoryService().createHistoricTaskInstanceQuery().taskId(taskId).taskTenantId(TenantHelper.getTenantId()).singleResult();
|
||||
HistoricProcessInstance historicProcessInstance = PROCESS_ENGINE.getHistoryService().createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(historicTaskInstance.getProcessInstanceId()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult();
|
||||
return historicProcessInstance.getBusinessStatus();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user