|
@@ -1,5 +1,8 @@
|
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.impl;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
|
+import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
|
+import cn.com.qmth.examcloud.commons.util.JsonUtil;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.dao.ExamScoreRepo;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.dao.ExamStudentFinalScoreRepo;
|
|
@@ -14,6 +17,7 @@ import cn.com.qmth.examcloud.core.oe.admin.dao.enums.MarkingType;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentFinalScoreService;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.service.others.ExamCacheTransferHelper;
|
|
|
|
|
|
+import com.mysql.cj.log.LogFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -39,6 +43,8 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
|
@Autowired
|
|
|
private ExamStudentFinalScoreRepo examStudentFinalScoreRepo;
|
|
|
|
|
|
+ private static final ExamCloudLog LOG = ExamCloudLogFactory.getLog(ExamStudentFinalScoreServiceImpl.class);
|
|
|
+
|
|
|
@Override
|
|
|
public ExamStudentFinalScoreEntity calcAndSaveFinalScore(Long examStudentId) {
|
|
|
ExamStudentEntity examStudent = examStudentRepo.findByExamStudentId(examStudentId);
|
|
@@ -47,9 +53,26 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
|
String examType = ExamCacheTransferHelper.getDefaultCachedExam(examStudent.getExamId()).getExamType();
|
|
|
List<ExamRecordDataEntity> allExamRecordDataList = examRecordDataRepo.findByExamStudentId(examStudentId);
|
|
|
|
|
|
+ if (LOG.isDebugEnabled()) {
|
|
|
+ if (null != allExamRecordDataList) {
|
|
|
+ LOG.debug("[TEMP-DEBUG1]-allExamRecordDataList: " + JsonUtil.toJson(allExamRecordDataList));
|
|
|
+ } else {
|
|
|
+ LOG.debug("[TEMP-DEBUG1]-考生id:" + examStudentId + ",找不到任何考试记录");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//得到最终考试结果
|
|
|
ExamScoreEntity finalEffectiveExamScore = getFinalEffectiveExamScore(allExamRecordDataList, examType, markingType);
|
|
|
|
|
|
+ if (LOG.isDebugEnabled()) {
|
|
|
+ if (null != finalEffectiveExamScore) {
|
|
|
+ LOG.debug("[TEMP-DEBUG2]-finalEffectiveExamScore: " + JsonUtil.toJson(finalEffectiveExamScore));
|
|
|
+ } else {
|
|
|
+ LOG.debug("[TEMP-DEBUG2]-考生id:" + examStudentId + ",找不到最终考试记录");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//保存最终考试结果
|
|
|
return saveExamStudentFinalScore(examStudent.getExamStudentId(), finalEffectiveExamScore);
|
|
|
}
|
|
@@ -101,9 +124,16 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
if (firstFilterExamRecordList == null || firstFilterExamRecordList.size() == 0) {
|
|
|
+ if (LOG.isDebugEnabled()) {
|
|
|
+ LOG.debug("[TEMP-DEBUG3]-firstFilterExamRecordList-考生找不到满足条件考试记录");
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ if (LOG.isDebugEnabled()) {
|
|
|
+ LOG.debug("[TEMP-DEBUG3]-firstFilterExamRecordList: " + JsonUtil.toJson(firstFilterExamRecordList));
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* 第二次过滤考试记录:
|
|
|
* 没有违纪的&&(没有警告或有警告已审核通过的)
|
|
@@ -114,9 +144,16 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
|
|
|
|
List<ExamRecordDataEntity> secondFilterExamRecords = secondFilterExamRecordStream.collect(Collectors.toList());
|
|
|
if (secondFilterExamRecords == null || secondFilterExamRecords.size() == 0) {
|
|
|
+ if (LOG.isDebugEnabled()) {
|
|
|
+ LOG.debug("[TEMP-DEBUG4]-secondFilterExamRecords-考生找不到满足条件考试记录");
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ if (LOG.isDebugEnabled()) {
|
|
|
+ LOG.debug("[TEMP-DEBUG4]-secondFilterExamRecords: " + JsonUtil.toJson(secondFilterExamRecords));
|
|
|
+ }
|
|
|
+
|
|
|
//取出有效记录的成绩
|
|
|
List<Long> examRecordDataIds = new ArrayList<>();
|
|
|
for (int i = 0; i < secondFilterExamRecords.size(); i++) {
|
|
@@ -124,8 +161,16 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
|
}
|
|
|
List<ExamScoreEntity> effectiveExamScoreList = examScoreRepo.findByExamRecordDataIdIn(examRecordDataIds);
|
|
|
if (effectiveExamScoreList == null || effectiveExamScoreList.size() == 0) {
|
|
|
+ if (LOG.isDebugEnabled()) {
|
|
|
+ LOG.debug("[TEMP-DEBUG5]-effectiveExamScoreList-考生找不到满足条件考试分数记录");
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ if (LOG.isDebugEnabled()) {
|
|
|
+ LOG.debug("[TEMP-DEBUG5]-effectiveExamScoreList: " + JsonUtil.toJson(effectiveExamScoreList));
|
|
|
+ }
|
|
|
+
|
|
|
//离线考试
|
|
|
if ("OFFLINE".equals(examType)) {
|
|
|
return effectiveExamScoreList.get(0);
|