From 6c492f82b21c683ca7b26ec9ebe831aad64bf751 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 20 Jul 2022 18:52:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E5=88=97=E8=A1=A8=E8=B4=A3?= =?UTF-8?q?=E4=BB=BB=E4=BA=BA=E7=AD=9B=E9=80=89=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1015067 --user=陈建星 【测试跟踪】功能用例列表-按照执行结果+责任人筛选结果错误 https://www.tapd.cn/55049933/s/1205857 --- .../track/controller/TestCaseController.java | 8 +-- .../track/service/TestCaseService.java | 72 +------------------ .../common/components/MsSingleHandleDrag.vue | 5 +- .../track/case/components/TestCaseList.vue | 11 ++- 4 files changed, 15 insertions(+), 81 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java index 7b08ebc4a9..78627d851a 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -210,14 +210,14 @@ public class TestCaseController { @MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class) @SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, targetClass = TestCaseMapper.class, event = NoticeConstants.Event.CREATE, subject = "测试用例通知") - public TestCase addTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file", required = false) List files) { + public TestCase addTestCase(@RequestPart("request") EditTestCaseRequest request) { if (StringUtils.isBlank(request.getId())) { //新增 后端生成 id request.setId(UUID.randomUUID().toString()); } else { //复制,前端生成 id } - return testCaseService.refactorSave(request, files); + return testCaseService.add(request); } @PostMapping("/edit/order") @@ -230,8 +230,8 @@ public class TestCaseController { @MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class) @SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.getTestCase(#request.id)", targetClass = TestCaseService.class, event = NoticeConstants.Event.UPDATE, subject = "测试用例通知") - public TestCase editTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file", required = false) List files) { - return testCaseService.refactorEdit(request, files); + public TestCase editTestCase(@RequestPart("request") EditTestCaseRequest request) { + return testCaseService.edit(request); } @PostMapping(value = "/edit/testPlan", consumes = {"multipart/form-data"}) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index e01bf3802f..bd66027403 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -1950,37 +1950,7 @@ public class TestCaseService { return false; } - public TestCase save(EditTestCaseRequest request, List files) { - - - final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(request); - - // 复制用例时传入文件ID进行复制 - if (!CollectionUtils.isEmpty(request.getFileIds())) { - List fileIds = request.getFileIds(); - fileIds.forEach(id -> { - FileMetadata fileMetadata = fileService.copyFile(id); - TestCaseFile testCaseFile = new TestCaseFile(); - testCaseFile.setCaseId(testCaseWithBLOBs.getId()); - testCaseFile.setFileId(fileMetadata.getId()); - testCaseFileMapper.insert(testCaseFile); - }); - } - - if (files != null) { - files.forEach(file -> { - final FileMetadata fileMetadata = fileService.saveFile(file, testCaseWithBLOBs.getProjectId()); - TestCaseFile testCaseFile = new TestCaseFile(); - testCaseFile.setCaseId(testCaseWithBLOBs.getId()); - testCaseFile.setFileId(fileMetadata.getId()); - testCaseFileMapper.insert(testCaseFile); - }); - } - - return testCaseWithBLOBs; - } - - public TestCase refactorSave(EditTestCaseRequest request, List files) { + public TestCase add(EditTestCaseRequest request) { final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(request); // 复制用例时复制对应附件数据 if (StringUtils.isNotEmpty(request.getCopyCaseId())) { @@ -1993,45 +1963,7 @@ public class TestCaseService { return testCaseWithBLOBs; } - public TestCase edit(EditTestCaseRequest request, List files) { - TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getId()); - request.setNum(testCaseWithBLOBs.getNum()); - if (testCaseWithBLOBs == null) { - MSException.throwException(Translator.get("edit_load_test_not_found") + request.getId()); - } - - if (BooleanUtils.isTrue(request.isHandleAttachment())) { - // 新选择了一个文件,删除原来的文件 - List updatedFiles = request.getUpdatedFileList(); - List originFiles = fileService.getFileMetadataByCaseId(request.getId()); - List updatedFileIds = updatedFiles.stream().map(FileMetadata::getId).collect(Collectors.toList()); - List originFileIds = originFiles.stream().map(FileMetadata::getId).collect(Collectors.toList()); - // 相减 - List deleteFileIds = ListUtils.subtract(originFileIds, updatedFileIds); - fileService.deleteFileRelatedByIds(deleteFileIds); - - if (!CollectionUtils.isEmpty(deleteFileIds)) { - TestCaseFileExample testCaseFileExample = new TestCaseFileExample(); - testCaseFileExample.createCriteria().andFileIdIn(deleteFileIds); - testCaseFileMapper.deleteByExample(testCaseFileExample); - } - - if (files != null) { - files.forEach(file -> { - final FileMetadata fileMetadata = fileService.saveFile(file, testCaseWithBLOBs.getProjectId()); - TestCaseFile testCaseFile = new TestCaseFile(); - testCaseFile.setFileId(fileMetadata.getId()); - testCaseFile.setCaseId(request.getId()); - testCaseFileMapper.insert(testCaseFile); - }); - } - } - - this.setNode(request); - return editTestCase(request); - } - - public TestCase refactorEdit(EditTestCaseRequest request, List files) { + public TestCase edit(EditTestCaseRequest request) { TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getId()); request.setNum(testCaseWithBLOBs.getNum()); if (testCaseWithBLOBs == null) { diff --git a/frontend/src/business/components/common/components/MsSingleHandleDrag.vue b/frontend/src/business/components/common/components/MsSingleHandleDrag.vue index ecff1cb742..2a322d6047 100644 --- a/frontend/src/business/components/common/components/MsSingleHandleDrag.vue +++ b/frontend/src/business/components/common/components/MsSingleHandleDrag.vue @@ -37,10 +37,7 @@ @blur="handleValueEdit(element)" v-model="element.value"/> - - {{$t(element.text)}} - - + {{ (element.value && isKv ? '(' : '') + element.value + (element.value && isKv ? ')' : '')}} diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 45eafbb086..b89964790e 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -177,7 +177,7 @@ :fields-width="fieldsWidth" :label="field.system ? $t(systemFiledMap[field.name]) :field.name" :min-width="120" - :column-key="'custom' + field.id" + :column-key="field.columnKey ? field.columnKey : 'custom' + field.id" :prop="field.name">