fix(测试跟踪): 公共用例库版本列为空的问题
--bug=1017986 --user=宋昌昌 【测试跟踪】批量添加到公共用例库,版本列为空 https://www.tapd.cn/55049933/s/1261892
This commit is contained in:
parent
e3b264e5f1
commit
c2076639ce
|
@ -48,6 +48,7 @@ import io.metersphere.xpack.track.dto.EditTestCaseRequest;
|
||||||
import io.metersphere.xpack.track.dto.IssuesDao;
|
import io.metersphere.xpack.track.dto.IssuesDao;
|
||||||
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
import io.metersphere.xpack.track.dto.request.IssuesRequest;
|
||||||
import io.metersphere.xpack.track.issue.IssuesPlatform;
|
import io.metersphere.xpack.track.issue.IssuesPlatform;
|
||||||
|
import io.metersphere.xpack.version.service.ProjectVersionService;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
@ -75,6 +76,8 @@ import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static io.metersphere.service.ServiceUtils.buildVersionInfo;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class TestCaseService {
|
public class TestCaseService {
|
||||||
|
@ -795,9 +798,9 @@ public class TestCaseService {
|
||||||
request.setProjectId(null);
|
request.setProjectId(null);
|
||||||
ServiceUtils.setBaseQueryRequestCustomMultipleFields(request);
|
ServiceUtils.setBaseQueryRequestCustomMultipleFields(request);
|
||||||
List<TestCaseDTO> returnList = extTestCaseMapper.publicList(request);
|
List<TestCaseDTO> returnList = extTestCaseMapper.publicList(request);
|
||||||
ServiceUtils.buildVersionInfo(returnList);
|
|
||||||
ServiceUtils.buildProjectInfo(returnList);
|
ServiceUtils.buildProjectInfo(returnList);
|
||||||
buildUserInfo(returnList);
|
buildUserInfo(returnList);
|
||||||
|
buildVersionInfo(returnList);
|
||||||
buildPublicCustomField(request, returnList);
|
buildPublicCustomField(request, returnList);
|
||||||
return returnList;
|
return returnList;
|
||||||
}
|
}
|
||||||
|
@ -2838,6 +2841,16 @@ 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);
|
||||||
|
Map<String, String> projectVersionMap = projectVersionService.getProjectVersionByIds(versionIds).stream()
|
||||||
|
.collect(Collectors.toMap(ProjectVersion::getId, ProjectVersion::getName));
|
||||||
|
testCases.forEach(testCase -> {
|
||||||
|
testCase.setVersionName(projectVersionMap.get(testCase.getVersionId()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public int getRelationshipCount(String id) {
|
public int getRelationshipCount(String id) {
|
||||||
return relationshipEdgeService.getRelationshipCount(id, extTestCaseMapper::countByIds);
|
return relationshipEdgeService.getRelationshipCount(id, extTestCaseMapper::countByIds);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue