Sfoglia il codice sorgente

feat:
通过eval和coder查找学生的测试

mjh 4 anni fa
parent
commit
1d5de97a60

+ 3 - 1
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/config/SpringSecurityConfiguration.java

@@ -57,6 +57,7 @@ public class SpringSecurityConfiguration extends WebSecurityConfigurerAdapter {
                         "/api/user/resetPassword",
                         "/api/user/sendMessage",
                         "/api/user/findIdByPhone",
+                        "/api/user/findUserById",
                         "/api/interaction",
                         "/api/receiveIDToken",
                         "/api/authenticate",
@@ -69,7 +70,8 @@ public class SpringSecurityConfiguration extends WebSecurityConfigurerAdapter {
                         "/api/course/selection/confirm",
                         "/api/course/selection/cancel",
                         "/api/course/student",
-                        "/api/course/example")
+                        "/api/course/example",
+                        "/api/eval/student/exams")
                 .permitAll() // authenticate
                 .and()
                 .authorizeRequests()

+ 17 - 0
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/service/Impl/EvalService.java

@@ -45,4 +45,21 @@ public class EvalService implements SubsystemService {
         }
         return JSONObject.parseObject(result);
     }
+
+    public JSONObject getStudentExams(int pageSize, int pageNum, int state){
+        String uri = "https://eval-server.seec.seecoder.cn/api/exam/student/exams";
+        String token = httpService.getToken();
+        List<NameValuePair> params = new ArrayList<>();
+        System.out.println(pageSize);
+        params.add(new BasicNameValuePair("pageSize", String.valueOf(pageSize)));
+        params.add(new BasicNameValuePair("pageNum", String.valueOf(pageNum)));
+        params.add(new BasicNameValuePair("state", String.valueOf(state)));
+        String result = null;
+        try {
+            result = httpService.sendGet(uri, params, token);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return JSONObject.parseObject(result);
+    }
 }

+ 1 - 1
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/web/rest/CoderController.java

@@ -16,7 +16,7 @@ public class CoderController {
     public CoderController(CoderService coderService) {this.coderService = coderService;}
 
     @GetMapping("/exams")
-    public OkResponse<JSONObject> getAllExams(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit){
+    public OkResponse<JSONObject> getAllExams(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "100") int limit){
         return OkResponse.of(coderService.getAllExams(page, limit));
     }
 }

+ 10 - 0
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/web/rest/EvalController.java

@@ -3,6 +3,7 @@ package cn.seecoder.seecoderportalserver.web.rest;
 import cn.seecoder.seecoderportalserver.service.Impl.EvalService;
 import cn.seecoder.seecoderportalserver.utility.OkResponse;
 import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.ApiParam;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -19,4 +20,13 @@ public class EvalController {
     public OkResponse<JSONObject> getAllExams(@RequestParam(defaultValue = "100") int pageSize, @RequestParam(defaultValue = "1") int pageNum) {
         return OkResponse.of((JSONObject) evalService.getAllExams(pageSize, pageNum).get("result"));
     }
+
+    @GetMapping("/exams/student")
+    public OkResponse<JSONObject> getStudentExams(@RequestParam(defaultValue = "100") int pageSize,
+                                                  @RequestParam(defaultValue = "1") int pageNum,
+                                                  @ApiParam(name = "state", value = "0 所有, 1 未开始,2 进行中,3 已结束")
+                                                      @RequestParam(value = "state") int state
+    ){
+        return OkResponse.of((JSONObject) evalService.getStudentExams(pageSize, pageNum, state).get("result"));
+    }
 }