update - 优化任务校验的异常文案

This commit is contained in:
wangli 2024-04-16 17:16:34 +08:00
parent 59e5063058
commit 31c1df316d
2 changed files with 3 additions and 4 deletions

View File

@ -85,9 +85,6 @@ public class CustomApproveTaskCmd implements Command<Void>, Serializable {
HistoricTaskInstance historicTaskInstance = taskQuery.taskId(taskId).singleResult();
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
if (Objects.isNull(task)) {
log.info("任务不存在: {}", taskId);
}
validTask(historicTaskInstance, (TaskEntity) task, approver);
if (StringUtils.hasLength(advice)) {

View File

@ -100,7 +100,8 @@ public class CustomTaskHelper {
*/
public static void validTask(HistoricTaskInstance historicTaskInstance, TaskEntity taskEntity,
BpmnTaskDelegateAssigner originTaskAssigner) {
if (Objects.nonNull(historicTaskInstance) && Objects.nonNull(historicTaskInstance.getEndTime())) {
if (Objects.nonNull(historicTaskInstance) &&
(Objects.nonNull(historicTaskInstance.getEndTime()) || Objects.isNull(taskEntity))) {
throw new WorkflowEngineException(TASK_HAS_BEEN_COMPLETE);
}
@ -194,6 +195,7 @@ public class CustomTaskHelper {
task.setProcessInstanceId(processInstanceId);
return addComment(commandContext, task, type, message);
}
public static Comment addComment(CommandContext commandContext, Task task, String type, String message) {
ProcessEngineConfigurationImpl processEngineConfiguration =
CommandContextUtil.getProcessEngineConfiguration(commandContext);