|
@@ -19,7 +19,6 @@ import com.mooctest.crowd.site.data.vo.*;
|
|
|
import com.mooctest.crowd.site.mediator.ViewMediator;
|
|
|
import com.mooctest.crowd.site.service.CrowdTaskService;
|
|
|
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;
|
|
@@ -112,20 +111,11 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private ResourceTypeDao resourceTypeDao;
|
|
|
|
|
|
@Autowired
|
|
|
- private FieldDao fieldDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private UserToRoleDao userToRoleDao;
|
|
|
+ private RegionalManagerToRegionalDao regionalManagerToRegionalDao;
|
|
|
|
|
|
@Autowired
|
|
|
private ThemeStatusService themeStatusService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ThemeStatusTaskService themeStatusTaskService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private EndPointDao endPointDao;
|
|
|
-
|
|
|
@Value("${file.save.path}")
|
|
|
private String fileSaveRootPath;
|
|
|
|
|
@@ -428,7 +418,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
myCrowdDTO.setMyProjectCount((long) (myCrowdDTO.getMyProjects() == null ? 0 : myProjects.size()));
|
|
|
|
|
|
//对于区域管理员crowdTestProjectPO -> crowdTestProjectPO.getStatus() > CrowdTestProjectStatus.HAS_RELEASED
|
|
|
- if (user.getRoleList().stream().anyMatch(role -> role.getName().equals("RegionalManager"))) {
|
|
|
+ if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.REGIONAL_MANAGER.getName()))) {
|
|
|
List<CrowdTestProjectPO> crowdTestProjectPOList = projectDao.findByRegionalManagerIdAndIsDeleted(userId, DeletedStatus.isNotDeleted)
|
|
|
.stream().map(crowdTestProjectPO -> {
|
|
|
// 判断项目是否截止
|
|
@@ -699,7 +689,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
CrowdTaskVO crowdTaskVO = new CrowdTaskVO(crowdTestTask);
|
|
|
if (crowdTestTask.getDistributionType() == 0) {
|
|
|
String agencyName = evaluationAgencyRepo.findAgencyNameByUserId(crowdTestTask.getEvaluationAgencyId());
|
|
|
- crowdTaskVO.setInstitution(agencyName == null ? "该机构已注销" : agencyName);
|
|
|
+ crowdTaskVO.setAgencyName(agencyName == null ? "该机构已注销" : agencyName);
|
|
|
}
|
|
|
taskVOList.add(crowdTaskVO);
|
|
|
}
|
|
@@ -712,7 +702,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
CrowdProjectVO projectVO = new CrowdProjectVO(project);
|
|
|
if (project.getStatus() > CrowdTestProjectStatus.HAS_RELEASED && project.getRegionalManagerId() != null) {
|
|
|
Optional<UserPO> regionManager = userDao.findById(project.getRegionalManagerId());
|
|
|
- projectVO.setInstitution(regionManager.isPresent() ? regionManager.get().getName() : "区域管理员已注销");
|
|
|
+ projectVO.setInstitution(regionManager.isPresent() ? regionManager.get().getId() : 0L);
|
|
|
+ projectVO.setRegionManagerName(regionManager.isPresent() ? regionManager.get().getName() : "区域管理员已注销");
|
|
|
}
|
|
|
List<PieChartDataVO> progress = new ArrayList<>();
|
|
|
progress.add(new PieChartDataVO("已完成", crowdTestTaskList
|
|
@@ -733,7 +724,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
// 判断项目是否为定向发布,显示定向给的区域管理员信息
|
|
|
if(project.getProjectDistributionTypeId().equals(DistributeType.DIRECT.getId())){
|
|
|
- projectVO.setInstitution(userRepo.getByIDJustInfo(project.getRegionalManagerId()).getName());
|
|
|
+ projectVO.setInstitution(project.getRegionalManagerId());
|
|
|
+ projectVO.setRegionManagerName(userRepo.getByIDJustInfo(project.getRegionalManagerId()).getName());
|
|
|
}
|
|
|
|
|
|
// 项目类型值的转换
|
|
@@ -948,6 +940,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public List<RegionalManagerVO> renderRegionManagerList() {
|
|
|
+ List<Long> userIdList = userRepo.getUserIdListByRoleName(RoleType.REGIONAL_MANAGER.getName());
|
|
|
+ return userIdList.stream().map(userId -> new RegionalManagerVO(userId, userRepo.getByIDJustInfo(userId).getName())).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<EvaluationAgencyVO> renderAgencyList() {
|
|
|
List<EvaluationAgencyVO> agencyList = new ArrayList<>();
|
|
|
evaluationAgencyRepo.findAll().forEach(evaluationAgency -> {
|
|
@@ -1470,7 +1469,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
//需求提出者和系统管理员视角
|
|
|
- if (project.getUserId().equals(user.getId()) || user.getRoleList().stream().anyMatch(role -> role.getName().equals("SystemAdministrator"))) {
|
|
|
+ if (project.getUserId().equals(user.getId()) || user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.SYSTEM_ADMIN.getName()))) {
|
|
|
if (project.getStatus() < CrowdTestProjectStatus.HAS_RECEIVED) {
|
|
|
operationControl.setUpdate(true);
|
|
|
} else if (project.getStatus() == CrowdTestProjectStatus.HAS_COMMITED) {
|
|
@@ -1478,7 +1477,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
}
|
|
|
//区域管理员视角
|
|
|
- if (user.getRoleList().stream().anyMatch(role -> role.getName().equals("RegionalManager"))) {
|
|
|
+ if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.REGIONAL_MANAGER.getName()))) {
|
|
|
if ((project.getProjectDistributionTypeId() == 0 && project.getRegionalManagerId().equals(user.getId()))
|
|
|
|| ((project.getProjectDistributionTypeId() > 0 && project.getStatus() >= CrowdTestProjectStatus.HAS_RECEIVED) && project.getRegionalManagerId().equals(user.getId()))) {
|
|
|
if (project.getStatus() == CrowdTestProjectStatus.HAS_RELEASED) {
|
|
@@ -1531,7 +1530,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
// 任务时间截止,对于区域管理员可以有导出和fork功能
|
|
|
if(task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT){
|
|
|
- if (user.getRoleList().stream().anyMatch(role -> role.getName().equals("SystemAdministrator"))
|
|
|
+ if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.SYSTEM_ADMIN.getName()))
|
|
|
|| (user.getRegionalManager() != null && user.getId().equals(project.getRegionalManagerId()))) {
|
|
|
// 不管何时都可以导出任务
|
|
|
taskOperationControl.setExportTask(true);
|
|
@@ -1549,7 +1548,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
}else{
|
|
|
//区域管理员或系统管理员视角
|
|
|
- if (user.getRoleList().stream().anyMatch(role -> role.getName().equals("SystemAdministrator"))
|
|
|
+ if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.SYSTEM_ADMIN.getName()))
|
|
|
|| (user.getRegionalManager() != null && user.getId().equals(project.getRegionalManagerId()))) {
|
|
|
// 不管何时都可以导出任务
|
|
|
taskOperationControl.setExportTask(true);
|