|
@@ -100,7 +100,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private ApplicationTypeDao applicationTypeDao;
|
|
|
|
|
|
@Autowired
|
|
|
- private ResourceDao resourceDao;
|
|
|
+ private ResourceDao resourceDao;
|
|
|
|
|
|
@Autowired
|
|
|
private ResourceTypeDao resourceTypeDao;
|
|
@@ -113,15 +113,15 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
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());
|
|
|
- UserVO userVO=new UserVO(user);
|
|
|
+ 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());
|
|
|
+ UserVO userVO = new UserVO(user);
|
|
|
userVO.setTaskCount(rankCountInfos.get(i).getCount());
|
|
|
userVOS.add(userVO);
|
|
|
}
|
|
@@ -132,7 +132,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public List<CrowdTaskVO> findMoreHotTasks() {
|
|
|
- List<CrowdTestTaskPO> list=taskDao.findMoreHotTasks();//已经根据创建时间排序好了。
|
|
|
+ List<CrowdTestTaskPO> list = taskDao.findMoreHotTasks();//已经根据创建时间排序好了。
|
|
|
List<CrowdTaskVO> hotMoreTestprojects = taskDao.findMoreHotTasks().stream().map(crowdTestTaskPO -> {
|
|
|
CrowdTestTask task = new CrowdTestTask();
|
|
|
BeanUtils.copyProperties(crowdTestTaskPO, task);
|
|
@@ -143,8 +143,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public List<CrowdTestProjectVO> findMoreHotProjects() {
|
|
|
- List<CrowdTestProjectPO> list=projectDao.findMoreHotProjects();//已经根据创建时间排序好了。
|
|
|
- //根据 参加人数倒序排序
|
|
|
+ List<CrowdTestProjectPO> list = projectDao.findMoreHotProjects();//已经根据创建时间排序好了。
|
|
|
+ //根据 参加人数倒序排序
|
|
|
List<CrowdTestProjectVO> hotMoreTestprojects = projectDao.findMoreHotProjects().stream().map(crowdTestProjectPO -> {
|
|
|
CrowdTestProject project = new CrowdTestProject();
|
|
|
BeanUtils.copyProperties(crowdTestProjectPO, project);
|
|
@@ -580,9 +580,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
// 领域类型值的转换
|
|
|
Optional<FieldPO> fieldPO = fieldDao.findByCode(projectVO.getField());
|
|
|
- if(fieldPO.isPresent()){
|
|
|
+ if (fieldPO.isPresent()) {
|
|
|
projectVO.setField(fieldPO.get().getName());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
throw new HttpBadRequestException("请选择领域类型");
|
|
|
}
|
|
|
|
|
@@ -910,7 +910,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public UserDTO updateInformation(long userId, UserVO userVO) {
|
|
|
Optional<UserPO> userPO = userDao.findById(userId);
|
|
|
- if(userVO.getUnit()==null||userVO.getUnit().length()<=0){
|
|
|
+ if (userVO.getUnit() == null || userVO.getUnit().length() <= 0) {
|
|
|
throw new HttpBadRequestException("请输入企业简称");
|
|
|
}
|
|
|
userPO.get().setUnit(userVO.getUnit());
|
|
@@ -1004,7 +1004,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
String result = restTemplate.getForObject(url, String.class);
|
|
|
JSONObject json = new JSONObject(result);
|
|
|
String validated = String.valueOf(json.get("validated"));
|
|
|
- if("false".equals(validated)){
|
|
|
+ if ("false".equals(validated)) {
|
|
|
throw new HttpBadRequestException("请输入正确的卡号");
|
|
|
}
|
|
|
String bank = String.valueOf(json.get("bank"));
|
|
@@ -1054,13 +1054,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
resourceVO.setRemarks(resourcePO.getRemarks());
|
|
|
resourceVOList.add(resourceVO);
|
|
|
});
|
|
|
- List<ResourceVO> results=resourceVOList.stream().sorted(Comparator.comparing(ResourceVO::getStartTime).reversed()).collect(Collectors.toList());
|
|
|
+ List<ResourceVO> results = resourceVOList.stream().sorted(Comparator.comparing(ResourceVO::getStartTime).reversed()).collect(Collectors.toList());
|
|
|
return results;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ResourceVO getResourceDetailed(String code) {
|
|
|
- Optional<ResourcePO> resourcePO=resourceDao.findByCode(code);
|
|
|
+ Optional<ResourcePO> resourcePO = resourceDao.findByCode(code);
|
|
|
ResourceVO resourceVO = new ResourceVO();
|
|
|
resourceVO.setCode(resourcePO.get().getCode());
|
|
|
resourceVO.setName(resourcePO.get().getName());
|
|
@@ -1102,7 +1102,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
resourceVO.setRemarks(resourcePO.getRemarks());
|
|
|
resourceVOList.add(resourceVO);
|
|
|
});
|
|
|
- List<ResourceVO> results=resourceVOList.stream().sorted(Comparator.comparing(ResourceVO::getStartTime).reversed()).collect(Collectors.toList());
|
|
|
+ List<ResourceVO> results = resourceVOList.stream().sorted(Comparator.comparing(ResourceVO::getStartTime).reversed()).collect(Collectors.toList());
|
|
|
return results;
|
|
|
}
|
|
|
|
|
@@ -1110,7 +1110,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
ProjectOperationControl operationControl = new ProjectOperationControl();
|
|
|
if (user == null)
|
|
|
return operationControl;
|
|
|
- if(project.getStatus() == CrowdTestProjectStatus.HAS_TIME_OUT){
|
|
|
+ if (project.getStatus() == CrowdTestProjectStatus.HAS_TIME_OUT) {
|
|
|
return operationControl;
|
|
|
}
|
|
|
|
|
@@ -1168,7 +1168,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
TaskOperationControl taskOperationControl = new TaskOperationControl();
|
|
|
if (user == null)
|
|
|
return taskOperationControl;
|
|
|
- if(task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT){
|
|
|
+ if (task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT) {
|
|
|
return taskOperationControl;
|
|
|
}
|
|
|
|