|
@@ -24,6 +24,7 @@ import com.mooctest.crowd.site.data.vo.*;
|
|
|
import com.mooctest.crowd.site.mediator.ViewMediator;
|
|
|
import com.mooctest.crowd.site.service.ThemeStatusService;
|
|
|
import com.mooctest.crowd.site.service.ThemeStatusTaskService;
|
|
|
+import com.mooctest.crowd.site.service.impl.AuthCheckServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.codehaus.jettison.json.JSONException;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
@@ -117,8 +118,6 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Autowired
|
|
|
private FieldDao fieldDao;
|
|
|
|
|
|
- @Value("${agency}")
|
|
|
- private String agencyId;
|
|
|
@Autowired
|
|
|
private UserToRoleDao userToRoleDao;
|
|
|
|
|
@@ -811,13 +810,14 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
if (!task.isPresent())
|
|
|
throw new CrowdTestTaskNotExistException();
|
|
|
System.out.println("renderTaskReportDetails userID: " + userId);
|
|
|
+ User user = userRepo.getByID(userId);
|
|
|
ReportDetailsDTO reportDetailsDTO = new ReportDetailsDTO();
|
|
|
if (userId.equals(projectRepo.getByProjectCode(projectCode).getRegionalManagerId())) {
|
|
|
// 区域管理员
|
|
|
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))) {
|
|
|
+ } else if (AuthCheckServiceImpl.isAgency(user)) {
|
|
|
// 测评机构
|
|
|
Optional<TaskToUser> taskToUserOptional = task.get().getAcceptedUserList().stream().filter(taskToUser -> taskToUser.getUserId().equals(userId)).findFirst();
|
|
|
if (!taskToUserOptional.isPresent())
|
|
@@ -978,14 +978,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public List<EvaluationAgencyVO> renderAgencyList() {
|
|
|
List<EvaluationAgencyVO> agencyList = new ArrayList<>();
|
|
|
- EvaluationAgency agencyTemplate = evaluationAgencyRepo.findAgencyById(Long.parseLong(agencyId));
|
|
|
agencyDao.findAll().forEach(evaluationAgencyPO -> {
|
|
|
EvaluationAgencyVO agencyVO = new EvaluationAgencyVO();
|
|
|
agencyVO.setId(evaluationAgencyPO.getUserId());
|
|
|
agencyVO.setEvaluationAgencyName(evaluationAgencyPO.getEvaluationAgencyName());
|
|
|
agencyList.add(agencyVO);
|
|
|
});
|
|
|
- return agencyList.stream().filter(agency -> !agency.getEvaluationAgencyName().equals(agencyTemplate.getEvaluationAgencyName())).collect(Collectors.toList());
|
|
|
+ return agencyList.stream().collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1577,7 +1576,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
//发包机构和发包人员视角
|
|
|
- if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.PARTY_AGENCY.getName()) || role.getName().equals(RoleType.PARTY_USER.getName())) && task.getStatus() != CrowdTestTaskStatus.HAS_REJECTED) {
|
|
|
+ if (AuthCheckServiceImpl.isPart(user) && task.getStatus() != CrowdTestTaskStatus.HAS_REJECTED) {
|
|
|
return taskOperationControl;
|
|
|
}
|
|
|
|
|
@@ -1595,8 +1594,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
taskOperationControl.setConfirmFinish(false);
|
|
|
}
|
|
|
}
|
|
|
- //评测机构和测评人员视角 //??? 已拒绝视图
|
|
|
- else if (user.getRoleList().stream().anyMatch(role -> role.getName().equals("evaluationAgency") || role.getName().equals(RoleType.EVALUATION_USER.getName())) && task.getStatus() != CrowdTestTaskStatus.HAS_REJECTED) {
|
|
|
+ // TODO 已拒绝视图
|
|
|
+ //评测机构和测评人员视角
|
|
|
+ else if (AuthCheckServiceImpl.isAgency(user) && task.getStatus() != CrowdTestTaskStatus.HAS_REJECTED) {
|
|
|
if ((task.getDistributionType() == 0 && task.getEvaluationAgencyId().equals(user.getId()))
|
|
|
|| (task.getDistributionType() == 2 && task.getStatus() >= CrowdTestTaskStatus.HAS_RECEIVED)) {
|
|
|
List<TaskToUser> acceptedUserList = task.getAcceptedUserList();
|