|
@@ -25,6 +25,7 @@ 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;
|
|
@@ -82,6 +83,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Autowired
|
|
|
private TaskToUserDao taskToUserDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CrowdTestProjectDao crowdTestProjectDao;
|
|
|
+
|
|
|
@Value("${agency}")
|
|
|
private String agencyId;
|
|
|
|
|
@@ -99,27 +103,32 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
public IndexInfoDTO renderIndexInfos() {
|
|
|
IndexInfoDTO indexInfoDTO = new IndexInfoDTO();
|
|
|
Pageable pageable = PageRequest.of(0, 3);
|
|
|
- //获取用户排名
|
|
|
- List<UserVO> userRanks = projectDao.findTotalPriceOfUser(pageable).stream().map(rankInfo -> {
|
|
|
- Optional<UserPO> userPO = userDao.findById(rankInfo.getEntityId());
|
|
|
- if (userPO.isPresent()) {
|
|
|
- UserVO userVO = new UserVO();
|
|
|
- userVO.setName(userPO.get().getName());
|
|
|
- userVO.setUserName(userPO.get().getUserName());
|
|
|
- userVO.setAllProjectPrice(rankInfo.getTotalPrice());
|
|
|
- return userVO;
|
|
|
- }
|
|
|
- return null;
|
|
|
- }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
//获取机构排名
|
|
|
String agencyName = agencyDao.findById(Long.parseLong(agencyId)).get().getEvaluationAgencyName();
|
|
|
- List<EvolutionAgencyVO> agencyRanks = taskToUserDao.findTotalPriceOfAgency(pageable).stream().map(rankInfo -> {
|
|
|
+ List<EvolutionAgencyVO> agencyRanks = taskToUserDao.findTotalCountOfUser(pageable).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.setAllTaskPrice(rankInfo.getTotalPrice());
|
|
|
+ agencyVO.setTaskCount(rankInfo.getCount());
|
|
|
+ agencyVO.setId(agency.getId());
|
|
|
+ agencyVO.setUserId(agency.getUserId());
|
|
|
+ return agencyVO;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //获取众测人员排名
|
|
|
+ List<EvolutionAgencyVO> userRanks = taskToUserDao.findTotalCountOfUser(pageable).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;
|
|
|
}
|
|
|
return null;
|
|
@@ -154,6 +163,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
// 获取大赛信息
|
|
|
List<Competition> competitionList = commonRepo.getAllCompetition();
|
|
|
+ if(competitionList.size() > 3){
|
|
|
+ competitionList = competitionList.subList(0,3);
|
|
|
+ }
|
|
|
List<CompetitionVO> competitionVOS = competitionList.stream().map(competition -> {
|
|
|
CompetitionVO competitionVO = new CompetitionVO(competition);
|
|
|
return competitionVO;
|
|
@@ -181,8 +193,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return evolutionAgencyVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
+ Page<CrowdTestProjectPO> all = crowdTestProjectDao.findAll(pageable);
|
|
|
+
|
|
|
indexInfoDTO.setAgencyRank(agencyRanks);
|
|
|
- indexInfoDTO.setUserRank(userRanks);
|
|
|
+// indexInfoDTO.setUserRank(userRanks);
|
|
|
indexInfoDTO.setTestTypeList(testTypeVOS);
|
|
|
indexInfoDTO.setApplicationTypeList(applicationTypeVOS);
|
|
|
indexInfoDTO.setFieldList(fieldVOS);
|