fix(测试跟踪): 功能用例导入报错
--bug=1019205 --user=陈建星 【测试跟踪】导入8000+条用例,导入失败,报500 https://www.tapd.cn/55049933/s/1285154
This commit is contained in:
parent
c554f6cd22
commit
6cf24e5152
|
@ -16,6 +16,9 @@ public class TestCaseExportVersionConverter implements TestCaseExportConverter {
|
|||
|
||||
public TestCaseExportVersionConverter() {
|
||||
ProjectVersionService projectVersionService = CommonBeanFactory.getBean(ProjectVersionService.class);
|
||||
if (projectVersionService == null) {
|
||||
return;
|
||||
}
|
||||
List<ProjectVersionDTO> projectVersions = projectVersionService.getProjectVersions(SessionUtils.getCurrentProjectId());
|
||||
projectVersions.forEach(i -> versionMap.put(i.getId(), i.getName()));
|
||||
}
|
||||
|
|
|
@ -798,6 +798,9 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
|
|||
for (Map.Entry<Integer, String> headEntry : headMap.entrySet()) {
|
||||
Integer index = headEntry.getKey();
|
||||
String field = headEntry.getValue();
|
||||
if (StringUtils.isBlank(field)) {
|
||||
continue;
|
||||
}
|
||||
String value = StringUtils.isEmpty(row.get(index)) ? StringUtils.EMPTY : row.get(index);
|
||||
|
||||
if (excelHeadToFieldNameDic.containsKey(field)) {
|
||||
|
|
|
@ -117,12 +117,16 @@ public class TestPlanTestCaseService {
|
|||
.stream().collect(Collectors.toMap(User::getId, User::getName));
|
||||
List<String> versionIds = list.stream().map(TestPlanCaseDTO::getVersionId).collect(Collectors.toList());
|
||||
ProjectVersionService projectVersionService = CommonBeanFactory.getBean(ProjectVersionService.class);
|
||||
Map<String, String> projectVersionMap = projectVersionService.getProjectVersionByIds(versionIds).stream()
|
||||
.collect(Collectors.toMap(ProjectVersion::getId, ProjectVersion::getName));
|
||||
if (projectVersionService != null) {
|
||||
Map<String, String> projectVersionMap = projectVersionService.getProjectVersionByIds(versionIds).stream()
|
||||
.collect(Collectors.toMap(ProjectVersion::getId, ProjectVersion::getName));
|
||||
list.forEach(item -> {
|
||||
item.setVersionName(projectVersionMap.get(item.getVersionId()));
|
||||
});
|
||||
}
|
||||
list.forEach(item -> {
|
||||
item.setExecutorName(userMap.get(item.getExecutor()));
|
||||
item.setMaintainerName(userMap.get(item.getMaintainer()));
|
||||
item.setVersionName(projectVersionMap.get(item.getVersionId()));
|
||||
});
|
||||
}
|
||||
return list;
|
||||
|
|
|
@ -2853,6 +2853,9 @@ public class TestCaseService {
|
|||
public void buildVersionInfo(List<TestCaseDTO> testCases) {
|
||||
List<String> versionIds = testCases.stream().map(TestCaseDTO::getVersionId).collect(Collectors.toList());
|
||||
ProjectVersionService projectVersionService = CommonBeanFactory.getBean(ProjectVersionService.class);
|
||||
if (projectVersionService == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, String> projectVersionMap = projectVersionService.getProjectVersionByIds(versionIds).stream()
|
||||
.collect(Collectors.toMap(ProjectVersion::getId, ProjectVersion::getName));
|
||||
testCases.forEach(testCase -> {
|
||||
|
|
|
@ -75,14 +75,19 @@ public class TestReviewTestCaseService {
|
|||
.stream().collect(Collectors.toMap(User::getId, User::getName));
|
||||
List<String> versionIds = list.stream().map(TestReviewCaseDTO::getVersionId).collect(Collectors.toList());
|
||||
ProjectVersionService projectVersionService = CommonBeanFactory.getBean(ProjectVersionService.class);
|
||||
Map<String, String> projectVersionMap = projectVersionService.getProjectVersionByIds(versionIds).stream()
|
||||
.collect(Collectors.toMap(ProjectVersion::getId, ProjectVersion::getName));
|
||||
if (projectVersionService != null) {
|
||||
Map<String, String> projectVersionMap = projectVersionService.getProjectVersionByIds(versionIds).stream()
|
||||
.collect(Collectors.toMap(ProjectVersion::getId, ProjectVersion::getName));
|
||||
list.forEach(item -> {
|
||||
item.setVersionName(projectVersionMap.get(item.getVersionId()));
|
||||
});
|
||||
}
|
||||
|
||||
list.forEach(item -> {
|
||||
String reviewId = item.getReviewId();
|
||||
List<String> userIds = getReviewUserIds(reviewId);
|
||||
item.setReviewerName(getReviewName(userIds, userMap));
|
||||
item.setMaintainerName(userMap.get(item.getMaintainer()));
|
||||
item.setVersionName(projectVersionMap.get(item.getVersionId()));
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue