Pārlūkot izejas kodu

update exam statistic

deason 1 gadu atpakaļ
vecāks
revīzija
3d52ceda77

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

@@ -29,6 +29,11 @@ public class ExamStudentScoreInfo implements JsonSerializable {
      */
     private Double paperScore;
 
+    /**
+     * 是否违纪
+     */
+    private Boolean illegality;
+
     public Long getExamId() {
         return examId;
     }
@@ -85,4 +90,12 @@ public class ExamStudentScoreInfo implements JsonSerializable {
         this.paperScore = paperScore;
     }
 
+    public Boolean getIllegality() {
+        return illegality;
+    }
+
+    public void setIllegality(Boolean illegality) {
+        this.illegality = illegality;
+    }
+
 }

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

@@ -96,7 +96,7 @@ 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");
+                sql.append(" es.finished,sc.total_score,d.paper_score,d.is_illegality as illegality");
                 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");
@@ -111,7 +111,7 @@ public class ExamStatisticServiceImpl implements ExamStatisticService {
 
                 Map<Long, List<ExamStudentScoreInfo>> orgStatisticMaps = list.stream().collect(Collectors.groupingBy(ExamStudentScoreInfo::getOrgId));
                 for (Map.Entry<Long, List<ExamStudentScoreInfo>> e : orgStatisticMaps.entrySet()) {
-                    int allCount = 0, finishCount = 0, passScoreCount = 0, goodScoreCount = 0;
+                    int allCount = 0, finishCount = 0, passScoreCount = 0, goodScoreCount = 0, illegalityCount = 0;
                     for (ExamStudentScoreInfo v : e.getValue()) {
                         allCount++;
 
@@ -136,6 +136,10 @@ public class ExamStatisticServiceImpl implements ExamStatisticService {
                                 goodScoreCount++;
                             }
                         }
+
+                        if (v.getIllegality() != null && v.getIllegality()) {
+                            illegalityCount++;
+                        }
                     }
 
                     ExamStatisticEntity result = examStatisticRepo.findByExamIdAndCourseIdAndOrgId(examId, courseId, e.getKey());
@@ -149,7 +153,7 @@ public class ExamStatisticServiceImpl implements ExamStatisticService {
                     result.setFinishCount(finishCount);
                     result.setPassScoreCount(passScoreCount);
                     result.setGoodScoreCount(goodScoreCount);
-                    result.setIllegalityCount(0);//todo
+                    result.setIllegalityCount(illegalityCount);
                     result.setUpdateTime(new Date());
                     examStatisticRepo.save(result);
                 }