Procházet zdrojové kódy

MOOC-23 修改北斗任务下的视图权限

guo00guo před 5 roky
rodič
revize
e1a52abee6

+ 5 - 1
core/src/main/java/com/mooctest/crowd/domain/domainobject/CrowdTestTask.java

@@ -186,7 +186,11 @@ public class CrowdTestTask {
     }
 
     public void confirmFinish() {
-        if ((this.getParticipantHasCommittedCount() == this.getAcceptedCount() && this.getStatus() == CrowdTestTaskStatus.HAS_RECEIVED) || (this.getParticipantHasCommittedCount() == this.getParticipantCount() && this.getStatus() == CrowdTestTaskStatus.HAS_COMMITED)) {
+        // 具有配置项,管理员可以结束任务
+        if(this.getEndPoint() != null){
+            this.setStatus(CrowdTestTaskStatus.HAS_FINISHED);
+            this.setEndTime(new Timestamp(System.currentTimeMillis()));
+        } else if ((this.getParticipantHasCommittedCount() == this.getAcceptedCount() && this.getStatus() == CrowdTestTaskStatus.HAS_RECEIVED) || (this.getParticipantHasCommittedCount() == this.getParticipantCount() && this.getStatus() == CrowdTestTaskStatus.HAS_COMMITED)) {
             this.setStatus(CrowdTestTaskStatus.HAS_FINISHED);
             this.setEndTime(new Timestamp(System.currentTimeMillis()));
         } else {

+ 2 - 0
core/src/main/java/com/mooctest/crowd/domain/domainobject/TestType.java

@@ -12,4 +12,6 @@ public class TestType {
     private String code;
     private String name;
     private String introduction;
+    private int type; //0-无跳转 1-有跳转
+    private String url;
 }

+ 6 - 0
core/src/main/java/com/mooctest/crowd/domain/model/TestTypePO.java

@@ -24,4 +24,10 @@ public class TestTypePO {
 
     @Column(name = "TT_INTRODUCTION")
     private String introduction;
+
+    @Column(name = "TT_TYPE")
+    private int type; //0-无跳转 1-有跳转
+
+    @Column(name = "TT_URL")
+    private String url;
 }

+ 2 - 0
site/src/main/java/com/mooctest/crowd/site/data/TaskOperationControl.java

@@ -19,6 +19,7 @@ public class TaskOperationControl {
     private boolean uploadReport = false;
     private boolean finish = false;
     private boolean confirmFinish = false;
+    private boolean writeReport = false;
 
     public void hasAll(){
         this.receive = true;
@@ -36,5 +37,6 @@ public class TaskOperationControl {
         this.update = false;
         this.finish = false;
         this.uploadReport = false;
+        this.writeReport = false;
     }
 }

+ 1 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/CrowdTaskVO.java

@@ -49,6 +49,7 @@ public class CrowdTaskVO implements Serializable{
     private List<TaskToUserVO> taskToUserVOS = new ArrayList<>();
     private String time_interval;
     private EndPointVO endPointVO;
+    private String writeReportUrl;
 
     public CrowdTaskVO(CrowdTestTask task){
         id = task.getCode();

+ 4 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/TestTypeVO.java

@@ -18,10 +18,14 @@ public class TestTypeVO implements Serializable {
     private String code;
     private String name;
     private String introduction;
+    private int type; //0-无跳转 1-有跳转
+    private String url;
 
     public TestTypeVO(TestType testType){
         code = testType.getCode();
         name = testType.getName();
         introduction = testType.getIntroduction();
+        type = testType.getType();
+        url = testType.getUrl();
     }
 }

+ 11 - 0
site/src/main/java/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.java

@@ -1596,6 +1596,7 @@ public class WebMediatorImpl implements ViewMediator {
     }
 
     private TaskOperationControl initTaskPermission(CrowdTestProject project, CrowdTestTask task, User user) {
+        Optional<EndPointPO> endPointPOOptional = endPointDao.findByTaskCode(task.getCode());
         TaskOperationControl taskOperationControl = new TaskOperationControl();
 
         if (user == null || task.getStatus() == CrowdTestTaskStatus.HAS_FINISHED || task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT) {
@@ -1613,6 +1614,10 @@ public class WebMediatorImpl implements ViewMediator {
             }
             taskOperationControl.setFinish(false);
             if (task.getStatus() == CrowdTestTaskStatus.HAS_FINISHED || task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT) {
+                // 具有配置项,需要在第三方进行填写报告
+                if(endPointPOOptional.isPresent()){
+                    taskOperationControl.setUploadReport(true);
+                }
                 taskOperationControl.setConfirmFinish(false);
             }
         }
@@ -1638,6 +1643,12 @@ public class WebMediatorImpl implements ViewMediator {
                             taskOperationControl.setFinish(false);
                             taskOperationControl.setUploadReport(false);
                         }
+
+                        // 具有配置项,需要在第三方进行填写报告
+                        if(endPointPOOptional.isPresent()){
+                            taskOperationControl.noAll();
+                            taskOperationControl.setWriteReport(true);
+                        }
                     } else if (task.getStatus() == CrowdTestTaskStatus.HAS_COMMITED) {
                         taskOperationControl.setUploadReport(false);
                     }