xiatian 4 жил өмнө
parent
commit
fb25be2e12

+ 15 - 42
themis-exam/src/main/java/com/qmth/themis/exam/api/TEExamController.java

@@ -135,23 +135,14 @@ public class TEExamController {
     @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
     public Result studentPaperStruct(@RequestBody StudentPaperStructParamBean param) {
         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.getContent() == null) {
-                throw new BusinessException("试卷结构json字符串不能为空");
-            }
-            return ResultUtil
-                    .ok(teExamService.studentPaperStruct(teStudent.getId(), param.getRecordId(), param.getContent()));
-        } finally {
-            redisUtil.releaseLock(lockKey);
+        if (param.getContent() == null) {
+            throw new BusinessException("试卷结构json字符串不能为空");
         }
+        return ResultUtil
+                .ok(teExamService.studentPaperStruct(teStudent.getId(), param.getRecordId(), param.getContent()));
     }
 
     @ApiOperation(value = "提交作答结果")
@@ -185,25 +176,16 @@ public class TEExamController {
     @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
     public Result audioLeftPlayCountSubmit(@RequestBody AudioLeftPlayCountSubmitParamBean param) {
         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.getKey() == null) {
-                throw new BusinessException("音频标识不能为空");
-            }
-            if (param.getCount() == null) {
-                throw new BusinessException("剩余播放次数不能为空");
-            }
-            return ResultUtil.ok(teExamService.audioLeftPlayCountSubmit(teStudent.getId(), param.getRecordId(), param.getKey(), param.getCount()));
-        } finally {
-            redisUtil.releaseLock(lockKey);
+        if (param.getKey() == null) {
+            throw new BusinessException("音频标识不能为空");
+        }
+        if (param.getCount() == null) {
+            throw new BusinessException("剩余播放次数不能为空");
         }
+        return ResultUtil.ok(teExamService.audioLeftPlayCountSubmit(teStudent.getId(), param.getRecordId(), param.getKey(), param.getCount()));
     }
 
     @ApiOperation(value = "文件上传")
@@ -214,16 +196,7 @@ public class TEExamController {
                              @ApiParam(value = "后缀名", required = true) @RequestParam String suffix,
                              @ApiParam(value = "md5", required = true) @RequestParam String md5) {
         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);
-        }
-        try {
-            return ResultUtil.ok(teExamService.fileUpload(teStudent.getId(), recordId, file, suffix, md5));
-        } finally {
-            redisUtil.releaseLock(lockKey);
-        }
+        return ResultUtil.ok(teExamService.fileUpload(teStudent.getId(), recordId, file, suffix, md5));
     }
 
     @ApiOperation(value = "断点恢复")