|
|
@@ -103,8 +103,9 @@ public class EvalService implements SubsystemService {
|
|
|
|
|
|
public JSONObject createEvalExam(CreateEvalExamVO createEvalExamVO) {
|
|
|
String uri = "https://eval-server.seec.seecoder.cn/api/exam";
|
|
|
-// String uri = "http://localhost:8081/api/exam";
|
|
|
+// String uri = "https://localhost:8081/api/exam";
|
|
|
String token = httpService.getToken();
|
|
|
+ System.out.println(token);
|
|
|
JSONObject requestBody = new JSONObject();
|
|
|
requestBody.put("examName",createEvalExamVO.getExamName());
|
|
|
requestBody.put("skills",createEvalExamVO.getSkills());
|
|
|
@@ -116,6 +117,7 @@ public class EvalService implements SubsystemService {
|
|
|
requestBody.put("isPublic",createEvalExamVO.getIsPublic());
|
|
|
requestBody.put("position",createEvalExamVO.getPosition());
|
|
|
requestBody.put("courseId",createEvalExamVO.getCourseId());
|
|
|
+// requestBody.put("courseId",1);//测试用
|
|
|
System.out.println(requestBody);
|
|
|
String result = null;
|
|
|
try {
|
|
|
@@ -220,7 +222,68 @@ public class EvalService implements SubsystemService {
|
|
|
String uri = "https://eval-server.seec.seecoder.cn/api/exam/" + examId + "/questions/";
|
|
|
String token = httpService.getToken();
|
|
|
JSONObject requestBody = new JSONObject();
|
|
|
- requestBody.put("questionScoreMap",questionScoreMapVO);
|
|
|
+ requestBody.put("questionScoreMap",questionScoreMapVO.getQuestionScoreMap());
|
|
|
+ try {
|
|
|
+ httpService.sendPut(uri, requestBody,token);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public JSONObject getExamById(Integer examId) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/exam/" +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 getUsersByExamId(Integer examId) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/user/" + 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 getReportByExamId(Integer examId) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/report/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 void takeExamWithInviteCode(Integer examId, String inviteCode) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/exam/invite/code" + "?inviteCode=" + inviteCode + "&examId=" + examId;
|
|
|
+ String token = httpService.getToken();
|
|
|
+ JSONObject requestBody = new JSONObject();
|
|
|
+ requestBody.put("inviteCode",inviteCode);
|
|
|
+ requestBody.put("examId",examId);
|
|
|
+ try {
|
|
|
+ httpService.sendPut(uri, requestBody,token);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void takeExamWithoutInviteCode(Integer examId) {
|
|
|
+ String uri = "https://eval-server.seec.seecoder.cn/api/exam/invite/code" + "?examId=" + examId;
|
|
|
+ String token = httpService.getToken();
|
|
|
+ JSONObject requestBody = new JSONObject();
|
|
|
+ requestBody.put("examId",examId);
|
|
|
try {
|
|
|
httpService.sendPut(uri, requestBody,token);
|
|
|
} catch (Exception e) {
|