deason 1 gadu atpakaļ
vecāks
revīzija
50a4ce76d7

+ 14 - 1
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/statistic/ExamStudentScoreInfo.java

@@ -20,10 +20,15 @@ public class ExamStudentScoreInfo implements JsonSerializable {
     private Boolean finished;
 
     /**
-     * 考生成绩
+     * 考生 最终成绩
      */
     private Double totalScore;
 
+    /**
+     * 考生 最终成绩对应的考试记录ID
+     */
+    private Long examRecordDataId;
+
     /**
      * 试卷总分
      */
@@ -74,6 +79,14 @@ public class ExamStudentScoreInfo implements JsonSerializable {
         this.finished = finished;
     }
 
+    public Long getExamRecordDataId() {
+        return examRecordDataId;
+    }
+
+    public void setExamRecordDataId(Long examRecordDataId) {
+        this.examRecordDataId = examRecordDataId;
+    }
+
     public Double getTotalScore() {
         return totalScore;
     }

+ 19 - 16
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/ExamStatisticServiceImpl.java

@@ -99,7 +99,8 @@ public class ExamStatisticServiceImpl implements ExamStatisticService {
 
                 StringBuffer sql = new StringBuffer();
                 sql.append(" select es.exam_id,es.course_id,es.org_id,es.exam_student_id,");
-                sql.append(" es.finished,sc.total_score,d.paper_score,d.is_illegality as illegality");
+                sql.append(" es.finished,sc.total_score,d.paper_score,d.is_illegality as illegality,");
+                sql.append(" d.id as exam_record_data_id");
                 sql.append(" from ec_oe_exam_student es");
                 sql.append(" left join ec_oe_exam_student_final_score sc on sc.exam_student_id = es.exam_student_id");
                 sql.append(" left join ec_oe_exam_record_data d on d.id = sc.exam_record_data_id");
@@ -119,29 +120,31 @@ public class ExamStatisticServiceImpl implements ExamStatisticService {
                         allCount++;
 
                         if (v.getFinished() == null || !v.getFinished()) {
-                            // 未完成考试
+                            // 考生缺考,未完成考试
                             continue;
                         }
 
+                        // 考生非缺考,有考试记录
                         finishCount++;
 
-                        // 违纪时,可能没有成绩分值
-                        if (v.getTotalScore() == null) {
-                            v.setTotalScore(0d);
-                        }
-
-                        if (v.getPaperScore() != null) {
-                            if (v.getTotalScore() >= (v.getPaperScore() * passScoreLine) / 100d) {
-                                passScoreCount++;
+                        if (v.getTotalScore() == null || v.getExamRecordDataId() == null) {
+                            // 无最终成绩,算违纪
+                            illegalityCount++;
+                        } else {
+                            // 有最终成绩,违纪按最终成绩对应的考试记录是否违纪来计算
+                            if (v.getIllegality() != null && v.getIllegality()) {
+                                illegalityCount++;
                             }
 
-                            if (v.getTotalScore() >= (v.getPaperScore() * goodScoreLine) / 100d) {
-                                goodScoreCount++;
-                            }
-                        }
+                            if (v.getPaperScore() != null) {
+                                if (v.getTotalScore() >= (v.getPaperScore() * passScoreLine) / 100d) {
+                                    passScoreCount++;
+                                }
 
-                        if (v.getIllegality() != null && v.getIllegality()) {
-                            illegalityCount++;
+                                if (v.getTotalScore() >= (v.getPaperScore() * goodScoreLine) / 100d) {
+                                    goodScoreCount++;
+                                }
+                            }
                         }
                     }