考试重复提交判断-测试

This commit is contained in:
670788339
2024-05-09 16:26:09 +08:00
parent f5aaf51bac
commit 1130c4b2be

View File

@@ -54,6 +54,11 @@ public class StudyExamServiceImpl implements IStudyExamService{
@Transactional
public String save(StudyExam exam) {
String key = exam.getStudyId() + "_" + exam.getContentId();
try {
Thread.sleep(3000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
//判断是否存在redis
if(StringUtils.isNotEmpty(redisTemplate.opsForValue().get(key))){
log.info("------------试卷提交验证中,请等待! ");
@@ -63,7 +68,7 @@ public class StudyExamServiceImpl implements IStudyExamService{
redisTemplate.opsForValue().set(key,key);
//设置过期时间为1天
redisTemplate.expire(key, 2, TimeUnit.SECONDS);
log.info("------------设置redis-key ,请等待! " + LocalDateTime.now());
log.info("------------设置redis-key ,请等待! " + LocalDateTime.now() + ", key = " + redisTemplate.opsForValue().get(key));
//用于计算考试成绩
CourseExam cexam=cexamDao.get(exam.getTestId());