Răsfoiți Sursa

3.4.0 update

xiaofei 11 luni în urmă
părinte
comite
982046471b

+ 1 - 0
distributed-print/install/mysql/upgrade/3.4.0.sql

@@ -417,3 +417,4 @@ ALTER TABLE t_c_usual_score DROP KEY t_c_usual_score_unique;
 ALTER TABLE t_c_usual_score ADD CONSTRAINT t_c_usual_score_unique UNIQUE KEY (culture_program_id,course_id,student_code);
 
 ALTER TABLE `basic_card_rule` ADD COLUMN `default_option_number` INT NULL DEFAULT 4 COMMENT '选择题默认选项个数' AFTER `undertaking_body`;
+ALTER TABLE `mark_task` ADD INDEX `index1` (`exam_id` ASC, `paper_number` ASC);

+ 20 - 14
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkTaskService.java

@@ -37,42 +37,48 @@ public interface MarkTaskService extends IService<MarkTask> {
 
     int countByExamIdAndPaperNumberAndGroupNumberAndStatusIn(Long examId, String paperNumber, Integer groupNumber, List<MarkTaskStatus> statusList);
 
+    int countByExamIdAndPaperNumberAndStatusIn(Long examId, String paperNumber, List<MarkTaskStatus> statusList);
+
     MarkTask getLastOneByUserIdAndStatus(Long examId, String paperNumber, Integer groupNumber, Long userId, MarkTaskStatus status);
 
     List<MarkTask> listByExamIdAndPaperNumberAndGroupNumberAndStudentId(Long examId, String paperNumber, Integer groupNumber, Long studentId);
+
     List<MarkTask> listByStudentIdAndGroupNumber(Long studentId, Integer groupNumber);
 
     void updateHeaderResult(Long examId, String paperNumber, Integer groupNumber, Long studentId, Long updateUserId, Double totalScore, String scoreList, Long updateTime, MarkTaskStatus arbitrated);
 
     void deleteByStudentId(Long studentId);
 
-	int countByExamIdAndPaperNumberAndGroupNumber(Long examId, String paperNumber, Integer groupNumber);
+    int countByExamIdAndPaperNumberAndGroupNumber(Long examId, String paperNumber, Integer groupNumber);
+
+    int countByExamIdAndPaperNumberAndGroupNumberAndUserIdAndAndClassNameStatusIn(Long examId, String paperNumber, Integer groupNumber, Long userId, List<String> className, MarkTaskStatus... status);
 
-	int countByExamIdAndPaperNumberAndGroupNumberAndUserIdAndAndClassNameStatusIn(Long examId, String paperNumber, Integer groupNumber, Long userId, List<String> className, MarkTaskStatus... status);
     void deleteByExamIdAndPaperNumberAndGroupNumber(Long examId, String paperNumber, Integer groupNumber);
 
-	IPage<MarkTask> listPageHistory(Page<MarkTask> page, Long userId, Long examId, String paperNumber,
-			Integer groupNumber, String secretNumber, Double markerScore);
+    IPage<MarkTask> listPageHistory(Page<MarkTask> page, Long userId, Long examId, String paperNumber,
+                                    Integer groupNumber, String secretNumber, Double markerScore);
 
-	List<MarkTask> findUnMarked(Page<MarkTask> page, Long examId, String paperNumber, Integer groupNumber, Long userId);
+    List<MarkTask> findUnMarked(Page<MarkTask> page, Long examId, String paperNumber, Integer groupNumber, Long userId);
 
-	List<MarkTask> findUnMarkedFilterClass(Page<MarkTask> page, Long examId, String paperNumber, Integer groupNumber,
-			Long userId);
+    List<MarkTask> findUnMarkedFilterClass(Page<MarkTask> page, Long examId, String paperNumber, Integer groupNumber,
+                                           Long userId);
 
-	int countByIdAndStatus(Long id, MarkTaskStatus status);
+    int countByIdAndStatus(Long id, MarkTaskStatus status);
 
-	List<MarkTask> findByStudentIdAndGroupNumberAndStatus(Long studentId, Integer groupNumber, MarkTaskStatus... status);
+    List<MarkTask> findByStudentIdAndGroupNumberAndStatus(Long studentId, Integer groupNumber, MarkTaskStatus... status);
 
-	boolean updateProblemResult(Long taskId,Long userId, Long now, int spent);
+    boolean updateProblemResult(Long taskId, Long userId, Long now, int spent);
 
-	boolean updateStatusByStudentIdAndGroupNumber(Long studentId, Integer groupNumber, MarkTaskStatus status);
+    boolean updateStatusByStudentIdAndGroupNumber(Long studentId, Integer groupNumber, MarkTaskStatus status);
 
-	int countByStudentIdAndMarkerIdAndIdNotEqual(Long studentId, Long examId, String paperNumber, Integer groupNumber, Long userId, Long taskId);
+    int countByStudentIdAndMarkerIdAndIdNotEqual(Long studentId, Long examId, String paperNumber, Integer groupNumber, Long userId, Long taskId);
 
-	boolean updateMarkerResult(Long taskId, MarkTaskStatus marked, Long userId, Double markerScore, String scoreList,
-			Long now, int spent,MarkTaskStatus... inStatus);
+    boolean updateMarkerResult(Long taskId, MarkTaskStatus marked, Long userId, Double markerScore, String scoreList,
+                               Long now, int spent, MarkTaskStatus... inStatus);
 
     int countByExamIdAndPaperNumberAndGroupNumberAndTaskNumber(Long examId, String paperNumber, Integer groupNumber, int taskNumber);
 
     int countByStudentId(Long studentId);
+
+    int countByExamIdAndPaperNumber(Long examId, String paperNumber);
 }

+ 3 - 3
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkGroupServiceImpl.java

@@ -185,11 +185,11 @@ public class MarkGroupServiceImpl extends MppServiceImpl<MarkGroupMapper, MarkGr
         markGroupSummaryProgressDto.setOpenMarkClass(markPaper.getOpenMarkClass());
         MarkGroupTotalProgressDto markGroupTotalProgressDto = new MarkGroupTotalProgressDto();
         markGroupTotalProgressDto.setStudentCount(markPaper.getStudentCount());
-        markGroupTotalProgressDto.setUploadCount(markPaper.getUploadCount());
+        markGroupTotalProgressDto.setUploadCount(markStudentService.countUploadedByExamIdAndPaperNumber(examId, paperNumber));
         markGroupTotalProgressDto.setAbsentCount(markPaper.getAbsentCount());
 
-        int totalCount = markStudentService.countByExamIdAndPaperNumberAndMarkStatus(examId, paperNumber, null);
-        int markedCount = markStudentService.countByExamIdAndPaperNumberAndMarkStatus(examId, paperNumber, SubjectiveStatus.MARKED);
+        int totalCount = markTaskService.countByExamIdAndPaperNumber(examId, paperNumber);
+        int markedCount = markTaskService.countByExamIdAndPaperNumberAndStatusIn(examId, paperNumber, Arrays.asList(MarkTaskStatus.MARKED));
         markGroupTotalProgressDto.setPercent(Calculator.divide2String(Calculator.multiply(markedCount, 100), Double.valueOf(totalCount), 2));
         markGroupSummaryProgressDto.setTotalInfo(markGroupTotalProgressDto);
 

+ 17 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkTaskServiceImpl.java

@@ -56,7 +56,6 @@ public class MarkTaskServiceImpl extends ServiceImpl<MarkTaskMapper, MarkTask> i
         IPage<MarkManageDto> markManageDtoIPage = this.baseMapper.listPaperManage(page, examId, courseId, paperNumber, progressStatus, dpr);
         for (MarkManageDto record : markManageDtoIPage.getRecords()) {
             record.setStatusDisplay(record.getStatus() == null ? null : record.getStatus().getName());
-            record.setOmrAbsentCount(markStudentService.countOmrAbsentStudent(record.getExamId(), record.getPaperNumber(), record.getPaperType(), false));
             record.setPercent(Calculator.divide2String(Calculator.multiply(record.getMarkedCount(), 100), Double.valueOf(record.getTotalCount()), 2));
         }
         return markManageDtoIPage;
@@ -143,6 +142,15 @@ public class MarkTaskServiceImpl extends ServiceImpl<MarkTaskMapper, MarkTask> i
         return this.count(queryWrapper);
     }
 
+    @Override
+    public int countByExamIdAndPaperNumberAndStatusIn(Long examId, String paperNumber, List<MarkTaskStatus> statusList) {
+        QueryWrapper<MarkTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(MarkTask::getExamId, examId)
+                .eq(MarkTask::getPaperNumber, paperNumber)
+                .in(MarkTask::getStatus, statusList);
+        return this.count(queryWrapper);
+    }
+
     @Override
     public MarkTask getLastOneByUserIdAndStatus(Long examId, String paperNumber, Integer groupNumber, Long userId, MarkTaskStatus status) {
         return this.baseMapper.getLastOneByUserIdAndStatus(examId, paperNumber, groupNumber, userId, status.name());
@@ -313,4 +321,12 @@ public class MarkTaskServiceImpl extends ServiceImpl<MarkTaskMapper, MarkTask> i
         queryWrapper.lambda().eq(MarkTask::getStudentId, studentId);
         return this.count(queryWrapper);
     }
+
+    @Override
+    public int countByExamIdAndPaperNumber(Long examId, String paperNumber) {
+        QueryWrapper<MarkTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(MarkTask::getExamId, examId)
+                .eq(MarkTask::getPaperNumber, paperNumber);
+        return this.count(queryWrapper);
+    }
 }

+ 9 - 10
teachcloud-mark/src/main/resources/mapper/MarkTaskMapper.xml

@@ -38,21 +38,20 @@
         FROM mark_paper mp
             left join
             (select
-                 ms.exam_id,
-                 ms.paper_number ,
-                 ms.paper_type,
+                 mt.exam_id,
+                 mt.paper_number ,
                  count(1) totalCount,
-                 sum(case ms.subjective_status when 'MARKED' then 1 else 0 end) markedCount
-             from mark_student ms where ms.exam_id = #{examId}
+                 sum(case mt.status when 'MARKED' then 1 else 0 end) markedCount
+             from mark_task mt
+                where mt.exam_id = #{examId}
                 <if test="courseId != null">
-                    and ms.course_id = #{courseId}
+                    and mt.course_id = #{courseId}
                 </if>
                 <if test="paperNumber != null and paperNumber != ''">
-                    and ms.paper_number = #{paperNumber}
+                    and mt.paper_number = #{paperNumber}
                 </if>
-                and ms.is_upload = true and ms.is_absent = false and ms.is_breach = false and ms.omr_absent = false
-                group by ms.exam_id, ms.paper_number, ms.paper_type) b
-                    on mp.exam_id = b.exam_id and mp.paper_number = b.paper_number and mp.paper_type = b.paper_type
+                group by mt.exam_id, mt.paper_number) b
+                    on mp.exam_id = b.exam_id and mp.paper_number = b.paper_number
             left join basic_course bc on mp.course_id = bc.id
         <where>
             mp.exam_id = #{examId}