From 4361c1462337281f4f98b4c2c49c74af0fedc257 Mon Sep 17 00:00:00 2001 From: xusd Date: Fri, 10 May 2024 17:52:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E6=A0=B8=E8=AF=84=E4=BC=B0-=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E7=AD=94=E9=A2=98=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../examine/ExamMyExamineController.java | 9 +++++ .../examine/mapper/MyExamineMapper.java | 16 ++++++++ .../examine/service/IMyExamineService.java | 6 +++ .../service/impl/MyExamineServiceImpl.java | 26 +++++++++++++ .../examine/vo/MyExamPaperQuestionVO.java | 21 ++++++++++ .../main/resources/mapper/MyExamineMapper.xml | 39 ++++++++++++++++++- 6 files changed, 116 insertions(+), 1 deletion(-) diff --git a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamMyExamineController.java b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamMyExamineController.java index 3054fd5..35ba166 100644 --- a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamMyExamineController.java +++ b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamMyExamineController.java @@ -82,6 +82,15 @@ public class ExamMyExamineController extends BaseController { return getDataTable(list); } + /** + * 查看历史作答详情 + */ + @PreAuthorize("@ss.hasPermi('examine:myExamine:getHistoryExam')") + @GetMapping("/getHistoryExam/{id}") + public MyExamVO getHistoryExam(@PathVariable("id") String id){ + return myExamineService.getHistoryExam(id); + } + /** * 查询我的认证管理列表 */ diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/MyExamineMapper.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/MyExamineMapper.java index e0a36dd..edcf2b8 100644 --- a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/MyExamineMapper.java +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/MyExamineMapper.java @@ -56,4 +56,20 @@ public interface MyExamineMapper { * @return java.util.List */ List selectPaperQuestionHaveAnswerListByPaperId(String paperId); + + /** + * 查看历史作答考试基本信息 + * @param id 试卷id + */ + MyExamVO getHistoryExam(String id); + + /** + * 获取答题记录和试题答案以及解析 + * + * @param paperId 试卷id + * @return java.util.List + * @Author xusd + * @Date 17:49 2024/5/10 + */ + List selectHistoryPaperQuestionNoAnswerListByPaperId(String paperId); } diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IMyExamineService.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IMyExamineService.java index db1ebca..85f895d 100644 --- a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IMyExamineService.java +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IMyExamineService.java @@ -53,4 +53,10 @@ public interface IMyExamineService { * @param submitExamDTO 考试及答案 */ int submitExam(SubmitExamDTO submitExamDTO); + + /** + * 查看历史作答详情 + * @param id 试卷id + */ + MyExamVO getHistoryExam(String id); } diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/MyExamineServiceImpl.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/MyExamineServiceImpl.java index 9fda4dc..3a9c2f8 100644 --- a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/MyExamineServiceImpl.java +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/MyExamineServiceImpl.java @@ -203,6 +203,32 @@ public class MyExamineServiceImpl implements IMyExamineService { return myExamineMapper.examHistoryList(examPaperInfo); } + /** + * 查看历史作答详情 + * @param id 试卷id + */ + @Override + public MyExamVO getHistoryExam(String id) { + MyExamVO myExam = myExamineMapper.getHistoryExam(id); + if (Objects.isNull(myExam)){ + throw new ServiceException("未查询到考试信息"); + } + //考试题 + List allPaperQuestionList = myExamineMapper.selectHistoryPaperQuestionNoAnswerListByPaperId(id); + if (StringUtils.isEmpty(allPaperQuestionList)){ + throw new ServiceException("未查询到考试题目"); + } + //试题类型 0 单选,1 多选,2 判断 + Map> allPaperQuestionMap = allPaperQuestionList.stream().collect(Collectors.groupingBy(MyExamPaperQuestionVO::getQuestionType)); + //单选 + myExam.setSingleChoiceList(allPaperQuestionMap.get("0")); + //多选 + myExam.setMultiChoiceList(allPaperQuestionMap.get("1")); + //判断 + myExam.setJudgeList(allPaperQuestionMap.get("2")); + return myExam; + } + /** * 查询我的认证管理列表 */ diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/vo/MyExamPaperQuestionVO.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/vo/MyExamPaperQuestionVO.java index c24a293..4df9148 100644 --- a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/vo/MyExamPaperQuestionVO.java +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/vo/MyExamPaperQuestionVO.java @@ -1,5 +1,6 @@ package com.inspur.examine.vo; +import com.inspur.common.annotation.Excel; import lombok.Data; /** @@ -31,4 +32,24 @@ public class MyExamPaperQuestionVO { */ private String questionOptions; + /** + * 试题答案 + */ + private String questionAnswer; + + /** + * 答案解析 + */ + private String questionAnswerAnalysis; + + /** + * 考生答案 + */ + private String examineAnswer; + + /** + * 是否正确(0:正确,1:错误) + */ + private String isSure; + } diff --git a/inspur-service/inspur-examine/src/main/resources/mapper/MyExamineMapper.xml b/inspur-service/inspur-examine/src/main/resources/mapper/MyExamineMapper.xml index 5374342..1056567 100644 --- a/inspur-service/inspur-examine/src/main/resources/mapper/MyExamineMapper.xml +++ b/inspur-service/inspur-examine/src/main/resources/mapper/MyExamineMapper.xml @@ -180,7 +180,7 @@ LEFT JOIN sys_user AS su ON epi.examine_id = su.user_id LEFT JOIN exam_attestation AS ea ON ei.attestation_id = ea.id WHERE - epi.id = '38d240be52914ddd855054c183f6f0a3' + epi.id = #{id} AND epi.`status` = '0' @@ -210,4 +210,41 @@ epq.paper_id = #{paperId} + + + \ No newline at end of file