wangliang 3 месяцев назад
Родитель
Сommit
87d098c6ab

+ 14 - 9
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkServiceImpl.java

@@ -367,15 +367,20 @@ public class MarkServiceImpl implements MarkService {
     @Override
     @Transactional
     public void checkStudentSubjective(Long studentId, Long examId, String paperNumber, Integer version) {
-        long unBindMarkerQuestionCount = markQuestionService.countUnBindMarkerByExamIdAndPaperNumberAndObjective(examId, paperNumber, false);
-        long questionCount = markQuestionService.countByExamIdAndPaperNumberAndObjective(examId, paperNumber, false);
-        long subjectiveScoreCount = markSubjectiveScoreService.countByStudentId(studentId);
-        // 主观题数大于0,主观题全部绑定了评卷员,考生小题分数数量等于主观题数量
-        if (questionCount > 0 && unBindMarkerQuestionCount == 0 && questionCount == subjectiveScoreCount) {
-            scoreCalculate(studentId, version);
-        } else {//否则更新该学生主观题状态为未阅卷
-//            markStudentService.updateSubjectiveStatusAndScore(studentId, SubjectiveStatus.UNMARK, null, null);
-            markStudentService.updateSubjectiveScoreByVersion(studentId, SubjectiveStatus.MARKED, null, null, version);
+        try {
+            long unBindMarkerQuestionCount = markQuestionService.countUnBindMarkerByExamIdAndPaperNumberAndObjective(examId, paperNumber, false);
+            long questionCount = markQuestionService.countByExamIdAndPaperNumberAndObjective(examId, paperNumber, false);
+            long subjectiveScoreCount = markSubjectiveScoreService.countByStudentId(studentId);
+            // 主观题数大于0,主观题全部绑定了评卷员,考生小题分数数量等于主观题数量
+            if (questionCount > 0 && unBindMarkerQuestionCount == 0 && questionCount == subjectiveScoreCount) {
+                scoreCalculate(studentId, version);
+            } else {//否则更新该学生主观题状态为未阅卷
+//                markStudentService.updateSubjectiveStatusAndScore(studentId, SubjectiveStatus.UNMARK, null, null);
+                markStudentService.updateSubjectiveScoreByVersion(studentId, SubjectiveStatus.MARKED, null, null, version);
+            }
+        } catch (Exception e) {
+            log.error(SystemConstant.LOG_ERROR, e);
+            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
         }
     }
 

+ 6 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -2464,9 +2464,14 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
      * @return
      */
     @Override
+    @Transactional
     public int updateSubjectiveScoreByVersion(Long studentId, SubjectiveStatus status, Double score, String scoreList, Integer version) {
         Objects.requireNonNull(status, "主观题状态不能为空");
-        return this.baseMapper.updateSubjectiveScoreByVersion(studentId, status.name(), score, scoreList, version);
+        int update = this.baseMapper.updateSubjectiveScoreByVersion(studentId, status.name(), score, scoreList, version)
+        if (update == 0) {
+            throw ExceptionResultEnum.ERROR.exception("版本号发生改变,更新失败");
+        }
+        return update;
     }
 
     /**