소스 검색

适配河南模拟卷及记录的名称

mingfu 1 주 전
부모
커밋
9803adbd80

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

@@ -480,7 +480,10 @@ public class ExamService {
         List<LearnExaminee> examineeList = examineeMapper.selectLearnExamineeList(examinee);
         if(CollectionUtils.isNotEmpty(examineeList)) {
             LearnExaminee exist = examineeList.get(0);
-            return buildAnswerSheet(learnPaper, exist, loadQuestionAnswers(exist, exist.getState() < ExamineeStatus.Commit.getVal()));
+            if(exist.getState() >= ExamineeStatus.Commit.getVal()) {
+                throw new ValidationException("试卷不能重复打开做, 请查问答卷");
+            }
+            return buildAnswerSheet(learnPaper, exist, loadQuestionAnswers(exist, true));
         }
         return openNewExamineeByPaper(examinee, learnPaper);
     }
@@ -488,6 +491,9 @@ public class ExamService {
         examinee.setPaperId(paper.getId());
         examinee.setState(ExamineeStatus.Sign.getVal());
         examinee.setDuration(0L);
+        JSONObject info = new JSONObject();
+        info.put("paperName", paper.getPaperName());
+        examinee.setPaperInfo(info.toJSONString());
         examineeMapper.insertLearnExaminee(examinee);
         AnswerSheet answerSheet = buildAnswerSheet(paper, examinee, null);
         answerSheet.setSubjectId(paper.getSubjectId());

+ 7 - 1
ie-admin/src/main/java/com/ruoyi/web/service/StudentService.java

@@ -111,12 +111,18 @@ public class StudentService {
 
         List<JSONObject> list = learnExamineeMapper.selectLearnExamineeList(eCond).stream().map(t -> {
             JSONObject info = JSONObject.parseObject(t.getPaperInfo());
+            String name = null;
+            if(null == info) {
+                name = t.getPaperKey();
+            } else if(StringUtils.isBlank(name = info.getString("paperName"))) {
+                name = info.getString("universityName") + "-" + info.getString("majorName");
+            }
             String[] paperKey = t.getPaperKey().split("_");
             DzSubject dzSubject = dzSubjectService.selectDzSubjectBySubjectId(Long.parseLong(paperKey[paperKey.length - 1]));
-            String name = info.getString("universityName") + "-" + info.getString("majorName");
             return JSONObject.of("id", t.getExamineeId(), "state", t.getState()
                     , "subjectName", dzSubject.getSubjectName()
                     , "name", name
+                    , "subjectGroup", (dzSubject.getSubjectId() < 10 ? "公共课" : "专业课")
                     , "date", DateUtils.format(null != t.getEndTime() ? t.getEndTime() : t.getBeginTime(), "yyyy-MM-dd HH:mm")
                     , "score", t.getScore());
         }).collect(Collectors.toList());

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

@@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </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
+        SELECT id, subjectId, paperName, YEAR, paperType, number, fenshu, paperSource, direct_key, p.paper_info, tiid, osspath, filename, relate_id, locations, examineeTypes, createTime, e.examinee_id examineeId, 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>