|
@@ -946,7 +946,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);
|
|
@@ -964,15 +964,14 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
if (userId == null) {
|
|
|
taskDetailsDTO.setTaskOperationControl(this.initTaskPermission(project, crowdTestTask, null));
|
|
|
} else {
|
|
|
- User user = userRepo.getByID(userId);
|
|
|
+ User user = userRepo.getInfoAndRolesByID(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 -> {
|
|
@@ -1019,12 +1018,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());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1689,7 +1686,8 @@ 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();
|
|
|
|
|
|
// 用户未登录,无其他操作权限
|
|
@@ -1710,8 +1708,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
// 任务已结束,如果存在配置项的任务展示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);
|
|
|
}
|
|
|
}
|
|
@@ -1727,7 +1725,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
taskOperationControl.setUpdate(true);
|
|
|
taskOperationControl.setTaskRecommend(true);
|
|
|
// 具有配置项,需要在第三方进行填写报告
|
|
|
- if(endPointPOOptional.isPresent()){
|
|
|
+ if(endPoint != null){
|
|
|
taskOperationControl.setWriteReport(true);
|
|
|
}
|
|
|
}
|
|
@@ -1745,11 +1743,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);
|
|
|
}
|
|
|
}
|
|
@@ -1792,7 +1790,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
// 具有配置项,需要在第三方进行填写报告
|
|
|
- if(endPointPOOptional.isPresent()){
|
|
|
+ if(endPoint != null){
|
|
|
taskOperationControl.noAll();
|
|
|
taskOperationControl.setWriteReport(true);
|
|
|
}
|