|
@@ -67,17 +67,15 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "验证考试口令接口")
|
|
@ApiOperation(value = "验证考试口令接口")
|
|
@RequestMapping(value = "/short_code", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/short_code", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "考试信息", response = TEExam.class)})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "考试信息", response = TEExam.class) })
|
|
public Result shortCode(@ApiJsonObject(name = "shortCode", value = {
|
|
public Result shortCode(@ApiJsonObject(name = "shortCode", value = {
|
|
- @ApiJsonProperty(key = "shortCode", description = "考试口令")
|
|
|
|
- }) @ApiParam(value = "考试口令", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
|
|
|
|
+ @ApiJsonProperty(key = "shortCode", description = "考试口令") }) @ApiParam(value = "考试口令", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
if (Objects.isNull(mapParameter.get("shortCode")) || Objects.equals(mapParameter.get("shortCode"), "")) {
|
|
if (Objects.isNull(mapParameter.get("shortCode")) || Objects.equals(mapParameter.get("shortCode"), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.SHORT_CODE_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.SHORT_CODE_IS_NULL);
|
|
}
|
|
}
|
|
String shortCode = String.valueOf(mapParameter.get("shortCode"));
|
|
String shortCode = String.valueOf(mapParameter.get("shortCode"));
|
|
QueryWrapper<TEExam> teExamQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<TEExam> teExamQueryWrapper = new QueryWrapper<>();
|
|
- teExamQueryWrapper.lambda().eq(TEExam::getShortCode, shortCode)
|
|
|
|
- .eq(TEExam::getEnable, 1)
|
|
|
|
|
|
+ teExamQueryWrapper.lambda().eq(TEExam::getShortCode, shortCode).eq(TEExam::getEnable, 1)
|
|
.eq(TEExam::getArchived, 1);
|
|
.eq(TEExam::getArchived, 1);
|
|
TEExam teExam = teExamService.getOne(teExamQueryWrapper);
|
|
TEExam teExam = teExamService.getOne(teExamQueryWrapper);
|
|
if (Objects.isNull(teExam)) {
|
|
if (Objects.isNull(teExam)) {
|
|
@@ -91,11 +89,12 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "获取待考列表接口")
|
|
@ApiOperation(value = "获取待考列表接口")
|
|
@RequestMapping(value = "/waiting", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/waiting", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "考试列表", response = TEExamDto.class)})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "考试列表", response = TEExamDto.class) })
|
|
public Result waiting(@ApiJsonObject(name = "examWaiting", value = {
|
|
public Result waiting(@ApiJsonObject(name = "examWaiting", value = {
|
|
- @ApiJsonProperty(key = "examId", type = "long", example = "1", description = "批次id")
|
|
|
|
- }) @ApiParam(value = "考试口令", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
|
|
- Long examId = Objects.nonNull(mapParameter.get(SystemConstant.EXAM_ID)) ? Long.parseLong(String.valueOf(mapParameter.get(SystemConstant.EXAM_ID))) : null;
|
|
|
|
|
|
+ @ApiJsonProperty(key = "examId", type = "long", example = "1", description = "批次id") }) @ApiParam(value = "考试口令", required = true) @RequestBody Map<String, Object> mapParameter) {
|
|
|
|
+ Long examId = Objects.nonNull(mapParameter.get(SystemConstant.EXAM_ID)) ?
|
|
|
|
+ Long.parseLong(String.valueOf(mapParameter.get(SystemConstant.EXAM_ID))) :
|
|
|
|
+ null;
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
List<TEExamWaitDto> list = teExamService.getWaitingExam(teStudent.getId(), examId, teStudent.getOrgId());
|
|
List<TEExamWaitDto> list = teExamService.getWaitingExam(teStudent.getId(), examId, teStudent.getOrgId());
|
|
return ResultUtil.ok(Collections.singletonMap("waiting", list));
|
|
return ResultUtil.ok(Collections.singletonMap("waiting", list));
|
|
@@ -103,12 +102,11 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "开始候考")
|
|
@ApiOperation(value = "开始候考")
|
|
@RequestMapping(value = "/prepare", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/prepare", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "候考信息", response = ExamPrepareBean.class)})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "候考信息", response = ExamPrepareBean.class) })
|
|
public Result prepare(@RequestBody PrepareParamBean param) {
|
|
public Result prepare(@RequestBody PrepareParamBean param) {
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
String lockKey = SystemConstant.REDIS_LOCK_STUDENT_PREFIX + teStudent.getId();
|
|
String lockKey = SystemConstant.REDIS_LOCK_STUDENT_PREFIX + teStudent.getId();
|
|
- Boolean lock = redisUtil.lock(lockKey, SystemConstant.REDIS_CACHE_TIME_OUT);
|
|
|
|
- if (!lock) {
|
|
|
|
|
|
+ if (!redisUtil.lock(lockKey, SystemConstant.REDIS_CACHE_TIME_OUT)) {
|
|
throw new BusinessException(ExceptionResultEnum.REQUEST_AWAIT);
|
|
throw new BusinessException(ExceptionResultEnum.REQUEST_AWAIT);
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
@@ -123,11 +121,12 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "候考/答题状态退出")
|
|
@ApiOperation(value = "候考/答题状态退出")
|
|
@RequestMapping(value = "/exit", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/exit", 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 exit(@ApiJsonObject(name = "saveInvigilateUser", value = {
|
|
public Result exit(@ApiJsonObject(name = "saveInvigilateUser", value = {
|
|
- @ApiJsonProperty(key = "recordId", type = "long", example = "1", description = "考试记录id", required = true)
|
|
|
|
- }) @ApiParam(value = "考试记录id", required = true) @RequestBody Map<String, Object> mapParameter) throws NoSuchAlgorithmException, IOException {
|
|
|
|
- if (Objects.isNull(mapParameter.get(SystemConstant.RECORD_ID)) || Objects.equals(mapParameter.get(SystemConstant.RECORD_ID), "")) {
|
|
|
|
|
|
+ @ApiJsonProperty(key = "recordId", type = "long", example = "1", description = "考试记录id", required = true) }) @ApiParam(value = "考试记录id", required = true) @RequestBody Map<String, Object> mapParameter)
|
|
|
|
+ throws NoSuchAlgorithmException, IOException {
|
|
|
|
+ if (Objects.isNull(mapParameter.get(SystemConstant.RECORD_ID)) || Objects
|
|
|
|
+ .equals(mapParameter.get(SystemConstant.RECORD_ID), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
}
|
|
}
|
|
String recordId = (String) mapParameter.get(SystemConstant.RECORD_ID);
|
|
String recordId = (String) mapParameter.get(SystemConstant.RECORD_ID);
|
|
@@ -153,12 +152,11 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "开始考试")
|
|
@ApiOperation(value = "开始考试")
|
|
@RequestMapping(value = "/start", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/start", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result start(@RequestBody ExamStartParamBean param) {
|
|
public Result start(@RequestBody ExamStartParamBean param) {
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
String lockKey = SystemConstant.REDIS_LOCK_STUDENT_PREFIX + teStudent.getId();
|
|
String lockKey = SystemConstant.REDIS_LOCK_STUDENT_PREFIX + teStudent.getId();
|
|
- Boolean lock = redisUtil.lock(lockKey, SystemConstant.REDIS_CACHE_TIME_OUT);
|
|
|
|
- if (!lock) {
|
|
|
|
|
|
+ if (!redisUtil.lock(lockKey, SystemConstant.REDIS_CACHE_TIME_OUT)) {
|
|
throw new BusinessException(ExceptionResultEnum.REQUEST_AWAIT);
|
|
throw new BusinessException(ExceptionResultEnum.REQUEST_AWAIT);
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
@@ -170,20 +168,26 @@ public class TEExamController {
|
|
Long breakId = ExamRecordCacheUtil.getLastBreakId(param.getRecordId());
|
|
Long breakId = ExamRecordCacheUtil.getLastBreakId(param.getRecordId());
|
|
if (Objects.nonNull(breakId)) {
|
|
if (Objects.nonNull(breakId)) {
|
|
JSONObject jsonObject = JSONObject.parseObject(param.getReason());
|
|
JSONObject jsonObject = JSONObject.parseObject(param.getReason());
|
|
- ExceptionEnum exceptionEnum = ExceptionEnum.valueOf(ExceptionEnum.convertToName(String.valueOf(jsonObject.get(SystemConstant.TYPE))));
|
|
|
|
|
|
+ ExceptionEnum exceptionEnum = ExceptionEnum
|
|
|
|
+ .valueOf(ExceptionEnum.convertToName(String.valueOf(jsonObject.get(SystemConstant.TYPE))));
|
|
String reason = String.valueOf(jsonObject.get("reason"));
|
|
String reason = String.valueOf(jsonObject.get("reason"));
|
|
ExamBreakCacheUtil.setBreakReason(breakId, exceptionEnum);
|
|
ExamBreakCacheUtil.setBreakReason(breakId, exceptionEnum);
|
|
ExamBreakCacheUtil.setResumeReason(breakId, reason);
|
|
ExamBreakCacheUtil.setResumeReason(breakId, reason);
|
|
tOeExamBreakHistoryService.sendExamRecordBreakHistoryDataMq(breakId);
|
|
tOeExamBreakHistoryService.sendExamRecordBreakHistoryDataMq(breakId);
|
|
//考试断点异常原因 发送mq start
|
|
//考试断点异常原因 发送mq start
|
|
- MqDto mqDto = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.EXCEPTION_LOG.name(), JacksonUtil.parseJson(param), MqTagEnum.EXCEPTION_LOG, String.valueOf(param.getRecordId()), param.getReason());
|
|
|
|
|
|
+ MqDto mqDto = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.EXCEPTION_LOG.name(),
|
|
|
|
+ JacksonUtil.parseJson(param), MqTagEnum.EXCEPTION_LOG, String.valueOf(param.getRecordId()),
|
|
|
|
+ param.getReason());
|
|
mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
//考试断点异常原因 发送mq end
|
|
//考试断点异常原因 发送mq end
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//mq发送消息start
|
|
//mq发送消息start
|
|
- MqDto mqDto = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.STUDENT.name(), SystemOperationEnum.ANSWERING, MqTagEnum.STUDENT, String.valueOf(teStudent.getId()), teStudent.getIdentity());
|
|
|
|
- teExamService.sendOeLogMessage(SystemOperationEnum.ANSWERING, ExamRecordCacheUtil.getExamStudentId(param.getRecordId()), param.getRecordId(), mqDto);
|
|
|
|
|
|
+ MqDto mqDto = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.STUDENT.name(),
|
|
|
|
+ SystemOperationEnum.ANSWERING, MqTagEnum.STUDENT, String.valueOf(teStudent.getId()),
|
|
|
|
+ teStudent.getIdentity());
|
|
|
|
+ teExamService.sendOeLogMessage(SystemOperationEnum.ANSWERING,
|
|
|
|
+ ExamRecordCacheUtil.getExamStudentId(param.getRecordId()), param.getRecordId(), mqDto);
|
|
//mq发送消息end
|
|
//mq发送消息end
|
|
}
|
|
}
|
|
ExamConstant.sendExamStartMsg(param.getRecordId());
|
|
ExamConstant.sendExamStartMsg(param.getRecordId());
|
|
@@ -195,7 +199,7 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "上传个人试卷结构")
|
|
@ApiOperation(value = "上传个人试卷结构")
|
|
@RequestMapping(value = "/student_paper_struct/upload", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/student_paper_struct/upload", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result studentPaperStruct(@RequestBody StudentPaperStructParamBean param) {
|
|
public Result studentPaperStruct(@RequestBody StudentPaperStructParamBean param) {
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
@@ -210,7 +214,7 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "提交作答结果")
|
|
@ApiOperation(value = "提交作答结果")
|
|
@RequestMapping(value = "/answer/submit", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/answer/submit", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result answerSubmit(@RequestBody AnswerSubmitParamBean param) throws IOException {
|
|
public Result answerSubmit(@RequestBody AnswerSubmitParamBean param) throws IOException {
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
@@ -229,31 +233,31 @@ public class TEExamController {
|
|
throw new BusinessException("时间戳不能为空");
|
|
throw new BusinessException("时间戳不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
-// Map mqMap = new HashMap<>();
|
|
|
|
-// mqMap.put(SystemConstant.RECORD_ID, param.getRecordId());
|
|
|
|
-// mqMap.put("source", MonitorVideoSourceEnum.MOBILE_FIRST.name());
|
|
|
|
-// //监控结束
|
|
|
|
-// MqDto mqDtoStop = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.MONITOR_STOP.name(), param.getRecordId(), MqTagEnum.MONITOR_STOP, String.valueOf(param.getRecordId()), mqMap, String.valueOf(param.getRecordId()));
|
|
|
|
-// mqDtoService.assembleSendOneOrderMsg(mqDtoStop);
|
|
|
|
|
|
+ // Map mqMap = new HashMap<>();
|
|
|
|
+ // mqMap.put(SystemConstant.RECORD_ID, param.getRecordId());
|
|
|
|
+ // mqMap.put("source", MonitorVideoSourceEnum.MOBILE_FIRST.name());
|
|
|
|
+ // //监控结束
|
|
|
|
+ // MqDto mqDtoStop = new MqDto(mqUtil.getMqGroupDomain().getTopic(), MqTagEnum.MONITOR_STOP.name(), param.getRecordId(), MqTagEnum.MONITOR_STOP, String.valueOf(param.getRecordId()), mqMap, String.valueOf(param.getRecordId()));
|
|
|
|
+ // mqDtoService.assembleSendOneOrderMsg(mqDtoStop);
|
|
|
|
|
|
-// ExamRecordCacheUtil.setStatus(param.getRecordId(), ExamRecordStatusEnum.FINISHED, System.currentTimeMillis());
|
|
|
|
-// ConcurrentHashMap<String, WebSocketOeServer> webSocketMap = WebSocketOeServer.getWebSocketMap();
|
|
|
|
-// String clientWebsocketId = ExamRecordCacheUtil.getClientWebsocketId(param.getRecordId());
|
|
|
|
-// if (Objects.nonNull(clientWebsocketId)) {
|
|
|
|
-// WebSocketOeServer webSocketOeServer = webSocketMap.get(clientWebsocketId);
|
|
|
|
-// WebSocketOeServer.close(webSocketOeServer);
|
|
|
|
-// }
|
|
|
|
|
|
+ // ExamRecordCacheUtil.setStatus(param.getRecordId(), ExamRecordStatusEnum.FINISHED, System.currentTimeMillis());
|
|
|
|
+ // ConcurrentHashMap<String, WebSocketOeServer> webSocketMap = WebSocketOeServer.getWebSocketMap();
|
|
|
|
+ // String clientWebsocketId = ExamRecordCacheUtil.getClientWebsocketId(param.getRecordId());
|
|
|
|
+ // if (Objects.nonNull(clientWebsocketId)) {
|
|
|
|
+ // WebSocketOeServer webSocketOeServer = webSocketMap.get(clientWebsocketId);
|
|
|
|
+ // WebSocketOeServer.close(webSocketOeServer);
|
|
|
|
+ // }
|
|
|
|
|
|
- AnswerSubmitBean ret = teExamService.answerSubmit(teStudent.getId(), param.getRecordId(), param.getMainNumber(),
|
|
|
|
- param.getSubNumber(), param.getSubIndex(), param.getAnswer(), param.getVersion(),
|
|
|
|
- param.getDurationSeconds());
|
|
|
|
|
|
+ AnswerSubmitBean ret = teExamService
|
|
|
|
+ .answerSubmit(teStudent.getId(), param.getRecordId(), param.getMainNumber(), param.getSubNumber(),
|
|
|
|
+ param.getSubIndex(), param.getAnswer(), param.getVersion(), param.getDurationSeconds());
|
|
return ResultUtil.ok(ret);
|
|
return ResultUtil.ok(ret);
|
|
-// return ResultUtil.ok(true);
|
|
|
|
|
|
+ // return ResultUtil.ok(true);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更新音频剩余播放次数")
|
|
@ApiOperation(value = "更新音频剩余播放次数")
|
|
@RequestMapping(value = "/audio_left_play_count/submit", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/audio_left_play_count/submit", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result audioLeftPlayCountSubmit(@RequestBody AudioLeftPlayCountSubmitParamBean param) {
|
|
public Result audioLeftPlayCountSubmit(@RequestBody AudioLeftPlayCountSubmitParamBean param) {
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
@@ -265,23 +269,24 @@ public class TEExamController {
|
|
if (param.getCount() == null) {
|
|
if (param.getCount() == null) {
|
|
throw new BusinessException("剩余播放次数不能为空");
|
|
throw new BusinessException("剩余播放次数不能为空");
|
|
}
|
|
}
|
|
- return ResultUtil.ok(teExamService.audioLeftPlayCountSubmit(teStudent.getId(), param.getRecordId(), param.getKey(), param.getCount()));
|
|
|
|
|
|
+ return ResultUtil.ok(teExamService
|
|
|
|
+ .audioLeftPlayCountSubmit(teStudent.getId(), param.getRecordId(), param.getKey(), param.getCount()));
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "文件上传")
|
|
@ApiOperation(value = "文件上传")
|
|
@RequestMapping(value = "/file/upload", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/file/upload", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result fileUpload(@ApiParam(value = "考试记录ID", required = true) @RequestParam Long recordId,
|
|
public Result fileUpload(@ApiParam(value = "考试记录ID", required = true) @RequestParam Long recordId,
|
|
- @ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
|
|
|
|
- @ApiParam(value = "后缀名", required = true) @RequestParam String suffix,
|
|
|
|
- @ApiParam(value = "md5", required = true) @RequestParam String md5) {
|
|
|
|
|
|
+ @ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
|
|
|
|
+ @ApiParam(value = "后缀名", required = true) @RequestParam String suffix,
|
|
|
|
+ @ApiParam(value = "md5", required = true) @RequestParam String md5) {
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
return ResultUtil.ok(teExamService.fileUpload(teStudent.getId(), recordId, file, suffix, md5));
|
|
return ResultUtil.ok(teExamService.fileUpload(teStudent.getId(), recordId, file, suffix, md5));
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "断点恢复")
|
|
@ApiOperation(value = "断点恢复")
|
|
@RequestMapping(value = "/resume", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/resume", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result resume(@RequestBody ResumeParamBean param) {
|
|
public Result resume(@RequestBody ResumeParamBean param) {
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
String lockKey = SystemConstant.REDIS_LOCK_STUDENT_PREFIX + teStudent.getId();
|
|
String lockKey = SystemConstant.REDIS_LOCK_STUDENT_PREFIX + teStudent.getId();
|
|
@@ -301,7 +306,7 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "结束考试")
|
|
@ApiOperation(value = "结束考试")
|
|
@RequestMapping(value = "/finish", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/finish", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result finish(@RequestBody FinishParamBean param) {
|
|
public Result finish(@RequestBody FinishParamBean param) {
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
String lockKey = SystemConstant.REDIS_LOCK_STUDENT_PREFIX + teStudent.getId();
|
|
String lockKey = SystemConstant.REDIS_LOCK_STUDENT_PREFIX + teStudent.getId();
|
|
@@ -319,7 +324,8 @@ public class TEExamController {
|
|
if (param.getDurationSeconds() == null) {
|
|
if (param.getDurationSeconds() == null) {
|
|
throw new BusinessException("总用时秒数不能为空");
|
|
throw new BusinessException("总用时秒数不能为空");
|
|
}
|
|
}
|
|
- return ResultUtil.ok(teExamService.finish(teStudent.getId(), param.getRecordId(), param.getType(), param.getDurationSeconds()));
|
|
|
|
|
|
+ return ResultUtil.ok(teExamService
|
|
|
|
+ .finish(teStudent.getId(), param.getRecordId(), param.getType(), param.getDurationSeconds()));
|
|
} finally {
|
|
} finally {
|
|
redisUtil.releaseLock(lockKey);
|
|
redisUtil.releaseLock(lockKey);
|
|
}
|
|
}
|
|
@@ -327,7 +333,7 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "查询交卷结果")
|
|
@ApiOperation(value = "查询交卷结果")
|
|
@RequestMapping(value = "/result", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/result", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result result(@RequestBody ResultParamBean param) {
|
|
public Result result(@RequestBody ResultParamBean param) {
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
@@ -337,7 +343,9 @@ public class TEExamController {
|
|
TOeExamRecord tOeExamRecord = tOeExamRecordService.getById(param.getRecordId());
|
|
TOeExamRecord tOeExamRecord = tOeExamRecordService.getById(param.getRecordId());
|
|
examRecordStatusEnum = tOeExamRecord.getStatus();
|
|
examRecordStatusEnum = tOeExamRecord.getStatus();
|
|
}
|
|
}
|
|
- if (Objects.nonNull(examRecordStatusEnum) && (!Objects.equals(ExamRecordStatusEnum.FIRST_PREPARE, examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.RESUME_PREPARE, examRecordStatusEnum))) {
|
|
|
|
|
|
+ if (Objects.nonNull(examRecordStatusEnum) && (
|
|
|
|
+ !Objects.equals(ExamRecordStatusEnum.FIRST_PREPARE, examRecordStatusEnum) && !Objects
|
|
|
|
+ .equals(ExamRecordStatusEnum.RESUME_PREPARE, examRecordStatusEnum))) {
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ERROR);
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ERROR);
|
|
}
|
|
}
|
|
return ResultUtil.ok(teExamService.result(param.getRecordId()));
|
|
return ResultUtil.ok(teExamService.result(param.getRecordId()));
|
|
@@ -345,13 +353,15 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "获取试卷下载信息")
|
|
@ApiOperation(value = "获取试卷下载信息")
|
|
@RequestMapping(value = "/paper/download", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/paper/download", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result paperDownload(@RequestBody ResultParamBean param) throws IOException {
|
|
public Result paperDownload(@RequestBody ResultParamBean param) throws IOException {
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
}
|
|
}
|
|
ExamRecordStatusEnum examRecordStatusEnum = ExamRecordCacheUtil.getStatus(param.getRecordId());
|
|
ExamRecordStatusEnum examRecordStatusEnum = ExamRecordCacheUtil.getStatus(param.getRecordId());
|
|
- if (Objects.nonNull(examRecordStatusEnum) && (!Objects.equals(ExamRecordStatusEnum.FIRST_PREPARE, examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.RESUME_PREPARE, examRecordStatusEnum))) {
|
|
|
|
|
|
+ if (Objects.nonNull(examRecordStatusEnum) && (
|
|
|
|
+ !Objects.equals(ExamRecordStatusEnum.FIRST_PREPARE, examRecordStatusEnum) && !Objects
|
|
|
|
+ .equals(ExamRecordStatusEnum.RESUME_PREPARE, examRecordStatusEnum))) {
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ERROR);
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ERROR);
|
|
}
|
|
}
|
|
return ResultUtil.ok(teExamService.paperDownload(param.getRecordId()));
|
|
return ResultUtil.ok(teExamService.paperDownload(param.getRecordId()));
|
|
@@ -359,16 +369,20 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "试卷下载成功通知")
|
|
@ApiOperation(value = "试卷下载成功通知")
|
|
@RequestMapping(value = "/paper/downloaded", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/paper/downloaded", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result paperDownloaded(@RequestBody ResultParamBean param) {
|
|
public Result paperDownloaded(@RequestBody ResultParamBean param) {
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
}
|
|
}
|
|
ExamRecordStatusEnum examRecordStatusEnum = ExamRecordCacheUtil.getStatus(param.getRecordId());
|
|
ExamRecordStatusEnum examRecordStatusEnum = ExamRecordCacheUtil.getStatus(param.getRecordId());
|
|
- if (Objects.nonNull(examRecordStatusEnum) && (!Objects.equals(ExamRecordStatusEnum.FIRST_PREPARE, examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.RESUME_PREPARE, examRecordStatusEnum))) {
|
|
|
|
|
|
+ if (Objects.nonNull(examRecordStatusEnum) && (
|
|
|
|
+ !Objects.equals(ExamRecordStatusEnum.FIRST_PREPARE, examRecordStatusEnum) && !Objects
|
|
|
|
+ .equals(ExamRecordStatusEnum.RESUME_PREPARE, examRecordStatusEnum))) {
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ERROR);
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ERROR);
|
|
}
|
|
}
|
|
- Integer paperDownload = Objects.isNull(ExamRecordCacheUtil.getPaperDownload(param.getRecordId())) ? 1 : ExamRecordCacheUtil.getPaperDownload(param.getRecordId());
|
|
|
|
|
|
+ Integer paperDownload = Objects.isNull(ExamRecordCacheUtil.getPaperDownload(param.getRecordId())) ?
|
|
|
|
+ 1 :
|
|
|
|
+ ExamRecordCacheUtil.getPaperDownload(param.getRecordId());
|
|
if (paperDownload.intValue() == 1) {
|
|
if (paperDownload.intValue() == 1) {
|
|
ExamRecordCacheUtil.setPaperDownload(param.getRecordId(), 0);
|
|
ExamRecordCacheUtil.setPaperDownload(param.getRecordId(), 0);
|
|
tOeExamRecordService.sendExamRecordDataSaveMq(param.getRecordId(), System.currentTimeMillis());
|
|
tOeExamRecordService.sendExamRecordDataSaveMq(param.getRecordId(), System.currentTimeMillis());
|
|
@@ -378,7 +392,7 @@ public class TEExamController {
|
|
|
|
|
|
@ApiOperation(value = "查询考试状态")
|
|
@ApiOperation(value = "查询考试状态")
|
|
@RequestMapping(value = "/status", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/status", method = RequestMethod.POST)
|
|
- @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
|
|
|
|
|
|
+ @ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result status(@RequestBody ResultParamBean param) {
|
|
public Result status(@RequestBody ResultParamBean param) {
|
|
if (Objects.isNull(param)) {
|
|
if (Objects.isNull(param)) {
|
|
throw new BusinessException(ExceptionResultEnum.PARAMS_ILLEGALITY);
|
|
throw new BusinessException(ExceptionResultEnum.PARAMS_ILLEGALITY);
|