From 7f6005592dcb0fc51c25f1f8435c3d38fc9a043d Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Mon, 28 Oct 2024 10:13:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1ID=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1048118 --user=陈建星 【组织任务中心】即时任务列表-点击ID进入任务详情-展示了同id的其它子任务 https://www.tapd.cn/55049933/s/1598879 --- .../java/io/metersphere/api/service/ApiCommonService.java | 2 +- .../src/main/java/io/metersphere/system/uid/NumGenerator.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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 用例类型