|
@@ -18,22 +18,17 @@ import com.mooctest.crowd.site.data.dto.*;
|
|
|
import com.mooctest.crowd.site.data.enums.RoleType;
|
|
|
import com.mooctest.crowd.site.data.vo.*;
|
|
|
import com.mooctest.crowd.site.mediator.ViewMediator;
|
|
|
-import com.mooctest.crowd.site.util.DataUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.codehaus.jettison.json.JSONException;
|
|
|
import org.codehaus.jettison.json.JSONObject;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.cache.annotation.Cacheable;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
-import org.springframework.data.jpa.domain.Specification;
|
|
|
-import org.springframework.data.jpa.domain.Specifications;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
+
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -494,6 +489,12 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
List<CrowdTaskVO> taskVOList = taskDao.findAllByIsDeleted(0).stream().map(crowdTestTaskPO -> {
|
|
|
CrowdTestTask task = CrowdTestProjectFactory.defaultTask();
|
|
|
BeanUtils.copyProperties(crowdTestTaskPO, task);
|
|
|
+ // 测试类型的转换
|
|
|
+ Optional<TestTypePO> testTypePO = testTypeDao.findByCode(task.getType());
|
|
|
+ if (!testTypePO.isPresent()) {
|
|
|
+ throw new HttpBadRequestException("请选择测试类型");
|
|
|
+ }
|
|
|
+ task.setType(testTypePO.get().getName());
|
|
|
return task;
|
|
|
}).collect(Collectors.toList()).stream().filter(crowdTestTask -> crowdTestTask.getStatus() == CrowdTestTaskStatus.HAS_RELEASED ||
|
|
|
(crowdTestTask.getStatus() == CrowdTestTaskStatus.HAS_RECEIVED && crowdTestTask.getFullStatus() == CrowdTestTaskAcceptStatus.NOT_FULL))
|
|
@@ -528,6 +529,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
EvaluationAgencyPO agencyPO = agencyDao.findByUserId(crowdTestTask.getEvaluationAgencyId());
|
|
|
crowdTaskVO.setInstitution(agencyPO == null ? "该机构已注销" : agencyPO.getEvaluationAgencyName());
|
|
|
}
|
|
|
+
|
|
|
+ // 测试类型的转换
|
|
|
+ Optional<TestTypePO> testTypePO = testTypeDao.findByCode(crowdTaskVO.getServiceType());
|
|
|
+ crowdTaskVO.setServiceType(testTypePO.get().getName());
|
|
|
taskVOList.add(crowdTaskVO);
|
|
|
}
|
|
|
|
|
@@ -552,7 +557,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
if(applicationTypePO.isPresent()){
|
|
|
projectVO.setPlatform(applicationTypePO.get().getName());
|
|
|
}else{
|
|
|
- throw new HttpBadRequestException("不存在此应用类型");
|
|
|
+ throw new HttpBadRequestException("请选择应用类型");
|
|
|
}
|
|
|
|
|
|
// 领域类型值的转换
|
|
@@ -560,7 +565,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
if(fieldPO.isPresent()){
|
|
|
projectVO.setField(fieldPO.get().getName());
|
|
|
}else{
|
|
|
- throw new HttpBadRequestException("不存在此领域类型");
|
|
|
+ throw new HttpBadRequestException("请选择领域类型");
|
|
|
}
|
|
|
|
|
|
// 测试类型的转换
|
|
@@ -569,7 +574,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
if (testTypePO.isPresent()) {
|
|
|
return testTypePO.get().getName();
|
|
|
} else {
|
|
|
- throw new HttpBadRequestException("不存在此测试类型");
|
|
|
+ throw new HttpBadRequestException("请选择测试类型");
|
|
|
}
|
|
|
}).collect(Collectors.toList());
|
|
|
projectVO.setType(testStringList);
|
|
@@ -654,6 +659,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
CrowdTaskVO taskVO = new CrowdTaskVO(task.get());
|
|
|
+ // 测试类型的转换
|
|
|
+ Optional<TestTypePO> testTypePO = testTypeDao.findByCode(taskVO.getServiceType());
|
|
|
+ if (!testTypePO.isPresent()) {
|
|
|
+ throw new HttpBadRequestException("请选择测试类型");
|
|
|
+ }
|
|
|
+ taskVO.setServiceType(testTypePO.get().getName());
|
|
|
+
|
|
|
System.out.println("renderTaskDetails userId:" + userId);
|
|
|
if (userId == null) {
|
|
|
taskDetailsDTO.setTaskOperationControl(this.initTaskPermission(project, task.get(), null));
|