mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 11:56:50 +08:00
考试重复提交判断-测试
This commit is contained in:
@@ -54,6 +54,11 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
|||||||
@Transactional
|
@Transactional
|
||||||
public String save(StudyExam exam) {
|
public String save(StudyExam exam) {
|
||||||
String key = exam.getStudyId() + "_" + exam.getContentId();
|
String key = exam.getStudyId() + "_" + exam.getContentId();
|
||||||
|
try {
|
||||||
|
Thread.sleep(3000L);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
//判断是否存在redis
|
//判断是否存在redis
|
||||||
if(StringUtils.isNotEmpty(redisTemplate.opsForValue().get(key))){
|
if(StringUtils.isNotEmpty(redisTemplate.opsForValue().get(key))){
|
||||||
log.info("------------试卷提交验证中,请等待! ");
|
log.info("------------试卷提交验证中,请等待! ");
|
||||||
@@ -63,7 +68,7 @@ public class StudyExamServiceImpl implements IStudyExamService{
|
|||||||
redisTemplate.opsForValue().set(key,key);
|
redisTemplate.opsForValue().set(key,key);
|
||||||
//设置过期时间为1天
|
//设置过期时间为1天
|
||||||
redisTemplate.expire(key, 2, TimeUnit.SECONDS);
|
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());
|
CourseExam cexam=cexamDao.get(exam.getTestId());
|
||||||
|
|||||||
Reference in New Issue
Block a user