|
@@ -113,20 +113,18 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<UserVO> renderMoreUser(Pageable pageable) {
|
|
public List<UserVO> renderMoreUser(Pageable pageable) {
|
|
- List<UserVO> userVOS = new ArrayList<>();
|
|
|
|
- List<RankCountInfo> rankCountInfos = taskToUserDao.findTotalCountOfUser();
|
|
|
|
- long[] ids = new long[rankCountInfos.size()];
|
|
|
|
- for (int i = 0; i < rankCountInfos.size(); i++) {
|
|
|
|
- if (userDao.findById(rankCountInfos.get(i).getEntityId()).isPresent()) {
|
|
|
|
- ids[i] = rankCountInfos.get(i).getEntityId();
|
|
|
|
- Optional<UserPO> userPO = userDao.findById(ids[i]);
|
|
|
|
- User user = new User(userPO.get());
|
|
|
|
|
|
+ //获取众测人员排名
|
|
|
|
+ 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 userVO = new UserVO(user);
|
|
- userVO.setTaskCount(rankCountInfos.get(i).getCount());
|
|
|
|
- userVOS.add(userVO);
|
|
|
|
|
|
+ userVO.setTaskCount(rankInfo.getCount());
|
|
|
|
+ return userVO;
|
|
}
|
|
}
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ return null;
|
|
|
|
+ }).filter(Objects::nonNull).collect(Collectors.toList());
|
|
return userVOS;
|
|
return userVOS;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -495,6 +493,57 @@ public class WebMediatorImpl implements ViewMediator {
|
|
return myCrowdDTO;
|
|
return myCrowdDTO;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public UserDataDTO renderMyCrowdData(Long userId) {
|
|
|
|
+ UserDataDTO userDataDTO = new UserDataDTO();
|
|
|
|
+ User user = userRepo.getByID(userId);
|
|
|
|
+ //我的众测 - 项目相关信息
|
|
|
|
+ //获取我创建的项目列表
|
|
|
|
+ List<CrowdProjectDataVO> myProjects = projectDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted).stream().map(CrowdTestProject::new).collect(Collectors.toList())
|
|
|
|
+ .stream().map(CrowdProjectDataVO::new).collect(Collectors.toList());
|
|
|
|
+ UserVO userVO = new UserVO(user);
|
|
|
|
+ userDataDTO.setMyProjects(myProjects);
|
|
|
|
+ userDataDTO.setUserVO(userVO);
|
|
|
|
+ if (user.getRoleList().stream().noneMatch(role -> role.getName().equals("evaluationAgency")))
|
|
|
|
+ return userDataDTO;
|
|
|
|
+ List<CrowdTestTask> allTaskOfAgency = null;
|
|
|
|
+ List<CrowdTestTask> unfinishedTasks = null;
|
|
|
|
+ List<CrowdTestTask> finishedTasks = null;
|
|
|
|
+ if (user.getRoleList().stream().anyMatch(role -> role.getName().equals("evaluationAgency"))) {
|
|
|
|
+ List<TaskToUserPO> taskToUserPOS = taskToUserDao.findByUserId(user.getId());
|
|
|
|
+ if (taskToUserPOS != null && taskToUserPOS.size() > 0) {
|
|
|
|
+ allTaskOfAgency = taskToUserPOS.stream().sorted(Comparator.comparing(TaskToUserPO::getAcceptTime))
|
|
|
|
+ .map(taskToUserPO -> {
|
|
|
|
+ CrowdTestTaskPO crowdTestTaskPO = taskDao.findByCodeAndIsDeleted(taskToUserPO.getTaskCode(), DeletedStatus.isNotDeleted);
|
|
|
|
+ if (crowdTestTaskPO != null) {
|
|
|
|
+ CrowdTestTask task = new CrowdTestTask();
|
|
|
|
+ BeanUtils.copyProperties(crowdTestTaskPO, task);
|
|
|
|
+
|
|
|
|
+ // 测试类型的转换
|
|
|
|
+ Optional<TestTypePO> testTypePO = testTypeDao.findByCode(task.getType());
|
|
|
|
+ if (!testTypePO.isPresent()) {
|
|
|
|
+ throw new HttpBadRequestException("请选择测试类型");
|
|
|
|
+ }
|
|
|
|
+ task.setType(testTypePO.get().getName());
|
|
|
|
+ CrowdTestTask taskDetail = projectRepo.getTaskDetail(task, user.getId());
|
|
|
|
+ return taskDetail;
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ unfinishedTasks = allTaskOfAgency.stream()
|
|
|
|
+ .filter(crowdTestTask -> crowdTestTask.getStatus() >= CrowdTestTaskStatus.HAS_RELEASED && crowdTestTask.getStatus() < CrowdTestTaskStatus.HAS_FINISHED)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ finishedTasks = allTaskOfAgency.stream()
|
|
|
|
+ .filter(crowdTestTask -> crowdTestTask.getStatus() == CrowdTestTaskStatus.HAS_FINISHED)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ userDataDTO.setFinishedTasks(finishedTasks);
|
|
|
|
+ userDataDTO.setUnfinishedTasks(unfinishedTasks);
|
|
|
|
+ return userDataDTO;
|
|
|
|
+ }
|
|
|
|
+
|
|
private CrowdProjectVO changeApplicationType(CrowdProjectVO projectVO) {
|
|
private CrowdProjectVO changeApplicationType(CrowdProjectVO projectVO) {
|
|
// 应用类型值的转换
|
|
// 应用类型值的转换
|
|
Optional<ApplicationTypePO> applicationTypePO = applicationTypeDao.findByCode(projectVO.getPlatform());
|
|
Optional<ApplicationTypePO> applicationTypePO = applicationTypeDao.findByCode(projectVO.getPlatform());
|