|
@@ -55,14 +55,16 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
ExamProperties.MARKING_TYPE.name()).getValue();
|
|
ExamProperties.MARKING_TYPE.name()).getValue();
|
|
String examType = ExamCacheTransferHelper.getDefaultCachedExam(examStudent.getExamId()).getExamType();
|
|
String examType = ExamCacheTransferHelper.getDefaultCachedExam(examStudent.getExamId()).getExamType();
|
|
|
|
|
|
- List<ExamRecordDataEntity> effectiveExamRecordDataList = examRecordDataRepo.findEffectiveDataByExamStudentIdList(Arrays.asList(examStudentId));
|
|
|
|
|
|
+ List<ExamRecordDataEntity> effectiveExamRecordDataList = examRecordDataRepo.findEffectiveDataByExamStudentIdList(
|
|
|
|
+ Arrays.asList(examStudentId));
|
|
if (CollectionUtils.isEmpty(effectiveExamRecordDataList)) {
|
|
if (CollectionUtils.isEmpty(effectiveExamRecordDataList)) {
|
|
LOG.warn("calcAndSaveFinalScore examRecordDataList is empty, examStudentId = {}", examStudentId);
|
|
LOG.warn("calcAndSaveFinalScore examRecordDataList is empty, examStudentId = {}", examStudentId);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
//得到最终考试结果
|
|
//得到最终考试结果
|
|
- ExamScoreEntity finalEffectiveExamScore = getFinalEffectiveExamScore(effectiveExamRecordDataList, examType, markingType);
|
|
|
|
|
|
+ ExamScoreEntity finalEffectiveExamScore = getFinalEffectiveExamScore(effectiveExamRecordDataList, examType,
|
|
|
|
+ markingType);
|
|
if (finalEffectiveExamScore == null) {
|
|
if (finalEffectiveExamScore == null) {
|
|
LOG.warn("calcAndSaveFinalScore finalExamScore is null, examStudentId = {}", examStudentId);
|
|
LOG.warn("calcAndSaveFinalScore finalExamScore is null, examStudentId = {}", examStudentId);
|
|
return null;
|
|
return null;
|
|
@@ -72,7 +74,6 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
return saveExamStudentFinalScore(examStudentId, finalEffectiveExamScore);
|
|
return saveExamStudentFinalScore(examStudentId, finalEffectiveExamScore);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public ExamStudentFinalScoreEntity getFinalEffectiveExamScore(Long examStudentId) {
|
|
public ExamStudentFinalScoreEntity getFinalEffectiveExamScore(Long examStudentId) {
|
|
ExamStudentFinalScoreEntity finalExamScore = examStudentFinalScoreRepo.findByExamStudentId(examStudentId);
|
|
ExamStudentFinalScoreEntity finalExamScore = examStudentFinalScoreRepo.findByExamStudentId(examStudentId);
|
|
@@ -84,7 +85,8 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
return this.calcAndSaveFinalScore(examStudentId);
|
|
return this.calcAndSaveFinalScore(examStudentId);
|
|
}
|
|
}
|
|
|
|
|
|
- private ExamStudentFinalScoreEntity saveExamStudentFinalScore(Long examStudentId, ExamScoreEntity finalEffectiveExamScore) {
|
|
|
|
|
|
+ private ExamStudentFinalScoreEntity saveExamStudentFinalScore(Long examStudentId,
|
|
|
|
+ ExamScoreEntity finalEffectiveExamScore) {
|
|
if (finalEffectiveExamScore == null) {
|
|
if (finalEffectiveExamScore == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
@@ -102,13 +104,17 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
finalScoreEntity.setSuccPercent(finalEffectiveExamScore.getSuccPercent());
|
|
finalScoreEntity.setSuccPercent(finalEffectiveExamScore.getSuccPercent());
|
|
finalScoreEntity.setTotalScore(finalEffectiveExamScore.getTotalScore());
|
|
finalScoreEntity.setTotalScore(finalEffectiveExamScore.getTotalScore());
|
|
|
|
|
|
|
|
+ LOG.warn("【最终成绩】已更新! examStudentId:{} examRecordDataId:{} objectiveScore:{} subjectiveScore:{}",
|
|
|
|
+ examStudentId, finalScoreEntity.getExamRecordDataId(), finalScoreEntity.getObjectiveScore(),
|
|
|
|
+ finalScoreEntity.getSubjectiveScore());
|
|
return examStudentFinalScoreRepo.save(finalScoreEntity);
|
|
return examStudentFinalScoreRepo.save(finalScoreEntity);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 计算得出最终有效成绩
|
|
* 计算得出最终有效成绩
|
|
*/
|
|
*/
|
|
- private ExamScoreEntity getFinalEffectiveExamScore(List<ExamRecordDataEntity> examRecords, String examType, String markingType) {
|
|
|
|
|
|
+ private ExamScoreEntity getFinalEffectiveExamScore(List<ExamRecordDataEntity> examRecords, String examType,
|
|
|
|
+ String markingType) {
|
|
if (examRecords == null || examRecords.isEmpty()) {
|
|
if (examRecords == null || examRecords.isEmpty()) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
@@ -118,7 +124,8 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
}
|
|
}
|
|
|
|
|
|
//取出有效记录的id
|
|
//取出有效记录的id
|
|
- List<Long> examRecordDataIds = examRecords.stream().map(ExamRecordDataEntity::getId).collect(Collectors.toList());
|
|
|
|
|
|
+ List<Long> examRecordDataIds = examRecords.stream().map(ExamRecordDataEntity::getId)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
List<ExamScoreEntity> examScoreList = examScoreRepo.findByExamRecordDataIdIn(examRecordDataIds);
|
|
List<ExamScoreEntity> examScoreList = examScoreRepo.findByExamRecordDataIdIn(examRecordDataIds);
|
|
if (examScoreList == null || examScoreList.isEmpty()) {
|
|
if (examScoreList == null || examScoreList.isEmpty()) {
|
|
@@ -138,14 +145,12 @@ public class ExamStudentFinalScoreServiceImpl implements ExamStudentFinalScoreSe
|
|
if (markingType.equals(MarkingType.ALL.name()) || markingType.equals(MarkingType.OBJECT_SCORE_MAX.name())) {
|
|
if (markingType.equals(MarkingType.ALL.name()) || markingType.equals(MarkingType.OBJECT_SCORE_MAX.name())) {
|
|
//全部评阅规则或客观分最高规则:取总分最高
|
|
//全部评阅规则或客观分最高规则:取总分最高
|
|
List<ExamScoreEntity> examScores = examScoreList.stream()
|
|
List<ExamScoreEntity> examScores = examScoreList.stream()
|
|
- .sorted((o1, o2) -> o2.getTotalScore().compareTo(o1.getTotalScore()))
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
+ .sorted((o1, o2) -> o2.getTotalScore().compareTo(o1.getTotalScore())).collect(Collectors.toList());
|
|
return examScores.get(0);
|
|
return examScores.get(0);
|
|
} else if (markingType.equals(MarkingType.LAST_SUBMIT.name())) {
|
|
} else if (markingType.equals(MarkingType.LAST_SUBMIT.name())) {
|
|
//最后一次提交规则:取最后一次的成绩
|
|
//最后一次提交规则:取最后一次的成绩
|
|
List<ExamScoreEntity> examScores = examScoreList.stream()
|
|
List<ExamScoreEntity> examScores = examScoreList.stream()
|
|
- .sorted((o1, o2) -> o2.getId().compareTo(o1.getId()))
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
+ .sorted((o1, o2) -> o2.getId().compareTo(o1.getId())).collect(Collectors.toList());
|
|
return examScores.get(0);
|
|
return examScores.get(0);
|
|
}
|
|
}
|
|
|
|
|