From aa046e18d23354e561f4e7c954d210eb120a2352 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Wed, 27 Nov 2024 10:40:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E9=87=8D=E8=B7=91=E5=90=8E=EF=BC=8C=E4=BB=BB=E5=8A=A1=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049600 --user=陈建星 【任务中心】即时任务列表-点击重跑后-查看任务详情报Duplicate key https://www.tapd.cn/55049933/s/1618318 --- .../api/service/definition/ApiTestCaseBatchRunService.java | 4 ++-- .../api/service/scenario/ApiScenarioBatchRunService.java | 4 ++-- .../io/metersphere/system/mapper/ExtExecTaskItemMapper.java | 2 ++ .../io/metersphere/system/mapper/ExtExecTaskItemMapper.xml | 6 ++++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseBatchRunService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseBatchRunService.java index cf42e7dfbe..cdc4a4eabb 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseBatchRunService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseBatchRunService.java @@ -494,7 +494,7 @@ public class ApiTestCaseBatchRunService { private void serialRerunExecute(ExecTask execTask, String userId) { ApiRunModeConfigDTO runModeConfig = getRunModeConfig(execTask); - List execTaskItems = extExecTaskItemMapper.selectIdAndResourceIdByTaskId(execTask.getId()); + List execTaskItems = extExecTaskItemMapper.selectRerunIdAndResourceIdByTaskId(execTask.getId()); // 初始化执行队列 ExecutionQueue queue = apiBatchRunBaseService.getExecutionQueue(runModeConfig, ApiExecuteResourceType.API_CASE.name(), execTask.getId(), userId); @@ -516,7 +516,7 @@ public class ApiTestCaseBatchRunService { */ public void parallelRerunExecute(ExecTask execTask, String userId) { String projectId = execTask.getProjectId(); - List execTaskItems = extExecTaskItemMapper.selectIdAndResourceIdByTaskId(execTask.getId()); + List execTaskItems = extExecTaskItemMapper.selectRerunIdAndResourceIdByTaskId(execTask.getId()); ApiRunModeConfigDTO runModeConfig = getRunModeConfig(execTask); // 记录用例和任务的映射 diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioBatchRunService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioBatchRunService.java index 604f23f522..92be83136d 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioBatchRunService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioBatchRunService.java @@ -464,7 +464,7 @@ public class ApiScenarioBatchRunService { private void serialRerunExecute(ExecTask execTask, String userId) { ApiRunModeConfigDTO runModeConfig = apiTestCaseBatchRunService.getRunModeConfig(execTask); - List execTaskItems = extExecTaskItemMapper.selectIdAndResourceIdByTaskId(execTask.getId()); + List execTaskItems = extExecTaskItemMapper.selectRerunIdAndResourceIdByTaskId(execTask.getId()); // 删除重跑的步骤 deleteRerunIntegratedStepResult(execTask, execTaskItems, runModeConfig); @@ -489,7 +489,7 @@ public class ApiScenarioBatchRunService { */ public void parallelRerunExecute(ExecTask execTask, String userId) { String projectId = execTask.getProjectId(); - List execTaskItems = extExecTaskItemMapper.selectIdAndResourceIdByTaskId(execTask.getId()); + List execTaskItems = extExecTaskItemMapper.selectRerunIdAndResourceIdByTaskId(execTask.getId()); ApiRunModeConfigDTO runModeConfig = apiTestCaseBatchRunService.getRunModeConfig(execTask); // 删除重跑的步骤 diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.java index e646581ff6..80044690b3 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.java @@ -72,5 +72,7 @@ public interface ExtExecTaskItemMapper { List selectIdAndResourceIdByTaskId(@Param("taskId") String taskId); + List selectRerunIdAndResourceIdByTaskId(@Param("taskId") String taskId); + void deleteRerunTaskItem(@Param("taskId") String taskId, String userId); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml index 68ff154f38..781241f5d9 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml @@ -333,6 +333,12 @@ where task_id = #{taskId} and deleted = false + + insert into exec_task_item(id, task_id, resource_id, resource_name, task_origin, status, `result`, resource_pool_id, resource_pool_node, resource_type, project_id, organization_id, thread_id, start_time, end_time, executor, collection_id,