feat(通用功能): 版本置新用例更新时,最新版本不自动改变

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-12-13 18:19:00 +08:00 committed by xiaomeinvG
parent 35ab1c1f47
commit cf9615a317
5 changed files with 37 additions and 22 deletions

View File

@ -529,31 +529,42 @@ public class ApiDefinitionImportUtilService {
if (i == v.size()) {
//如果系统内的所有版本都不是当前选择的数据更新版本需要与lasted = 1 比较请求参数参数一致仅变更接口模块为当前导入接口的模块不一致新增并变更接口模块为当前导入接口的模块
if (latestApi != null) {
Boolean hasChange = ApiDefinitionImportUtil.checkIsSynchronize(latestApi, apiDefinitionWithBLOBs);
Boolean hasChange;
if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) {
hasChange = ApiDefinitionImportUtil.checkIsSynchronize(latestApi, apiDefinitionWithBLOBs);
} else {
hasChange = true;
}
if (!hasChange) {
for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) {
definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId());
definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath());
definitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
updateApiList.add(definitionWithBLOBs);
if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) {
for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) {
definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId());
definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath());
definitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
updateApiList.add(definitionWithBLOBs);
}
}
apiDefinitionWithBLOBs.setVersionId("trash");
} else {
addNewVersionApi(apiDefinitionWithBLOBs, latestApi, "update");
for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) {
definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId());
definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath());
definitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
updateApiList.add(definitionWithBLOBs);
if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) {
for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) {
definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId());
definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath());
definitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
updateApiList.add(definitionWithBLOBs);
}
}
}
}
} else {
for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) {
definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId());
definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath());
definitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
updateApiList.add(definitionWithBLOBs);
if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) {
for (ApiDefinitionWithBLOBs definitionWithBLOBs : v) {
definitionWithBLOBs.setModuleId(apiDefinitionWithBLOBs.getModuleId());
definitionWithBLOBs.setModulePath(apiDefinitionWithBLOBs.getModulePath());
definitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
updateApiList.add(definitionWithBLOBs);
}
}
optionData.remove(apiDefinitionWithBLOBs);
}
@ -862,7 +873,6 @@ public class ApiDefinitionImportUtilService {
if (MapUtils.isNotEmpty(caseNameMap)) {
buildCaseList(oldCaseMap, caseNameMap, definitionWithBLOBs, optionDataCases);
}
ApiDefinitionWithBLOBs api = new ApiDefinitionWithBLOBs();
BeanUtils.copyBean(api, apiDefinitionWithBLOBs);
api.setId(definitionWithBLOBs.getId());
@ -874,7 +884,12 @@ public class ApiDefinitionImportUtilService {
}
if (i == v.size()) {
if (latestApi!=null) {
Boolean hasChange = ApiDefinitionImportUtil.checkIsSynchronize(latestApi, apiDefinitionWithBLOBs);
boolean hasChange;
if (apiDefinitionWithBLOBs.getProtocol().equals("HTTP")) {
hasChange = ApiDefinitionImportUtil.checkIsSynchronize(latestApi, apiDefinitionWithBLOBs);
} else {
hasChange = true;
}
if (!hasChange) {
optionData.remove(apiDefinitionWithBLOBs);
} else {

View File

@ -783,7 +783,7 @@ public class ApiDefinitionService {
apiTestCaseService.updateByApiDefinitionId(ids, test, request.getTriggerUpdate());
}
ApiDefinitionWithBLOBs result = apiDefinitionMapper.selectByPrimaryKey(test.getId());
checkAndSetLatestVersion(result.getRefId());
//checkAndSetLatestVersion(result.getRefId());
// 存储附件关系
extFileAssociationService.saveApi(test.getId(), request.getRequest(), FileAssociationTypeEnums.API.name());

View File

@ -409,7 +409,7 @@ public class ApiScenarioService {
if (relationshipEdgeService != null) {
relationshipEdgeService.initRelationshipEdge(beforeScenario, scenario);
}
checkAndSetLatestVersion(beforeScenario.getRefId());
//checkAndSetLatestVersion(beforeScenario.getRefId());
// 存储附件关系
extFileAssociationService.saveScenario(scenario.getId(), request.getScenarioDefinition());
return scenario;

View File

@ -325,7 +325,7 @@ public class PerformanceTestService {
copyLoadTestFiles(testId, loadTest.getId());
loadTestMapper.insertSelective(loadTest);
}
checkAndSetLatestVersion(loadTest.getRefId());
//checkAndSetLatestVersion(loadTest.getRefId());
return loadTest;
}

View File

@ -463,7 +463,7 @@ public class TestCaseService {
dealWithOtherInfoOfNewVersion(testCase, oldTestCase.getId());
testCaseMapper.insertSelective(testCase);
}
checkAndSetLatestVersion(testCase.getRefId());
//checkAndSetLatestVersion(testCase.getRefId());
}
/**