fix(测试跟踪): 功能用例列表责任人筛选错误
--bug=1015067 --user=陈建星 【测试跟踪】功能用例列表-按照执行结果+责任人筛选结果错误 https://www.tapd.cn/55049933/s/1205857
This commit is contained in:
parent
99fd019dbc
commit
6c492f82b2
|
@ -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)
|
@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,
|
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, targetClass = TestCaseMapper.class,
|
||||||
event = NoticeConstants.Event.CREATE, subject = "测试用例通知")
|
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())) {
|
if (StringUtils.isBlank(request.getId())) {
|
||||||
//新增 后端生成 id
|
//新增 后端生成 id
|
||||||
request.setId(UUID.randomUUID().toString());
|
request.setId(UUID.randomUUID().toString());
|
||||||
} else {
|
} else {
|
||||||
//复制,前端生成 id
|
//复制,前端生成 id
|
||||||
}
|
}
|
||||||
return testCaseService.refactorSave(request, files);
|
return testCaseService.add(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/edit/order")
|
@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)
|
@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,
|
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.getTestCase(#request.id)", targetClass = TestCaseService.class,
|
||||||
event = NoticeConstants.Event.UPDATE, subject = "测试用例通知")
|
event = NoticeConstants.Event.UPDATE, subject = "测试用例通知")
|
||||||
public TestCase editTestCase(@RequestPart("request") EditTestCaseRequest request, @RequestPart(value = "file", required = false) List<MultipartFile> files) {
|
public TestCase editTestCase(@RequestPart("request") EditTestCaseRequest request) {
|
||||||
return testCaseService.refactorEdit(request, files);
|
return testCaseService.edit(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/edit/testPlan", consumes = {"multipart/form-data"})
|
@PostMapping(value = "/edit/testPlan", consumes = {"multipart/form-data"})
|
||||||
|
|
|
@ -1950,37 +1950,7 @@ public class TestCaseService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestCase save(EditTestCaseRequest request, List<MultipartFile> files) {
|
public TestCase add(EditTestCaseRequest request) {
|
||||||
|
|
||||||
|
|
||||||
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) {
|
|
||||||
final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(request);
|
final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(request);
|
||||||
// 复制用例时复制对应附件数据
|
// 复制用例时复制对应附件数据
|
||||||
if (StringUtils.isNotEmpty(request.getCopyCaseId())) {
|
if (StringUtils.isNotEmpty(request.getCopyCaseId())) {
|
||||||
|
@ -1993,45 +1963,7 @@ public class TestCaseService {
|
||||||
return testCaseWithBLOBs;
|
return testCaseWithBLOBs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestCase edit(EditTestCaseRequest request, List<MultipartFile> files) {
|
public TestCase edit(EditTestCaseRequest request) {
|
||||||
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) {
|
|
||||||
TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getId());
|
TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getId());
|
||||||
request.setNum(testCaseWithBLOBs.getNum());
|
request.setNum(testCaseWithBLOBs.getNum());
|
||||||
if (testCaseWithBLOBs == null) {
|
if (testCaseWithBLOBs == null) {
|
||||||
|
|
|
@ -37,10 +37,7 @@
|
||||||
@blur="handleValueEdit(element)"
|
@blur="handleValueEdit(element)"
|
||||||
v-model="element.value"/>
|
v-model="element.value"/>
|
||||||
<span class="text-item" v-else-if="isKv">
|
<span class="text-item" v-else-if="isKv">
|
||||||
<span v-if="element.system">
|
<span>
|
||||||
{{$t(element.text)}}
|
|
||||||
</span>
|
|
||||||
<span v-else>
|
|
||||||
{{ (element.value && isKv ? '(' : '') + element.value + (element.value && isKv ? ')' : '')}}
|
{{ (element.value && isKv ? '(' : '') + element.value + (element.value && isKv ? ')' : '')}}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -177,7 +177,7 @@
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
:label="field.system ? $t(systemFiledMap[field.name]) :field.name"
|
:label="field.system ? $t(systemFiledMap[field.name]) :field.name"
|
||||||
:min-width="120"
|
:min-width="120"
|
||||||
:column-key="'custom' + field.id"
|
:column-key="field.columnKey ? field.columnKey : 'custom' + field.id"
|
||||||
:prop="field.name">
|
:prop="field.name">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<span v-if="field.name === '用例等级'">
|
<span v-if="field.name === '用例等级'">
|
||||||
|
@ -679,6 +679,13 @@ export default {
|
||||||
testCaseDefaultValue[item.name] = "";
|
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);
|
this.$store.commit('setTestCaseDefaultValue', testCaseDefaultValue);
|
||||||
},
|
},
|
||||||
|
@ -791,8 +798,6 @@ export default {
|
||||||
this.condition.filters.review_status = ['UnPass'];
|
this.condition.filters.review_status = ['UnPass'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.condition.filters.priority = this.condition.filters['用例等级'];
|
|
||||||
this.condition.filters.status = this.condition.filters['用例状态'];
|
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
//支持回收站查询版本
|
//支持回收站查询版本
|
||||||
let versionIds = this.condition.filters.version_id;
|
let versionIds = this.condition.filters.version_id;
|
||||||
|
|
Loading…
Reference in New Issue