1. 修改setDataMap函数为addDataMap以防止swagger将DataMap视为一种属性

2. 当任务未通过审核时,现在会立刻报错而不是返回false
This commit is contained in:
EnderByEndera
2024-01-19 15:09:23 +08:00
parent 1d317eb10f
commit 449c320261
22 changed files with 176 additions and 75 deletions

View File

@@ -35,9 +35,9 @@ public class StateHandler {
throw new IllegalArgumentException("无效的task_id因为task_audit_status为空");
}
// 如果审核状态不为已通过审核,则无效
// 如果审核状态不为已通过审核,则报错
if (taskAuditStatus != AuditStatus.AUDITED.getAuditStatus()) {
return false;
throw new IllegalArgumentException("无效的task_id因为未通过审核");
}
return switch (TaskTypeEnum.getTaskTypeByNum(task.getTaskType())) {

View File

@@ -14,7 +14,8 @@ public class PendingState extends StateHandler implements State {
case FAILED -> handleFailed(commandService, taskId);
case RUNNING -> handleStart(taskService, commandService, taskId);
case FINISHED -> handleFinish(commandService, taskId);
default -> throw new IllegalStateException("Unexpected value: " + StateEnum.getStateEnumByState(newState));
default -> throw new IllegalStateException(taskId + " meets unexpected value: "
+ StateEnum.getStateEnumByState(newState));
};
}
}