|
|
@@ -7,10 +7,7 @@ import com.mooctest.crowd.domain.exception.CrowdTestReportNotExistException;
|
|
|
import com.mooctest.crowd.domain.exception.CrowdTestTaskNotExistException;
|
|
|
import com.mooctest.crowd.domain.exception.HttpBadRequestException;
|
|
|
import com.mooctest.crowd.domain.factory.CrowdTestProjectFactory;
|
|
|
-import com.mooctest.crowd.domain.model.CrowdTestProjectPO;
|
|
|
-import com.mooctest.crowd.domain.model.CrowdTestTaskPO;
|
|
|
-import com.mooctest.crowd.domain.model.EvaluationAgencyPO;
|
|
|
-import com.mooctest.crowd.domain.model.UserPO;
|
|
|
+import com.mooctest.crowd.domain.model.*;
|
|
|
import com.mooctest.crowd.domain.repository.CrowdTestProjectRepo;
|
|
|
import com.mooctest.crowd.domain.repository.EvaluationAgencyRepo;
|
|
|
import com.mooctest.crowd.domain.repository.UserRepo;
|
|
|
@@ -58,6 +55,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private UserDao userDao;
|
|
|
|
|
|
@Autowired
|
|
|
+ private CrowdTestReportDao crowdTestReportDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private RegionalManagerToRegionalDao regionalManagerToRegionalDao;
|
|
|
|
|
|
@Autowired
|
|
|
@@ -298,22 +298,26 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
throw new CrowdTestTaskNotExistException();
|
|
|
System.out.println("renderTaskReportDetails userID: " + userId);
|
|
|
ReportDetailsDTO reportDetailsDTO = new ReportDetailsDTO();
|
|
|
- if(userRepo.getByID(userId).getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.REGIONAL_MANAGER)) && !userId.equals(projectRepo.getByProjectCode(projectCode).getRegionalManagerId())){
|
|
|
+ if(userId.equals(projectRepo.getByProjectCode(projectCode).getRegionalManagerId())){
|
|
|
// 区域管理员
|
|
|
- throw new HttpBadRequestException("当前用户没有不是此任务的区域管理员!");
|
|
|
+ reportDetailsDTO.setCrowdReportVO(new CrowdReportVO(Converter.convert(CrowdTestReport.class, crowdTestReportDao.findByCodeAndIsDeleted(reportCode, DeletedStatus.isNotDeleted))));
|
|
|
+ if (task.get().getStatus()<CrowdTestTaskStatus.HAS_FINISHED)
|
|
|
+ reportDetailsDTO.setOperational(false);
|
|
|
}else if(!userRepo.getByID(userId).getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.REGIONAL_MANAGER))){
|
|
|
// 测评机构
|
|
|
Optional<TaskToUser> taskToUserOptional = task.get().getAcceptedUserList().stream().filter(taskToUser -> taskToUser.getUserId().equals(userId)).findFirst();
|
|
|
if(!taskToUserOptional.isPresent())
|
|
|
- throw new HttpBadRequestException("当前用户没有接收此任务!");
|
|
|
+ throw new HttpBadRequestException("当前用户无法查看此报告!");
|
|
|
Optional<CrowdTestReport> report = taskToUserOptional.get().getCrowdTestReportList().stream().filter(crowdTestReport -> crowdTestReport.getCode().equals(reportCode)).findFirst();
|
|
|
if (!report.isPresent())
|
|
|
throw new CrowdTestReportNotExistException();
|
|
|
reportDetailsDTO.setCrowdReportVO(new CrowdReportVO(report.get()));
|
|
|
if (task.get().getStatus()<CrowdTestTaskStatus.HAS_FINISHED)
|
|
|
reportDetailsDTO.setOperational(true);
|
|
|
+ }else{
|
|
|
+ // 区域管理员
|
|
|
+ throw new HttpBadRequestException("当前用户无法查看此报告!");
|
|
|
}
|
|
|
- // 区域管理员
|
|
|
|
|
|
return reportDetailsDTO;
|
|
|
}
|
|
|
@@ -369,7 +373,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
.filter(taskToUser -> taskToUser.getUserId().equals(userId)).map(taskToUser -> {
|
|
|
TaskToUserVO taskToUserVO = new TaskToUserVO(taskToUser);
|
|
|
taskToUserVO.setUserVO(Converter.convert(UserVO.class, taskToUser.getUser()));
|
|
|
- // 获取每个人员的报告信息
|
|
|
+ if(taskToUser.getIsCommitted() == 1){
|
|
|
+ StatusVO statusVO = new StatusVO();
|
|
|
+ statusVO.setText("已提交");
|
|
|
+ statusVO.setStyle("primary");
|
|
|
+ taskVO.setStatusVO(statusVO);
|
|
|
+ }
|
|
|
+ // 获取当前用户的报告信息
|
|
|
List<CrowdTestReport> crowdTestReportList = taskToUser.getCrowdTestReportList();
|
|
|
if(crowdTestReportList.size() > 0){
|
|
|
List<CrowdReportVO> crowdReportVOS = crowdTestReportList.stream().map(crowdTestReport -> new CrowdReportVO(crowdTestReport)).collect(Collectors.toList());
|
|
|
@@ -561,8 +571,11 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
if (task.getParticipantHasCommittedCount() == task.getAcceptedCount()){
|
|
|
taskOperationControl.setFinish(true);
|
|
|
}
|
|
|
+ if (taskToUserOptional.get().getIsCommitted() == 1){
|
|
|
+ taskOperationControl.setUploadReport(false);
|
|
|
+ }
|
|
|
} else if (task.getStatus() == CrowdTestTaskStatus.HAS_COMMITED){
|
|
|
- taskOperationControl.setUploadReport(true);
|
|
|
+ taskOperationControl.setUploadReport(false);
|
|
|
}
|
|
|
}else{
|
|
|
// 未接收用户
|