|
@@ -22,61 +22,61 @@ import java.util.stream.Collectors;
|
|
@Service("examRecordQuestionsService")
|
|
@Service("examRecordQuestionsService")
|
|
public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsService {
|
|
public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsService {
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private ExamRecordQuestionsRepo examRecordQuestionsRepo;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private ExamRecordDataRepo examRecordDataRepo;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private ExamScoreRepo examScoreRepo;
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamRecordQuestionsRepo examRecordQuestionsRepo;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private ExamStudentFinalScoreService examStudentFinalScoreService;
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamRecordDataRepo examRecordDataRepo;
|
|
|
|
|
|
- @Override
|
|
|
|
- public List<ExamQuestionEntity> querySubjectiveAnswerList(Long examRecordDataId) {
|
|
|
|
- ExamRecordQuestionsEntity examRecordQuestionsEntity = examRecordQuestionsRepo.findByExamRecordDataId(examRecordDataId);
|
|
|
|
- List<ExamQuestionEntity> examRecordQuestionList = examRecordQuestionsEntity.getExamQuestionEntities();
|
|
|
|
-
|
|
|
|
- return examRecordQuestionList.stream().filter((obj->{
|
|
|
|
- return !QuestionTypeUtil.isObjectiveQuestion(obj.getQuestionType());
|
|
|
|
- })).collect(Collectors.toList());
|
|
|
|
- }
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamScoreRepo examScoreRepo;
|
|
|
|
|
|
- @Override
|
|
|
|
- public void saveSubjectiveQuestionScore(Long examRecordDataId,List<SubjectiveQuestionScoreInfo> subjectiveQuestionScoreInfoList) {
|
|
|
|
- ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo,examRecordDataId,ExamRecordDataEntity.class);
|
|
|
|
- if(examRecordData.getExamType() == ExamType.ONLINE){
|
|
|
|
- ExamRecordQuestionsEntity examRecordQuestionsEntity = examRecordQuestionsRepo.findByExamRecordDataId(examRecordDataId);
|
|
|
|
- List<ExamQuestionEntity> examRecordQuestionList = examRecordQuestionsEntity.getExamQuestionEntities();
|
|
|
|
-
|
|
|
|
- for(SubjectiveQuestionScoreInfo scoreInfo:subjectiveQuestionScoreInfoList){
|
|
|
|
- for(ExamQuestionEntity examQuestionEntity:examRecordQuestionList){
|
|
|
|
- if(scoreInfo.getQuestionId().equals(examQuestionEntity.getQuestionId())
|
|
|
|
- && scoreInfo.getOrder().intValue() == examQuestionEntity.getOrder().intValue()){
|
|
|
|
- examQuestionEntity.setStudentScore(scoreInfo.getScore());
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- examRecordQuestionsRepo.save(examRecordQuestionsEntity);
|
|
|
|
- }
|
|
|
|
- //计算主观题总得分
|
|
|
|
- double totalSubjectiveScore = 0D;
|
|
|
|
- for(SubjectiveQuestionScoreInfo scoreInfo:subjectiveQuestionScoreInfoList){
|
|
|
|
- totalSubjectiveScore += scoreInfo.getScore();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //更新ec_oe_exam_score
|
|
|
|
- ExamScoreEntity examScoreEntity = examScoreRepo.findByExamRecordDataId(examRecordDataId);
|
|
|
|
- examScoreEntity.setSubjectiveScore(totalSubjectiveScore);
|
|
|
|
- double totalScore = totalSubjectiveScore+examScoreEntity.getObjectiveScore();
|
|
|
|
- examScoreEntity.setTotalScore(totalScore);
|
|
|
|
- examScoreRepo.save(examScoreEntity);
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamStudentFinalScoreService examStudentFinalScoreService;
|
|
|
|
|
|
- //计算考生的最终分数
|
|
|
|
- examStudentFinalScoreService.calculateFinalScore(examRecordData.getExamStudentId());
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<ExamQuestionEntity> querySubjectiveAnswerList(Long examRecordDataId) {
|
|
|
|
+ ExamRecordQuestionsEntity examRecordQuestionsEntity = examRecordQuestionsRepo.findByExamRecordDataId(examRecordDataId);
|
|
|
|
+ List<ExamQuestionEntity> examRecordQuestionList = examRecordQuestionsEntity.getExamQuestionEntities();
|
|
|
|
+
|
|
|
|
+ return examRecordQuestionList.stream().filter((obj -> {
|
|
|
|
+ return !QuestionTypeUtil.isObjectiveQuestion(obj.getQuestionType());
|
|
|
|
+ })).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void saveSubjectiveQuestionScore(Long examRecordDataId, List<SubjectiveQuestionScoreInfo> subjectiveQuestionScoreInfoList) {
|
|
|
|
+ ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
|
|
|
|
+ if (examRecordData.getExamType() == ExamType.ONLINE) {
|
|
|
|
+ ExamRecordQuestionsEntity examRecordQuestionsEntity = examRecordQuestionsRepo.findByExamRecordDataId(examRecordDataId);
|
|
|
|
+ List<ExamQuestionEntity> examRecordQuestionList = examRecordQuestionsEntity.getExamQuestionEntities();
|
|
|
|
+
|
|
|
|
+ for (SubjectiveQuestionScoreInfo scoreInfo : subjectiveQuestionScoreInfoList) {
|
|
|
|
+ for (ExamQuestionEntity examQuestionEntity : examRecordQuestionList) {
|
|
|
|
+ if (scoreInfo.getQuestionId().equals(examQuestionEntity.getQuestionId())
|
|
|
|
+ && scoreInfo.getOrder().intValue() == examQuestionEntity.getOrder().intValue()) {
|
|
|
|
+ examQuestionEntity.setStudentScore(scoreInfo.getScore());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ examRecordQuestionsRepo.save(examRecordQuestionsEntity);
|
|
|
|
+ }
|
|
|
|
+ //计算主观题总得分
|
|
|
|
+ double totalSubjectiveScore = 0D;
|
|
|
|
+ for (SubjectiveQuestionScoreInfo scoreInfo : subjectiveQuestionScoreInfoList) {
|
|
|
|
+ totalSubjectiveScore += scoreInfo.getScore();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //更新ec_oe_exam_score
|
|
|
|
+ ExamScoreEntity examScoreEntity = examScoreRepo.findByExamRecordDataId(examRecordDataId);
|
|
|
|
+ examScoreEntity.setSubjectiveScore(totalSubjectiveScore);
|
|
|
|
+ double totalScore = totalSubjectiveScore + examScoreEntity.getObjectiveScore();
|
|
|
|
+ examScoreEntity.setTotalScore(totalScore);
|
|
|
|
+ examScoreRepo.save(examScoreEntity);
|
|
|
|
+
|
|
|
|
+ //计算考生的最终分数
|
|
|
|
+ examStudentFinalScoreService.calculateFinalScore(examRecordData.getExamStudentId());
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|