deason vor 2 Jahren
Ursprung
Commit
61a0a87136

+ 21 - 21
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamScoreDataCloudServiceProvider.java

@@ -465,18 +465,18 @@ public class ExamScoreDataCloudServiceProvider extends ControllerSupport impleme
         List<Long> examRecordDataIds = examRecordDataEntities.stream().map(ExamRecordDataEntity::getId).collect(Collectors.toList());
         List<ExamScoreEntity> examScoreEntities = examScoreRepo.findByExamRecordDataIdIn(examRecordDataIds);
         if (CollectionUtils.isEmpty(examScoreEntities)) {
-            LOGGER.info("examScoreEntities size is empty. ");
+            LOGGER.warn("ExamScores size is empty, examId:{}", examId);
             return queryResp;
         }
 
-        LOGGER.info("examRecordData size is " + examRecordDataEntities.size() + ", examScore size is " + examScoreEntities.size());
+        LOGGER.info("ExamScores size is {}, examId:{}", examScoreEntities.size(), examId);
         Map<Long, ExamScoreEntity> examScoreMaps = examScoreEntities.stream().collect(Collectors.toMap(ExamScoreEntity::getExamRecordDataId, v -> v, (k, v) -> v));
 
         Map<Long, CourseBean> courseMaps = new HashMap<>();
         for (ExamRecordDataEntity examRecordData : examRecordDataEntities) {
             ExamScoreEntity examScore = examScoreMaps.get(examRecordData.getId());
             if (examScore == null) {
-                LOGGER.debug("examSore not exist. examRecordDataId = " + examRecordData.getId());
+                LOGGER.warn("ExamScoreEntity not exist, examStudentId:{} examRecordDataId:{}", examRecordData.getExamStudentId(), examRecordData.getId());
                 continue;
             }
 
@@ -523,11 +523,13 @@ public class ExamScoreDataCloudServiceProvider extends ControllerSupport impleme
     @Override
     public GetFinalScoreDataResp getFinalScoreData(@RequestBody GetFinalScoreDataReq req) {
         if (req.getRootOrgId() == null) {
-            throw new StatusException("100002", "学校id不允许为空");
+            throw new StatusException("100002", "学校ID不允许为空");
         }
+
         if (req.getExamId() == null) {
-            throw new StatusException("100003", "考试id不允许为空");
+            throw new StatusException("100003", "考试ID不允许为空");
         }
+
         //只支持离线和在线考试
         ExamSettingsCacheBean examSettings = ExamCacheTransferHelper.getDefaultCachedExam(req.getExamId());
         if (!(ExamType.ONLINE.toString().equals(examSettings.getExamType()) ||
@@ -539,14 +541,16 @@ public class ExamScoreDataCloudServiceProvider extends ControllerSupport impleme
         if (StringUtils.isEmpty(req.getIdentityNumber()) && StringUtils.isEmpty(req.getStudentCode())) {
             throw new StatusException("100004", "学号和身份证号不能同时为空");
         }
+
         if (StringUtils.isEmpty(req.getCourseCode())) {
             throw new StatusException("100005", "课程代码不允许为空");
         }
+
         String identityNumber = req.getIdentityNumber();
         if (StringUtils.isEmpty(identityNumber)) {
-            identityNumber = gainBaseDataService.getStudentBean(req.getStudentCode(),
-                    req.getRootOrgId()).getIdentityNumber();
+            identityNumber = gainBaseDataService.getStudentBean(req.getStudentCode(), req.getRootOrgId()).getIdentityNumber();
             if (StringUtils.isEmpty(identityNumber)) {
+                LOGGER.warn("找不到学号对应的学生身份证信息!rootOrgId:{} studentCode:{}", req.getRootOrgId(), req.getStudentCode());
                 throw new StatusException("100006", "找不到学号对应的学生身份证信息");
             }
         }
@@ -554,30 +558,29 @@ public class ExamScoreDataCloudServiceProvider extends ControllerSupport impleme
         CourseBean courseBean = gainBaseDataService.getCourseBean(req.getCourseCode(), req.getRootOrgId());
         Long courseId = courseBean.getId();
         if (courseId == null) {
+            LOGGER.warn("课程不存在!rootOrgId:{} courseCode:{}", req.getRootOrgId(), req.getCourseCode());
             throw new StatusException("100007", "课程代码不正确");
         }
 
-        GetFinalScoreDataResp resp = new GetFinalScoreDataResp();
         //如果该学生缺考,直接返回
-        ExamStudentEntity examStudent = examStudentRepo.findByIdentityNumberAndExamIdAndCourseId(
-                identityNumber, req.getExamId(), courseId);
+        ExamStudentEntity examStudent = examStudentRepo.findByIdentityNumberAndExamIdAndCourseId(identityNumber, req.getExamId(), courseId);
         if (examStudent == null) {
+            LOGGER.warn("考生不存在!examId:{} courseId:{} identityNumber:{}", req.getExamId(), courseId, identityNumber);
             throw new StatusException("100008", "考生不存在");
         }
-        Boolean isAbsent = examStudent.getFinished() == null || !examStudent.getFinished();
-        if (isAbsent) {
+
+        GetFinalScoreDataResp resp = new GetFinalScoreDataResp();
+        if (examStudent.getFinished() == null || !examStudent.getFinished()) {
             resp.setAbsent(true);
             return resp;
         }
 
         //最终生效的考试分数对象
-        ExamStudentFinalScoreEntity finalExamScore =
-                examStudentFinalScoreService.getFinalEffectiveExamScore(examStudent.getExamStudentId());
+        ExamStudentFinalScoreEntity finalExamScore = examStudentFinalScoreService.getFinalEffectiveExamScore(examStudent.getExamStudentId());
 
         //如果查到最终有分数数据,则直接返回
         if (null != finalExamScore) {
-            ScoreDataBean scoreDataBean = buildScoreDataBean(identityNumber, courseBean,
-                    finalExamScore.getTotalScore(), finalExamScore.getExamRecordDataId());
+            ScoreDataBean scoreDataBean = buildScoreDataBean(identityNumber, courseBean, finalExamScore.getTotalScore(), finalExamScore.getExamRecordDataId());
             resp.setScoreDataBean(scoreDataBean);
             resp.setAbsent(false);
             resp.setIllegality(false);
@@ -587,22 +590,19 @@ public class ExamScoreDataCloudServiceProvider extends ControllerSupport impleme
 
         //如果查不到有效的分数集合,则将所有的考试分数集合均返回
         resp.setAbsent(false);
-        List<ExamScoreEntity> allExamScoreList =
-                examScoreService.getAllExamScoreList(req.getExamId(), identityNumber, courseId);
+        List<ExamScoreEntity> allExamScoreList = examScoreService.getAllExamScoreList(req.getExamId(), identityNumber, courseId);
         if (allExamScoreList == null) {
             return resp;
         }
 
         List<ScoreDataBean> scoreDataBeanList = new ArrayList<>();
         for (ExamScoreEntity scoreEntity : allExamScoreList) {
-            scoreDataBeanList.add(buildScoreDataBean(identityNumber,
-                    courseBean, scoreEntity.getTotalScore(), scoreEntity.getExamRecordDataId()));
+            scoreDataBeanList.add(buildScoreDataBean(identityNumber, courseBean, scoreEntity.getTotalScore(), scoreEntity.getExamRecordDataId()));
         }
         resp.setAllScoreDataBeanList(scoreDataBeanList);
         resp.setAudit(scoreDataBeanList.stream().anyMatch(p -> p.getIsAudit() == null || !p.getIsAudit()));
         resp.setIllegality(scoreDataBeanList.stream().anyMatch(p -> p.getIsIllegality() != null && p.getIsIllegality()));
         return resp;
-
     }
 
     private ScoreDataBean buildScoreDataBean(String identityNumber, final CourseBean courseBean,