diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiCommonService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiCommonService.java index 4a0aa3e604..7a7bfc5767 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiCommonService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/ApiCommonService.java @@ -483,7 +483,7 @@ public class ApiCommonService { public ExecTask newExecTask(String projectId, String userId) { ExecTask execTask = new ExecTask(); - execTask.setNum(NumGenerator.nextNum(projectId, ApplicationNumScope.TASK)); + execTask.setNum(NumGenerator.nextNum(ApplicationNumScope.TASK)); execTask.setProjectId(projectId); execTask.setId(IDGenerator.nextStr()); execTask.setCreateTime(System.currentTimeMillis()); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/uid/NumGenerator.java b/backend/services/system-setting/src/main/java/io/metersphere/system/uid/NumGenerator.java index 0fa4a1a4c2..f31b49e389 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/uid/NumGenerator.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/uid/NumGenerator.java @@ -27,6 +27,10 @@ public class NumGenerator { private static final List SUB_NUM = List.of(ApplicationNumScope.API_TEST_CASE, ApplicationNumScope.API_MOCK, ApplicationNumScope.TEST_PLAN_FUNCTION_CASE, ApplicationNumScope.TEST_PLAN_API_CASE, ApplicationNumScope.TEST_PLAN_API_SCENARIO); + public static long nextNum(ApplicationNumScope scope) { + return nextNum(scope.name(), scope); + } + /** * @param prefix 前缀: PROJECT_ID, 或者 PROJECT_ID + "_" + DOMAIN 例如接口用例的前缀为: 100001_12345 * @param scope 用例类型