|
@@ -22,6 +22,7 @@ import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -50,6 +51,9 @@ public class CrowdTestProjectRepo implements ICrowdTestProjectRepo {
|
|
|
private TestActionDao testActionDao;
|
|
|
|
|
|
@Autowired
|
|
|
+ private TestCaseToUserDao testCaseToUserDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private TestCaseDao testCaseDao;
|
|
|
|
|
|
@Autowired
|
|
@@ -177,7 +181,10 @@ public class CrowdTestProjectRepo implements ICrowdTestProjectRepo {
|
|
|
CrowdTestProjectPO crowdTestProjectPO = Converter.convert(CrowdTestProjectPO.class, crowdTestProject);
|
|
|
crowdTestProjectDao.save(crowdTestProjectPO);
|
|
|
List<CrowdTestTask> crowdTestTaskList = crowdTestProject.getCrowdTestTaskList();
|
|
|
+
|
|
|
Optional.ofNullable(crowdTestTaskList).orElse(new ArrayList<>()).stream().forEach(crowdTestTask -> {
|
|
|
+
|
|
|
+ // 保存接包信息
|
|
|
List<TaskToUser> acceptedUserList = crowdTestTask.getAcceptedUserList();
|
|
|
Optional.ofNullable(acceptedUserList).orElse(new ArrayList<>()).stream().forEach(taskToUser -> {
|
|
|
// 保存接包信息
|
|
@@ -187,6 +194,27 @@ public class CrowdTestProjectRepo implements ICrowdTestProjectRepo {
|
|
|
Optional.ofNullable(crowdTestReportList).orElse(new ArrayList<>()).stream()
|
|
|
.forEach(crowdTestReport -> crowdTestReportDao.save(Converter.convert(CrowdTestReportPO.class, crowdTestReport)));
|
|
|
});
|
|
|
+
|
|
|
+ // 保存用例信息
|
|
|
+ List<TestCase> testCaseList = crowdTestTask.getTestCaseList();
|
|
|
+ Optional.ofNullable(testCaseList).orElse(new ArrayList<>()).stream().forEach(testCase -> {
|
|
|
+ // 进行数据库存储
|
|
|
+ TestCasePO testCasePO = testCaseDao.save(Converter.convert(TestCasePO.class, testCase));
|
|
|
+ List<TestAction> testActions = testCase.getTestActionsPre();
|
|
|
+ List<TestAction> testActionsNext = testCase.getTestActionsNext();
|
|
|
+ testActions.addAll(testActionsNext);
|
|
|
+ testActions.stream().forEach(testAction -> {
|
|
|
+ testAction.setTestCaseId(testCasePO.getId());
|
|
|
+ testActionDao.save(Converter.convert(TestActionPO.class, testAction));
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 保存用户用例完成情况
|
|
|
+ List<TestCaseToUser> testCaseToUserList = crowdTestTask.getTestCaseToUserList();
|
|
|
+ Optional.ofNullable(testCaseToUserList).orElse(new ArrayList<>()).stream().forEach(testCaseToUser -> {
|
|
|
+ testCaseToUserDao.save(Converter.convert(TestCaseToUserPO.class, testCaseToUser));
|
|
|
+ });
|
|
|
+
|
|
|
// 保存任务基本信息
|
|
|
crowdTestTaskDao.save(Converter.convert(CrowdTestTaskPO.class, crowdTestTask));
|
|
|
// 保存任务配置信息
|
|
@@ -429,10 +457,22 @@ public class CrowdTestProjectRepo implements ICrowdTestProjectRepo {
|
|
|
TestCase testCase = Converter.convert(TestCase.class, testCasePO);
|
|
|
List<TestActionPO> testActionPOList = testActionDao.findByTestCaseId(testCasePO.getId());
|
|
|
List<TestAction> testActionList = testActionPOList.stream().map(testActionPO -> Converter.convert(TestAction.class, testActionPO)).collect(Collectors.toList());
|
|
|
- testCase.setTestActions(testActionList);
|
|
|
+ testCase.setTestActionsPre(testActionList.stream().filter(testAction -> testAction.getType() == 0).collect(Collectors.toList()));
|
|
|
+ testCase.setTestActionsNext(testActionList.stream().filter(testAction -> testAction.getType() == 1).collect(Collectors.toList()));
|
|
|
return testCase;
|
|
|
}).collect(Collectors.toList());
|
|
|
crowdTestTaskResult.setTestCaseList(testCaseList);
|
|
|
+
|
|
|
+ // 检索任务中的用例完成信息
|
|
|
+ List<TestCaseToUserPO> testCaseToUserPOList = testCaseToUserDao.findByTaskCode(crowdTestTaskResult.getCode());
|
|
|
+ List<TestCaseToUser> testCaseToUserList = testCaseToUserPOList.stream().map(testCaseToUserPO -> {
|
|
|
+ TestCaseToUser testCaseToUser = Converter.convert(TestCaseToUser.class, testCaseToUserPO);
|
|
|
+ TestCase testCaseResult = testCaseList.stream().filter(testCase -> testCase.getId().equals(testCaseToUser.getTestCaseId())).findFirst().get();
|
|
|
+ testCaseToUser.setTestCase(testCaseResult);
|
|
|
+ return testCaseToUser;
|
|
|
+ }).sorted(Comparator.comparing(TestCaseToUser::getIsCommitted).thenComparing(TestCaseToUser::getCommitTime)).collect(Collectors.toList());
|
|
|
+ crowdTestTaskResult.setTestCaseToUserList(testCaseToUserList);
|
|
|
+
|
|
|
// // 检索任务中的所有的报告
|
|
|
// List<CrowdTestReport> crowdTestReportListResult = getCrowdTestReportByCrowdTestTask(crowdTestTaskPO.getCode());
|
|
|
// crowdTestTaskResult.setCrowdTestReportList(crowdTestReportListResult);
|