|
|
@@ -51,9 +51,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Autowired
|
|
|
private EvaluationAgencyRepo evaluationAgencyRepo;
|
|
|
|
|
|
-
|
|
|
@Autowired
|
|
|
private CommonRepo commonRepo;
|
|
|
+
|
|
|
@Autowired
|
|
|
private CrowdTestTaskDao taskDao;
|
|
|
|
|
|
@@ -96,10 +96,65 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Autowired
|
|
|
private BankLogoDao bankLogoDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ApplicationTypeDao applicationTypeDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResourceDao resourceDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResourceTypeDao resourceTypeDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FieldDao fieldDao;
|
|
|
+
|
|
|
@Value("${agency}")
|
|
|
private String agencyId;
|
|
|
|
|
|
@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);
|
|
|
+ userVO.setTaskCount(rankCountInfos.get(i).getCount());
|
|
|
+ userVOS.add(userVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return userVOS;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<CrowdTaskVO> findMoreHotTasks() {
|
|
|
+ List<CrowdTestTaskPO> list=taskDao.findMoreHotTasks();//已经根据创建时间排序好了。
|
|
|
+ List<CrowdTaskVO> hotMoreTestprojects = taskDao.findMoreHotTasks().stream().map(crowdTestTaskPO -> {
|
|
|
+ CrowdTestTask task = new CrowdTestTask();
|
|
|
+ BeanUtils.copyProperties(crowdTestTaskPO, task);
|
|
|
+ return new CrowdTaskVO(task);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return hotMoreTestprojects;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<CrowdTestProjectVO> findMoreHotProjects() {
|
|
|
+ List<CrowdTestProjectPO> list=projectDao.findMoreHotProjects();//已经根据创建时间排序好了。
|
|
|
+ //根据 参加人数倒序排序
|
|
|
+ List<CrowdTestProjectVO> hotMoreTestprojects = projectDao.findMoreHotProjects().stream().map(crowdTestProjectPO -> {
|
|
|
+ CrowdTestProject project = new CrowdTestProject();
|
|
|
+ BeanUtils.copyProperties(crowdTestProjectPO, project);
|
|
|
+ return new CrowdTestProjectVO(project);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return hotMoreTestprojects;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
public EnterpriseAuthVO getEnterpriseAuthByUserId(Long userId) {
|
|
|
EnterpriseAuthentication enterpriseAuthentication = new EnterpriseAuthentication();
|
|
|
EnterpriseAuthenticationPO enterpriseAuthenticationPO = enterpriseAuthenticationDao.findByUserId(userId);
|
|
|
@@ -163,8 +218,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
EvaluationAgencyPO agency = agencyDao.findByUserId(rankInfo.getEntityId());
|
|
|
if (agency != null && !agency.getEvaluationAgencyName().equals(agencyName)) {
|
|
|
EvolutionAgencyVO agencyVO = new EvolutionAgencyVO();
|
|
|
- agencyVO.setName(agency.getEvaluationAgencyName());
|
|
|
- agencyVO.setLogo(agency.getAgencyPhoto());
|
|
|
+ agencyVO.setEvaluationAgencyName(agency.getEvaluationAgencyName());
|
|
|
+ agencyVO.setAgencyPhoto(agency.getAgencyPhoto());
|
|
|
agencyVO.setTaskCount(rankInfo.getCount());
|
|
|
agencyVO.setId(agency.getId());
|
|
|
agencyVO.setUserId(agency.getUserId());
|
|
|
@@ -300,8 +355,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
EvaluationAgencyPO agency = agencyDao.findByUserId(rankInfo.getEntityId());
|
|
|
if (agency != null) {
|
|
|
EvolutionAgencyVO agencyVO = new EvolutionAgencyVO();
|
|
|
- agencyVO.setName(agency.getEvaluationAgencyName());
|
|
|
- agencyVO.setLogo(agency.getAgencyPhoto());
|
|
|
+ agencyVO.setEvaluationAgencyName(agency.getEvaluationAgencyName());
|
|
|
+ agencyVO.setAgencyPhoto(agency.getAgencyPhoto());
|
|
|
agencyVO.setAllTaskPrice(rankInfo.getTotalPrice());
|
|
|
return agencyVO;
|
|
|
}
|
|
|
@@ -434,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))
|
|
|
@@ -468,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);
|
|
|
}
|
|
|
|
|
|
@@ -486,6 +551,34 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
.stream().filter(task -> task.getStatus() == CrowdTestTaskStatus.HAS_FINISHED).count()));
|
|
|
progress.add(new PieChartDataVO("进行中", crowdTestTaskList
|
|
|
.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("请选择应用类型");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 领域类型值的转换
|
|
|
+ Optional<FieldPO> fieldPO = fieldDao.findByCode(projectVO.getField());
|
|
|
+ if(fieldPO.isPresent()){
|
|
|
+ projectVO.setField(fieldPO.get().getName());
|
|
|
+ }else{
|
|
|
+ throw new HttpBadRequestException("请选择领域类型");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 测试类型的转换
|
|
|
+ List<String> testStringList = projectVO.getType().stream().map(testType -> {
|
|
|
+ Optional<TestTypePO> testTypePO = testTypeDao.findByCode(testType);
|
|
|
+ if (testTypePO.isPresent()) {
|
|
|
+ return testTypePO.get().getName();
|
|
|
+ } else {
|
|
|
+ throw new HttpBadRequestException("请选择测试类型");
|
|
|
+ }
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ projectVO.setType(testStringList);
|
|
|
+
|
|
|
projectDetailsDTO.setProjectDetails(projectVO);
|
|
|
projectDetailsDTO.setTaskList(taskVOList);
|
|
|
projectDetailsDTO.setReportList(reportVOList);
|
|
|
@@ -566,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));
|
|
|
@@ -663,10 +763,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
agencyDao.findAll().forEach(evaluationAgencyPO -> {
|
|
|
EvolutionAgencyVO agencyVO = new EvolutionAgencyVO();
|
|
|
agencyVO.setId(evaluationAgencyPO.getUserId());
|
|
|
- agencyVO.setName(evaluationAgencyPO.getEvaluationAgencyName());
|
|
|
+ agencyVO.setEvaluationAgencyName(evaluationAgencyPO.getEvaluationAgencyName());
|
|
|
agencyList.add(agencyVO);
|
|
|
});
|
|
|
- return agencyList.stream().filter(agency -> !agency.getName().equals(agencyTemplate.getEvaluationAgencyName())).collect(Collectors.toList());
|
|
|
+ return agencyList.stream().filter(agency -> !agency.getEvaluationAgencyName().equals(agencyTemplate.getEvaluationAgencyName())).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -782,7 +882,6 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
userVO.setProvince(userPO.get().getProvince());
|
|
|
userVO.setCity(userPO.get().getCity());
|
|
|
userVO.setCounty(userPO.get().getCounty());
|
|
|
- userVO.setDetailedAddress(userPO.get().getDetailedAddress());
|
|
|
userVO.setPersonalCompetence(userPO.get().getPersonalCompetence());
|
|
|
userDTO.setUserVO(userVO);
|
|
|
return userDTO;
|
|
|
@@ -793,13 +892,15 @@ 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){
|
|
|
+ throw new HttpBadRequestException("请输入企业简称");
|
|
|
+ }
|
|
|
userPO.get().setUnit(userVO.getUnit());
|
|
|
userPO.get().setGender(userVO.getGender());
|
|
|
userPO.get().setBirthday(userVO.getBirthday());
|
|
|
userPO.get().setProvince(userVO.getProvince());
|
|
|
userPO.get().setCity(userVO.getCity());
|
|
|
userPO.get().setCounty(userVO.getCounty());
|
|
|
- userPO.get().setDetailedAddress(userVO.getDetailedAddress());
|
|
|
userPO.get().setPersonalCompetence(userVO.getPersonalCompetence());
|
|
|
userDao.save(userPO.get());
|
|
|
return this.getInformation(userId);
|
|
|
@@ -884,6 +985,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
String result = restTemplate.getForObject(url, String.class);
|
|
|
JSONObject json = new JSONObject(result);
|
|
|
+ String validated = String.valueOf(json.get("validated"));
|
|
|
+ if("false".equals(validated)){
|
|
|
+ throw new HttpBadRequestException("请输入正确的卡号");
|
|
|
+ }
|
|
|
String bank = String.valueOf(json.get("bank"));
|
|
|
bankCardPO.setUser(bankCardVO.getUser());
|
|
|
bankCardPO.setNumber(bankCardVO.getNumber());
|
|
|
@@ -909,6 +1014,80 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return technicalArticlesDTO;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<ResourceVO> getResource() {
|
|
|
+ List<ResourceVO> resourceVOList = new ArrayList<>();
|
|
|
+ resourceDao.findAll().forEach(resourcePO -> {
|
|
|
+ ResourceVO resourceVO = new ResourceVO();
|
|
|
+ resourceVO.setCode(resourcePO.getCode());
|
|
|
+ resourceVO.setName(resourcePO.getName());
|
|
|
+ Optional<ResourceTypePO> type = resourceTypeDao.findByCode(resourcePO.getType());
|
|
|
+ resourceVO.setType(type.get().getName());
|
|
|
+ resourceVO.setQuantity(resourcePO.getQuantity());
|
|
|
+ resourceVO.setPhotoUrl(resourcePO.getPhotoUrl());
|
|
|
+ resourceVO.setDescription(resourcePO.getDescription());
|
|
|
+ resourceVO.setScene(resourcePO.getScene());
|
|
|
+ resourceVO.setUnitWork(resourcePO.getUnitWork());
|
|
|
+ resourceVO.setStandard(resourcePO.getStandard());
|
|
|
+ resourceVO.setUnit(resourcePO.getUnit());
|
|
|
+ resourceVO.setState(resourcePO.getState());
|
|
|
+ resourceVO.setStartTime(resourcePO.getStartTime());
|
|
|
+ resourceVO.setPersonnel(resourcePO.getPersonnel());
|
|
|
+ resourceVO.setRemarks(resourcePO.getRemarks());
|
|
|
+ resourceVOList.add(resourceVO);
|
|
|
+ });
|
|
|
+ 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);
|
|
|
+ ResourceVO resourceVO = new ResourceVO();
|
|
|
+ resourceVO.setCode(resourcePO.get().getCode());
|
|
|
+ resourceVO.setName(resourcePO.get().getName());
|
|
|
+ Optional<ResourceTypePO> type = resourceTypeDao.findByCode(resourcePO.get().getType());
|
|
|
+ resourceVO.setType(type.get().getName());
|
|
|
+ resourceVO.setQuantity(resourcePO.get().getQuantity());
|
|
|
+ resourceVO.setPhotoUrl(resourcePO.get().getPhotoUrl());
|
|
|
+ resourceVO.setDescription(resourcePO.get().getDescription());
|
|
|
+ resourceVO.setScene(resourcePO.get().getScene());
|
|
|
+ resourceVO.setUnitWork(resourcePO.get().getUnitWork());
|
|
|
+ resourceVO.setStandard(resourcePO.get().getStandard());
|
|
|
+ resourceVO.setUnit(resourcePO.get().getUnit());
|
|
|
+ resourceVO.setState(resourcePO.get().getState());
|
|
|
+ resourceVO.setStartTime(resourcePO.get().getStartTime());
|
|
|
+ resourceVO.setPersonnel(resourcePO.get().getPersonnel());
|
|
|
+ resourceVO.setRemarks(resourcePO.get().getRemarks());
|
|
|
+ return resourceVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ResourceVO> getSearchResource(String name) {
|
|
|
+ List<ResourceVO> resourceVOList = new ArrayList<>();
|
|
|
+ resourceDao.findByNameLike("%" + name + "%").forEach(resourcePO -> {
|
|
|
+ ResourceVO resourceVO = new ResourceVO();
|
|
|
+ resourceVO.setCode(resourcePO.getCode());
|
|
|
+ resourceVO.setName(resourcePO.getName());
|
|
|
+ Optional<ResourceTypePO> type = resourceTypeDao.findByCode(resourcePO.getType());
|
|
|
+ resourceVO.setType(type.get().getName());
|
|
|
+ resourceVO.setQuantity(resourcePO.getQuantity());
|
|
|
+ resourceVO.setPhotoUrl(resourcePO.getPhotoUrl());
|
|
|
+ resourceVO.setDescription(resourcePO.getDescription());
|
|
|
+ resourceVO.setScene(resourcePO.getScene());
|
|
|
+ resourceVO.setUnitWork(resourcePO.getUnitWork());
|
|
|
+ resourceVO.setStandard(resourcePO.getStandard());
|
|
|
+ resourceVO.setUnit(resourcePO.getUnit());
|
|
|
+ resourceVO.setState(resourcePO.getState());
|
|
|
+ resourceVO.setStartTime(resourcePO.getStartTime());
|
|
|
+ resourceVO.setPersonnel(resourcePO.getPersonnel());
|
|
|
+ resourceVO.setRemarks(resourcePO.getRemarks());
|
|
|
+ resourceVOList.add(resourceVO);
|
|
|
+ });
|
|
|
+ List<ResourceVO> results=resourceVOList.stream().sorted(Comparator.comparing(ResourceVO::getStartTime).reversed()).collect(Collectors.toList());
|
|
|
+ return results;
|
|
|
+ }
|
|
|
+
|
|
|
private ProjectOperationControl initProjectPermission(CrowdTestProject project, User user) {
|
|
|
ProjectOperationControl operationControl = new ProjectOperationControl();
|
|
|
if (user == null)
|