|
@@ -8,9 +8,12 @@
|
|
|
package cn.com.qmth.examcloud.app.service;
|
|
|
|
|
|
import cn.com.qmth.examcloud.app.exception.ApiException;
|
|
|
+import cn.com.qmth.examcloud.app.model.Constants;
|
|
|
import cn.com.qmth.examcloud.app.model.Result;
|
|
|
import cn.com.qmth.examcloud.app.utils.DateUtils;
|
|
|
import cn.com.qmth.examcloud.app.utils.HttpUtils;
|
|
|
+import cn.com.qmth.examcloud.app.utils.JsonMapper;
|
|
|
+import okhttp3.FormBody;
|
|
|
import okhttp3.MediaType;
|
|
|
import okhttp3.MultipartBody;
|
|
|
import okhttp3.RequestBody;
|
|
@@ -21,6 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
import static cn.com.qmth.examcloud.app.model.Constants.TYPE_PDF;
|
|
|
import static cn.com.qmth.examcloud.app.model.Constants.TYPE_ZIP;
|
|
|
|
|
@@ -101,15 +107,26 @@ public class NetExamService {
|
|
|
}
|
|
|
|
|
|
public Result getExamRecordPaperQuestionList(String key, String token, String examRecordId) throws Exception {
|
|
|
- return null;
|
|
|
+ //封装请求参数
|
|
|
+ final String requestUrl = String.format("%s/api/exam_question?exam_record_id=%s", propertyService.getNetExamUrl(), examRecordId);
|
|
|
+ return HttpUtils.doGet(requestUrl, key, token);
|
|
|
}
|
|
|
|
|
|
public Result getExamRecordPaperQuestionDetail(String key, String token, String questionId) throws Exception {
|
|
|
- return null;
|
|
|
+ //封装请求参数
|
|
|
+ final String requestUrl = String.format("%s/api/exam_question/question?question_id=%s", propertyService.getNetExamUrl(), questionId);
|
|
|
+ return HttpUtils.doGet(requestUrl, key, token);
|
|
|
}
|
|
|
|
|
|
public Result updateExamRecordPaperQuestionAnswer(String key, String token, String examQuestionId, String studentAnswer) throws Exception {
|
|
|
- return null;
|
|
|
+ //封装请求参数
|
|
|
+ final String requestUrl = String.format("%s/api/exam_question/%s", propertyService.getNetExamUrl(), examQuestionId);
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("examQuestionId", examQuestionId);
|
|
|
+ params.put("stuAnswer", studentAnswer);
|
|
|
+ String json = new JsonMapper().toJson(params);
|
|
|
+ RequestBody formBody = FormBody.create(MediaType.parse(Constants.CHARSET_JSON_UTF8), json);
|
|
|
+ return HttpUtils.doPut(requestUrl, formBody, key, token);
|
|
|
}
|
|
|
|
|
|
public Result submitPracticeExamRecord(String key, String token, String examRecordId) throws Exception {
|