|
|
@@ -1,9 +1,12 @@
|
|
|
package cn.seecoder.seecoderportalserver.serviceImpl.subsystem;
|
|
|
|
|
|
import cn.seecoder.seecoderportalcommon.vo.CourseVO;
|
|
|
+import cn.seecoder.seecoderportalcommon.vo.CreateEvalExamVO;
|
|
|
+import cn.seecoder.seecoderportalcommon.vo.QuestionScoreMapVO;
|
|
|
import cn.seecoder.seecoderportalserver.service.HttpService;
|
|
|
import cn.seecoder.seecoderportalserver.service.subsystem.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;
|
|
|
@@ -97,6 +100,33 @@ public class EvalService implements SubsystemService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public JSONObject createEvalExam(CreateEvalExamVO createEvalExamVO) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/exam";
|
|
|
+// String uri = "http://localhost:8081/api/exam";
|
|
|
+ String token = httpService.getToken();
|
|
|
+ JSONObject requestBody = new JSONObject();
|
|
|
+ requestBody.put("examName",createEvalExamVO.getExamName());
|
|
|
+ requestBody.put("skills",createEvalExamVO.getSkills());
|
|
|
+ requestBody.put("difficulty",createEvalExamVO.getDifficulty());
|
|
|
+ requestBody.put("startTime",createEvalExamVO.getStartTime());
|
|
|
+ requestBody.put("endTime",createEvalExamVO.getEndTime());
|
|
|
+ requestBody.put("comment",createEvalExamVO.getComment());
|
|
|
+ requestBody.put("antiCheating",createEvalExamVO.getAntiCheating());
|
|
|
+ requestBody.put("isPublic",createEvalExamVO.getIsPublic());
|
|
|
+ requestBody.put("position",createEvalExamVO.getPosition());
|
|
|
+ requestBody.put("courseId",createEvalExamVO.getCourseId());
|
|
|
+ System.out.println(requestBody);
|
|
|
+ String result = null;
|
|
|
+ try {
|
|
|
+ result = httpService.sendPost(uri, requestBody,null, token);
|
|
|
+ System.out.println(result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return JSONObject.parseObject(result);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public JSONObject findRecommendExamsByCourseId(int courseId) {
|
|
|
String uri = "https://eval-server.seec.seecoder.cn/api/exam/recommend/" + courseId;
|
|
|
@@ -108,4 +138,93 @@ public class EvalService implements SubsystemService {
|
|
|
}
|
|
|
return JSONObject.parseObject(result);
|
|
|
}
|
|
|
+
|
|
|
+ public JSONObject getSampleExamPaperList() {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/question/sample";
|
|
|
+ String result = null;
|
|
|
+ try {
|
|
|
+ result = httpService.sendGet(uri,new ArrayList<>(),null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ return JSONObject.parseObject(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ public JSONObject getExamQuestionAndScoreById(Integer examId) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/exam/" + examId +"/questions";
|
|
|
+ String result = null;
|
|
|
+ try {
|
|
|
+ result = httpService.sendGet(uri, new ArrayList<>(), null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return JSONObject.parseObject(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ public JSONObject getQuestionById(String id) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/question/" + id;
|
|
|
+ String result = null;
|
|
|
+ try {
|
|
|
+ result = httpService.sendGet(uri, new ArrayList<>(), null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return JSONObject.parseObject(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setExamQuestionsBySampleExamPaper(int examId, int sampleExamPaperId) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/exam/question/sample/" + examId + "/?sampleExamPaperId=" + sampleExamPaperId;
|
|
|
+ String token = httpService.getToken();
|
|
|
+ try {
|
|
|
+ httpService.sendPost(uri, null,null,token);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public JSONObject getQuestionRecordsOfExamByUserId(Integer examId) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/record/all" + "?examId=" + examId;
|
|
|
+ String token = httpService.getToken();
|
|
|
+ String result = null;
|
|
|
+ try {
|
|
|
+ result = httpService.sendGet(uri, new ArrayList<>(), token);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return JSONObject.parseObject(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ public JSONObject getQuestionList(String stem, List<String> tags, String knowledgeName, int pageSize, int pageNum) {
|
|
|
+ String params = "";
|
|
|
+ if(stem!=null){
|
|
|
+ params+=("stem=" + stem + "&");
|
|
|
+ }
|
|
|
+ if(tags!=null){
|
|
|
+ params+=("tags=" + tags + "&");
|
|
|
+ }
|
|
|
+ if(knowledgeName!=null){
|
|
|
+ params+=("knowledgeName=" + knowledgeName + "&");
|
|
|
+ }
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/question/question" + "?" + params + "pageSize=" + pageSize + "&pageNum=" + pageNum;
|
|
|
+ String token = httpService.getToken();
|
|
|
+ String result = null;
|
|
|
+ try {
|
|
|
+ result = httpService.sendGet(uri, new ArrayList<>(), token);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return JSONObject.parseObject(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void updateQuestionsOfExam(Integer examId, QuestionScoreMapVO questionScoreMapVO) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/exam/" + examId + "/questions/";
|
|
|
+ String token = httpService.getToken();
|
|
|
+ JSONObject requestBody = new JSONObject();
|
|
|
+ requestBody.put("questionScoreMap",questionScoreMapVO);
|
|
|
+ try {
|
|
|
+ httpService.sendPut(uri, requestBody,token);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|