|
@@ -58,6 +58,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private CrowdTestTaskDao taskDao;
|
|
|
|
|
|
@Autowired
|
|
|
+ private UserTaskCountDao userTaskCountDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private UserDao userDao;
|
|
|
|
|
|
@Autowired
|
|
@@ -114,17 +117,27 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public List<UserVO> renderMoreUser(Pageable pageable) {
|
|
|
//获取众测人员排名
|
|
|
- String agencyName = agencyDao.findById(Long.parseLong(agencyId)).get().getEvaluationAgencyName();
|
|
|
- List<UserVO> userVOS = 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());
|
|
|
+// String agencyName = agencyDao.findById(Long.parseLong(agencyId)).get().getEvaluationAgencyName();
|
|
|
+// List<UserVO> userVOS = 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> userVOS = userTaskCountDao.findByType(RoleType.EVALUATION_USER.getId())
|
|
|
+ .stream().sorted(Comparator.comparing(UserTaskCountPO::getCount)).collect(Collectors.toList())
|
|
|
+ .stream().map(userTaskCountPO -> {
|
|
|
+ User user = userRepo.getByIDJustInfo(userTaskCountPO.getUserId());
|
|
|
+ UserVO userVO = new UserVO(user);
|
|
|
+ userVO.setTaskCount(userTaskCountPO.getCount());
|
|
|
+ return userVO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
return userVOS;
|
|
|
}
|
|
|
|
|
@@ -190,70 +203,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public IndexInfoDTO renderIndexInfos() {
|
|
|
+ public IndexInfoDTO renderIndexInfosCache() {
|
|
|
IndexInfoDTO indexInfoDTO = new IndexInfoDTO();
|
|
|
- Pageable pageable = PageRequest.of(0, 3);
|
|
|
int top = 3;
|
|
|
- //获取热门众测
|
|
|
- List<ApplicationTypeVO> applicationTypeRank = projectDao.findTotalCountOfApplicationType(pageable).stream().map(rankInfos -> {
|
|
|
- ApplicationType applicationType = commonRepo.getApplicationTypeByAppCode(rankInfos.getCode());
|
|
|
- ApplicationTypeVO applicationTypeVO = new ApplicationTypeVO(applicationType);
|
|
|
- applicationTypeVO.setCount(rankInfos.getCount());
|
|
|
- return applicationTypeVO;
|
|
|
- }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
- List<ApplicationTypeVO> applicationTypeRanks = new ArrayList<>();
|
|
|
- if (applicationTypeRanks.size() > top) {
|
|
|
- for (int i = 0; i < top; i++) {
|
|
|
- applicationTypeRanks.add(applicationTypeRank.get(i));
|
|
|
- }
|
|
|
- } else {
|
|
|
- applicationTypeRanks = applicationTypeRank;
|
|
|
- }
|
|
|
-
|
|
|
- //获取机构排名
|
|
|
- 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 = 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 = new ArrayList<>();
|
|
|
- if (userRank.size() > top) {
|
|
|
- for (int i = 0; i < top; i++) {
|
|
|
- userRanks.add(userRank.get(i));
|
|
|
- }
|
|
|
- } else {
|
|
|
- userRanks = userRank;
|
|
|
- }
|
|
|
-
|
|
|
// 获取大赛信息
|
|
|
List<Competition> competitionList = commonRepo.getAllCompetition();
|
|
|
List<Competition> competitionLists = new ArrayList<>();
|
|
@@ -278,17 +230,18 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}).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<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();
|
|
@@ -297,21 +250,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return fieldVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
- // 获取资源和工具
|
|
|
- List<Resource> resourceList = commonRepo.getAllResource();
|
|
|
- List<ResourceVO> resourceVOS = resourceList.stream().map(resource -> {
|
|
|
- ResourceVO resourceVO = new ResourceVO(resource);
|
|
|
- return resourceVO;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
// 获取入驻品牌机构
|
|
|
- List<Partner> partnerList = commonRepo.getAllPartner();
|
|
|
- List<PartnerVO> partnerVOS = partnerList.stream().map(partner -> {
|
|
|
- PartnerVO partnerVO = new PartnerVO(partner);
|
|
|
- return partnerVO;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
- // 获取合作机构
|
|
|
List<ResidentAgency> allResidentAgency = commonRepo.getAllResidentAgency();
|
|
|
List<EvaluationAgencyVO> agencyVOS = allResidentAgency.stream().map(residentAgency -> {
|
|
|
EvaluationAgency agency = evaluationAgencyRepo.findAgencyById(residentAgency.getAgencyId());
|
|
@@ -319,16 +258,123 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return evalutionAgencyVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
- indexInfoDTO.setApplicationTypeRank(applicationTypeRanks);
|
|
|
- indexInfoDTO.setAgencyRank(agencyRanks);
|
|
|
- indexInfoDTO.setUserRank(userRanks);
|
|
|
+ // 获取合作机构
|
|
|
+// 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.setResourceList(resourceVOS);
|
|
|
indexInfoDTO.setResidentAgencyList(agencyVOS);
|
|
|
- indexInfoDTO.setPartnerList(partnerVOS);
|
|
|
+// indexInfoDTO.setPartnerList(partnerVOS);
|
|
|
+ return indexInfoDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IndexInfoDTO renderIndexInfos() {
|
|
|
+ IndexInfoDTO indexInfoDTO = new IndexInfoDTO();
|
|
|
+ Pageable pageable = PageRequest.of(0, 3);
|
|
|
+ int top = 3;
|
|
|
+ //获取热门众测
|
|
|
+ List<ApplicationTypeVO> applicationTypeRank = projectDao.findTotalCountOfApplicationType(pageable).stream().map(rankInfos -> {
|
|
|
+ ApplicationType applicationType = commonRepo.getApplicationTypeByAppCode(rankInfos.getCode());
|
|
|
+ ApplicationTypeVO applicationTypeVO = new ApplicationTypeVO(applicationType);
|
|
|
+ applicationTypeVO.setCount(rankInfos.getCount());
|
|
|
+ return applicationTypeVO;
|
|
|
+ }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ List<ApplicationTypeVO> applicationTypeRanks = new ArrayList<>();
|
|
|
+ if (applicationTypeRanks.size() > top) {
|
|
|
+ for (int i = 0; i < top; i++) {
|
|
|
+ applicationTypeRanks.add(applicationTypeRank.get(i));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ applicationTypeRanks = applicationTypeRank;
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取机构排名
|
|
|
+// 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)).limit(top).collect(Collectors.toList())
|
|
|
+ .stream().map(userTaskCountPO -> {
|
|
|
+ EvaluationAgencyPO agency = agencyDao.findByUserId(userTaskCountPO.getUserId());
|
|
|
+ EvaluationAgencyVO agencyVO = new EvaluationAgencyVO();
|
|
|
+ agencyVO.setAgencyPhoto(agency.getAgencyPhoto());
|
|
|
+ agencyVO.setTaskCount(userTaskCountPO.getCount());
|
|
|
+ agencyVO.setId(agency.getId());
|
|
|
+ agencyVO.setUserId(agency.getUserId());
|
|
|
+ agencyVO.setEvaluationAgencyName(agency.getEvaluationAgencyName());
|
|
|
+ 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)).limit(top).collect(Collectors.toList())
|
|
|
+ .stream().map(userTaskCountPO -> {
|
|
|
+ User user = userRepo.getByIDJustInfo(userTaskCountPO.getUserId());
|
|
|
+ UserVO userVO = new UserVO(user);
|
|
|
+ userVO.setTaskCount(userTaskCountPO.getCount());
|
|
|
+ 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 = resourceList.stream().map(resource -> {
|
|
|
+ ResourceVO resourceVO = new ResourceVO(resource);
|
|
|
+ return resourceVO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ indexInfoDTO.setApplicationTypeRank(applicationTypeRanks);
|
|
|
+ indexInfoDTO.setAgencyRank(agencyRanks);
|
|
|
+ indexInfoDTO.setUserRank(userRanks);
|
|
|
+ indexInfoDTO.setResourceList(resourceVOS);
|
|
|
+
|
|
|
return indexInfoDTO;
|
|
|
}
|
|
|
|