소스 검색

河南模拟卷返回考生做题状态

mingfu 1 주 전
부모
커밋
d788bc3ebe

+ 2 - 1
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontPaperController.java

@@ -141,7 +141,8 @@ public class FrontPaperController {
         learnPaper.setDirectKey(sysUser.getExamType().name() + "_" + subjectKey);
         learnPaper.setSubjectId(null);
         learnPaper.setStatus(1);
-        List<LearnPaper> list = learnPaperService.selectLearnPaperList(learnPaper);
+        learnPaper.setExamineeId(sysUser.getUserId());
+        List<LearnPaper> list = learnPaperService.selectLearnPaperForExam(learnPaper);
         Map<Long, String> subjectMap = dzSubjectService.selectDzSubjectList(new DzSubject()).stream().collect(Collectors.toMap(DzSubject::getSubjectId, DzSubject::getSubjectName));
         List<JSONObject> jsonList = list.stream().map(t -> {
             JSONObject o = JSONObject.from(t);

+ 2 - 2
ie-admin/src/main/java/com/ruoyi/web/service/ExamService.java

@@ -477,10 +477,10 @@ public class ExamService {
         examinee.setStudentId(SecurityUtils.getLoginUser().getUser().getUserId());
         examinee.setPaperType(PaperType.Simulated.getVal());
         examinee.setPaperKey("P" + "_" + paperId + "_" + learnPaper.getSubjectId());
-        examinee.setState(ExamineeStatus.Sign.getVal());
         List<LearnExaminee> examineeList = examineeMapper.selectLearnExamineeList(examinee);
         if(CollectionUtils.isNotEmpty(examineeList)) {
-            return buildAnswerSheet(learnPaper, examineeList.get(0), loadQuestionAnswers(examineeList.get(0), true));
+            LearnExaminee exist = examineeList.get(0);
+            return buildAnswerSheet(learnPaper, exist, loadQuestionAnswers(exist, exist.getState() < ExamineeStatus.Commit.getVal()));
         }
         return openNewExamineeByPaper(examinee, learnPaper);
     }

+ 1 - 1
ie-system/src/main/java/com/ruoyi/learn/mapper/LearnPaperMapper.java

@@ -30,7 +30,7 @@ public interface LearnPaperMapper
      * @return 试卷集合
      */
     public List<LearnPaper> selectLearnPaperList(LearnPaper learnPaper);
-
+    public List<LearnPaper> selectLearnPaperForExam(LearnPaper learnPaper);
     /**
      * 新增试卷
      *

+ 1 - 0
ie-system/src/main/java/com/ruoyi/learn/service/ILearnPaperService.java

@@ -26,6 +26,7 @@ public interface ILearnPaperService
      * @return 试卷集合
      */
     public List<LearnPaper> selectLearnPaperList(LearnPaper learnPaper);
+    public List<LearnPaper> selectLearnPaperForExam(LearnPaper learnPaper);
     public List<LearnPaper> selectPapersListFromFavorites(LearnPaper papers);
     /**
      * 新增试卷

+ 6 - 0
ie-system/src/main/java/com/ruoyi/learn/service/impl/LearnPaperServiceImpl.java

@@ -44,6 +44,12 @@ public class LearnPaperServiceImpl implements ILearnPaperService
         return learnPaperMapper.selectLearnPaperList(learnPaper);
     }
 
+    @Override
+    public List<LearnPaper> selectLearnPaperForExam(LearnPaper learnPaper)
+    {
+        return learnPaperMapper.selectLearnPaperForExam(learnPaper);
+    }
+
     @Override
     public List<LearnPaper> selectPapersListFromFavorites(LearnPaper papers) {
         return learnPaperMapper.selectPapersListFromFavorites(papers);

+ 24 - 0
ie-system/src/main/resources/mapper/learn/LearnPaperMapper.xml

@@ -29,6 +29,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select id, subjectId, paperName, year, paperType, number, fenshu, paperSource, direct_key, paper_info, tiid, osspath, filename, relate_id, locations, examineeTypes, createTime from learn_paper
     </sql>
 
+    <select id="selectLearnPaperForExam" parameterType="LearnPaper" resultMap="LearnPaperResult">
+        SELECT id, subjectId, paperName, YEAR, paperType, number, fenshu, paperSource, direct_key, p.paper_info, tiid, osspath, filename, relate_id, locations, examineeTypes, createTime, IF(e.`state` IS NULL, 1, e.`state`) status
+        FROM learn_paper p LEFT JOIN `learn_examinee` e ON p.`id` = e.`paper_id` AND e.`student_id` = #{examineeId}
+        <where>
+            <if test="subjectId != null "> and p.subjectId = #{subjectId}</if>
+            <if test="paperName != null  and paperName != ''"> and p.paperName like concat('%', #{paperName}, '%')</if>
+            <if test="year != null "> and p.year = #{year}</if>
+            <if test="paperType != null  and paperType != ''"> and p.paperType = #{paperType}</if>
+            <if test="status != null"> and p.status = #{status}</if>
+            <if test="number != null  and number != ''"> and p.number = #{number}</if>
+            <if test="fenshu != null "> and p.fenshu = #{fenshu}</if>
+            <if test="paperSource != null "> and p.paperSource = #{paperSource}</if>
+            <if test="directKey == null or directKey == ''"> and (p.direct_key is null or p.direct_key = '')</if>
+            <if test="directKey != null  and directKey != ''"> and p.direct_key like concat(#{directKey}, '%')</if>
+            <if test="paperInfo != null  and paperInfo != ''"> and p.paper_info = #{paperInfo}</if>
+            <if test="tiid != null  and tiid != ''"> and p.tiid = #{tiid}</if>
+            <if test="osspath != null  and osspath != ''"> and p.osspath = #{osspath}</if>
+            <if test="relateId != null "> and p.relate_id = #{relateId}</if>
+            <if test="locations != null  and locations != ''"> and p.locations = #{locations}</if>
+            <if test="examineeTypes != null  and examineeTypes != ''"> and p.examineeTypes = #{examineeTypes}</if>
+            <if test="createTime != null "> and p.createTime = #{createTime}</if>
+        </where>
+    </select>
+
     <select id="selectLearnPaperList" parameterType="LearnPaper" resultMap="LearnPaperResult">
         <include refid="selectLearnPaperVo"/>
         <where>