所有流程流转增加当前流程节点

This commit is contained in:
wangliwen 2022-09-26 17:15:52 +08:00
parent 3826cdae37
commit 57f73108ea
1 changed files with 23 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricProcessInstanceQuery;
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -191,6 +192,28 @@ public class HistoryController {
// @RequiresPermissions("sys:his:all")
public Result<HistoryDetailDTO> getTaskHandleDetailInfo(String processInstanceId) {
List<HistoryDetailDTO> list = activitiService.getTaskHandleDetailInfo(processInstanceId);
if (runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() != null) { // 流程是否结束
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).active().includeProcessVariables().singleResult();
if (task != null && StringUtils.isNotEmpty(task.getId()) && StringUtils.isNumeric(task.getAssignee())) {
final HistoryDetailDTO detailDTO = new HistoryDetailDTO();
detailDTO.setId(task.getId());
detailDTO.setAssignee(task.getAssignee());
detailDTO.setAssigneeName(sysUserService.get(Long.valueOf(task.getAssignee())).getRealName());
detailDTO.setActivityName(task.getName());
detailDTO.setActivityType("");
detailDTO.setStartTime(task.getCreateTime());
detailDTO.setEndTime(null);
detailDTO.setDurationInSeconds(null);
detailDTO.setExecutionId(task.getExecutionId());
detailDTO.setProcessDefinitionId(task.getProcessDefinitionId());
detailDTO.setComment("待审核");
final List<HistoryDetailDTO> taskHandleDetailInfo_ = new ArrayList<>();
taskHandleDetailInfo_.add(detailDTO);
taskHandleDetailInfo_.addAll(list);
list.clear();
list = taskHandleDetailInfo_;
}
}
return new Result().ok(list);
}