|
@@ -4,24 +4,24 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.mooctest.crowd.domain.dao.*;
|
|
|
import com.mooctest.crowd.domain.domainobject.*;
|
|
|
+import com.mooctest.crowd.domain.domainobject.ApplicationType;
|
|
|
+import com.mooctest.crowd.domain.domainobject.enums.DistributeType;
|
|
|
import com.mooctest.crowd.domain.exception.*;
|
|
|
import com.mooctest.crowd.domain.factory.CrowdTestProjectFactory;
|
|
|
import com.mooctest.crowd.domain.model.*;
|
|
|
import com.mooctest.crowd.domain.repository.*;
|
|
|
import com.mooctest.crowd.domain.util.Converter;
|
|
|
-import com.mooctest.crowd.site.command.ApplyEnterpriseAuthCommand;
|
|
|
-import com.mooctest.crowd.site.command.ApplyPersonalAuthCommand;
|
|
|
import com.mooctest.crowd.site.command.LoginCommand;
|
|
|
import com.mooctest.crowd.site.command.RegisterCommand;
|
|
|
+import com.mooctest.crowd.site.configuration.DataCache;
|
|
|
import com.mooctest.crowd.site.data.ProjectOperationControl;
|
|
|
import com.mooctest.crowd.site.data.TaskOperationControl;
|
|
|
import com.mooctest.crowd.site.data.dto.*;
|
|
|
-import com.mooctest.crowd.site.data.enums.RoleType;
|
|
|
+import com.mooctest.crowd.domain.domainobject.enums.RoleType;
|
|
|
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;
|
|
@@ -45,9 +45,6 @@ import java.util.stream.Collectors;
|
|
|
@Component("WebMediator")
|
|
|
public class WebMediatorImpl implements ViewMediator {
|
|
|
@Autowired
|
|
|
- private TestTypeDao testTypeDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private CrowdTaskService crowdTaskService;
|
|
|
|
|
|
@Autowired
|
|
@@ -66,6 +63,9 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private CommonRepo commonRepo;
|
|
|
|
|
|
@Autowired
|
|
|
+ private DataCache dataCache;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private ToolRepo toolRepo;
|
|
|
|
|
|
@Autowired
|
|
@@ -81,9 +81,6 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private CrowdTestReportDao crowdTestReportDao;
|
|
|
|
|
|
@Autowired
|
|
|
- private RegionalManagerToRegionalDao regionalManagerToRegionalDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private EvaluationAgencyDao agencyDao;
|
|
|
|
|
|
@Autowired
|
|
@@ -114,29 +111,17 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private BankLogoDao bankLogoDao;
|
|
|
|
|
|
@Autowired
|
|
|
- private ApplicationTypeDao applicationTypeDao;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private ResourceDao resourceDao;
|
|
|
|
|
|
@Autowired
|
|
|
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;
|
|
|
|
|
@@ -171,78 +156,6 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
private String indexResourceCount;
|
|
|
|
|
|
@Override
|
|
|
- public List<CrowdTestProjectVO> crowdTestProjects() {
|
|
|
- List<CrowdTestProjectVO> resultList = new ArrayList<>();
|
|
|
- resultList.addAll(projectDao.findAll().stream().map(crowdTestProjectPO -> {
|
|
|
- CrowdTestProject crowdTestProject = new CrowdTestProject();
|
|
|
- BeanUtils.copyProperties(crowdTestProjectPO, crowdTestProject);
|
|
|
- return new CrowdTestProjectVO(crowdTestProject);
|
|
|
- }).collect(Collectors.toList()));
|
|
|
- return resultList;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void saveEnterpriseRole(User user, ApplyEnterpriseAuthCommand applyEnterpriseAuthCommand) {
|
|
|
- //如果是研发机构那么能发包
|
|
|
- if(applyEnterpriseAuthCommand.getRoleList().contains(0) && applyEnterpriseAuthCommand.getRoleList().contains(1)){
|
|
|
- UserToRolePO u2r = new UserToRolePO();
|
|
|
- u2r.setUserId(user.getId());
|
|
|
- u2r.setRoleId(8L);
|
|
|
- userToRoleDao.save(u2r);
|
|
|
- UserToRolePO u2rl = new UserToRolePO();
|
|
|
- u2rl.setUserId(user.getId());
|
|
|
- u2rl.setRoleId(2L);
|
|
|
- userToRoleDao.save(u2rl);
|
|
|
-
|
|
|
- }
|
|
|
- else if(applyEnterpriseAuthCommand.getRoleList().contains(1)){
|
|
|
- UserToRolePO u2r = new UserToRolePO();
|
|
|
- u2r.setUserId(user.getId());
|
|
|
- u2r.setRoleId(2L);
|
|
|
- userToRoleDao.save(u2r);
|
|
|
- }
|
|
|
- else if(applyEnterpriseAuthCommand.getRoleList().contains(0)){
|
|
|
- UserToRolePO u2r = new UserToRolePO();
|
|
|
- u2r.setUserId(user.getId());
|
|
|
- u2r.setRoleId(8L);
|
|
|
- userToRoleDao.save(u2r);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void saveUserRole(User user, ApplyPersonalAuthCommand command) {
|
|
|
- if (command.getRoleList().size() == 0 || command.getRoleList() == null) {
|
|
|
- throw new BaseException("请选择成为发包或者接包用户");
|
|
|
- }
|
|
|
- UserPO userPO = userDao.save(Converter.convert(UserPO.class, user));
|
|
|
- //如果两个都选择那么权限都给
|
|
|
- if (command.getRoleList().contains(1) && command.getRoleList().contains(0)) {
|
|
|
- UserToRolePO u2r = new UserToRolePO();
|
|
|
- u2r.setUserId(userPO.getId());
|
|
|
- u2r.setRoleId(RoleType.PARTY_USER.getId());
|
|
|
- userToRoleDao.save(u2r);
|
|
|
- UserToRolePO u2rl = new UserToRolePO();
|
|
|
- u2rl.setUserId(userPO.getId());
|
|
|
- u2rl.setRoleId(RoleType.EVALUATION_USER.getId());
|
|
|
- userToRoleDao.save(u2rl);
|
|
|
- }
|
|
|
- //如果选择成为发包用户
|
|
|
- else if (command.getRoleList().contains(0)) {
|
|
|
- UserToRolePO u2r = new UserToRolePO();
|
|
|
- u2r.setUserId(userPO.getId());
|
|
|
- u2r.setRoleId(RoleType.PARTY_USER.getId());
|
|
|
- userToRoleDao.save(u2r);
|
|
|
- }
|
|
|
- //如果选择成为接包用户
|
|
|
- else if (command.getRoleList().contains(1)) {
|
|
|
- UserToRolePO u2r = new UserToRolePO();
|
|
|
- u2r.setUserId(userPO.getId());
|
|
|
- u2r.setRoleId(RoleType.EVALUATION_USER.getId());
|
|
|
- userToRoleDao.save(u2r);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public List<UserVO> renderMoreUser(Pageable pageable,String keyword) {
|
|
|
//获取众测人员排名
|
|
|
// String agencyName = agencyDao.findById(Long.parseLong(agencyId)).get().getEvaluationAgencyName();
|
|
@@ -281,19 +194,6 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
@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);
|
|
@@ -492,15 +392,15 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public MyCrowdDTO renderMyCrowd(Long userId) {
|
|
|
+ public MyCrowdDTO renderMyCrowd(User user) {
|
|
|
+ Long userId = user.getId();
|
|
|
MyCrowdDTO myCrowdDTO = new MyCrowdDTO();
|
|
|
- User user = userRepo.getByID(userId);
|
|
|
//我的众测 - 项目相关信息
|
|
|
|
|
|
// 获取领域、应用、测试类型code 和 name 的map
|
|
|
- Map<String, String> fieldMap = commonRepo.getFieldCodeNameMap();
|
|
|
- Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
- Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ Map<String, String> fieldMap = dataCache.getFieldMap();
|
|
|
+ Map<String, String> applicationMap = dataCache.getApplicationTypeMap();
|
|
|
+ Map<String, String> testMap = dataCache.getTestTypeMap();
|
|
|
|
|
|
//获取我创建的项目列表
|
|
|
List<CrowdProjectVO> myProjects = projectDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted)
|
|
@@ -512,7 +412,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
if (project.getStatus() == CrowdTestProjectStatus.HAS_COMMITED)
|
|
|
projectVO.setNeedHandle(true);
|
|
|
// 领域类型、应用类型值的转换
|
|
|
- projectVO = changeFieldAndApplicationAndTestType(projectVO, applicationMap, fieldMap, testMap);
|
|
|
+ projectVO = this.changeFieldAndApplicationAndTestType(projectVO, applicationMap, fieldMap, testMap);
|
|
|
|
|
|
// 判断项目是否截止
|
|
|
if (projectVO.getDatetime().getTime() <= System.currentTimeMillis() && project.getStatus() < CrowdTestProjectStatus.HAS_FINISHED) {
|
|
@@ -524,7 +424,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 -> {
|
|
|
// 判断项目是否截止
|
|
@@ -587,7 +487,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
// 测评机构或者测试人员
|
|
|
if (AuthCheckServiceImpl.isAgency(user)) {
|
|
|
- List<TaskToUserPO> taskToUserPOS = taskToUserDao.findByUserId(user.getId());
|
|
|
+ List<TaskToUserPO> taskToUserPOS = taskToUserDao.findByUserId(userId);
|
|
|
if (taskToUserPOS != null && taskToUserPOS.size() > 0) {
|
|
|
allTaskOfAgency = taskToUserPOS.stream().map(taskToUserPO -> {
|
|
|
CrowdTestTaskPO crowdTestTaskPO = taskDao.findByCodeAndIsDeleted(taskToUserPO.getTaskCode(), DeletedStatus.isNotDeleted);
|
|
@@ -610,7 +510,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
if(allTaskOfAgency != null && allTaskOfAgency.size() > 0){
|
|
|
unfinishedTasks = allTaskOfAgency.stream()
|
|
|
- .filter(crowdTestTask -> crowdTestTask.getStatus() >= CrowdTestTaskStatus.HAS_RELEASED && crowdTestTask.getStatus() < CrowdTestTaskStatus.HAS_FINISHED)
|
|
|
+ .filter(crowdTestTask -> crowdTestTask.getStatus() >= CrowdTestTaskStatus.HAS_RELEASED && (crowdTestTask.getStatus() < CrowdTestTaskStatus.HAS_FINISHED || crowdTestTask.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT))
|
|
|
.sorted(Comparator.comparing(CrowdTestTask::getCreateTime).reversed())
|
|
|
.map(CrowdTaskVO::new).collect(Collectors.toList());
|
|
|
|
|
@@ -623,7 +523,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
myCrowdDTO.setFinishedTasks(finishedTasks);
|
|
|
myCrowdDTO.setUnfinishedTasks(unfinishedTasks);
|
|
|
- myCrowdDTO.setUnfinishedTaskNoticeCount((long) unfinishedTasks.size());
|
|
|
+ myCrowdDTO.setUnfinishedTaskNoticeCount(unfinishedTasks == null ? 0 : (long) unfinishedTasks.size());
|
|
|
myCrowdDTO.setFinishedTaskCount((long) (myCrowdDTO.getFinishedTasks() == null ? 0 : myCrowdDTO.getFinishedTasks().size()));
|
|
|
myCrowdDTO.setUnfinishedTaskCount((long) (myCrowdDTO.getUnfinishedTasks() == null ? 0 : myCrowdDTO.getUnfinishedTasks().size()));
|
|
|
return myCrowdDTO;
|
|
@@ -719,55 +619,33 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public CrowdTestTask changeFieldAndApplicationAndTestTypeByTask(CrowdTestTask task, Map<String, String> applicationMap
|
|
|
- , Map<String, String> fieldMap, Map<String, String> testMap) {
|
|
|
- // 领域类型值的转换
|
|
|
- task.setFieldType(fieldMap.get(task.getFieldType()));
|
|
|
- // 应用类型值的转换
|
|
|
- task.setApplicationType(applicationMap.get(task.getApplicationType()));
|
|
|
- // 测试类型值的转换
|
|
|
- task.setType(testMap.get(task.getType()));
|
|
|
- return task;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public CrowdTestTask changeTypeByProjectAndTask(CrowdTestProject project, CrowdTestTask task, Map<String, String> applicationMap
|
|
|
, Map<String, String> fieldMap, Map<String, String> testMap) {
|
|
|
- // 获取项目的领域、应用类型赋值给任务
|
|
|
- task.setFieldType(project.getFieldType());
|
|
|
- task.setApplicationType(project.getApplicationType());
|
|
|
// 领域类型值的转换
|
|
|
- task.setFieldType(fieldMap.get(task.getFieldType()));
|
|
|
+ task.setFieldType(fieldMap.get(project.getFieldType()));
|
|
|
// 应用类型值的转换
|
|
|
- task.setApplicationType(applicationMap.get(task.getApplicationType()));
|
|
|
+ task.setApplicationType(applicationMap.get(project.getApplicationType()));
|
|
|
// 测试类型值的转换
|
|
|
task.setType(testMap.get(task.getType()));
|
|
|
return task;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public CrowdTestTask changeTypeByProjectAndTask(CrowdTestProject project, CrowdTestTask task) {
|
|
|
- // 获取领域、应用、测试类型code 和 name 的map
|
|
|
- Map<String, String> fieldMap = commonRepo.getFieldCodeNameMap();
|
|
|
- Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
- Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
-
|
|
|
+ public CrowdTaskVO changeTypeByProjectAndTaskVO(CrowdTestProject project, CrowdTaskVO task, Map<String, String> applicationMap
|
|
|
+ , Map<String, String> fieldMap, Map<String, String> testMap) {
|
|
|
// 获取项目的领域、应用类型赋值给任务
|
|
|
- task.setFieldType(project.getFieldType());
|
|
|
- task.setApplicationType(project.getApplicationType());
|
|
|
// 领域类型值的转换
|
|
|
- task.setFieldType(fieldMap.get(task.getFieldType()));
|
|
|
+ task.setFieldType(fieldMap.get(project.getFieldType()));
|
|
|
// 应用类型值的转换
|
|
|
- task.setApplicationType(applicationMap.get(task.getApplicationType()));
|
|
|
+ task.setApplicationType(applicationMap.get(project.getApplicationType()));
|
|
|
// 测试类型值的转换
|
|
|
- task.setType(testMap.get(task.getType()));
|
|
|
+ task.setServiceType(testMap.get(task.getServiceType()));
|
|
|
return task;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public TaskSquareDTO renderTaskSquare() {
|
|
|
- Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ Map<String, String> testMap = dataCache.getTestTypeMap();
|
|
|
|
|
|
List<CrowdTaskVO> taskVOList = taskDao.findAllByIsDeleted(0).stream().map(crowdTestTaskPO -> {
|
|
|
CrowdTestTask task = CrowdTestProjectFactory.defaultTask();
|
|
@@ -785,12 +663,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ProjectDetailsDTO renderProjectDetails(CrowdTestProject project, User user) {
|
|
|
-
|
|
|
- Map<String, String> fieldMap = commonRepo.getFieldCodeNameMap();
|
|
|
- Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
- Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ public ProjectDetailsDTO renderProjectDetails(CrowdTestProject project, Long userId) {
|
|
|
+ // 获取领域、应用、测试类型code 和 name 的map
|
|
|
+ Map<String, String> fieldMap = dataCache.getFieldMap();
|
|
|
+ Map<String, String> applicationMap = dataCache.getApplicationTypeMap();
|
|
|
+ Map<String, String> testMap = dataCache.getTestTypeMap();
|
|
|
|
|
|
+ User user = userRepo.getInfoAndRolesAndRegionalMangerByID(userId);
|
|
|
boolean saveFlag = false;
|
|
|
// 判断项目是否截止
|
|
|
if (project.getDeadTime().getTime() <= System.currentTimeMillis() && project.getStatus() < CrowdTestProjectStatus.HAS_FINISHED) {
|
|
@@ -808,12 +687,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
saveFlag = true;
|
|
|
}
|
|
|
|
|
|
- // 类型的转换
|
|
|
- this.changeTypeByProjectAndTask(project, crowdTestTask, applicationMap, fieldMap, testMap);
|
|
|
CrowdTaskVO crowdTaskVO = new CrowdTaskVO(crowdTestTask);
|
|
|
if (crowdTestTask.getDistributionType() == 0) {
|
|
|
- EvaluationAgencyPO agencyPO = agencyDao.findByUserId(crowdTestTask.getEvaluationAgencyId());
|
|
|
- crowdTaskVO.setInstitution(agencyPO == null ? "该机构已注销" : agencyPO.getEvaluationAgencyName());
|
|
|
+ String agencyName = evaluationAgencyRepo.findAgencyNameByUserId(crowdTestTask.getEvaluationAgencyId());
|
|
|
+ crowdTaskVO.setAgencyName(agencyName == null ? "该机构已注销" : agencyName);
|
|
|
}
|
|
|
taskVOList.add(crowdTaskVO);
|
|
|
}
|
|
@@ -826,7 +703,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
|
|
@@ -834,31 +712,46 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
progress.add(new PieChartDataVO("进行中", crowdTestTaskList
|
|
|
.stream().filter(task -> task.getStatus() > CrowdTestTaskStatus.HAS_CREATED && task.getStatus() < CrowdTestTaskStatus.HAS_FINISHED).count()));
|
|
|
|
|
|
+ if (saveFlag) {
|
|
|
+ // 项目或者任务中的状态需要变更
|
|
|
+ projectRepo.saveCrowdTestProject(project);
|
|
|
+ }else{
|
|
|
+ // 状态不需要变更则进行类型转换
|
|
|
+ for (CrowdTaskVO crowdTaskVO : taskVOList) {
|
|
|
+ // 类型的转换
|
|
|
+ this.changeTypeByProjectAndTaskVO(project, crowdTaskVO, applicationMap, fieldMap, testMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // 判断项目是否为定向发布,显示定向给的区域管理员信息
|
|
|
+ if(project.getProjectDistributionTypeId().equals(DistributeType.DIRECT.getId())){
|
|
|
+ projectVO.setInstitution(project.getRegionalManagerId());
|
|
|
+ projectVO.setRegionManagerName(userRepo.getByIDJustInfo(project.getRegionalManagerId()).getName());
|
|
|
+ }
|
|
|
+
|
|
|
// 项目类型值的转换
|
|
|
projectVO = changeFieldAndApplicationAndTestType(projectVO, applicationMap, fieldMap, testMap);
|
|
|
|
|
|
projectDetailsDTO.setProjectDetails(projectVO);
|
|
|
projectDetailsDTO.setTaskList(taskVOList);
|
|
|
projectDetailsDTO.setReportList(reportVOList);
|
|
|
- projectDetailsDTO.setProjectOperationControl(initProjectPermission(project, user));
|
|
|
+ projectDetailsDTO.setProjectOperationControl(this.initProjectPermission(project, user));
|
|
|
projectDetailsDTO.setProgress(progress);
|
|
|
|
|
|
- if (saveFlag) {
|
|
|
- projectRepo.saveCrowdTestProject(project);
|
|
|
- }
|
|
|
return projectDetailsDTO;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ReportDetailsDTO renderTaskReportDetails(String projectCode, String taskCode, String reportCode, Long userId) {
|
|
|
- Optional<CrowdTestTask> task = projectRepo.getByProjectCode(projectCode).getCrowdTestTaskList()
|
|
|
+ CrowdTestProject project = projectRepo.getByProjectCodeAndTaskCode(projectCode, taskCode);
|
|
|
+ Optional<CrowdTestTask> task = project.getCrowdTestTaskList()
|
|
|
.stream().filter(crowdTestTask -> crowdTestTask.getCode().equals(taskCode)).findFirst();
|
|
|
if (!task.isPresent())
|
|
|
throw new CrowdTestTaskNotExistException();
|
|
|
log.info("renderTaskReportDetails userID: " + userId);
|
|
|
- User user = userRepo.getByID(userId);
|
|
|
+ User user = userRepo.getInfoAndRolesByID(userId);
|
|
|
ReportDetailsDTO reportDetailsDTO = new ReportDetailsDTO();
|
|
|
- if (userId.equals(projectRepo.getByProjectCode(projectCode).getRegionalManagerId())) {
|
|
|
+ if (userId.equals(project.getRegionalManagerId())) {
|
|
|
// 区域管理员
|
|
|
reportDetailsDTO.setCrowdReportVO(new CrowdReportVO(Converter.convert(CrowdTestReport.class, crowdTestReportDao.findByCodeAndIsDeleted(reportCode, DeletedStatus.isNotDeleted))));
|
|
|
if (task.get().getStatus() < CrowdTestTaskStatus.HAS_FINISHED)
|
|
@@ -883,7 +776,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public ReportDetailsDTO renderProjectReportDetails(String projectCode, String reportCode, Long userId) {
|
|
|
- CrowdTestProject project = projectRepo.getByProjectCode(projectCode);
|
|
|
+ CrowdTestProject project = projectRepo.getByProjectCodeJustInfoAndProjectReport(projectCode);
|
|
|
CrowdTestReport report = project.getCrowdTestReportForProject();
|
|
|
if (report == null)
|
|
|
throw new CrowdTestReportNotExistException();
|
|
@@ -904,12 +797,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public TaskDetailsDTO renderTaskDetails(String projectCode, String taskCode, Long userId) {
|
|
|
-// Map<String, String> fieldMap = commonRepo.getFieldCodeNameMap();
|
|
|
-// Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
-// Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ // 获取领域、应用、测试类型code 和 name 的map
|
|
|
+ Map<String, String> fieldMap = dataCache.getFieldMap();
|
|
|
+ Map<String, String> applicationMap = dataCache.getApplicationTypeMap();
|
|
|
+ Map<String, String> testMap = dataCache.getTestTypeMap();
|
|
|
|
|
|
TaskDetailsDTO taskDetailsDTO = new TaskDetailsDTO();
|
|
|
- CrowdTestProject project = projectRepo.getByProjectCode(projectCode);
|
|
|
+ CrowdTestProject project = projectRepo.getByProjectCodeAndTaskCode(projectCode, taskCode);
|
|
|
|
|
|
boolean saveFlag = false;
|
|
|
// 判断项目是否截止
|
|
@@ -923,7 +817,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
throw new CrowdTestTaskNotExistException();
|
|
|
|
|
|
CrowdTestTask crowdTestTask = task.get();
|
|
|
-
|
|
|
+ EndPoint endPoint = crowdTestTask.getEndPoint();
|
|
|
// 判断任务是否截止
|
|
|
if (crowdTestTask.getDeadTime().getTime() <= System.currentTimeMillis() && crowdTestTask.getStatus() < CrowdTestTaskStatus.HAS_FINISHED) {
|
|
|
crowdTestTask.setStatus(CrowdTestTaskStatus.HAS_TIME_OUT);
|
|
@@ -934,22 +828,21 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
crowdTestTask.setFieldType(project.getFieldType());
|
|
|
crowdTestTask.setApplicationType(project.getApplicationType());
|
|
|
|
|
|
-// this.changeTypeByProjectAndTask(project, crowdTestTask, applicationMap, fieldMap, testMap);
|
|
|
+ this.changeTypeByProjectAndTask(project, crowdTestTask, applicationMap, fieldMap, testMap);
|
|
|
CrowdTaskVO taskVO = new CrowdTaskVO(crowdTestTask);
|
|
|
|
|
|
log.info("renderTaskDetails userId:" + userId);
|
|
|
if (userId == null) {
|
|
|
taskDetailsDTO.setTaskOperationControl(this.initTaskPermission(project, crowdTestTask, null));
|
|
|
} else {
|
|
|
- User user = userRepo.getByID(userId);
|
|
|
+ User user = userRepo.getInfoAndRolesAndRegionalMangerByID(userId);
|
|
|
taskDetailsDTO.setTaskOperationControl(this.initTaskPermission(project, crowdTestTask, user));
|
|
|
// 区域管理员视图
|
|
|
List<TaskToUserVO> taskToUserVOS = new ArrayList<>();
|
|
|
if (userId.equals(project.getRegionalManagerId())) {
|
|
|
// 判断否存在配置项
|
|
|
- Optional<EndPointPO> endPointPO = endPointDao.findByTaskCode(taskVO.getCode());
|
|
|
- if(endPointPO.isPresent()){
|
|
|
- taskVO.setEndPointVO(new EndPointVO(Converter.convert(EndPoint.class, endPointPO.get())));
|
|
|
+ if(endPoint != null){
|
|
|
+ taskVO.setEndPointVO(new EndPointVO(endPoint));
|
|
|
}
|
|
|
|
|
|
taskToUserVOS = crowdTestTask.getAcceptedUserList().stream().map(taskToUser -> {
|
|
@@ -963,6 +856,11 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
return taskToUserVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 判断是否为定向发布的任务,如果是则获取定向发布机构/人员的名称信息
|
|
|
+ if(crowdTestTask.getDistributionType().equals(DistributeType.DIRECT.getId())){
|
|
|
+ taskVO.setAgencyName(evaluationAgencyRepo.findAgencyNameByUserId(crowdTestTask.getEvaluationAgencyId()));
|
|
|
+ }
|
|
|
}
|
|
|
// 测评机构视图
|
|
|
else if (AuthCheckServiceImpl.isAgency(user)) {
|
|
@@ -991,12 +889,10 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
taskDetailsDTO.setAcceptedUserList(taskToUserVOS);
|
|
|
|
|
|
- Optional<EndPointPO> endPointPOOptional = endPointDao.findByTaskCode(crowdTestTask.getCode());
|
|
|
// 判断是否具有配置项,提供跳转url
|
|
|
- if(endPointPOOptional.isPresent()){
|
|
|
+ if(endPoint != null){
|
|
|
// 获取测试类型对应的跳转url
|
|
|
- String reportUrl = endPointPOOptional.get().getUrl().replace("userId", String.valueOf(userId));
|
|
|
- taskVO.setWriteReportUrl(reportUrl);
|
|
|
+ taskVO.setWriteReportUrl(endPoint.getUrl());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1005,15 +901,15 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
taskDetailsDTO.setCrowdTaskVO(taskVO);
|
|
|
-// EvaluationAgencyPO agencyPO = agencyDao.findByUserId(task.get().getEvaluationAgencyId());
|
|
|
-// taskVO.setInstitution(agencyPO==null?"该机构已注销":agencyPO.getEvaluationAgencyName());
|
|
|
-
|
|
|
+ // 词云图
|
|
|
+// List<JabaResult> wordCloudList = TFIDFAnalyzer.getInstance().extractTagsList(taskVO.getDescription(), 20);
|
|
|
+// taskDetailsDTO.setWordCloudList(wordCloudList);
|
|
|
return taskDetailsDTO;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public CrowdTaskVO renderTaskDetailsByTourist(String projectCode, String taskCode) {
|
|
|
- CrowdTestProject project = projectRepo.getByProjectCode(projectCode);
|
|
|
+ CrowdTestProject project = projectRepo.getByProjectCodeAndTaskCode(projectCode, taskCode);
|
|
|
Optional<CrowdTestTask> task = project.getCrowdTestTaskList().stream().filter(crowdTestTask -> crowdTestTask.getCode().equals(taskCode)).findFirst();
|
|
|
if (!task.isPresent())
|
|
|
throw new CrowdTestTaskNotExistException();
|
|
@@ -1038,8 +934,6 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
userDTO.setAgencyVO(new AgencyVO(user.getEvaluationAgency()));
|
|
|
if (user.getPersonalAuthentication() != null)
|
|
|
userDTO.setPersonalAuthVO(new PersonalAuthVO(user.getPersonalAuthentication()));
|
|
|
- if (user.getEnterpriseAuthentication() != null)
|
|
|
- userDTO.setEnterpriseAuthVO(new EnterpriseAuthVO(user.getEnterpriseAuthentication()));
|
|
|
List<PermissionVO> permissionList = new ArrayList<>();
|
|
|
user.getRoleList().forEach(role -> role.getPermissionList().forEach(permission -> permissionList.add(new PermissionVO(permission))));
|
|
|
userDTO.setPermissions(permissionList);
|
|
@@ -1048,17 +942,11 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public List<RegionalManagerVO> renderRegionManagerList() {
|
|
|
- List<RegionalManagerVO> regionalManagerVOList = new ArrayList<>();
|
|
|
- regionalManagerToRegionalDao.findAll().forEach(regionalManagerPO -> {
|
|
|
- RegionalManagerVO regionalManagerVO = new RegionalManagerVO();
|
|
|
- regionalManagerVO.setId(regionalManagerPO.getUserId());
|
|
|
- regionalManagerVO.setName(userDao.findById(regionalManagerPO.getUserId()).get().getName());
|
|
|
- regionalManagerVOList.add(regionalManagerVO);
|
|
|
- });
|
|
|
- List<RegionalManagerVO> results = regionalManagerVOList.stream().distinct().collect(Collectors.toList());
|
|
|
- return results;
|
|
|
+ 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<>();
|
|
@@ -1082,24 +970,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public List<BaseAuthVO> renderAuthingList() {
|
|
|
List<BaseAuthVO> resultList = new ArrayList<>();
|
|
|
- resultList.addAll(personalAuthenticationDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream().map(personalAuthenticationPO -> {
|
|
|
- PersonalAuthentication personalAuthentication = new PersonalAuthentication();
|
|
|
- BeanUtils.copyProperties(personalAuthenticationPO, personalAuthentication);
|
|
|
- return new BaseAuthVO(personalAuthentication);
|
|
|
- }).collect(Collectors.toList()));
|
|
|
+ resultList.addAll(personalAuthenticationDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream()
|
|
|
+ .map(personalAuthenticationPO -> new BaseAuthVO(Converter.convert(PersonalAuthentication.class, personalAuthenticationPO))).collect(Collectors.toList()));
|
|
|
|
|
|
-// resultList.addAll(enterpriseAuthenticationDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream().map(enterpriseAuthenticationPO -> {
|
|
|
-// EnterpriseAuthentication enterpriseAuthentication = new EnterpriseAuthentication();
|
|
|
-// BeanUtils.copyProperties(enterpriseAuthenticationPO, enterpriseAuthentication);
|
|
|
-// return new BaseAuthVO(enterpriseAuthentication);
|
|
|
-// }).collect(Collectors.toList()));
|
|
|
+ resultList.addAll(agencyDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream()
|
|
|
+ .map(evaluationAgencyPO -> new BaseAuthVO(Converter.convert(EvaluationAgency.class, evaluationAgencyPO))).collect(Collectors.toList()));
|
|
|
|
|
|
- resultList.addAll(agencyDao.findByIsAuthentication(AuthenticationStatus.isAuthenIng).stream().map(evaluationAgencyPO -> {
|
|
|
- EvaluationAgency agency = new EvaluationAgency();
|
|
|
- BeanUtils.copyProperties(evaluationAgencyPO, agency);
|
|
|
- return new BaseAuthVO(agency);
|
|
|
- }).collect(Collectors.toList()));
|
|
|
- if(resultList.size() > 0 && resultList != null) {
|
|
|
+ if(resultList != null && resultList.size() > 0) {
|
|
|
resultList.sort(Comparator.comparing(BaseAuthVO::getApplytime).reversed());
|
|
|
}
|
|
|
return resultList;
|
|
@@ -1134,7 +1011,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public List<CrowdTestProjectVO> findByNameLike(String name) {
|
|
|
- Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
+ Map<String, String> applicationMap = dataCache.getApplicationTypeMap();
|
|
|
List<CrowdTestProjectVO> resultList = new ArrayList<>();
|
|
|
resultList.addAll(projectRepo.findByNameLike("%" + name + "%").stream().map(crowdTestProject -> {
|
|
|
// 项目测试类型转换
|
|
@@ -1152,7 +1029,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<CrowdTaskVO> findTaskByNameLike(String name) {
|
|
|
- Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ Map<String, String> testMap = dataCache.getTestTypeMap();
|
|
|
return taskRepo.findByNameLikeAndIsDeleted("%" + name +"%", DeletedStatus.isNotDeleted).stream().map(crowdTestTask -> {
|
|
|
//根据code值查询出来该任务的type
|
|
|
crowdTestTask.setType(testMap.get(crowdTestTask.getType()));
|
|
@@ -1163,7 +1040,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public List<CrowdTestProjectVO> AllByPage(){
|
|
|
List<CrowdTestProjectVO> resultList = new ArrayList<>();
|
|
|
- Map<String, String> applicationMap = commonRepo.getApplicationCodeNameMap();
|
|
|
+ Map<String, String> applicationMap = dataCache.getApplicationTypeMap();
|
|
|
resultList.addAll(projectDao.findAll().stream().map(crowdTestProjectPO ->{
|
|
|
CrowdTestProject crowdTestProject = new CrowdTestProject();
|
|
|
BeanUtils.copyProperties(crowdTestProjectPO, crowdTestProject);
|
|
@@ -1188,24 +1065,6 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<CrowdTestProjectVO> crowdTestProjectsWaitingAccept() {
|
|
|
- return projectDao.findAll().stream().filter(crowdTestProjectPO -> crowdTestProjectPO.getStatus() == CrowdTestProjectStatus.HAS_RELEASED
|
|
|
- && crowdTestProjectPO.getDeadTime().getTime() > System.currentTimeMillis()).map(crowdTestProjectPO -> {
|
|
|
- CrowdTestProject crowdTestProject = new CrowdTestProject();
|
|
|
- BeanUtils.copyProperties(crowdTestProjectPO, crowdTestProject);
|
|
|
- // 应用类型值的转换
|
|
|
- Optional<ApplicationTypePO> applicationTypePO = applicationTypeDao.findByCode(crowdTestProject.getApplicationType());
|
|
|
- if (applicationTypePO.isPresent()) {
|
|
|
- crowdTestProject.setApplicationType(applicationTypePO.get().getName());
|
|
|
- } else {
|
|
|
- throw new HttpBadRequestException("应用类型有误");
|
|
|
- }
|
|
|
- return new CrowdTestProjectVO(crowdTestProject);
|
|
|
-
|
|
|
- }).collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public List<UserTaskCountVO> getCount() {
|
|
|
List<RankCountInfo> rankCountInfos = taskToUserDao.findTotalCountOfUser();
|
|
|
for(int i=0;i<rankCountInfos.size();i++){
|
|
@@ -1237,7 +1096,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
@Override
|
|
|
public List<CrowdTaskVO> findIndexTaskLimitCount(int indexCount, String testTypeCode){
|
|
|
List<CrowdTaskVO> resultList = new ArrayList<>();
|
|
|
- Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ Map<String, String> testMap = dataCache.getTestTypeMap();
|
|
|
|
|
|
resultList.addAll(taskDao.findIndexTaskLimitCount(indexCount).stream().filter(crowdTestTaskPO -> crowdTestTaskPO.getDeadTime().getTime() > System.currentTimeMillis()).map(crowdTestTaskPO -> {
|
|
|
CrowdTestTask crowdTestTask = new CrowdTestTask();
|
|
@@ -1250,7 +1109,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
@Override
|
|
|
public List<CrowdTaskVO> crowdTaskVOSByTestTypeCode(String testTypeCode) {
|
|
|
- Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ Map<String, String> testMap = dataCache.getTestTypeMap();
|
|
|
return taskDao.findByType(testTypeCode).stream().map(crowdTestTaskPO -> {
|
|
|
CrowdTestTask crowdTestTask = new CrowdTestTask();
|
|
|
BeanUtils.copyProperties(crowdTestTaskPO, crowdTestTask);
|
|
@@ -1262,7 +1121,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
// ???
|
|
|
@Override
|
|
|
public List<CrowdTaskVO> crowdTaskVosWaitingAccept() {
|
|
|
- Map<String, String> testMap = commonRepo.getTypeCodeNameMap();
|
|
|
+ Map<String, String> testMap = dataCache.getTestTypeMap();
|
|
|
List<CrowdTaskVO> taskVOList = taskDao.findCanAcceptTask().stream().filter(crowdTestTaskPO -> crowdTestTaskPO.getDeadTime().getTime() > System.currentTimeMillis()).map(crowdTestTaskPO -> {
|
|
|
//根据code值查询出来该任务的type
|
|
|
CrowdTestTask crowdTestTask = new CrowdTestTask();
|
|
@@ -1611,7 +1470,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) {
|
|
@@ -1619,7 +1478,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) {
|
|
@@ -1661,36 +1520,53 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
private TaskOperationControl initTaskPermission(CrowdTestProject project, CrowdTestTask task, User user) {
|
|
|
- Optional<EndPointPO> endPointPOOptional = endPointDao.findByTaskCode(task.getCode());
|
|
|
+// Optional<EndPointPO> endPointPOOptional = endPointDao.findByTaskCode(task.getCode());
|
|
|
+ EndPoint endPoint = task.getEndPoint();
|
|
|
TaskOperationControl taskOperationControl = new TaskOperationControl();
|
|
|
|
|
|
- if (user == null || task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT) {
|
|
|
+ // 用户未登录,无其他操作权限
|
|
|
+ if (user == null) {
|
|
|
+ return taskOperationControl;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 任务时间截止,对于区域管理员可以有导出和fork功能
|
|
|
+ if(task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT){
|
|
|
+ if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.SYSTEM_ADMIN.getName()))
|
|
|
+ || (user.getRegionalManager() != null && user.getId().equals(project.getRegionalManagerId()))) {
|
|
|
+ // 不管何时都可以导出任务
|
|
|
+ taskOperationControl.setExportTask(true);
|
|
|
+ taskOperationControl.setForkTask(true);
|
|
|
+ }
|
|
|
return taskOperationControl;
|
|
|
}
|
|
|
|
|
|
// 任务已结束,如果存在配置项的任务展示token则显示 任务面板按钮
|
|
|
if(task.getStatus() == CrowdTestTaskStatus.HAS_FINISHED){
|
|
|
- if(endPointPOOptional.isPresent()){
|
|
|
- if(endPointPOOptional.get().getToken() != null && !endPointPOOptional.get().getToken().equals("")){
|
|
|
+ if(endPoint != null){
|
|
|
+ if(endPoint.getToken() != null && !endPoint.getToken().equals("")){
|
|
|
taskOperationControl.setTaskDemonstrate(true);
|
|
|
}
|
|
|
}
|
|
|
}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);
|
|
|
+ taskOperationControl.setForkTask(true);
|
|
|
// 刚发布时,可修改,可查看推荐,可跳转看报告链接是否正确
|
|
|
if (task.getStatus() < CrowdTestTaskStatus.HAS_RECEIVED) {
|
|
|
taskOperationControl.setUpdate(true);
|
|
|
taskOperationControl.setTaskRecommend(true);
|
|
|
// 具有配置项,需要在第三方进行填写报告
|
|
|
- if(endPointPOOptional.isPresent()){
|
|
|
+ if(endPoint != null){
|
|
|
taskOperationControl.setWriteReport(true);
|
|
|
+ if(endPoint.getToken() != null && !endPoint.getToken().equals("")){
|
|
|
+ taskOperationControl.setTaskDemonstrate(true);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- // 任务已发布
|
|
|
+ // 任务已被接收
|
|
|
else{
|
|
|
taskOperationControl.setTaskRecommend(true);
|
|
|
// 已被接收,分两种:1、为平台填写报告,此时提交人数和接收人数一致,则可以确认结束任务;2、为众测任务,已提交了报告,可以确认结束任务
|
|
@@ -1704,11 +1580,11 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
taskOperationControl.setTaskRecommend(false);
|
|
|
}
|
|
|
// 具有配置项,需要在第三方进行填写报告;可以填写报告、上传报告、确认结束
|
|
|
- if(endPointPOOptional.isPresent()){
|
|
|
+ if(endPoint != null){
|
|
|
taskOperationControl.setWriteReport(true);
|
|
|
taskOperationControl.setUploadReport(true);
|
|
|
taskOperationControl.setConfirmFinish(true);
|
|
|
- if(endPointPOOptional.get().getToken() != null && !endPointPOOptional.get().getToken().equals("")){
|
|
|
+ if(endPoint.getToken() != null && !endPoint.getToken().equals("")){
|
|
|
taskOperationControl.setTaskDemonstrate(true);
|
|
|
}
|
|
|
}
|
|
@@ -1751,7 +1627,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
// 具有配置项,需要在第三方进行填写报告
|
|
|
- if(endPointPOOptional.isPresent()){
|
|
|
+ if(endPoint != null){
|
|
|
taskOperationControl.noAll();
|
|
|
taskOperationControl.setWriteReport(true);
|
|
|
}
|
|
@@ -1788,9 +1664,6 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
return taskOperationControl;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
System.out.println(taskOperationControl);
|
|
|
return taskOperationControl;
|
|
|
}
|