|
@@ -1,21 +1,30 @@
|
|
|
package cn.com.qmth.examcloud.core.oe.admin.api.controller.client;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.api.commons.enums.ExamType;
|
|
|
+import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
|
+import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamRecordDataBeanConvert;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamRecordDataDomain;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordPaperStructEntity;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordQuestionsEntity;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.service.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.bean.examscore.ObjectiveScoreInfo;
|
|
|
+import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Api(tags = "(客户端)考试过程相关接口")
|
|
@@ -23,58 +32,113 @@ import java.util.List;
|
|
|
@RequestMapping("${$rmp.ctr.oe}/client/exam/process")
|
|
|
public class ExamProcessController extends ControllerSupport {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ExamStudentService examStudentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PracticeService practiceService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordDataSyncService examRecordDataSyncService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordPaperStructService examRecordPaperStructService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordQuestionsService examRecordQuestionsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordDataRepo examRecordDataRepo;
|
|
|
+
|
|
|
@ApiOperation(value = "获取在线考试待考列表")
|
|
|
@PostMapping("/queryExamList")
|
|
|
public List<OnHandExamInfo> queryExamList() {
|
|
|
- return new ArrayList<>();
|
|
|
+ User user = getAccessUser();
|
|
|
+ return examStudentService.queryOnlineExamList(user.getUserId(), ExamType.ONLINE);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取在线考试已结束列表")
|
|
|
@PostMapping("/queryExamEndList")
|
|
|
public List<OnHandExamInfo> queryExamEndList() {
|
|
|
- return new ArrayList<>();
|
|
|
+ User user = getAccessUser();
|
|
|
+ return examStudentService.queryOnlineExamEndList(user.getUserId(), ExamType.ONLINE);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取在线作业待考列表")
|
|
|
@PostMapping("/queryHomeworkList")
|
|
|
public List<OnHandExamInfo> queryHomeworkList() {
|
|
|
- return new ArrayList<>();
|
|
|
+ User user = getAccessUser();
|
|
|
+ return examStudentService.queryOnlineExamList(user.getUserId(), ExamType.ONLINE_HOMEWORK);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "练习课程列表")
|
|
|
@PostMapping("/queryPracticeCourseList")
|
|
|
public List<PracticeCourseInfo> queryPracticeCourseList(@RequestParam Long examId) {
|
|
|
- return new ArrayList<>();
|
|
|
+ Check.isNull(examId, "examId不能为空");
|
|
|
+ User user = getAccessUser();
|
|
|
+ return practiceService.queryPracticeCourseList(examId, user.getUserId());
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "课程练习记录详情")
|
|
|
@PostMapping("/queryPracticeRecordList")
|
|
|
public List<PracticeRecordInfo> queryPracticeRecordList(@RequestParam Long examStudentId) {
|
|
|
- return new ArrayList<>();
|
|
|
+ Check.isNull(examStudentId, "examStudentId不能为空");
|
|
|
+ return practiceService.queryPracticeRecordList(examStudentId);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "单次练习答题情况统计")
|
|
|
@PostMapping("/getPracticeDetailInfo")
|
|
|
public PracticeDetailInfo getPracticeDetailInfo(@RequestParam Long examRecordDataId, @RequestParam(required = false) String fromCache) {
|
|
|
- return new PracticeDetailInfo();
|
|
|
+ Check.isNull(examRecordDataId, "examRecordDataId不能为空");
|
|
|
+ if (fromCache != null) {
|
|
|
+ examRecordDataId = examRecordDataSyncService.getExamRecordDataIdByCacheId(examRecordDataId);
|
|
|
+ if (examRecordDataId == null) {
|
|
|
+ throw new StatusException("1001", "未找到数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return practiceService.getPracticeDetailInfo(examRecordDataId);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取考试记录试卷结构")
|
|
|
@PostMapping("/getExamRecordPaperStruct")
|
|
|
public ExamRecordPaperStructEntity getExamRecordPaperStruct(@RequestParam Long examRecordDataId, @RequestParam(required = false) String fromCache) {
|
|
|
- return null;
|
|
|
+ Check.isNull(examRecordDataId, "examRecordDataId不能为空");
|
|
|
+ if (fromCache != null) {
|
|
|
+ examRecordDataId = examRecordDataSyncService.getExamRecordDataIdByCacheId(examRecordDataId);
|
|
|
+ if (examRecordDataId == null) {
|
|
|
+ throw new StatusException("1001", "未找到数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return examRecordPaperStructService.getExamRecordPaperStruct(examRecordDataId);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取交卷之后的所有试题作答信息")
|
|
|
@PostMapping("/getExamRecordQuestions")
|
|
|
public ExamRecordQuestionsEntity getExamRecordQuestions(@RequestParam Long examRecordDataId, @RequestParam(required = false) String fromCache) {
|
|
|
- return null;
|
|
|
+ Check.isNull(examRecordDataId, "examRecordDataId不能为空");
|
|
|
+ if (fromCache != null) {
|
|
|
+ examRecordDataId = examRecordDataSyncService.getExamRecordDataIdByCacheId(examRecordDataId);
|
|
|
+ if (examRecordDataId == null) {
|
|
|
+ throw new StatusException("1001", "未找到数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return examRecordQuestionsService.getExamRecordQuestionsAndFixExamRecordDataIfNecessary(examRecordDataId);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取当前考试记录信息")
|
|
|
@PostMapping("/findExamRecordDataEntity")
|
|
|
public ExamRecordDataDomain findExamRecordDataEntity(@RequestParam Long examRecordDataId, @RequestParam(required = false) String fromCache) {
|
|
|
- return null;
|
|
|
+ if (fromCache != null) {
|
|
|
+ examRecordDataId = examRecordDataSyncService.getExamRecordDataIdByCacheId(examRecordDataId);
|
|
|
+ if (examRecordDataId == null) {
|
|
|
+ throw new StatusException("1001", "未找到数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ExamRecordDataEntity examRecordDataEntity = GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
|
|
|
+ ExamRecordDataDomain domain = ExamRecordDataBeanConvert.copyFrom(examRecordDataEntity);
|
|
|
+ domain.setExamRecord(examRecordDataEntity);
|
|
|
+ return domain;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "根据examStudentId获取客观分信息")
|