fix(测试跟踪): 功能用例列表责任人筛选错误

--bug=1015067 --user=陈建星 【测试跟踪】功能用例列表-按照执行结果+责任人筛选结果错误 https://www.tapd.cn/55049933/s/1205857
This commit is contained in:
chenjianxing 2022-07-20 18:52:27 +08:00 committed by f2c-ci-robot[bot]
parent cdee6925e1
commit d4c7d771cd
4 changed files with 15 additions and 81 deletions

View File

@ -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<MultipartFile> 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<MultipartFile> 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"})

View File

@ -1950,37 +1950,7 @@ public class TestCaseService {
return false;
}
public TestCase save(EditTestCaseRequest request, List<MultipartFile> files) {
final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(request);
// 复制用例时传入文件ID进行复制
if (!CollectionUtils.isEmpty(request.getFileIds())) {
List<String> 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<MultipartFile> 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<MultipartFile> 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<FileMetadata> updatedFiles = request.getUpdatedFileList();
List<FileMetadata> originFiles = fileService.getFileMetadataByCaseId(request.getId());
List<String> updatedFileIds = updatedFiles.stream().map(FileMetadata::getId).collect(Collectors.toList());
List<String> originFileIds = originFiles.stream().map(FileMetadata::getId).collect(Collectors.toList());
// 相减
List<String> 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<MultipartFile> files) {
public TestCase edit(EditTestCaseRequest request) {
TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getId());
request.setNum(testCaseWithBLOBs.getNum());
if (testCaseWithBLOBs == null) {

View File

@ -37,10 +37,7 @@
@blur="handleValueEdit(element)"
v-model="element.value"/>
<span class="text-item" v-else-if="isKv">
<span v-if="element.system">
{{$t(element.text)}}
</span>
<span v-else>
<span>
{{ (element.value && isKv ? '(' : '') + element.value + (element.value && isKv ? ')' : '')}}
</span>
</span>

View File

@ -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">
<template v-slot="scope">
<span v-if="field.name === '用例等级'">
@ -679,6 +679,13 @@ export default {
testCaseDefaultValue[item.name] = "";
}
}
if (item.name === '用例等级') {
item.columnKey = 'priority';
} else if (item.name === '责任人') {
item.columnKey = 'maintainer';
} else if (item.name === '用例状态') {
item.columnKey = 'status';
}
});
this.$store.commit('setTestCaseDefaultValue', testCaseDefaultValue);
},
@ -791,8 +798,6 @@ export default {
this.condition.filters.review_status = ['UnPass'];
break;
}
this.condition.filters.priority = this.condition.filters['用例等级'];
this.condition.filters.status = this.condition.filters['用例状态'];
if (this.trashEnable) {
//
let versionIds = this.condition.filters.version_id;