|
@@ -621,18 +621,16 @@ public class TIeInvigilateController {
|
|
@ApiOperation(value = "结束监考接口")
|
|
@ApiOperation(value = "结束监考接口")
|
|
@RequestMapping(value = "/exam/finish", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/exam/finish", method = RequestMethod.POST)
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
- public Result examFinish(@ApiParam(value = "考试id", required = true) @RequestParam Long examId) {
|
|
|
|
- if (Objects.isNull(examId) || Objects.equals(examId, "")) {
|
|
|
|
- throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
|
|
|
|
- }
|
|
|
|
|
|
+ public Result examFinish(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
|
|
|
|
+ @ApiParam(value = "监考状态", required = true) @RequestParam InvigilateMonitorStatusEnum status) {
|
|
|
|
+ Optional.ofNullable(examId).orElseThrow(() -> new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL));
|
|
|
|
+ Optional.ofNullable(status).orElseThrow(() -> new BusinessException("监考状态不能为空"));
|
|
|
|
+
|
|
ExamCacheBean examCacheBean = teExamService.getExamCacheBean(examId);
|
|
ExamCacheBean examCacheBean = teExamService.getExamCacheBean(examId);
|
|
- if (System.currentTimeMillis() < examCacheBean.getEndTime()) {
|
|
|
|
|
|
+ if (status == InvigilateMonitorStatusEnum.FINISHED && System.currentTimeMillis() < examCacheBean.getEndTime()) {
|
|
throw new BusinessException("未到考试批次结束时间");
|
|
throw new BusinessException("未到考试批次结束时间");
|
|
}
|
|
}
|
|
- if (examCacheBean.getMonitorStatus() == InvigilateMonitorStatusEnum.FINISHED) {
|
|
|
|
- throw new BusinessException("考试批次已结束");
|
|
|
|
- }
|
|
|
|
- teExamService.updateInvigilateMonitorStatus(InvigilateMonitorStatusEnum.FINISHED, examId);
|
|
|
|
|
|
+ teExamService.updateInvigilateMonitorStatus(status, examId);
|
|
teExamService.deleteExamCacheBean(examId);
|
|
teExamService.deleteExamCacheBean(examId);
|
|
return ResultUtil.ok(true);
|
|
return ResultUtil.ok(true);
|
|
}
|
|
}
|