Răsfoiți Sursa

3.4.4 update-20250427,bug修改

xiaofei 1 lună în urmă
părinte
comite
a0913403ed

+ 3 - 0
distributed-print/install/mysql/upgrade/3.4.4.sql

@@ -378,3 +378,6 @@ UPDATE `sys_config` SET `config_value` = '[{"name":"A3","size":"297*420"}, {"nam
 
 ALTER TABLE `exam_detail` ADD COLUMN `merge_pdf_path` VARCHAR(2000) NULL COMMENT '考场合并所有文件后的文件路径' AFTER `update_time`;
 ALTER TABLE `t_b_sync_task` CHANGE COLUMN `error_message` `error_message` VARCHAR(2000) DEFAULT NULL COMMENT '人工错误原因' ;
+
+update mark_document md join mark_paper mp on md.exam_id = mp.exam_id and md.paper_number = mp.paper_number set md.file_path = mp.paper_file_path where md.type = 'PAPER';
+update mark_document md join mark_paper mp on md.exam_id = mp.exam_id and md.paper_number = mp.paper_number set md.file_path = mp.answer_file_path where md.type = 'ANSWER';

+ 1 - 0
distributed-print/src/main/java/com/qmth/distributed/print/upgrade/DataUpgrade_3_4_4.java

@@ -503,6 +503,7 @@ public class DataUpgrade_3_4_4 implements DataUpgradeService {
         sql.append("     mqa.answer,                                                            ");
         sql.append("     mqa.objective_policy,                                                  ");
         sql.append("     mqa.objective_policy_score,                                            ");
+        sql.append("     mq.main_title,                                                         ");
         sql.append("     mq.main_number,                                                        ");
         sql.append("     mq.sub_number,                                                         ");
         sql.append("     mq.total_score,                                                        ");

+ 2 - 1
distributed-print/src/main/resources/upgrade/3.4.4-upgrade-1.sql

@@ -15,7 +15,8 @@ CREATE TABLE `mark_archive_student`
     `archive_card_id`      VARCHAR(50) NULL,
     `create_time`          BIGINT(20) NULL,
     PRIMARY KEY (`student_id`),
-    INDEX `idx_student_id` (`student_id` ASC)
+    INDEX `idx_student_id` (`student_id` ASC),
+    INDEX `idx_1` (`exam_id` ASC, `paper_number` ASC)
 ) COMMENT = '考生归档数据表';
 
 

+ 3 - 0
distributed-print/src/main/resources/upgrade/3.4.4-upgrade-2.sql

@@ -374,3 +374,6 @@ UPDATE `sys_config` SET `config_value` = '[{"name":"A3","size":"297*420"}, {"nam
 
 ALTER TABLE `exam_detail` ADD COLUMN `merge_pdf_path` VARCHAR(2000) NULL COMMENT '考场合并所有文件后的文件路径' AFTER `update_time`;
 ALTER TABLE `t_b_sync_task` CHANGE COLUMN `error_message` `error_message` VARCHAR(2000) CHARACTER SET 'utf8mb4' NULL DEFAULT NULL COMMENT '人工错误原因' ;
+
+update mark_document md join mark_paper mp on md.exam_id = mp.exam_id and md.paper_number = mp.paper_number set md.file_path = mp.paper_file_path where md.type = 'PAPER';
+update mark_document md join mark_paper mp on md.exam_id = mp.exam_id and md.paper_number = mp.paper_number set md.file_path = mp.answer_file_path where md.type = 'ANSWER';

+ 3 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkArchiveStudentService.java

@@ -1,6 +1,7 @@
 package com.qmth.teachcloud.mark.service;
 
 import com.qmth.teachcloud.mark.dto.mark.manage.TaskQuestion;
+import com.qmth.teachcloud.mark.dto.mark.score.StudentObjectiveAnswerDto;
 import com.qmth.teachcloud.mark.entity.MarkArchiveStudent;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -19,4 +20,6 @@ public interface MarkArchiveStudentService extends IService<MarkArchiveStudent>
     List<MarkArchiveStudent> listByStudentIds(List<Long> studentIds);
 
     List<TaskQuestion> listTaskQuestionByStudentIds(List<Long> studentIds);
+
+    List<StudentObjectiveAnswerDto> listStudentObjectiveAnswerDtoByExamIdAndPaperNumber(Long examId, String paperNumber);
 }

+ 16 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkArchiveStudentServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.mark.dto.mark.manage.TaskQuestion;
+import com.qmth.teachcloud.mark.dto.mark.score.StudentObjectiveAnswerDto;
 import com.qmth.teachcloud.mark.entity.MarkArchiveStudent;
 import com.qmth.teachcloud.mark.mapper.MarkArchiveStudentMapper;
 import com.qmth.teachcloud.mark.service.MarkArchiveStudentService;
@@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -42,4 +44,18 @@ public class MarkArchiveStudentServiceImpl extends ServiceImpl<MarkArchiveStuden
                 .flatMap(List::stream).collect(Collectors.toList());
         return taskQuestions;
     }
+
+    @Override
+    public List<StudentObjectiveAnswerDto> listStudentObjectiveAnswerDtoByExamIdAndPaperNumber(Long examId, String paperNumber) {
+        QueryWrapper<MarkArchiveStudent> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(MarkArchiveStudent::getExamId, examId)
+                .eq(MarkArchiveStudent::getPaperNumber, paperNumber)
+                .isNotNull(MarkArchiveStudent::getObjectiveQuestions)
+                .last(" limit 1");
+        MarkArchiveStudent markArchiveStudent = this.getOne(queryWrapper);
+        if (markArchiveStudent != null) {
+            return JSON.parseArray(markArchiveStudent.getObjectiveQuestions(), StudentObjectiveAnswerDto.class);
+        }
+        return Collections.emptyList();
+    }
 }

+ 25 - 8
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -19,6 +19,7 @@ import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotNull;
 
 import com.qmth.teachcloud.mark.dto.mark.manage.TaskQuestion;
+import javafx.beans.property.StringProperty;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -1541,7 +1542,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         }
 
         // 客观题成绩分析
-        fillObjective(ret, studentList, query.getExamId(), query.getPaperNumber());
+        fillObjective(ret, studentList, markPaper);
 
         // 主观题成绩分析
         List<Long> studentIds = studentList.stream().map(ArchiveStudentVo::getStudentId).collect(Collectors.toList());
@@ -1716,9 +1717,25 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         return this.update(updateWrapper);
     }
 
-    private void fillObjective(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long examId, String
-            paperNumber) {
-        List<MarkQuestion> qs = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, paperNumber, true);
+    private void fillObjective(ScoreReportVo ret, List<ArchiveStudentVo> studentList, MarkPaper markPaper) {
+        Long examId = markPaper.getExamId();
+        String paperNumber = markPaper.getPaperNumber();
+        List<MarkQuestion> qs;
+        if (markPaper.getArchive()) {
+            List<StudentObjectiveAnswerDto> objectiveAnswerDtos = markArchiveStudentService.listStudentObjectiveAnswerDtoByExamIdAndPaperNumber(examId, paperNumber);
+            qs = objectiveAnswerDtos.stream().map(m -> {
+                MarkQuestion markQuestion = new MarkQuestion();
+                markQuestion.setMainNumber(m.getMainNumber());
+                markQuestion.setSubNumber(m.getSubNumber());
+                markQuestion.setTotalScore(m.getTotalScore());
+                markQuestion.setMainTitle(StringUtils.isBlank(m.getTitle()) ? m.getQuestionType() == 1 ? "单选题" : m.getQuestionType() == 2 ? "多选题" : m.getQuestionType() == 3 ? "判断题" : "" : "");
+                return markQuestion;
+            }).collect(Collectors.toList());
+            qs.sort(Comparator.comparing(MarkQuestion::getMainNumber).thenComparing(MarkQuestion::getSubNumber));
+        } else {
+            qs = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, paperNumber, true);
+        }
+
         Map<String, List<ArchiveStudentVo>> collect = studentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperType())).collect(Collectors.groupingBy(ArchiveStudentVo::getPaperType));
 
         List<QuestionObjectiveVo> questionObjectiveVoList = new ArrayList<>();
@@ -1803,7 +1820,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             if (CollectionUtils.isNotEmpty(studentIdList)) {
                 markArchiveStudents = markArchiveStudentService.listByStudentIds(studentIdList);
             }
-            if(CollectionUtils.isNotEmpty(markArchiveStudents)) {
+            if (CollectionUtils.isNotEmpty(markArchiveStudents)) {
                 for (MarkArchiveStudent markArchiveStudent : markArchiveStudents) {
                     List<TaskQuestion> taskQuestionList = JSON.parseArray(markArchiveStudent.getSubjectiveQuestions(), TaskQuestion.class);
                     Map<Integer, Double> listMap = taskQuestionList.stream().collect(Collectors.groupingBy(m -> m.getMainNumber(), Collectors.summingDouble(n -> n.getMarkerScore())));
@@ -1812,8 +1829,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
                     }
                 }
                 MarkArchiveStudent markArchiveStudent = markArchiveStudents.get(0);
-                if(markArchiveStudent!= null) {
-                    if(StringUtils.isNotBlank(markArchiveStudent.getObjectiveQuestions())) {
+                if (markArchiveStudent != null) {
+                    if (StringUtils.isNotBlank(markArchiveStudent.getObjectiveQuestions())) {
                         List<StudentObjectiveAnswerDto> taskQuestions = JSON.parseArray(markArchiveStudent.getObjectiveQuestions(), StudentObjectiveAnswerDto.class);
                         for (StudentObjectiveAnswerDto taskQuestion : taskQuestions) {
                             MarkQuestion markQuestion = new MarkQuestion();
@@ -1825,7 +1842,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
                             questionDatasource.add(markQuestion);
                         }
                     }
-                    if(StringUtils.isNotBlank(markArchiveStudent.getSubjectiveQuestions())) {
+                    if (StringUtils.isNotBlank(markArchiveStudent.getSubjectiveQuestions())) {
                         List<TaskQuestion> taskQuestions = JSON.parseArray(markArchiveStudent.getSubjectiveQuestions(), TaskQuestion.class);
                         for (TaskQuestion taskQuestion : taskQuestions) {
                             MarkQuestion markQuestion = new MarkQuestion();

+ 2 - 8
teachcloud-mark/src/main/resources/mapper/MarkUserQuestionMapper.xml

@@ -205,14 +205,8 @@
                           FROM
                               basic_exam_student bes
                           WHERE
-                              EXISTS( SELECT
-                                          1
-                                      FROM
-                                          mark_student es
-                                      WHERE
-                                          es.exam_id = #{examId}
-                                        AND es.paper_number = #{paperNumber}
-                                        AND bes.id = es.basic_student_id)
+                              bes.exam_id = #{examId}
+                            AND bes.paper_number = #{paperNumber}
                             AND bes.teacher_id IS NOT NULL)
     </select>
     <select id="countClassByExamIdAndPaperNumberAndQuestionId" resultType="java.lang.String">