|
@@ -25,7 +25,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -101,9 +100,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
public IndexInfoDTO renderIndexInfos() {
|
|
|
IndexInfoDTO indexInfoDTO = new IndexInfoDTO();
|
|
|
Pageable pageable = PageRequest.of(0, 3);
|
|
|
+ int top = 3;
|
|
|
//获取机构排名
|
|
|
String agencyName = agencyDao.findById(Long.parseLong(agencyId)).get().getEvaluationAgencyName();
|
|
|
- List<EvolutionAgencyVO> agencyRanks = taskToUserDao.findTotalCountOfUser(pageable).stream().map(rankInfo -> {
|
|
|
+ List<EvolutionAgencyVO> agencyRanks = taskToUserDao.findTotalCountOfUser().stream().map(rankInfo -> {
|
|
|
EvaluationAgencyPO agency = agencyDao.findByUserId(rankInfo.getEntityId());
|
|
|
if (agency!=null && !agency.getEvaluationAgencyName().equals(agencyName)) {
|
|
|
EvolutionAgencyVO agencyVO = new EvolutionAgencyVO();
|
|
@@ -116,21 +116,24 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
return null;
|
|
|
}).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ if(agencyRanks.size() > top){
|
|
|
+ agencyRanks = agencyRanks.subList(0,top);
|
|
|
+ }
|
|
|
|
|
|
//获取众测人员排名
|
|
|
- List<EvolutionAgencyVO> userRanks = taskToUserDao.findTotalCountOfUser(pageable).stream().map(rankInfo -> {
|
|
|
+ List<UserVO> userRanks = taskToUserDao.findTotalCountOfUser().stream().map(rankInfo -> {
|
|
|
EvaluationAgencyPO agency = agencyDao.findByUserId(rankInfo.getEntityId());
|
|
|
if (agency!=null && agency.getEvaluationAgencyName().equals(agencyName)) {
|
|
|
- EvolutionAgencyVO agencyVO = new EvolutionAgencyVO();
|
|
|
- agencyVO.setName(agency.getEvaluationAgencyName());
|
|
|
- agencyVO.setLogo(agency.getAgencyPhoto());
|
|
|
- agencyVO.setTaskCount(rankInfo.getCount());
|
|
|
- agencyVO.setId(agency.getId());
|
|
|
- agencyVO.setUserId(agency.getUserId());
|
|
|
- return agencyVO;
|
|
|
+ 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());
|
|
|
+ if(userRanks.size() > top){
|
|
|
+ userRanks = userRanks.subList(0,top);
|
|
|
+ }
|
|
|
|
|
|
// 获取服务类型
|
|
|
List<TestType> allTestType = commonRepo.getAllTestType();
|
|
@@ -161,8 +164,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
// 获取大赛信息
|
|
|
List<Competition> competitionList = commonRepo.getAllCompetition();
|
|
|
- if(competitionList.size() > 3){
|
|
|
- competitionList = competitionList.subList(0,3);
|
|
|
+ if(competitionList.size() > top){
|
|
|
+ competitionList = competitionList.subList(0,top);
|
|
|
}
|
|
|
List<CompetitionVO> competitionVOS = competitionList.stream().map(competition -> {
|
|
|
CompetitionVO competitionVO = new CompetitionVO(competition);
|
|
@@ -191,10 +194,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return evolutionAgencyVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
- Page<CrowdTestProjectPO> all = projectDao.findAll(pageable);
|
|
|
+// Page<CrowdTestProjectPO> all = projectDao.findAll(pageable);
|
|
|
|
|
|
indexInfoDTO.setAgencyRank(agencyRanks);
|
|
|
-// indexInfoDTO.setUserRank(userRanks);
|
|
|
+ indexInfoDTO.setUserRank(userRanks);
|
|
|
indexInfoDTO.setTestTypeList(testTypeVOS);
|
|
|
indexInfoDTO.setApplicationTypeList(applicationTypeVOS);
|
|
|
indexInfoDTO.setFieldList(fieldVOS);
|