fix(流程审核): 修复流程实例ID获取失败,导致抄送以及审批记录丢失问题。

This commit is contained in:
konbai
2022-09-03 00:56:05 +08:00
parent fe65cb3227
commit 20d9b0d2e8
3 changed files with 8 additions and 8 deletions

View File

@@ -30,7 +30,7 @@ public class WfTaskBo {
private String comment;
@ApiModelProperty("流程实例Id")
private String instanceId;
private String procInsId;
@ApiModelProperty("节点")
private String targetKey;

View File

@@ -89,7 +89,7 @@ public class WfCopyServiceImpl implements IWfCopyService {
return true;
}
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(taskBo.getInstanceId()).singleResult();
.processInstanceId(taskBo.getProcInsId()).singleResult();
String[] ids = taskBo.getCopyUserIds().split(",");
List<WfCopy> copyList = new ArrayList<>(ids.length);
Long originatorId = LoginHelper.getUserId();
@@ -102,7 +102,7 @@ public class WfCopyServiceImpl implements IWfCopyService {
copy.setProcessId(historicProcessInstance.getProcessDefinitionId());
copy.setProcessName(historicProcessInstance.getProcessDefinitionName());
copy.setDeploymentId(historicProcessInstance.getDeploymentId());
copy.setInstanceId(taskBo.getInstanceId());
copy.setInstanceId(taskBo.getProcInsId());
copy.setTaskId(taskBo.getTaskId());
copy.setUserId(userId);
copy.setOriginatorId(originatorId);

View File

@@ -81,10 +81,10 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
throw new ServiceException("任务不存在");
}
if (DelegationState.PENDING.equals(task.getDelegationState())) {
taskService.addComment(taskBo.getTaskId(), taskBo.getInstanceId(), FlowComment.DELEGATE.getType(), taskBo.getComment());
taskService.addComment(taskBo.getTaskId(), taskBo.getProcInsId(), FlowComment.DELEGATE.getType(), taskBo.getComment());
taskService.resolveTask(taskBo.getTaskId());
} else {
taskService.addComment(taskBo.getTaskId(), taskBo.getInstanceId(), FlowComment.NORMAL.getType(), taskBo.getComment());
taskService.addComment(taskBo.getTaskId(), taskBo.getProcInsId(), FlowComment.NORMAL.getType(), taskBo.getComment());
Long userId = LoginHelper.getUserId();
taskService.setAssignee(taskBo.getTaskId(), userId.toString());
if (ObjectUtil.isNotEmpty(taskBo.getVariables())) {
@@ -484,13 +484,13 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
*/
@Override
public void stopProcess(WfTaskBo bo) {
List<Task> task = taskService.createTaskQuery().processInstanceId(bo.getInstanceId()).list();
List<Task> task = taskService.createTaskQuery().processInstanceId(bo.getProcInsId()).list();
if (CollectionUtils.isEmpty(task)) {
throw new RuntimeException("流程未启动或已执行完成,取消申请失败");
}
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
.processInstanceId(bo.getInstanceId()).singleResult();
.processInstanceId(bo.getProcInsId()).singleResult();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
if (Objects.nonNull(bpmnModel)) {
Process process = bpmnModel.getMainProcess();
@@ -520,7 +520,7 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
*/
@Override
public void revokeProcess(WfTaskBo bo) {
Task task = taskService.createTaskQuery().processInstanceId(bo.getInstanceId()).singleResult();
Task task = taskService.createTaskQuery().processInstanceId(bo.getProcInsId()).singleResult();
if (task == null) {
throw new RuntimeException("流程未启动或已执行完成,无法撤回");
}