|
|
@@ -4,6 +4,7 @@ import cn.seecoder.seecoderportalcommon.vo.CourseVO;
|
|
|
import cn.seecoder.seecoderportalserver.service.HttpService;
|
|
|
import cn.seecoder.seecoderportalserver.service.SubsystemService;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
@@ -40,7 +41,7 @@ public class CoderService implements SubsystemService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void deleteService() {
|
|
|
+ public void deleteService(CourseVO courseVO) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -57,7 +58,7 @@ public class CoderService implements SubsystemService {
|
|
|
System.out.println(result);
|
|
|
}
|
|
|
|
|
|
- public JSONObject getStudentExams(int page, int limit){
|
|
|
+ public JSONObject getStudentExams(int page, int limit) {
|
|
|
String uri = "https://coder-server.seec.seecoder.cn/api/exam";
|
|
|
String token = httpService.getToken();
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
@@ -72,12 +73,12 @@ public class CoderService implements SubsystemService {
|
|
|
return JSON.parseObject(result);
|
|
|
}
|
|
|
|
|
|
- public JSONObject getExampleExams(int page, int limit, String status){
|
|
|
+ public JSONObject getExampleExams(int page, int limit, String status) {
|
|
|
String uri = "https://coder-server.seec.seecoder.cn/api/unauthorizedExam";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("page", String.valueOf(page)));
|
|
|
params.add(new BasicNameValuePair("limit", String.valueOf(limit)));
|
|
|
- if(!status.equals("default")){
|
|
|
+ if (!status.equals("default")) {
|
|
|
params.add(new BasicNameValuePair("status", status));
|
|
|
}
|
|
|
String result = null;
|
|
|
@@ -88,4 +89,24 @@ public class CoderService implements SubsystemService {
|
|
|
}
|
|
|
return JSON.parseObject(result);
|
|
|
}
|
|
|
+
|
|
|
+ public JSONArray getTeacherExamsByCourseId(int courseId) {
|
|
|
+ String uri = "https://coder-server.seec.seecoder.cn/api/exam";
|
|
|
+ String token = httpService.getToken();
|
|
|
+ List<NameValuePair> params = new ArrayList<>();
|
|
|
+ params.add(new BasicNameValuePair("page", String.valueOf(1)));
|
|
|
+ params.add(new BasicNameValuePair("limit", String.valueOf(100)));
|
|
|
+ JSONArray result = new JSONArray();
|
|
|
+ try {
|
|
|
+ JSONArray exams = JSONObject.parseObject(httpService.sendGet(uri, params, token)).getJSONArray("res");
|
|
|
+ for (int i = 0; i < exams.size(); i++) {
|
|
|
+ if ((Integer) exams.getJSONObject(i).get("courseId") == courseId) {
|
|
|
+ result.add(exams.getJSONObject(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|