|
@@ -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);
|
|
@@ -410,6 +410,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
CrowdProjectVO projectVO = new CrowdProjectVO(project);
|
|
|
if (project.getStatus() == CrowdTestProjectStatus.HAS_COMMITED)
|
|
|
projectVO.setNeedHandle(true);
|
|
|
+ // 应用类型值的转换
|
|
|
+ projectVO = changeApplicationType(projectVO);
|
|
|
return projectVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
//对于区域管理员
|
|
@@ -421,6 +423,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
CrowdTestProject project = new CrowdTestProject();
|
|
|
BeanUtils.copyProperties(crowdTestProjectPO, project);
|
|
|
CrowdProjectVO projectVO = new CrowdProjectVO(project);
|
|
|
+ projectVO = changeApplicationType(projectVO);
|
|
|
List<CrowdTestTaskPO> tasksOfProject = taskDao.findByCrowdTestProjectCodeAndIsDeleted(project.getCode(), DeletedStatus.isNotDeleted);
|
|
|
if (tasksOfProject != null && tasksOfProject.stream().anyMatch(task -> task.getStatus() == CrowdTestTaskStatus.HAS_COMMITED)) {
|
|
|
// log.info("\n\n需要处理!!!\n\n");
|
|
@@ -441,7 +444,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
.map(crowdTestProjectPO -> {
|
|
|
CrowdTestProject project = new CrowdTestProject();
|
|
|
BeanUtils.copyProperties(crowdTestProjectPO, project);
|
|
|
- return new CrowdProjectVO(project);
|
|
|
+ CrowdProjectVO projectVO = new CrowdProjectVO(project);
|
|
|
+ projectVO = changeApplicationType(projectVO);
|
|
|
+ return projectVO;
|
|
|
}).collect(Collectors.toList()));
|
|
|
myCrowdDTO.setAcceptableProjectNoticeCount(Long.parseLong("" + acceptableProject.size()));
|
|
|
}
|
|
@@ -465,6 +470,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
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());
|
|
|
return task;
|
|
|
}
|
|
|
return null;
|
|
@@ -483,6 +495,17 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return myCrowdDTO;
|
|
|
}
|
|
|
|
|
|
+ private CrowdProjectVO changeApplicationType(CrowdProjectVO projectVO) {
|
|
|
+ // 应用类型值的转换
|
|
|
+ Optional<ApplicationTypePO> applicationTypePO = applicationTypeDao.findByCode(projectVO.getPlatform());
|
|
|
+ if (applicationTypePO.isPresent()) {
|
|
|
+ projectVO.setPlatform(applicationTypePO.get().getName());
|
|
|
+ } else {
|
|
|
+ throw new HttpBadRequestException("请选择应用类型");
|
|
|
+ }
|
|
|
+ return projectVO;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public TaskSquareDTO renderTaskSquare() {
|
|
@@ -553,18 +576,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
.stream().filter(task -> task.getStatus() > CrowdTestTaskStatus.HAS_CREATED && task.getStatus() < CrowdTestTaskStatus.HAS_FINISHED).count()));
|
|
|
|
|
|
// 应用类型值的转换
|
|
|
- Optional<ApplicationTypePO> applicationTypePO = applicationTypeDao.findByCode(projectVO.getPlatform());
|
|
|
- if(applicationTypePO.isPresent()){
|
|
|
- projectVO.setPlatform(applicationTypePO.get().getName());
|
|
|
- }else{
|
|
|
- throw new HttpBadRequestException("请选择应用类型");
|
|
|
- }
|
|
|
+ projectVO = changeApplicationType(projectVO);
|
|
|
|
|
|
// 领域类型值的转换
|
|
|
Optional<FieldPO> fieldPO = fieldDao.findByCode(projectVO.getField());
|
|
|
- if(fieldPO.isPresent()){
|
|
|
+ if (fieldPO.isPresent()) {
|
|
|
projectVO.setField(fieldPO.get().getName());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
throw new HttpBadRequestException("请选择领域类型");
|
|
|
}
|
|
|
|
|
@@ -892,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());
|
|
@@ -986,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"));
|
|
@@ -1036,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());
|
|
@@ -1084,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;
|
|
|
}
|
|
|
|
|
@@ -1092,6 +1110,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
ProjectOperationControl operationControl = new ProjectOperationControl();
|
|
|
if (user == null)
|
|
|
return operationControl;
|
|
|
+ if (project.getStatus() == CrowdTestProjectStatus.HAS_TIME_OUT) {
|
|
|
+ return operationControl;
|
|
|
+ }
|
|
|
+
|
|
|
//需求提出者和系统管理员视角
|
|
|
if (project.getUserId().equals(user.getId()) || user.getRoleList().stream().anyMatch(role -> role.getName().equals("SystemAdministrator"))) {
|
|
|
if (project.getStatus() < CrowdTestProjectStatus.HAS_RECEIVED) {
|
|
@@ -1103,7 +1125,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
//区域管理员视角
|
|
|
if (user.getRoleList().stream().anyMatch(role -> role.getName().equals("RegionalManager"))) {
|
|
|
if ((project.getProjectDistributionTypeId() == 0 && project.getRegionalManagerId().equals(user.getId()))
|
|
|
- || (project.getProjectDistributionTypeId() > 0 && project.getStatus() >= CrowdTestProjectStatus.HAS_RECEIVED && project.getRegionalManagerId().equals(user.getId()))) {
|
|
|
+ || ((project.getProjectDistributionTypeId() > 0 && project.getStatus() >= CrowdTestProjectStatus.HAS_RECEIVED) && project.getRegionalManagerId().equals(user.getId()))) {
|
|
|
if (project.getStatus() == CrowdTestProjectStatus.HAS_RELEASED) {
|
|
|
operationControl.setReceive(true);
|
|
|
operationControl.setReject(true);
|
|
@@ -1119,6 +1141,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
}
|
|
|
if (project.getCrowdTestReportForProject() != null) {
|
|
|
+ operationControl.setUploadReport(false);
|
|
|
operationControl.setFinish(true);
|
|
|
}
|
|
|
} else if (project.getStatus() == CrowdTestProjectStatus.HAS_COMMITED) {
|
|
@@ -1145,6 +1168,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
TaskOperationControl taskOperationControl = new TaskOperationControl();
|
|
|
if (user == null)
|
|
|
return taskOperationControl;
|
|
|
+ if (task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT) {
|
|
|
+ return taskOperationControl;
|
|
|
+ }
|
|
|
+
|
|
|
//区域管理员或系统管理员视角
|
|
|
if (user.getRoleList().stream().anyMatch(role -> role.getName().equals("SystemAdministrator"))
|
|
|
|| (user.getRegionalManager() != null && user.getId().equals(project.getRegionalManagerId()))) {
|