Browse Source

feat: 增加获取学生考试列表的接口

yhd12345 3 years ago
parent
commit
4d23cd7971

+ 2 - 0
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/service/ExamService.java

@@ -103,4 +103,6 @@ public interface ExamService {
     void takeExamWithoutInviteCode(Integer examId);
 
     void takeExamWithInviteCode(Integer examId, String inviteCode);
+
+    JSONObject getExamListByCurrentStudent();
 }

+ 5 - 0
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/serviceImpl/ExamServiceImpl.java

@@ -201,6 +201,11 @@ public class ExamServiceImpl implements ExamService {
         evalService.takeExamWithInviteCode(examId,inviteCode);
     }
 
+    @Override
+    public JSONObject getExamListByCurrentStudent() {
+        return evalService.getExamListByCurrentStudent();
+    }
+
 
     @Override
     public JSONObject getResultByExamId(int examId) {

+ 13 - 0
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/serviceImpl/subsystem/EvalService.java

@@ -290,4 +290,17 @@ public class EvalService implements SubsystemService {
             e.printStackTrace();
         }
     }
+
+    public JSONObject getExamListByCurrentStudent() {
+        String uri = "https://eval-server.seec.seecoder.cn/api/exam/student/examList";
+//        String uri = "https://localhost:8081/api/exam/student/examList";
+        String token = httpService.getToken();
+        String result = null;
+        try {
+            result = httpService.sendGet(uri, new ArrayList<>(), token);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return JSONObject.parseObject(result);
+    }
 }

+ 7 - 0
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/web/rest/ExamController.java

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import springfox.documentation.annotations.ApiIgnore;
@@ -360,4 +361,10 @@ public class ExamController {
         return OkResponse.of(null);
     }
 
+    @ApiOperation("获得学生参加的考试列表")
+    @GetMapping("/eval/exam/student/examList")
+    public OkResponse<JSONObject> getExamListByCurrentStudent(){
+        return OkResponse.of(examService.getExamListByCurrentStudent());
+    }
+
 }