|
@@ -59,6 +59,7 @@ import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
import static cn.com.qmth.examcloud.core.questions.service.cache.Constants.CACHE_KEY_PAPER;
|
|
import static cn.com.qmth.examcloud.core.questions.service.cache.Constants.CACHE_KEY_PAPER;
|
|
|
|
+import static cn.com.qmth.examcloud.core.questions.service.cache.Constants.CACHE_KEY_QUESTION;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author chenken
|
|
* @author chenken
|
|
@@ -1160,6 +1161,9 @@ public class PaperServiceImpl implements PaperService {
|
|
question = paperDetailUnitRepo.findByPaperAndNumber(paper, Integer.valueOf(numbers[0])).getQuestion();
|
|
question = paperDetailUnitRepo.findByPaperAndNumber(paper, Integer.valueOf(numbers[0])).getQuestion();
|
|
uploadAudioFile(paperId, question.getId(), file, user);
|
|
uploadAudioFile(paperId, question.getId(), file, user);
|
|
appendAudioTag(file.getOriginalFilename(), question.getId());
|
|
appendAudioTag(file.getOriginalFilename(), question.getId());
|
|
|
|
+
|
|
|
|
+ //清除缓存
|
|
|
|
+ this.clearQuestionCache(question.getId());
|
|
}
|
|
}
|
|
//删除服务器文件夹
|
|
//删除服务器文件夹
|
|
String mp3DirectoryPath = TEMP_FILE_EXP + File.separator + paperId;
|
|
String mp3DirectoryPath = TEMP_FILE_EXP + File.separator + paperId;
|
|
@@ -1756,4 +1760,13 @@ public class PaperServiceImpl implements PaperService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void clearQuestionCache(String questionId) {
|
|
|
|
+ //清理与当前试题相关的缓存
|
|
|
|
+ final String patternKey = CACHE_KEY_QUESTION + "*" + questionId;
|
|
|
|
+ Set<String> keys = redisTemplate.keys(patternKey);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(keys)) {
|
|
|
|
+ redisTemplate.delete(keys);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|