|
|
@@ -101,6 +101,14 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
IndexInfoDTO indexInfoDTO = new IndexInfoDTO();
|
|
|
Pageable pageable = PageRequest.of(0, 3);
|
|
|
int top = 3;
|
|
|
+ //获取热门众测
|
|
|
+ List<FieldVO> fieldRanks = projectDao.findTotalCountOfField(pageable).stream().map(fieldRankInfo -> {
|
|
|
+ Field field = commonRepo.getFieldByFieldCode(fieldRankInfo.getName());
|
|
|
+ FieldVO fieldVO = new FieldVO(field);
|
|
|
+ fieldVO.setCount(fieldRankInfo.getCount());
|
|
|
+ return fieldVO;
|
|
|
+ }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+
|
|
|
//获取机构排名
|
|
|
String agencyName = agencyDao.findById(Long.parseLong(agencyId)).get().getEvaluationAgencyName();
|
|
|
List<EvolutionAgencyVO> agencyRanks = taskToUserDao.findTotalCountOfUser().stream().map(rankInfo -> {
|
|
|
@@ -135,6 +143,16 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
userRanks = userRanks.subList(0,top);
|
|
|
}
|
|
|
|
|
|
+ // 获取大赛信息
|
|
|
+ List<Competition> competitionList = commonRepo.getAllCompetition();
|
|
|
+ if(competitionList.size() > top){
|
|
|
+ competitionList = competitionList.subList(0,top);
|
|
|
+ }
|
|
|
+ List<CompetitionVO> competitionVOS = competitionList.stream().map(competition -> {
|
|
|
+ CompetitionVO competitionVO = new CompetitionVO(competition);
|
|
|
+ return competitionVO;
|
|
|
+ }).sorted(Comparator.comparing(CompetitionVO::getStartTime).reversed()).collect(Collectors.toList());
|
|
|
+
|
|
|
// 获取服务类型
|
|
|
List<TestType> allTestType = commonRepo.getAllTestType();
|
|
|
List<TestTypeVO> testTypeVOS = allTestType.stream().map(testType -> {
|
|
|
@@ -162,16 +180,6 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return fieldVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
- // 获取大赛信息
|
|
|
- List<Competition> competitionList = commonRepo.getAllCompetition();
|
|
|
- if(competitionList.size() > top){
|
|
|
- competitionList = competitionList.subList(0,top);
|
|
|
- }
|
|
|
- List<CompetitionVO> competitionVOS = competitionList.stream().map(competition -> {
|
|
|
- CompetitionVO competitionVO = new CompetitionVO(competition);
|
|
|
- return competitionVO;
|
|
|
- }).sorted(Comparator.comparing(CompetitionVO::getStartTime).reversed()).collect(Collectors.toList());
|
|
|
-
|
|
|
// 获取资源和工具
|
|
|
List<Resource> resourceList = commonRepo.getAllResource();
|
|
|
List<ResourceVO> resourceVOS = resourceList.stream().map(resource -> {
|
|
|
@@ -196,6 +204,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
// Page<CrowdTestProjectPO> all = projectDao.findAll(pageable);
|
|
|
|
|
|
+ indexInfoDTO.setFieldRank(fieldRanks);
|
|
|
indexInfoDTO.setAgencyRank(agencyRanks);
|
|
|
indexInfoDTO.setUserRank(userRanks);
|
|
|
indexInfoDTO.setTestTypeList(testTypeVOS);
|