Browse Source

Merge branch 'dev'
1

wangliang 4 years ago
parent
commit
c77aceda21

+ 42 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamStudentController.java

@@ -383,4 +383,46 @@ public class TEExamStudentController {
         }
         return ResultUtil.ok(teExamStudentService.markResultQuery(new Page<>(pageNumber, pageSize), examId, activityId, identity, name, courseCode));
     }
+
+    @ApiOperation(value = "成绩查询导出接口")
+    @RequestMapping(value = "/mark/result/export", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "考试批次信息", response = MarkResultDto.class)})
+    public Result markResultExport(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId,
+                             @ApiParam(value = "考试场次id", required = false) @RequestParam(required = false) Long activityId,
+                             @ApiParam(value = "证件号", required = false) @RequestParam(required = false) String identity,
+                             @ApiParam(value = "姓名", required = false) @RequestParam(required = false) String name,
+                             @ApiParam(value = "科目代码", required = false) @RequestParam(required = false) String courseCode) {
+        if (Objects.isNull(examId) || Objects.equals(examId, "")) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
+        }
+        ExamCacheBean examCacheBean = teExamService.getExamCacheBean(examId);
+        if (Objects.isNull(examCacheBean)) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_NO);
+        }
+        InvigilateMonitorStatusEnum invigilateMonitorStatusEnum = examCacheBean.getMonitorStatus();//监考状态
+        if (Objects.nonNull(invigilateMonitorStatusEnum) && !Objects.equals(invigilateMonitorStatusEnum, InvigilateMonitorStatusEnum.FINISHED)) {
+            throw new BusinessException("当前批次监考未结束,请在结束后查询");
+        }
+        ScoreStatusEnum scoreStatusEnum = examCacheBean.getScoreStatus();//算分状态
+        if (Objects.nonNull(scoreStatusEnum) && (Objects.equals(scoreStatusEnum, ScoreStatusEnum.NEVER) || Objects.equals(scoreStatusEnum, ScoreStatusEnum.FINISH))) {
+            throw new BusinessException("当前批次算分未结束,请在结束后查询");
+        }
+        QueryWrapper<TEExamCourse> teExamCourseQueryWrapper = new QueryWrapper<>();
+        teExamCourseQueryWrapper.lambda().eq(TEExamCourse::getExamId, examId);
+        List<TEExamCourse> teExamCourseList = teExamCourseService.list(teExamCourseQueryWrapper);
+        Set answerList = null;
+        if (Objects.nonNull(teExamCourseList) && teExamCourseList.size() > 0) {
+            answerList = teExamCourseList.stream().filter(s -> {
+                if (Objects.nonNull(s.getHasAnswer()) && s.getHasAnswer().intValue() == 0) {
+                    return true;
+                } else {
+                    return false;
+                }
+            }).collect(Collectors.toSet());
+        }
+        if (Objects.nonNull(answerList) && answerList.size() > 0) {
+            throw new BusinessException("当前批次标答未补齐,请补齐后查询");
+        }
+        return ResultUtil.ok(true);
+    }
 }

+ 1 - 1
themis-business/src/main/java/com/qmth/themis/business/enums/VerifyExceptionEnum.java

@@ -14,7 +14,7 @@ public enum VerifyExceptionEnum {
 
     FACE_COUNT_ERROR("人脸数量异常", Arrays.asList("D4", "D8"), "违纪预警"),
 
-    FACE_COMPARE_ERROR("人脸比对异常", Arrays.asList("D6"), "违纪预警"),
+    FACE_COMPARE_ERROR("人脸比对异常", Arrays.asList("D6", "D8"), "违纪预警"),
 
     EYE_CLOSE_ERROR("闭眼检测异常", Arrays.asList("D14"), "违纪预警"),
 

+ 3 - 3
themis-business/src/main/java/com/qmth/themis/business/service/impl/WarningServiceImpl.java

@@ -112,13 +112,13 @@ public class WarningServiceImpl implements WarningService {
             Integer count = Integer.parseInt(String.valueOf(map.get("tmpCount")));
             count = Objects.isNull(count) ? 0 : count;
             if (count > teConfig.getMatchFaceCompareErrorCount()) {
-                TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
+                TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(1), WarningLevelEnum.valueOf(warningEnum.getLevel().get(1)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
                 this.setWarningCount(recordId);
                 this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getMatchFaceCompareErrorCount());
             }
             if (count > teConfig.getTotalFaceCompareErrorCount()) {
-                TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(1), WarningLevelEnum.valueOf(warningEnum.getLevel().get(1)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
+                TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
                 this.setWarningCount(recordId);
                 this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getTotalFaceCompareErrorCount());
@@ -150,7 +150,7 @@ public class WarningServiceImpl implements WarningService {
                 TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getTitle(), warningEnum, photoUrl, Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(recordId)) ? ExamRecordCacheUtil.getBreachStatus(recordId) : 1);
                 tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
                 this.setWarningCount(recordId);
-                this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getMatchFaceCompareErrorCount());
+                this.setPhotoUrls(map, tIeInvigilateWarnInfo, examStudentCacheBean, recordId, teConfig.getTotalEyeCloseErrorCount());
             }
         }
     }

+ 2 - 4
themis-business/src/main/resources/mapper/TEExamReexamMapper.xml

@@ -14,11 +14,9 @@
             tees.course_name as courseName,
             tees.exam_id as examId,
             tee.exam_count - tees.already_exam_count as examCount,
-            toer.status
+            (select count(1) from t_oe_exam_record toer where toer.status <![CDATA[ <> ]]> 'FINISHED') as statusCount
         from
             t_e_exam_student tees
-            left join t_oe_exam_record toer on
-            toer.exam_student_id = toer.exam_student_id
             left join t_e_exam tee on
             tees.exam_id = tee.id
             inner join (select distinct tbeiu.room_code from t_b_exam_invigilate_user tbeiu
@@ -47,7 +45,7 @@
                 </if>
                 and tees.enable = 1
             </where>
-        ) t where t.examCount = 0 and status = 'finished'
+        ) t where t.examCount = 0 and statusCount = 0
             order by t.roomCode
     </select>