PracticeExamRestController.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * *************************************************
  3. * Copyright (c) 2018 QMTH. All Rights Reserved.
  4. * Created by Deason on 2018-07-16 17:53:55.
  5. * *************************************************
  6. */
  7. package cn.com.qmth.examcloud.app.controller;
  8. import cn.com.qmth.examcloud.app.model.Result;
  9. import cn.com.qmth.examcloud.app.service.CoreExamWorkService;
  10. import cn.com.qmth.examcloud.app.service.CoreOeService;
  11. import cn.com.qmth.examcloud.app.service.CoreQuestionService;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.*;
  16. import static cn.com.qmth.examcloud.app.model.Constants.PARAM_APP_KEY;
  17. import static cn.com.qmth.examcloud.app.model.Constants.PARAM_APP_TOKEN;
  18. /**
  19. * 在线练习相关接口
  20. *
  21. * @version v1.0
  22. * @author: QMTH
  23. * @since: 2018/7/16
  24. */
  25. @RestController
  26. @RequestMapping("${$rmp}/v2")
  27. @Api(tags = "在线练习相关接口")
  28. public class PracticeExamRestController {
  29. @Autowired
  30. private CoreExamWorkService examWorkService;
  31. @Autowired
  32. private CoreOeService oeService;
  33. @Autowired
  34. private CoreQuestionService questionService;
  35. @ApiOperation(value = "获取某考生的“考试批次”列表接口")
  36. @RequestMapping(value = "/exam/practice/list", method = {RequestMethod.POST})
  37. public Result getPracticeExamList(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String studentId) throws Exception {
  38. return examWorkService.getPracticeExamList(key, token, studentId);
  39. }
  40. @ApiOperation(value = "获取某考试批次下的课程列表接口")
  41. @RequestMapping(value = "/exam/practice/course/list", method = {RequestMethod.POST})
  42. public Result getPracticeExamCourseList(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String examId) throws Exception {
  43. return oeService.getPracticeExamCourseList(key, token, examId);
  44. }
  45. @ApiOperation(value = "获取当前练习的剩余作答时间接口")
  46. @RequestMapping(value = "/exam/record/heartbeat", method = {RequestMethod.POST})
  47. public Result getExamRecordHeartbeat(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token) throws Exception {
  48. return oeService.getExamRecordHeartbeat(key, token);
  49. }
  50. @ApiOperation(value = "考生“开始练习”接口")
  51. @RequestMapping(value = "/exam/record/start", method = {RequestMethod.POST})
  52. public Result startPracticeExamRecord(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String examStudentId) throws Exception {
  53. return oeService.startPracticeExamRecord(key, token, examStudentId);
  54. }
  55. @ApiOperation(value = "记录切屏次数接口")
  56. @PostMapping(value = "/exam/record/switch/screen")
  57. public Result switchScreen(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String examRecordDataId) throws Exception {
  58. return oeService.switchScreen(key, token, examRecordDataId);
  59. }
  60. @ApiOperation(value = "获取结束练习的试卷大题结构信息接口")
  61. @RequestMapping(value = "/exam/admin/record/paper/struct/list", method = {RequestMethod.POST})
  62. public Result getExamAdminRecordPaperStructList(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String examRecordId, @RequestParam(required = false) String fromCache) throws Exception {
  63. return oeService.getAdminExamPaperStructList(key, token, examRecordId, fromCache);
  64. }
  65. @ApiOperation(value = "获取当前练习的试卷大题结构信息接口")
  66. @RequestMapping(value = "/exam/student/record/paper/struct/list", method = {RequestMethod.POST})
  67. public Result getExamStudentRecordPaperStructList(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String examRecordId) throws Exception {
  68. return oeService.getStudentExamPaperStructList(key, token, examRecordId);
  69. }
  70. @ApiOperation(value = "获取当前练习的考试基本信息接口")
  71. @RequestMapping(value = "/exam/info/{examId}", method = {RequestMethod.POST})
  72. public Result getExamInfo(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @PathVariable Long examId) throws Exception {
  73. return examWorkService.getExamInfo(key, token, examId);
  74. }
  75. @ApiOperation(value = "获取当前练习的试卷试题列表接口")
  76. @RequestMapping(value = "/exam/record/paper/question/list", method = {RequestMethod.POST})
  77. public Result getExamRecordPaperQuestionList(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token) throws Exception {
  78. return oeService.getExamRecordPaperQuestionList(key, token);
  79. }
  80. @ApiOperation(value = "获取考生作答的某个试题的详细信息接口")
  81. @RequestMapping(value = "/exam/record/paper/question/detail/{questionId}/{examRecordId}", method = {RequestMethod.POST})
  82. public Result questionDetail(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @PathVariable String questionId, @PathVariable String examRecordId) throws Exception {
  83. return oeService.getExamRecordPaperQuestionDetail(key, token, questionId, examRecordId);
  84. }
  85. @ApiOperation(value = "保存或更新考生作答的某个试题答案接口")
  86. @RequestMapping(value = "/exam/record/paper/question/answer/update", method = {RequestMethod.POST})
  87. public Result updateExamRecordPaperQuestionAnswer(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam Integer order, @RequestParam String studentAnswer, @RequestParam(required = false) String audioPlayTimes) throws Exception {
  88. return oeService.updateExamRecordPaperQuestionAnswer(key, token, order, studentAnswer, audioPlayTimes);
  89. }
  90. @ApiOperation(value = "当前练习的交卷接口")
  91. @RequestMapping(value = "/exam/record/submit", method = {RequestMethod.POST})
  92. public Result submitPracticeExamRecord(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token) throws Exception {
  93. return oeService.submitPracticeExamRecord(key, token);
  94. }
  95. @ApiOperation(value = "检查考生当前是否有正在进行的练习记录接口")
  96. @RequestMapping(value = "/exam/record/online/check", method = {RequestMethod.POST})
  97. public Result checkOnlineExamRecord(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token) throws Exception {
  98. return oeService.checkOnlineExamRecord(key, token);
  99. }
  100. @ApiOperation(value = "获取当前考生的当前课程的历史练习记录接口")
  101. @RequestMapping(value = "/exam/record/practice/course/history/list", method = {RequestMethod.POST})
  102. public Result getExamRecordPracticeHistoryList(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String examStudentId) throws Exception {
  103. return oeService.getExamRecordPracticeHistoryList(key, token, examStudentId);
  104. }
  105. @ApiOperation(value = "获取成绩报告的答题情况统计接口")
  106. @RequestMapping(value = "/exam/record/total", method = {RequestMethod.POST})
  107. public Result getExamRecordTotalInfo(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String examRecordId, @RequestParam(required = false) String fromCache) throws Exception {
  108. return oeService.getExamRecordTotalInfo(key, token, examRecordId, fromCache);
  109. }
  110. @ApiOperation(value = "获取作答的题列表接口")
  111. @RequestMapping(value = "/exam/record/paper/question/detail/list", method = {RequestMethod.POST})
  112. public Result getExamRecordQuestionDetailList(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String examRecordId) throws Exception {
  113. return oeService.getExamRecordQuestionDetailList(key, token, examRecordId);
  114. }
  115. @ApiOperation(value = "获取当前试题的音频已播放次数接口")
  116. @RequestMapping(value = "/exam/record/paper/question/get/playtimes", method = {RequestMethod.POST})
  117. public Result getExamRecordQuestionAudioPlayTimes(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String questionId) throws Exception {
  118. return oeService.getExamRecordQuestionAudioPlayTimes(key, token, questionId);
  119. }
  120. @ApiOperation(value = "更新当前试题的音频已播放次数接口")
  121. @RequestMapping(value = "/exam/record/paper/question/update/playtimes", method = {RequestMethod.POST})
  122. public Result updateExamRecordQuestionAudioPlayTimes(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String questionId, @RequestParam String mediaName) throws Exception {
  123. return oeService.updateExamRecordQuestionAudioPlayTimes(key, token, questionId, mediaName);
  124. }
  125. @ApiOperation(value = "开考前查询“考试说明”")
  126. @RequestMapping(value = "/exam/practice/before/{examId}/{type}", method = {RequestMethod.POST})
  127. public Result getBeforeExamRemark(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @PathVariable Long examId, @PathVariable String type) throws Exception {
  128. return examWorkService.getBeforeExamRemark(key, token, examId, type);
  129. }
  130. @ApiOperation(value = "查询练习记录配置信息")
  131. @RequestMapping(value = "/exam/practice/end/findExamRecordDataEntity/{examRecordDataId}", method = {RequestMethod.POST})
  132. public Result findExamRecordDataEntity(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @PathVariable Long examRecordDataId, @RequestParam(required = false) String fromCache) throws Exception {
  133. return oeService.findExamRecordDataEntity(key, token, examRecordDataId, fromCache);
  134. }
  135. @ApiOperation(value = "查询练习记录试题列表")
  136. @RequestMapping(value = "/exam/practice/end/getExamRecordQuestions/{examRecordDataId}", method = {RequestMethod.POST})
  137. public Result getExamRecordQuestions(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @PathVariable Long examRecordDataId, @RequestParam(required = false) String fromCache) throws Exception {
  138. return oeService.getExamRecordQuestions(key, token, examRecordDataId, fromCache);
  139. }
  140. @ApiOperation(value = "查询某个试题内容")
  141. @RequestMapping(value = "/exam/practice/end/question", method = {RequestMethod.POST})
  142. public Result getQuestion(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam String courseCode,
  143. @RequestParam Long examId, @RequestParam String groupCode, @RequestParam String questionId) throws Exception {
  144. return questionService.getQuestion(key, token, courseCode, examId, groupCode, questionId);
  145. }
  146. @ApiOperation(value = "获取冻结时间")
  147. @RequestMapping(value = "/exam/practice/getFreezeTime", method = {RequestMethod.POST})
  148. public Result getFreezeTime(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @RequestParam Long examId) throws Exception {
  149. return examWorkService.getFreezeTime(key, token, examId);
  150. }
  151. @ApiOperation(value = "获取文件上传类型")
  152. @RequestMapping(value = "/exam/practice/getUpLoadType/{examId}", method = {RequestMethod.POST})
  153. public Result getUpLoadType(@RequestHeader(name = PARAM_APP_KEY) String key, @RequestHeader(name = PARAM_APP_TOKEN) String token, @PathVariable Long examId) throws Exception {
  154. return examWorkService.getUpLoadType(key, token, examId);
  155. }
  156. }