fix: 功能用例导入bug
This commit is contained in:
parent
2597386377
commit
fdd217bf41
|
@ -144,7 +144,7 @@ public interface ExtTestCaseMapper {
|
||||||
|
|
||||||
int addLatestVersion(@Param("refId") String refId);
|
int addLatestVersion(@Param("refId") String refId);
|
||||||
|
|
||||||
int clearLatestVersion(@Param("refId") String refId);
|
int clearLatestVersion(@Param("refId") String refId, @Param("projectId") String projectId);
|
||||||
|
|
||||||
int setLatestVersion(@Param("refId") String refId, @Param("versionId") String versionId);
|
int setLatestVersion(@Param("refId") String refId, @Param("versionId") String versionId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1013,6 +1013,7 @@
|
||||||
<if test="refId != null">
|
<if test="refId != null">
|
||||||
and ref_id = #{refId}
|
and ref_id = #{refId}
|
||||||
</if>
|
</if>
|
||||||
|
and project_id = #{projectId}
|
||||||
</where>
|
</where>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
|
@ -533,7 +533,7 @@ public class TestCaseService {
|
||||||
}
|
}
|
||||||
List<TestCaseDTO> list = extTestCaseMapper.list(request);
|
List<TestCaseDTO> list = extTestCaseMapper.list(request);
|
||||||
buildUserInfo(list);
|
buildUserInfo(list);
|
||||||
if(StringUtils.isNotBlank(request.getProjectId())){
|
if (StringUtils.isNotBlank(request.getProjectId())) {
|
||||||
buildProjectInfo(request.getProjectId(), list);
|
buildProjectInfo(request.getProjectId(), list);
|
||||||
}
|
}
|
||||||
list = this.parseStatus(list);
|
list = this.parseStatus(list);
|
||||||
|
@ -818,8 +818,8 @@ public class TestCaseService {
|
||||||
return getImportResponse(errList, true);
|
return getImportResponse(errList, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ExcelResponse testCaseExcelImport(MultipartFile multipartFile, TestCaseImportRequest request,
|
private ExcelResponse testCaseExcelImport(MultipartFile multipartFile, TestCaseImportRequest request,
|
||||||
HttpServletRequest httpRequest) {
|
HttpServletRequest httpRequest) {
|
||||||
String projectId = request.getProjectId();
|
String projectId = request.getProjectId();
|
||||||
Set<String> userIds;
|
Set<String> userIds;
|
||||||
Project project = projectService.getProjectById(projectId);
|
Project project = projectService.getProjectById(projectId);
|
||||||
|
@ -997,32 +997,31 @@ public class TestCaseService {
|
||||||
testcase.setSort(sort.getAndIncrement());
|
testcase.setSort(sort.getAndIncrement());
|
||||||
TestCase dbCase = request.isUseCustomId() ? customIdMap.get(testcase.getCustomNum()) : customIdMap.get(testcase.getNum());
|
TestCase dbCase = request.isUseCustomId() ? customIdMap.get(testcase.getCustomNum()) : customIdMap.get(testcase.getNum());
|
||||||
testcase.setId(dbCase.getId());
|
testcase.setId(dbCase.getId());
|
||||||
testcase.setRefId(dbCase.getId());
|
testcase.setRefId(dbCase.getRefId());
|
||||||
if (StringUtils.isNotBlank(request.getVersionId())) {
|
if (StringUtils.isBlank(request.getVersionId())) {
|
||||||
// 选了版本就更新到对应的版本
|
request.setVersionId(extProjectVersionMapper.getDefaultVersion(projectId));
|
||||||
if (dbCase.getVersionId().equals(request.getVersionId())) {
|
}
|
||||||
mapper.updateByPrimaryKeySelective(testcase);
|
// 选了版本就更新到对应的版本
|
||||||
} else { // 没有对应的版本就新建对应版本用例
|
if (dbCase.getVersionId().equals(request.getVersionId())) {
|
||||||
testcase.setCreateTime(System.currentTimeMillis());
|
|
||||||
testcase.setVersionId(request.getVersionId());
|
|
||||||
testcase.setId(UUID.randomUUID().toString());
|
|
||||||
testcase.setOrder(dbCase.getOrder());
|
|
||||||
testcase.setCreateUser(SessionUtils.getUserId());
|
|
||||||
testcase.setCreateUser(SessionUtils.getUserId());
|
|
||||||
testcase.setCreateUser(SessionUtils.getUserId());
|
|
||||||
testcase.setCustomNum(dbCase.getCustomNum());
|
|
||||||
testcase.setNum(dbCase.getNum());
|
|
||||||
testcase.setLatest(false);
|
|
||||||
testcase.setType(dbCase.getType());
|
|
||||||
if (StringUtils.isBlank(testcase.getStatus())) {
|
|
||||||
testcase.setStatus(TestCaseReviewStatus.Prepare.name());
|
|
||||||
}
|
|
||||||
testcase.setReviewStatus(TestCaseReviewStatus.Prepare.name());
|
|
||||||
insertCases.add(testcase); // 由于是批处理,这里先保存,最后再执行
|
|
||||||
mapper.insert(testcase);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mapper.updateByPrimaryKeySelective(testcase);
|
mapper.updateByPrimaryKeySelective(testcase);
|
||||||
|
} else { // 没有对应的版本就新建对应版本用例
|
||||||
|
testcase.setCreateTime(System.currentTimeMillis());
|
||||||
|
testcase.setVersionId(request.getVersionId());
|
||||||
|
testcase.setId(UUID.randomUUID().toString());
|
||||||
|
testcase.setOrder(dbCase.getOrder());
|
||||||
|
testcase.setCreateUser(SessionUtils.getUserId());
|
||||||
|
testcase.setCreateUser(SessionUtils.getUserId());
|
||||||
|
testcase.setCreateUser(SessionUtils.getUserId());
|
||||||
|
testcase.setCustomNum(dbCase.getCustomNum());
|
||||||
|
testcase.setNum(dbCase.getNum());
|
||||||
|
testcase.setLatest(false);
|
||||||
|
testcase.setType(dbCase.getType());
|
||||||
|
if (StringUtils.isBlank(testcase.getStatus())) {
|
||||||
|
testcase.setStatus(TestCaseReviewStatus.Prepare.name());
|
||||||
|
}
|
||||||
|
testcase.setReviewStatus(TestCaseReviewStatus.Prepare.name());
|
||||||
|
insertCases.add(testcase); // 由于是批处理,这里先保存,最后再执行
|
||||||
|
mapper.insert(testcase);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2462,7 +2461,7 @@ public class TestCaseService {
|
||||||
//已经存在了最新版本 但是要判断这个所谓的最新版本是否是版本管理里面最新版本
|
//已经存在了最新版本 但是要判断这个所谓的最新版本是否是版本管理里面最新版本
|
||||||
String latestVersion = extProjectVersionMapper.getDefaultVersion(projectId);
|
String latestVersion = extProjectVersionMapper.getDefaultVersion(projectId);
|
||||||
if (StringUtils.equals(versionId, latestVersion)) {
|
if (StringUtils.equals(versionId, latestVersion)) {
|
||||||
extTestCaseMapper.clearLatestVersion(refId);
|
extTestCaseMapper.clearLatestVersion(refId, projectId);
|
||||||
extTestCaseMapper.setLatestVersion(refId, versionId);
|
extTestCaseMapper.setLatestVersion(refId, versionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue