refactor(测试计划): 测试计划功能用例详情的步骤结果对比增加唯一性
This commit is contained in:
parent
aa9101c795
commit
156bed16c9
|
@ -615,23 +615,22 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
|||
String historyStepStr = new String(testPlanCaseExecuteHistory.getSteps(), StandardCharsets.UTF_8);
|
||||
if (StringUtils.isNotBlank(historyStepStr)) {
|
||||
List<FunctionalCaseStepDTO> historySteps = JSON.parseArray(historyStepStr, FunctionalCaseStepDTO.class);
|
||||
Map<String, FunctionalCaseStepDTO> historyStepMap = historySteps.stream().collect(Collectors.toMap(FunctionalCaseStepDTO::getId, t -> t));
|
||||
newCaseSteps.forEach(newCaseStep -> {
|
||||
historySteps.forEach(historyStep -> {
|
||||
setHistoryInfo(newCaseStep, historyStep);
|
||||
});
|
||||
setHistoryInfo(newCaseStep, historyStepMap);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setHistoryInfo(FunctionalCaseStepDTO newCaseStep, FunctionalCaseStepDTO historyStep) {
|
||||
if (StringUtils.equals(historyStep.getDesc(), newCaseStep.getDesc()) && StringUtils.equals(historyStep.getResult(), newCaseStep.getResult())) {
|
||||
private static void setHistoryInfo(FunctionalCaseStepDTO newCaseStep, Map<String, FunctionalCaseStepDTO> historyStepMap) {
|
||||
FunctionalCaseStepDTO historyStep = historyStepMap.get(newCaseStep.getId());
|
||||
if (historyStep != null && StringUtils.equals(historyStep.getDesc(), newCaseStep.getDesc()) && StringUtils.equals(historyStep.getResult(), newCaseStep.getResult())) {
|
||||
newCaseStep.setExecuteResult(historyStep.getExecuteResult());
|
||||
newCaseStep.setActualResult(historyStep.getActualResult());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void editFunctionalCase(TestPlanCaseEditRequest request, String userId) {
|
||||
TestPlanFunctionalCase planFunctionalCase = testPlanFunctionalCaseMapper.selectByPrimaryKey(request.getId());
|
||||
TestPlanFunctionalCase functionalCase = new TestPlanFunctionalCase();
|
||||
|
|
Loading…
Reference in New Issue