Browse Source

app后端提交

weiwenhai 6 years ago
parent
commit
48d21cf9c6

+ 9 - 2
src/main/java/cn/com/qmth/examcloud/app/controller/PracticeExamRestController.java

@@ -12,6 +12,7 @@ import cn.com.qmth.examcloud.app.service.ExamAdminService;
 import cn.com.qmth.examcloud.app.service.NetExamService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -81,8 +82,8 @@ public class PracticeExamRestController {
 
     @ApiOperation(value = "保存或更新考生作答的某个试题答案接口")
     @RequestMapping(value = "/exam/record/paper/question/answer/update", method = {RequestMethod.GET, RequestMethod.POST})
-    public Result updateExamRecordPaperQuestionAnswer(@RequestHeader String key, @RequestHeader String token, @RequestParam String examQuestionId, @RequestParam String studentAnswer) throws Exception {
-        return netExamService.updateExamRecordPaperQuestionAnswer(key, token, examQuestionId, studentAnswer);
+    public Result updateExamRecordPaperQuestionAnswer(@RequestHeader String key, @RequestHeader String token, @RequestParam String order, @RequestParam String studentAnswer) throws Exception {
+        return netExamService.updateExamRecordPaperQuestionAnswer(key, token, order, studentAnswer);
     }
 
     @ApiOperation(value = "当前练习的交卷接口")
@@ -132,5 +133,11 @@ public class PracticeExamRestController {
     public Result updateExamRecordQuestionAudioPlayTimes(@RequestHeader String key, @RequestHeader String token, @RequestParam String questionId, @RequestParam String mediaName) throws Exception {
         return netExamService.updateExamRecordQuestionAudioPlayTimes(key, token, questionId, mediaName);
     }
+    
+    @ApiOperation(value = "更新当前试题的音频已播放次数接口")
+    @RequestMapping(value = "/exam/practice/before/{examId}/{type}", method = {RequestMethod.GET, RequestMethod.POST})
+    public Result getBeforeExamRemark(@RequestHeader String key, @RequestHeader String token, @PathVariable Long examId, @PathVariable String type) throws Exception {
+        return examAdminService.getBeforeExamRemark(key, token, examId, type);
+    }
 
 }

+ 11 - 0
src/main/java/cn/com/qmth/examcloud/app/service/ExamAdminService.java

@@ -38,5 +38,16 @@ public interface ExamAdminService {
      * @throws Exception
      */
     Result getExamInfo(String key, String token, Long examId) throws Exception;
+    
+    /**
+     * 查询考试说明
+     * 
+     * @param key
+     * @param token
+     * @param examId
+     * @return
+     * @throws Exception
+     */
+    Result getBeforeExamRemark(String key, String token, Long examId,String type) throws Exception;
 
 }

+ 1 - 1
src/main/java/cn/com/qmth/examcloud/app/service/NetExamService.java

@@ -138,7 +138,7 @@ public interface NetExamService {
      * @return
      * @throws Exception
      */
-    Result updateExamRecordPaperQuestionAnswer(String key, String token, String examQuestionId, String studentAnswer) throws Exception;
+    Result updateExamRecordPaperQuestionAnswer(String key, String token, String order, String studentAnswer) throws Exception;
 
     /**
      * 当前练习的交卷

+ 13 - 0
src/main/java/cn/com/qmth/examcloud/app/service/impl/ExamAdminServiceImpl.java

@@ -11,6 +11,7 @@ import cn.com.qmth.examcloud.app.core.utils.HttpUtils;
 import cn.com.qmth.examcloud.app.model.Result;
 import cn.com.qmth.examcloud.app.service.ExamAdminService;
 import cn.com.qmth.examcloud.app.service.PropertyService;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -56,4 +57,16 @@ public class ExamAdminServiceImpl implements ExamAdminService {
         return result;
     }
 
+	@Override
+	public Result getBeforeExamRemark(String key, String token, Long examId, String type) throws Exception {
+		//封装请求参数
+        final String requestUrl = String.format("%s/api/ecs_exam_work/exam/examOrgProperty/%s/%s", propertyService.getExamAdminUrl(), examId, type);
+        Result<String> result = HttpUtils.doGet(requestUrl, key, token);
+        if (result.isSuccess()) {
+            //过滤掉为空的属性
+            result.setData(HttpUtils.filterNullAttributes(result.getData()));
+        }
+        return result;
+	}
+
 }

+ 4 - 4
src/main/java/cn/com/qmth/examcloud/app/service/impl/NetExamServiceImpl.java

@@ -135,12 +135,12 @@ public class NetExamServiceImpl implements NetExamService {
     }
 
     @Override
-    public Result updateExamRecordPaperQuestionAnswer(String key, String token, String examQuestionId, String studentAnswer) throws Exception {
+    public Result updateExamRecordPaperQuestionAnswer(String key, String token, String order, String studentAnswer) throws Exception {
         //封装请求参数
-        final String requestUrl = String.format("%s/api/exam_question/%s", propertyService.getNetExamUrl(), examQuestionId);
+        final String requestUrl = String.format("%s/api/ecs_oe_student/examQuestion/submitQuestionAnswer", propertyService.getNetExamUrl());
         Map<String, String> params = new HashMap<>();
-        params.put("examQuestionId", examQuestionId);
-        params.put("stuAnswer", studentAnswer);
+        params.put("order", order);
+        params.put("studentAnswer", 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);