|
@@ -19,6 +19,7 @@ import com.mooctest.crowd.site.data.dto.*;
|
|
|
import com.mooctest.crowd.site.data.enums.RoleType;
|
|
|
import com.mooctest.crowd.site.data.vo.*;
|
|
|
import com.mooctest.crowd.site.mediator.ViewMediator;
|
|
|
+import com.mooctest.crowd.site.service.CrowdTaskService;
|
|
|
import com.mooctest.crowd.site.service.ThemeStatusService;
|
|
|
import com.mooctest.crowd.site.service.ThemeStatusTaskService;
|
|
|
import com.mooctest.crowd.site.service.impl.AuthCheckServiceImpl;
|
|
@@ -47,9 +48,15 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private TestTypeDao testTypeDao;
|
|
|
|
|
|
@Autowired
|
|
|
+ private CrowdTaskService crowdTaskService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private CrowdTestProjectRepo projectRepo;
|
|
|
|
|
|
@Autowired
|
|
|
+ private CrowdTestTaskRepo taskRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private UserRepo userRepo;
|
|
|
|
|
|
@Autowired
|
|
@@ -136,26 +143,42 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Value("${feature.client.oss}")
|
|
|
private Boolean usingOss;
|
|
|
|
|
|
+ @Value("${index.count.project}")
|
|
|
+ private String indexProjectCount;
|
|
|
+
|
|
|
+ @Value("${index.count.task}")
|
|
|
+ private String indexTaskCount;
|
|
|
+
|
|
|
+ @Value("${index.count.residentAgency}")
|
|
|
+ private String indexResidentAgencyCount;
|
|
|
+
|
|
|
+ @Value("${index.count.competition}")
|
|
|
+ private String indexCompetitionCount;
|
|
|
+
|
|
|
+ @Value("${index.count.crowd}")
|
|
|
+ private String indexCrowdCount;
|
|
|
+
|
|
|
+ @Value("${index.count.agency}")
|
|
|
+ private String indexAgencyCount;
|
|
|
+
|
|
|
+ @Value("${index.count.user}")
|
|
|
+ private String indexUserCount;
|
|
|
+
|
|
|
+ @Value("${index.count.tool}")
|
|
|
+ private String indexToolCount;
|
|
|
+
|
|
|
+ @Value("${index.count.resource}")
|
|
|
+ private String indexResourceCount;
|
|
|
+
|
|
|
@Override
|
|
|
public List<CrowdTestProjectVO> crowdTestProjects() {
|
|
|
- List<CrowdTestProjectVO> authingList = new ArrayList<>();
|
|
|
- authingList.addAll(projectDao.findAll().stream().map(crowdTestProjectPO -> {
|
|
|
+ List<CrowdTestProjectVO> resultList = new ArrayList<>();
|
|
|
+ resultList.addAll(projectDao.findAll().stream().map(crowdTestProjectPO -> {
|
|
|
CrowdTestProject crowdTestProject = new CrowdTestProject();
|
|
|
BeanUtils.copyProperties(crowdTestProjectPO, crowdTestProject);
|
|
|
return new CrowdTestProjectVO(crowdTestProject);
|
|
|
}).collect(Collectors.toList()));
|
|
|
- return authingList;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<CrowdTaskVO> findIndexTask() {
|
|
|
- List<CrowdTaskVO> authingList = new ArrayList<>();
|
|
|
- authingList.addAll(taskDao.findindexTask().stream().map(crowdTestProjectPO -> {
|
|
|
- CrowdTestTask crowdTestTask = new CrowdTestTask();
|
|
|
- BeanUtils.copyProperties(crowdTestProjectPO, crowdTestTask);
|
|
|
- return new CrowdTaskVO(crowdTestTask);
|
|
|
- }).collect(Collectors.toList()));
|
|
|
- return authingList;
|
|
|
+ return resultList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -310,134 +333,51 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public IndexInfoDTO renderIndexInfosCache() {
|
|
|
IndexInfoDTO indexInfoDTO = new IndexInfoDTO();
|
|
|
- int top = 3;
|
|
|
// 获取大赛信息
|
|
|
- List<Competition> competitionList = commonRepo.getAllCompetition();
|
|
|
- List<Competition> competitionLists = new ArrayList<>();
|
|
|
- if (competitionList.size() > top) {
|
|
|
- for (int i = 0; i < top; i++) {
|
|
|
- competitionLists.add(competitionList.get(i));
|
|
|
- }
|
|
|
- } else {
|
|
|
- competitionLists = competitionList;
|
|
|
- }
|
|
|
-
|
|
|
- List<CompetitionVO> competitionVOS = competitionLists.stream().map(competition -> {
|
|
|
- CompetitionVO competitionVO = new CompetitionVO(competition);
|
|
|
- return competitionVO;
|
|
|
- }).sorted(Comparator.comparing(CompetitionVO::getStartTime).reversed()).collect(Collectors.toList());
|
|
|
-
|
|
|
+ List<CompetitionVO> competitionVOS = commonRepo.getAllCompetition(Integer.parseInt(indexCompetitionCount)).stream().map(CompetitionVO::new).collect(Collectors.toList());
|
|
|
+ // 获取领域划分
|
|
|
+ List<FieldVO> fieldVOS = commonRepo.getAllFieldType().stream().map(FieldVO::new).collect(Collectors.toList());
|
|
|
// 获取服务类型
|
|
|
- List<TestType> allTestType = commonRepo.getAllTestType();
|
|
|
- List<TestTypeVO> testTypeVOS = allTestType.stream().map(testType -> {
|
|
|
- TestTypeVO testTypeVO = new TestTypeVO(testType);
|
|
|
- return testTypeVO;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
+ List<TestTypeVO> testTypeVOS = commonRepo.getAllTestType().stream().map(TestTypeVO::new).collect(Collectors.toList());
|
|
|
// 获取应用类型
|
|
|
List<ApplicationTypeVO> applicationTypeVOS = commonRepo.getAllApplicationType().stream().map(ApplicationTypeVO::new).collect(Collectors.toList());
|
|
|
-// List<ApplicationType> allApplicationType = commonRepo.getAllApplicationType();
|
|
|
-// List<ApplicationTypeVO> applicationTypeVOS = allApplicationType.stream().map(applicationType -> {
|
|
|
-// ApplicationTypeVO applicationTypeVO = new ApplicationTypeVO(applicationType);
|
|
|
-// List<TestType> testTypeList = commonRepo.getTestTypeListByAppCode(applicationType.getCode());
|
|
|
-// List<TestTypeVO> typeVOS = testTypeList.stream().map(testType -> {
|
|
|
-// TestTypeVO testTypeVO = new TestTypeVO(testType);
|
|
|
-// return testTypeVO;
|
|
|
-// }).collect(Collectors.toList());
|
|
|
-// applicationTypeVO.setTestTypeList(typeVOS);
|
|
|
-// return applicationTypeVO;
|
|
|
-// }).collect(Collectors.toList());
|
|
|
-
|
|
|
- // 获取领域划分
|
|
|
- List<Field> fieldList = commonRepo.getAllFieldType();
|
|
|
- List<FieldVO> fieldVOS = fieldList.stream().map(field -> {
|
|
|
- FieldVO fieldVO = new FieldVO(field);
|
|
|
- return fieldVO;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
// 获取入驻品牌机构
|
|
|
- List<ResidentAgency> allResidentAgency = commonRepo.getAllResidentAgency();
|
|
|
- List<EvaluationAgencyVO> agencyVOS = new ArrayList<>();
|
|
|
- List<EvaluationAgencyVO> agencyVOList = allResidentAgency.stream().map(residentAgency -> {
|
|
|
+ List<ResidentAgency> allResidentAgency = commonRepo.getAllResidentAgency(Integer.parseInt(indexResidentAgencyCount));
|
|
|
+ // 获取资源
|
|
|
+// List<ResourceVO> resourceVOS = commonRepo.getAllResource().stream().map(ResourceVO::new).limit(Integer.parseInt(indexResourceCount)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 获取工具
|
|
|
+ List<ToolVO> toolVOS = toolRepo.getAllTools().stream().map(tool -> new ToolVO(tool)).limit(Integer.parseInt(indexToolCount)).collect(Collectors.toList());
|
|
|
+ List<EvaluationAgencyVO> agencyVOS = allResidentAgency.stream().map(residentAgency -> {
|
|
|
EvaluationAgency agency = evaluationAgencyRepo.findAgencyById(residentAgency.getAgencyId());
|
|
|
EvaluationAgencyVO evalutionAgencyVO = new EvaluationAgencyVO(agency);
|
|
|
return evalutionAgencyVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
- if (agencyVOList.size() > 12) {
|
|
|
- for (int i = 0; i < 12; i++) {
|
|
|
- agencyVOS.add(agencyVOList.get(i));
|
|
|
- }
|
|
|
- } else {
|
|
|
- agencyVOS = agencyVOList;
|
|
|
- }
|
|
|
-
|
|
|
- // 获取热门任务
|
|
|
-
|
|
|
- List<CrowdTaskVO> taskVOList = taskDao.findMoreHotTasks().stream().map(crowdTestTaskPO -> {
|
|
|
- CrowdTestTask task = new CrowdTestTask();
|
|
|
- BeanUtils.copyProperties(crowdTestTaskPO, task);
|
|
|
- return new CrowdTaskVO(task);
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- List<CrowdTaskVO> taskVOS = new ArrayList<>();
|
|
|
- if (taskVOList.size() > top) {
|
|
|
- for (int i = 0; i < top; i++) {
|
|
|
- taskVOS.add(taskVOList.get(i));
|
|
|
- }
|
|
|
- } else {
|
|
|
- taskVOS = taskVOList;
|
|
|
- }
|
|
|
-
|
|
|
- // 获取合作机构
|
|
|
-// List<Partner> partnerList = commonRepo.getAllPartner();
|
|
|
-// List<PartnerVO> partnerVOS = partnerList.stream().map(partner -> {
|
|
|
-// PartnerVO partnerVO = new PartnerVO(partner);
|
|
|
-// return partnerVO;
|
|
|
-// }).collect(Collectors.toList());
|
|
|
|
|
|
indexInfoDTO.setTestTypeList(testTypeVOS);
|
|
|
indexInfoDTO.setApplicationTypeList(applicationTypeVOS);
|
|
|
indexInfoDTO.setFieldList(fieldVOS);
|
|
|
indexInfoDTO.setCompetitionList(competitionVOS);
|
|
|
indexInfoDTO.setResidentAgencyList(agencyVOS);
|
|
|
-// indexInfoDTO.setPartnerList(partnerVOS);
|
|
|
- indexInfoDTO.setTaskList(taskVOS);
|
|
|
+// indexInfoDTO.setResourceList(resourceVOS);
|
|
|
+ indexInfoDTO.setToolList(toolVOS);
|
|
|
return indexInfoDTO;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public IndexInfoDTO renderIndexInfos() {
|
|
|
IndexInfoDTO indexInfoDTO = new IndexInfoDTO();
|
|
|
- Pageable pageable = PageRequest.of(0, 3);
|
|
|
- int top = 3;
|
|
|
- List<ApplicationTypeVO> applicationTypeRank = getApplicationTypeRankVOS(pageable);
|
|
|
- List<ApplicationTypeVO> applicationTypeRanks = new ArrayList<>();
|
|
|
- if (applicationTypeRanks.size() > top) {
|
|
|
- for (int i = 0; i < top; i++) {
|
|
|
- applicationTypeRanks.add(applicationTypeRank.get(i));
|
|
|
- }
|
|
|
- } else {
|
|
|
- applicationTypeRanks = applicationTypeRank;
|
|
|
- }
|
|
|
+ Pageable pageable = PageRequest.of(0, Integer.parseInt(indexCrowdCount));
|
|
|
+ // 获取热门项目
|
|
|
+ List<CrowdTestProjectVO> projectVOS = projectRepo.findHotProjectCardLimitCount(Integer.parseInt(indexProjectCount)).stream().map(CrowdTestProjectVO::new).collect(Collectors.toList());
|
|
|
+ // 获取热门任务
|
|
|
+ List<CrowdTaskVO> taskVOS = crowdTaskService.findMoreHotTasksList("", Integer.parseInt(indexTaskCount));
|
|
|
+ // 获取热门众测
|
|
|
+ List<ApplicationTypeVO> applicationTypeRanks = getApplicationTypeRankVOS(pageable).stream().limit(Integer.parseInt(indexCrowdCount)).collect(Collectors.toList());
|
|
|
|
|
|
//获取机构排名
|
|
|
-// String agencyName = agencyDao.findById(Long.parseLong(agencyId)).get().getEvaluationAgencyName();
|
|
|
-// List<EvaluationAgencyVO> agencyRank = taskToUserDao.findTotalCountOfUser().stream().map(rankInfo -> {
|
|
|
-// EvaluationAgencyPO agency = agencyDao.findByUserId(rankInfo.getEntityId());
|
|
|
-// if (agency != null && !agency.getEvaluationAgencyName().equals(agencyName)) {
|
|
|
-// EvaluationAgencyVO agencyVO = new EvaluationAgencyVO();
|
|
|
-// agencyVO.setEvaluationAgencyName(agency.getEvaluationAgencyName());
|
|
|
-// agencyVO.setAgencyPhoto(agency.getAgencyPhoto());
|
|
|
-// agencyVO.setTaskCount(rankInfo.getCount());
|
|
|
-// agencyVO.setId(agency.getId());
|
|
|
-// agencyVO.setUserId(agency.getUserId());
|
|
|
-// return agencyVO;
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
-
|
|
|
List<EvaluationAgencyVO> agencyRanks = userTaskCountDao.findByType(RoleType.AGENCY.getId())
|
|
|
- .stream().sorted(Comparator.comparing(UserTaskCountPO::getCount).reversed()).limit(top).collect(Collectors.toList())
|
|
|
+ .stream().sorted(Comparator.comparing(UserTaskCountPO::getCount).reversed()).limit(Integer.parseInt(indexAgencyCount)).collect(Collectors.toList())
|
|
|
.stream().map(userTaskCountPO -> {
|
|
|
EvaluationAgencyPO agency = agencyDao.findByUserId(userTaskCountPO.getUserId());
|
|
|
EvaluationAgencyVO agencyVO = new EvaluationAgencyVO();
|
|
@@ -449,29 +389,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return agencyVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
-// List<EvaluationAgencyVO> agencyRanks = new ArrayList<>();
|
|
|
-// if (agencyRank.size() > top) {
|
|
|
-// for (int i = 0; i < top; i++) {
|
|
|
-// agencyRanks.add(agencyRank.get(i));
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// agencyRanks = agencyRank;
|
|
|
-// }
|
|
|
-
|
|
|
//获取众测人员排名
|
|
|
-// List<UserVO> userRank = taskToUserDao.findTotalCountOfUser().stream().map(rankInfo -> {
|
|
|
-// EvaluationAgencyPO agency = agencyDao.findByUserId(rankInfo.getEntityId());
|
|
|
-// if (agency != null && agency.getEvaluationAgencyName().equals(agencyName)) {
|
|
|
-// User user = userRepo.getByID(agency.getUserId());
|
|
|
-// UserVO userVO = new UserVO(user);
|
|
|
-// userVO.setTaskCount(rankInfo.getCount());
|
|
|
-// return userVO;
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
-
|
|
|
List<UserVO> userRanks = userTaskCountDao.findByType(RoleType.EVALUATION_USER.getId())
|
|
|
- .stream().sorted(Comparator.comparing(UserTaskCountPO::getCount).reversed()).limit(top).collect(Collectors.toList())
|
|
|
+ .stream().sorted(Comparator.comparing(UserTaskCountPO::getCount).reversed()).limit(Integer.parseInt(indexUserCount)).collect(Collectors.toList())
|
|
|
.stream().map(userTaskCountPO -> {
|
|
|
User user = userRepo.getByIDJustInfo(userTaskCountPO.getUserId());
|
|
|
UserVO userVO = new UserVO(user);
|
|
@@ -479,47 +399,11 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return userVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
-// List<UserVO> userRanks = new ArrayList<>();
|
|
|
-// if (userRank.size() > top) {
|
|
|
-// for (int i = 0; i < top; i++) {
|
|
|
-// userRanks.add(userRank.get(i));
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// userRanks = userRank;
|
|
|
-// }
|
|
|
-
|
|
|
- // 获取资源
|
|
|
- List<Resource> resourceList = commonRepo.getAllResource();
|
|
|
- List<ResourceVO> resourceVOS = new ArrayList<>();
|
|
|
- List<ResourceVO> resourceVOList = resourceList.stream().map(resource -> {
|
|
|
- ResourceVO resourceVO = new ResourceVO(resource);
|
|
|
- return resourceVO;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- if (resourceVOList.size() > 12) {
|
|
|
- for (int i = 0; i < 12; i++) {
|
|
|
- resourceVOS.add(resourceVOList.get(i));
|
|
|
- }
|
|
|
- } else {
|
|
|
- resourceVOS = resourceVOList;
|
|
|
- }
|
|
|
-
|
|
|
- // 获取工具
|
|
|
- List<Tool> toolList = toolRepo.getAllTools();
|
|
|
- List<ToolVO> toolVOS = new ArrayList<>();
|
|
|
- List<ToolVO> toolVOList = toolList.stream().map(tool -> new ToolVO(tool)).collect(Collectors.toList());
|
|
|
- if (toolVOList.size() > 12) {
|
|
|
- for (int i = 0; i < 12; i++) {
|
|
|
- toolVOS.add(toolVOList.get(i));
|
|
|
- }
|
|
|
- } else {
|
|
|
- toolVOS = toolVOList;
|
|
|
- }
|
|
|
-
|
|
|
+ indexInfoDTO.setTaskList(taskVOS);
|
|
|
+ indexInfoDTO.setProjectList(projectVOS);
|
|
|
indexInfoDTO.setApplicationTypeRank(applicationTypeRanks);
|
|
|
indexInfoDTO.setAgencyRank(agencyRanks);
|
|
|
indexInfoDTO.setUserRank(userRanks);
|
|
|
- indexInfoDTO.setResourceList(resourceVOS);
|
|
|
- indexInfoDTO.setToolList(toolVOS);
|
|
|
return indexInfoDTO;
|
|
|
}
|
|
|
|
|
@@ -613,9 +497,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
User user = userRepo.getByID(userId);
|
|
|
//我的众测 - 项目相关信息
|
|
|
|
|
|
- // 获取应用、测试类型code 和 name 的map
|
|
|
+ // 获取领域、应用、测试类型code 和 name 的map
|
|
|
+ Map<String, String> fieldMap = commonRepo.getFieldCodeNameMap();
|
|
|
Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
- Map<String, String> typeMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
|
|
|
//获取我创建的项目列表
|
|
|
List<CrowdProjectVO> myProjects = projectDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted)
|
|
@@ -626,8 +511,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
// themeStatusService.updateStatus(project);
|
|
|
if (project.getStatus() == CrowdTestProjectStatus.HAS_COMMITED)
|
|
|
projectVO.setNeedHandle(true);
|
|
|
- // 应用类型值的转换
|
|
|
- projectVO = changeApplicationType(projectVO, applicationMap);
|
|
|
+ // 领域类型、应用类型值的转换
|
|
|
+ projectVO = changeFieldAndApplicationAndTestType(projectVO, applicationMap, fieldMap, testMap);
|
|
|
|
|
|
// 判断项目是否截止
|
|
|
if (projectVO.getDatetime().getTime() <= System.currentTimeMillis() && project.getStatus() < CrowdTestProjectStatus.HAS_FINISHED) {
|
|
@@ -655,7 +540,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
BeanUtils.copyProperties(crowdTestProjectPO, project);
|
|
|
CrowdProjectVO projectVO = new CrowdProjectVO(project);
|
|
|
// 应用类型值的转换
|
|
|
- projectVO = changeApplicationType(projectVO, applicationMap);
|
|
|
+ projectVO = changeFieldAndApplicationAndTestType(projectVO, applicationMap, fieldMap, testMap);
|
|
|
|
|
|
// List<CrowdTestTaskPO> tasksOfProject = taskDao.findByCrowdTestProjectCodeAndIsDeleted(project.getCode(), DeletedStatus.isNotDeleted);
|
|
|
// if (tasksOfProject != null && tasksOfProject.stream().anyMatch(task -> task.getStatus() == CrowdTestTaskStatus.HAS_COMMITED)) {
|
|
@@ -678,7 +563,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
CrowdTestProject project = new CrowdTestProject();
|
|
|
BeanUtils.copyProperties(crowdTestProjectPO, project);
|
|
|
CrowdProjectVO projectVO = new CrowdProjectVO(project);
|
|
|
- projectVO = changeApplicationType(projectVO, applicationMap);
|
|
|
+ projectVO = changeFieldAndApplicationAndTestType(projectVO, applicationMap, fieldMap, testMap);
|
|
|
return projectVO;
|
|
|
}).collect(Collectors.toList()));
|
|
|
myCrowdDTO.setAcceptableProjectNoticeCount(Long.parseLong("" + acceptableProject.size()));
|
|
@@ -707,7 +592,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
CrowdTestTask task = new CrowdTestTask();
|
|
|
BeanUtils.copyProperties(crowdTestTaskPO, task);
|
|
|
// 测试类型的转换
|
|
|
- task.setType(typeMap.get(task.getType()));
|
|
|
+ task.setType(testMap.get(task.getType()));
|
|
|
// 判断任务是否截止
|
|
|
if (task.getDeadTime().getTime() <= System.currentTimeMillis() && task.getStatus() < CrowdTestTaskStatus.HAS_FINISHED) {
|
|
|
task.setStatus(CrowdTestTaskStatus.HAS_TIME_OUT);
|
|
@@ -788,23 +673,99 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return userDataDTO;
|
|
|
}
|
|
|
|
|
|
- public CrowdProjectVO changeApplicationType(CrowdProjectVO projectVO, Map<String, String> applicationMap) {
|
|
|
+ /**
|
|
|
+ * 项目领域、应用、测试类型的转换
|
|
|
+ * @param projectVO
|
|
|
+ * @param applicationMap
|
|
|
+ * @param fieldMap
|
|
|
+ * @param testMap
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public CrowdProjectVO changeFieldAndApplicationAndTestType(CrowdProjectVO projectVO, Map<String, String> applicationMap
|
|
|
+ , Map<String, String> fieldMap, Map<String, String> testMap) {
|
|
|
+ // 领域类型值的转换
|
|
|
+ projectVO.setField(fieldMap.get(projectVO.getField()));
|
|
|
// 应用类型值的转换
|
|
|
- String applicationName = applicationMap.get(projectVO.getPlatform());
|
|
|
- projectVO.setPlatform(applicationName);
|
|
|
+ projectVO.setPlatform(applicationMap.get(projectVO.getPlatform()));
|
|
|
+ // 测试类型值的转换
|
|
|
+ projectVO.setType(projectVO.getType().stream().map(testType -> testMap.get(testType)).collect(Collectors.toList()));
|
|
|
return projectVO;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public CrowdTestProject changeFieldAndApplicationAndTestType(CrowdTestProject project, Map<String, String> applicationMap
|
|
|
+ , Map<String, String> fieldMap, Map<String, String> testMap) {
|
|
|
+ // 领域类型值的转换
|
|
|
+ project.setFieldType(fieldMap.get(project.getFieldType()));
|
|
|
+ // 应用类型值的转换
|
|
|
+ project.setApplicationType(applicationMap.get(project.getApplicationType()));
|
|
|
+ // 测试类型值的转换
|
|
|
+ if(project.getType().contains("[")){
|
|
|
+ List<String> testTypeCodeList = (List<String>)JSONArray.parse(project.getType());
|
|
|
+ project.setType(testTypeCodeList.stream().map(testType -> '"'+ testMap.get(testType) + '"').collect(Collectors.toList()).toString());
|
|
|
+ }else{
|
|
|
+ project.setType(testMap.get(project.getType()));
|
|
|
+ }
|
|
|
+ return project;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CrowdTestTask changeFieldAndApplicationAndTestTypeByTask(CrowdTestTask task, Map<String, String> applicationMap
|
|
|
+ , Map<String, String> fieldMap, Map<String, String> testMap) {
|
|
|
+ // 领域类型值的转换
|
|
|
+ task.setFieldType(fieldMap.get(task.getFieldType()));
|
|
|
+ // 应用类型值的转换
|
|
|
+ task.setApplicationType(applicationMap.get(task.getApplicationType()));
|
|
|
+ // 测试类型值的转换
|
|
|
+ task.setType(testMap.get(task.getType()));
|
|
|
+ return task;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CrowdTestTask changeTypeByProjectAndTask(CrowdTestProject project, CrowdTestTask task, Map<String, String> applicationMap
|
|
|
+ , Map<String, String> fieldMap, Map<String, String> testMap) {
|
|
|
+ // 获取项目的领域、应用类型赋值给任务
|
|
|
+ task.setFieldType(project.getFieldType());
|
|
|
+ task.setApplicationType(project.getApplicationType());
|
|
|
+ // 领域类型值的转换
|
|
|
+ task.setFieldType(fieldMap.get(task.getFieldType()));
|
|
|
+ // 应用类型值的转换
|
|
|
+ task.setApplicationType(applicationMap.get(task.getApplicationType()));
|
|
|
+ // 测试类型值的转换
|
|
|
+ task.setType(testMap.get(task.getType()));
|
|
|
+ return task;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CrowdTestTask changeTypeByProjectAndTask(CrowdTestProject project, CrowdTestTask task) {
|
|
|
+ // 获取领域、应用、测试类型code 和 name 的map
|
|
|
+ Map<String, String> fieldMap = commonRepo.getFieldCodeNameMap();
|
|
|
+ Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
+ Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+
|
|
|
+ // 获取项目的领域、应用类型赋值给任务
|
|
|
+ task.setFieldType(project.getFieldType());
|
|
|
+ task.setApplicationType(project.getApplicationType());
|
|
|
+ // 领域类型值的转换
|
|
|
+ task.setFieldType(fieldMap.get(task.getFieldType()));
|
|
|
+ // 应用类型值的转换
|
|
|
+ task.setApplicationType(applicationMap.get(task.getApplicationType()));
|
|
|
+ // 测试类型值的转换
|
|
|
+ task.setType(testMap.get(task.getType()));
|
|
|
+ return task;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public TaskSquareDTO renderTaskSquare() {
|
|
|
- Map<String, String> typeMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
|
|
|
List<CrowdTaskVO> taskVOList = taskDao.findAllByIsDeleted(0).stream().map(crowdTestTaskPO -> {
|
|
|
CrowdTestTask task = CrowdTestProjectFactory.defaultTask();
|
|
|
BeanUtils.copyProperties(crowdTestTaskPO, task);
|
|
|
// 测试类型的转换
|
|
|
- task.setType(typeMap.get(task.getType()));
|
|
|
+ task.setType(testMap.get(task.getType()));
|
|
|
return task;
|
|
|
}).collect(Collectors.toList()).stream().filter(crowdTestTask -> crowdTestTask.getStatus() == CrowdTestTaskStatus.HAS_RELEASED ||
|
|
|
(crowdTestTask.getStatus() == CrowdTestTaskStatus.HAS_RECEIVED && crowdTestTask.getFullStatus() == CrowdTestTaskAcceptStatus.NOT_FULL))
|
|
@@ -818,8 +779,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public ProjectDetailsDTO renderProjectDetails(CrowdTestProject project, User user) {
|
|
|
|
|
|
+ Map<String, String> fieldMap = commonRepo.getFieldCodeNameMap();
|
|
|
Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
- Map<String, String> typeMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+
|
|
|
boolean saveFlag = false;
|
|
|
// 判断项目是否截止
|
|
|
if (project.getDeadTime().getTime() <= System.currentTimeMillis() && project.getStatus() < CrowdTestProjectStatus.HAS_FINISHED) {
|
|
@@ -837,15 +800,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
saveFlag = true;
|
|
|
}
|
|
|
|
|
|
+ // 类型的转换
|
|
|
+ this.changeTypeByProjectAndTask(project, crowdTestTask, applicationMap, fieldMap, testMap);
|
|
|
CrowdTaskVO crowdTaskVO = new CrowdTaskVO(crowdTestTask);
|
|
|
if (crowdTestTask.getDistributionType() == 0) {
|
|
|
EvaluationAgencyPO agencyPO = agencyDao.findByUserId(crowdTestTask.getEvaluationAgencyId());
|
|
|
crowdTaskVO.setInstitution(agencyPO == null ? "该机构已注销" : agencyPO.getEvaluationAgencyName());
|
|
|
}
|
|
|
- // 测试类型的转换
|
|
|
- crowdTaskVO.setServiceType(typeMap.get(crowdTaskVO.getServiceType()));
|
|
|
-// String typeName = commonRepo.getTypeNameByCode(crowdTaskVO.getServiceType());
|
|
|
-// crowdTaskVO.setServiceType(typeName);
|
|
|
taskVOList.add(crowdTaskVO);
|
|
|
}
|
|
|
|
|
@@ -865,22 +826,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
progress.add(new PieChartDataVO("进行中", crowdTestTaskList
|
|
|
.stream().filter(task -> task.getStatus() > CrowdTestTaskStatus.HAS_CREATED && task.getStatus() < CrowdTestTaskStatus.HAS_FINISHED).count()));
|
|
|
|
|
|
- // 应用类型值的转换
|
|
|
- projectVO = changeApplicationType(projectVO, applicationMap);
|
|
|
-
|
|
|
- // 领域类型值的转换
|
|
|
-
|
|
|
- Optional<FieldPO> fieldPO = fieldDao.findByCode(projectVO.getField());
|
|
|
- if (fieldPO.isPresent()) {
|
|
|
- projectVO.setField(fieldPO.get().getName());
|
|
|
- } else {
|
|
|
- throw new HttpBadRequestException("领域类型有误");
|
|
|
- }
|
|
|
-
|
|
|
- // 测试类型的转换
|
|
|
- List<String> testStringList = projectVO.getType().stream().map(testType -> typeMap.get(testType)).collect(Collectors.toList());
|
|
|
-
|
|
|
- projectVO.setType(testStringList);
|
|
|
+ // 项目类型值的转换
|
|
|
+ projectVO = changeFieldAndApplicationAndTestType(projectVO, applicationMap, fieldMap, testMap);
|
|
|
|
|
|
projectDetailsDTO.setProjectDetails(projectVO);
|
|
|
projectDetailsDTO.setTaskList(taskVOList);
|
|
@@ -900,7 +847,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
.stream().filter(crowdTestTask -> crowdTestTask.getCode().equals(taskCode)).findFirst();
|
|
|
if (!task.isPresent())
|
|
|
throw new CrowdTestTaskNotExistException();
|
|
|
- System.out.println("renderTaskReportDetails userID: " + userId);
|
|
|
+ log.info("renderTaskReportDetails userID: " + userId);
|
|
|
User user = userRepo.getByID(userId);
|
|
|
ReportDetailsDTO reportDetailsDTO = new ReportDetailsDTO();
|
|
|
if (userId.equals(projectRepo.getByProjectCode(projectCode).getRegionalManagerId())) {
|
|
@@ -949,6 +896,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public TaskDetailsDTO renderTaskDetails(String projectCode, String taskCode, Long userId) {
|
|
|
+// Map<String, String> fieldMap = commonRepo.getFieldCodeNameMap();
|
|
|
+// Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
+// Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+
|
|
|
TaskDetailsDTO taskDetailsDTO = new TaskDetailsDTO();
|
|
|
CrowdTestProject project = projectRepo.getByProjectCode(projectCode);
|
|
|
|
|
@@ -963,23 +914,27 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
if (!task.isPresent())
|
|
|
throw new CrowdTestTaskNotExistException();
|
|
|
|
|
|
+ CrowdTestTask crowdTestTask = task.get();
|
|
|
+
|
|
|
// 判断任务是否截止
|
|
|
- if (task.get().getDeadTime().getTime() <= System.currentTimeMillis() && task.get().getStatus() < CrowdTestTaskStatus.HAS_FINISHED) {
|
|
|
- task.get().setStatus(CrowdTestTaskStatus.HAS_TIME_OUT);
|
|
|
+ if (crowdTestTask.getDeadTime().getTime() <= System.currentTimeMillis() && crowdTestTask.getStatus() < CrowdTestTaskStatus.HAS_FINISHED) {
|
|
|
+ crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_TIME_OUT);
|
|
|
saveFlag = true;
|
|
|
}
|
|
|
|
|
|
- CrowdTaskVO taskVO = new CrowdTaskVO(task.get());
|
|
|
- // 测试类型的转换
|
|
|
-// String typeName = commonRepo.getTypeNameByCode(taskVO.getServiceType());
|
|
|
-// taskVO.setServiceType(typeName);
|
|
|
+ // 获取项目的领域、应用类型赋值给任务
|
|
|
+ crowdTestTask.setFieldType(project.getFieldType());
|
|
|
+ crowdTestTask.setApplicationType(project.getApplicationType());
|
|
|
+
|
|
|
+// this.changeTypeByProjectAndTask(project, crowdTestTask, applicationMap, fieldMap, testMap);
|
|
|
+ CrowdTaskVO taskVO = new CrowdTaskVO(crowdTestTask);
|
|
|
|
|
|
log.info("renderTaskDetails userId:" + userId);
|
|
|
if (userId == null) {
|
|
|
- taskDetailsDTO.setTaskOperationControl(this.initTaskPermission(project, task.get(), null));
|
|
|
+ taskDetailsDTO.setTaskOperationControl(this.initTaskPermission(project, crowdTestTask, null));
|
|
|
} else {
|
|
|
User user = userRepo.getByID(userId);
|
|
|
- taskDetailsDTO.setTaskOperationControl(this.initTaskPermission(project, task.get(), user));
|
|
|
+ taskDetailsDTO.setTaskOperationControl(this.initTaskPermission(project, crowdTestTask, user));
|
|
|
// 区域管理员视图
|
|
|
List<TaskToUserVO> taskToUserVOS = new ArrayList<>();
|
|
|
if (userId.equals(project.getRegionalManagerId())) {
|
|
@@ -989,7 +944,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
taskVO.setEndPointVO(new EndPointVO(Converter.convert(EndPoint.class, endPointPO.get())));
|
|
|
}
|
|
|
|
|
|
- taskToUserVOS = task.get().getAcceptedUserList().stream().map(taskToUser -> {
|
|
|
+ taskToUserVOS = crowdTestTask.getAcceptedUserList().stream().map(taskToUser -> {
|
|
|
TaskToUserVO taskToUserVO = new TaskToUserVO(taskToUser);
|
|
|
taskToUserVO.setUserVO(Converter.convert(UserVO.class, taskToUser.getUser()));
|
|
|
// 获取每个人员的报告信息
|
|
@@ -1007,7 +962,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
// if(!taskToUserOptional.isPresent())
|
|
|
// throw new HttpBadRequestException("当前用户没有接收此任务!");
|
|
|
|
|
|
- taskToUserVOS = task.get().getAcceptedUserList().stream()
|
|
|
+ taskToUserVOS = crowdTestTask.getAcceptedUserList().stream()
|
|
|
.filter(taskToUser -> taskToUser.getUserId().equals(userId)).map(taskToUser -> {
|
|
|
TaskToUserVO taskToUserVO = new TaskToUserVO(taskToUser);
|
|
|
taskToUserVO.setUserVO(Converter.convert(UserVO.class, taskToUser.getUser()));
|
|
@@ -1028,7 +983,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
taskDetailsDTO.setAcceptedUserList(taskToUserVOS);
|
|
|
|
|
|
- Optional<EndPointPO> endPointPOOptional = endPointDao.findByTaskCode(task.get().getCode());
|
|
|
+ Optional<EndPointPO> endPointPOOptional = endPointDao.findByTaskCode(crowdTestTask.getCode());
|
|
|
// 判断是否具有配置项,提供跳转url
|
|
|
if(endPointPOOptional.isPresent()){
|
|
|
// 获取测试类型对应的跳转url
|
|
@@ -1110,91 +1065,90 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public List<BaseAuthVO> renderAuthingList() {
|
|
|
- List<BaseAuthVO> authingList = new ArrayList<>();
|
|
|
- authingList.addAll(personalAuthenticationDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream().map(personalAuthenticationPO -> {
|
|
|
+ List<BaseAuthVO> resultList = new ArrayList<>();
|
|
|
+ resultList.addAll(personalAuthenticationDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream().map(personalAuthenticationPO -> {
|
|
|
PersonalAuthentication personalAuthentication = new PersonalAuthentication();
|
|
|
BeanUtils.copyProperties(personalAuthenticationPO, personalAuthentication);
|
|
|
return new BaseAuthVO(personalAuthentication);
|
|
|
}).collect(Collectors.toList()));
|
|
|
|
|
|
-// authingList.addAll(enterpriseAuthenticationDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream().map(enterpriseAuthenticationPO -> {
|
|
|
+// resultList.addAll(enterpriseAuthenticationDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream().map(enterpriseAuthenticationPO -> {
|
|
|
// EnterpriseAuthentication enterpriseAuthentication = new EnterpriseAuthentication();
|
|
|
// BeanUtils.copyProperties(enterpriseAuthenticationPO, enterpriseAuthentication);
|
|
|
// return new BaseAuthVO(enterpriseAuthentication);
|
|
|
// }).collect(Collectors.toList()));
|
|
|
|
|
|
- authingList.addAll(agencyDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream().map(evaluationAgencyPO -> {
|
|
|
+ resultList.addAll(agencyDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream().map(evaluationAgencyPO -> {
|
|
|
EvaluationAgency agency = new EvaluationAgency();
|
|
|
BeanUtils.copyProperties(evaluationAgencyPO, agency);
|
|
|
return new BaseAuthVO(agency);
|
|
|
}).collect(Collectors.toList()));
|
|
|
- if(authingList.size() > 0 && authingList != null) {
|
|
|
- authingList.sort(Comparator.comparing(BaseAuthVO::getApplytime).reversed());
|
|
|
+ if(resultList.size() > 0 && resultList != null) {
|
|
|
+ resultList.sort(Comparator.comparing(BaseAuthVO::getApplytime).reversed());
|
|
|
}
|
|
|
- return authingList;
|
|
|
+ return resultList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<BaseAuthVO> renderAuthedList() {
|
|
|
- List<BaseAuthVO> authingList = new ArrayList<>();
|
|
|
- authingList.addAll(personalAuthenticationDao.findByIsAuthenticationIsNot(AuthenticationStatus.isAuthenIng).stream().map(personalAuthenticationPO -> {
|
|
|
+ List<BaseAuthVO> resultList = new ArrayList<>();
|
|
|
+ resultList.addAll(personalAuthenticationDao.findByIsAuthenticationIsNot(AuthenticationStatus.isAuthenIng).stream().map(personalAuthenticationPO -> {
|
|
|
PersonalAuthentication personalAuthentication = new PersonalAuthentication();
|
|
|
BeanUtils.copyProperties(personalAuthenticationPO, personalAuthentication);
|
|
|
return new BaseAuthVO(personalAuthentication);
|
|
|
}).collect(Collectors.toList()));
|
|
|
|
|
|
-// authingList.addAll(enterpriseAuthenticationDao.findByIsAuthenticationIsNot(AuthenticationStatus.isAuthenIng).stream().map(enterpriseAuthenticationPO -> {
|
|
|
+// resultList.addAll(enterpriseAuthenticationDao.findByIsAuthenticationIsNot(AuthenticationStatus.isAuthenIng).stream().map(enterpriseAuthenticationPO -> {
|
|
|
// EnterpriseAuthentication enterpriseAuthentication = new EnterpriseAuthentication();
|
|
|
// BeanUtils.copyProperties(enterpriseAuthenticationPO, enterpriseAuthentication);
|
|
|
// return new BaseAuthVO(enterpriseAuthentication);
|
|
|
// }).collect(Collectors.toList()));
|
|
|
|
|
|
- authingList.addAll(agencyDao.findByIsAuthenticationIsNot(AuthenticationStatus.isAuthenIng).stream().map(evaluationAgencyPO -> {
|
|
|
+ resultList.addAll(agencyDao.findByIsAuthenticationIsNot(AuthenticationStatus.isAuthenIng).stream().map(evaluationAgencyPO -> {
|
|
|
EvaluationAgency agency = new EvaluationAgency();
|
|
|
BeanUtils.copyProperties(evaluationAgencyPO, agency);
|
|
|
return new BaseAuthVO(agency);
|
|
|
}).collect(Collectors.toList()));
|
|
|
- if(authingList.size() > 0 && authingList != null){
|
|
|
- authingList.sort(Comparator.comparing(BaseAuthVO::getApplytime).reversed());
|
|
|
+ if(resultList.size() > 0 && resultList != null){
|
|
|
+ resultList.sort(Comparator.comparing(BaseAuthVO::getApplytime).reversed());
|
|
|
}
|
|
|
- return authingList;
|
|
|
+ return resultList;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<CrowdTestProjectVO> findByNameLike(String name) {
|
|
|
Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
- List<CrowdTestProjectVO> authingList = new ArrayList<>();
|
|
|
- authingList.addAll(projectDao.findByNameLikeAndIsDeleted("%" + name + "%", DeletedStatus.isNotDeleted).stream().map(crowdTestProjectPO -> {
|
|
|
- CrowdTestProject crowdTestProject = new CrowdTestProject();
|
|
|
- BeanUtils.copyProperties(crowdTestProjectPO, crowdTestProject);
|
|
|
+ List<CrowdTestProjectVO> resultList = new ArrayList<>();
|
|
|
+ resultList.addAll(projectRepo.findByNameLike("%" + name + "%").stream().map(crowdTestProject -> {
|
|
|
// 项目测试类型转换
|
|
|
CrowdTestProjectVO crowdTestProjectVO = new CrowdTestProjectVO(crowdTestProject);
|
|
|
- crowdTestProjectVO.setApplicationType(applicationMap.get(crowdTestProjectPO.getApplicationType()));
|
|
|
+ crowdTestProjectVO.setApplicationType(applicationMap.get(crowdTestProject.getApplicationType()));
|
|
|
return crowdTestProjectVO;
|
|
|
}).collect(Collectors.toList()).stream().sorted(Comparator.comparing(CrowdTestProjectVO::getCreateTime).reversed()).collect(Collectors.toList()));
|
|
|
- return authingList;
|
|
|
+ return resultList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查看所有测试任务相关
|
|
|
+ * @param name
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public List<CrowdTaskVO> findTaskByNameLike(String name) {
|
|
|
- List<CrowdTaskVO> authingList = new ArrayList<>();
|
|
|
- authingList.addAll(taskDao.findByNameLike("%" + name + "%").stream().map(crowdTestTaskPO -> {
|
|
|
+ Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ return taskRepo.findByNameLikeAndIsDeleted("%" + name +"%", DeletedStatus.isNotDeleted).stream().map(crowdTestTask -> {
|
|
|
//根据code值查询出来该任务的type
|
|
|
- Optional<TestTypePO> serviceType = testTypeDao.findByCode(crowdTestTaskPO.getType());
|
|
|
- CrowdTestTask crowdTestTask = new CrowdTestTask();
|
|
|
- BeanUtils.copyProperties(crowdTestTaskPO, crowdTestTask);
|
|
|
- crowdTestTask.setType(serviceType.get().getName());
|
|
|
+ crowdTestTask.setType(testMap.get(crowdTestTask.getType()));
|
|
|
return new CrowdTaskVO(crowdTestTask);
|
|
|
- }).collect(Collectors.toList()).stream().sorted(Comparator.comparing(CrowdTaskVO::getCreateTime).reversed()).collect(Collectors.toList()));
|
|
|
- return authingList;
|
|
|
+ }).sorted(Comparator.comparing(CrowdTaskVO::getStatus).thenComparing(CrowdTaskVO::getCreateTime)).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<CrowdTestProjectVO> AllByPage(){
|
|
|
- List<CrowdTestProjectVO> authingList = new ArrayList<>();
|
|
|
+ List<CrowdTestProjectVO> resultList = new ArrayList<>();
|
|
|
Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
- authingList.addAll(projectDao.findAll().stream().map(crowdTestProjectPO ->{
|
|
|
+ resultList.addAll(projectDao.findAll().stream().map(crowdTestProjectPO ->{
|
|
|
CrowdTestProject crowdTestProject = new CrowdTestProject();
|
|
|
BeanUtils.copyProperties(crowdTestProjectPO, crowdTestProject);
|
|
|
themeStatusService.updateStatus(crowdTestProject);
|
|
@@ -1203,7 +1157,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
crowdTestProjectVO.setApplicationType(applicationMap.get(crowdTestProjectPO.getApplicationType()));
|
|
|
return crowdTestProjectVO;
|
|
|
}).collect(Collectors.toList()));
|
|
|
- return authingList;
|
|
|
+ return resultList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1211,37 +1165,12 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<CrowdTestProjectVO> hotCrowdTestProjects() {
|
|
|
- List<CrowdTestProjectVO> authingList = new ArrayList<>();
|
|
|
- authingList.addAll(projectDao.findall().stream().map(crowdTestProjectPO -> {
|
|
|
- CrowdTestProject crowdTestProject = new CrowdTestProject();
|
|
|
- BeanUtils.copyProperties(crowdTestProjectPO, crowdTestProject);
|
|
|
- return new CrowdTestProjectVO(crowdTestProject);
|
|
|
- }).collect(Collectors.toList()));
|
|
|
- return authingList;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- //众测广场首页6条项目
|
|
|
- public List<CrowdTestProjectVO> indexCrowdTestProjects() {
|
|
|
- List<CrowdTestProjectVO> authingList = new ArrayList<>();
|
|
|
- authingList.addAll(projectDao.findindexProject().stream().map(crowdTestProjectPO -> {
|
|
|
- CrowdTestProject crowdTestProject = new CrowdTestProject();
|
|
|
- BeanUtils.copyProperties(crowdTestProjectPO, crowdTestProject);
|
|
|
- // 应用类型值的转换
|
|
|
- Optional<ApplicationTypePO> applicationTypePO = applicationTypeDao.findByCode(crowdTestProject.getApplicationType());
|
|
|
- if (applicationTypePO.isPresent()) {
|
|
|
- crowdTestProject.setApplicationType(applicationTypePO.get().getName());
|
|
|
- } else {
|
|
|
- throw new HttpBadRequestException("应用类型有误");
|
|
|
- }
|
|
|
- return new CrowdTestProjectVO(crowdTestProject);
|
|
|
-
|
|
|
- }).collect(Collectors.toList()));
|
|
|
- return authingList;
|
|
|
+ public List<CrowdTestProjectVO> hotProjectCardLimitCount(int projectCount) {
|
|
|
+ List<CrowdTestProjectVO> resultList = new ArrayList<>();
|
|
|
+ resultList.addAll(projectRepo.findHotProjectCardLimitCount(projectCount).stream().map(CrowdTestProjectVO::new).collect(Collectors.toList()));
|
|
|
+ return resultList;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public List<CrowdTestProjectVO> crowdTestProjectsWaitingAccept() {
|
|
|
return projectDao.findAll().stream().filter(crowdTestProjectPO -> crowdTestProjectPO.getStatus() == CrowdTestProjectStatus.HAS_RELEASED
|
|
@@ -1284,42 +1213,44 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 众测广场首页展示的众测任务
|
|
|
+ * 众测广场首页展示的6个众测任务
|
|
|
* @return
|
|
|
+ * @param indexCount
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<CrowdTaskVO> crowdTaskVos(){
|
|
|
- List<CrowdTaskVO> authingList = new ArrayList<>();
|
|
|
- Map<String, String> typeMap = commonRepo.getTypeCodeNameMap();
|
|
|
- authingList.addAll(taskDao.findindexTask().stream().filter(crowdTestTaskPO -> crowdTestTaskPO.getDeadTime().getTime() > System.currentTimeMillis()).map(crowdTestTaskPO -> {
|
|
|
+ public List<CrowdTaskVO> findIndexTaskLimitCount(int indexCount){
|
|
|
+ List<CrowdTaskVO> resultList = new ArrayList<>();
|
|
|
+ Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+
|
|
|
+ resultList.addAll(taskDao.findIndexTaskLimitCount(indexCount).stream().filter(crowdTestTaskPO -> crowdTestTaskPO.getDeadTime().getTime() > System.currentTimeMillis()).map(crowdTestTaskPO -> {
|
|
|
CrowdTestTask crowdTestTask = new CrowdTestTask();
|
|
|
BeanUtils.copyProperties(crowdTestTaskPO, crowdTestTask);
|
|
|
- crowdTestTask.setType(typeMap.get(crowdTestTaskPO.getType()));
|
|
|
+ crowdTestTask.setType(testMap.get(crowdTestTaskPO.getType()));
|
|
|
return new CrowdTaskVO(crowdTestTask);
|
|
|
}).collect(Collectors.toList()));
|
|
|
- return authingList;
|
|
|
+ return resultList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<CrowdTaskVO> crowdTaskVOSByTestTypeCode(String testTypeCode) {
|
|
|
- Map<String, String> typeMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
return taskDao.findByType(testTypeCode).stream().map(crowdTestTaskPO -> {
|
|
|
CrowdTestTask crowdTestTask = new CrowdTestTask();
|
|
|
BeanUtils.copyProperties(crowdTestTaskPO, crowdTestTask);
|
|
|
- crowdTestTask.setType(typeMap.get(crowdTestTaskPO.getType()));
|
|
|
+ crowdTestTask.setType(testMap.get(crowdTestTaskPO.getType()));
|
|
|
return new CrowdTaskVO(crowdTestTask);
|
|
|
}).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
+ // ???
|
|
|
@Override
|
|
|
public List<CrowdTaskVO> crowdTaskVosWaitingAccept() {
|
|
|
- List<CrowdTestTaskPO> canAcceptTask = taskDao.findCanAcceptTask();
|
|
|
- List<CrowdTaskVO> taskVOList = canAcceptTask.stream().filter(crowdTestTaskPO -> crowdTestTaskPO.getDeadTime().getTime() > System.currentTimeMillis()).map(crowdTestTaskPO -> {
|
|
|
+ Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ List<CrowdTaskVO> taskVOList = taskDao.findCanAcceptTask().stream().filter(crowdTestTaskPO -> crowdTestTaskPO.getDeadTime().getTime() > System.currentTimeMillis()).map(crowdTestTaskPO -> {
|
|
|
//根据code值查询出来该任务的type
|
|
|
- Optional<TestTypePO> serviceType = testTypeDao.findByCode(crowdTestTaskPO.getType());
|
|
|
CrowdTestTask crowdTestTask = new CrowdTestTask();
|
|
|
BeanUtils.copyProperties(crowdTestTaskPO, crowdTestTask);
|
|
|
- crowdTestTask.setType(serviceType.get().getName());
|
|
|
+ crowdTestTask.setType(testMap.get(crowdTestTaskPO.getType()));
|
|
|
return new CrowdTaskVO(crowdTestTask);
|
|
|
}).collect(Collectors.toList());
|
|
|
return taskVOList;
|
|
@@ -1780,14 +1711,17 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
// 已发布:具有接收功能
|
|
|
taskOperationControl.setReceive(true);
|
|
|
// 定向发布:具有拒绝功能
|
|
|
- if (task.getDistributionType() == 0) {
|
|
|
+ if (task.getDistributionType() == DistributeType.DIRECT.getId()) {
|
|
|
taskOperationControl.setReject(true);
|
|
|
}
|
|
|
}
|
|
|
// 已接收用户
|
|
|
else if (task.getStatus() == CrowdTestTaskStatus.HAS_RECEIVED) {
|
|
|
- // 具有任务导出和上次报告功能
|
|
|
- taskOperationControl.setExportTask(true);
|
|
|
+ // 定向任务具有任务导出
|
|
|
+ if(task.getDistributionType() == DistributeType.DIRECT.getId()){
|
|
|
+ taskOperationControl.setExportTask(true);
|
|
|
+ }
|
|
|
+ // 上传报告功能
|
|
|
taskOperationControl.setUploadReport(true);
|
|
|
if (taskToUserOptional.get().getHasReport() == 1 && taskToUserOptional.get().getIsCommitted() == 0) {
|
|
|
taskOperationControl.setFinish(true);
|