|
@@ -163,37 +163,28 @@ public class TEExamController {
|
|
@ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
@ApiResponses({ @ApiResponse(code = 200, message = "试卷信息") })
|
|
public Result answerSubmit(@RequestBody AnswerSubmitParamBean param) {
|
|
public Result answerSubmit(@RequestBody AnswerSubmitParamBean param) {
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
|
|
- String lockKey = SystemConstant.REDIS_LOCK_STUDENT_PREFIX + teStudent.getId();
|
|
|
|
- Boolean lock = redisUtil.lock(lockKey, SystemConstant.REDIS_CACHE_TIME_OUT);
|
|
|
|
- if (!lock) {
|
|
|
|
- throw new BusinessException(ExceptionResultEnum.REQUEST_AWAIT);
|
|
|
|
|
|
+ if (param.getRecordId() == null) {
|
|
|
|
+ throw new BusinessException("考试记录id不能为空");
|
|
}
|
|
}
|
|
- try {
|
|
|
|
- if (param.getRecordId() == null) {
|
|
|
|
- throw new BusinessException("考试记录id不能为空");
|
|
|
|
- }
|
|
|
|
- if (param.getMainNumber() == null) {
|
|
|
|
- throw new BusinessException("大题号不能为空");
|
|
|
|
- }
|
|
|
|
- if (param.getSubNumber() == null) {
|
|
|
|
- throw new BusinessException("小题号不能为空");
|
|
|
|
- }
|
|
|
|
- if (param.getAnswer() == null) {
|
|
|
|
- throw new BusinessException("答案json字符串不能为空");
|
|
|
|
- }
|
|
|
|
- if (param.getVersion() == null) {
|
|
|
|
- throw new BusinessException("时间戳不能为空");
|
|
|
|
- }
|
|
|
|
- AnswerSubmitBean ret = teExamService.answerSubmit(teStudent.getId(), param.getRecordId(), param.getMainNumber(),
|
|
|
|
- param.getSubNumber(), param.getSubIndex(), param.getAnswer(), param.getVersion(),
|
|
|
|
- param.getDurationSeconds());
|
|
|
|
- // 发消息计算客观分
|
|
|
|
- calculateObjectiveScore(param.getRecordId(), param.getMainNumber(), param.getSubNumber(),
|
|
|
|
- param.getSubIndex());
|
|
|
|
- return ResultUtil.ok(ret);
|
|
|
|
- } finally {
|
|
|
|
- redisUtil.releaseLock(lockKey);
|
|
|
|
|
|
+ if (param.getMainNumber() == null) {
|
|
|
|
+ throw new BusinessException("大题号不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (param.getSubNumber() == null) {
|
|
|
|
+ throw new BusinessException("小题号不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (param.getAnswer() == null) {
|
|
|
|
+ throw new BusinessException("答案json字符串不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (param.getVersion() == null) {
|
|
|
|
+ throw new BusinessException("时间戳不能为空");
|
|
}
|
|
}
|
|
|
|
+ AnswerSubmitBean ret = teExamService.answerSubmit(teStudent.getId(), param.getRecordId(), param.getMainNumber(),
|
|
|
|
+ param.getSubNumber(), param.getSubIndex(), param.getAnswer(), param.getVersion(),
|
|
|
|
+ param.getDurationSeconds());
|
|
|
|
+ // 发消息计算客观分
|
|
|
|
+ calculateObjectiveScore(param.getRecordId(), param.getMainNumber(), param.getSubNumber(),
|
|
|
|
+ param.getSubIndex());
|
|
|
|
+ return ResultUtil.ok(ret);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更新音频剩余播放次数")
|
|
@ApiOperation(value = "更新音频剩余播放次数")
|