|
@@ -1,8 +1,5 @@
|
|
|
package cn.com.qmth.examcloud.core.questions.service.impl;
|
|
|
|
|
|
-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;
|
|
|
-
|
|
|
import java.io.BufferedInputStream;
|
|
|
import java.io.File;
|
|
|
import java.io.FileNotFoundException;
|
|
@@ -38,7 +35,6 @@ import org.springframework.data.domain.Sort.Order;
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
import org.springframework.data.mongodb.core.query.Query;
|
|
|
-import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.Assert;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -64,7 +60,6 @@ import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
|
|
|
import cn.com.qmth.examcloud.core.questions.base.exception.PaperException;
|
|
|
import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.ExamPaperRepo;
|
|
|
-import cn.com.qmth.examcloud.core.questions.dao.ExportServiceManageRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperDetailRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperDetailUnitRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperRepo;
|
|
@@ -72,7 +67,6 @@ import cn.com.qmth.examcloud.core.questions.dao.QuesBakRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.QuesRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Course;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.ExamPaper;
|
|
|
-import cn.com.qmth.examcloud.core.questions.dao.entity.ExportServiceManage;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetail;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailUnit;
|
|
@@ -93,6 +87,10 @@ import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperDetailUnitExp;
|
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperExp;
|
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperQuestionStructureInfo;
|
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.SubjectiveQuestionStructure;
|
|
|
+import cn.com.qmth.examcloud.core.questions.service.cache.BasePaperCache;
|
|
|
+import cn.com.qmth.examcloud.core.questions.service.cache.ExtractConfigPaperCache;
|
|
|
+import cn.com.qmth.examcloud.core.questions.service.cache.QuestionAnswerCache;
|
|
|
+import cn.com.qmth.examcloud.core.questions.service.cache.QuestionCache;
|
|
|
import cn.com.qmth.examcloud.core.questions.service.config.SysProperty;
|
|
|
import cn.com.qmth.examcloud.core.questions.service.export.ExportPaperAbstractService;
|
|
|
import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
|
|
@@ -149,20 +147,23 @@ public class PaperServiceImpl implements PaperService {
|
|
|
@Autowired
|
|
|
private QuestionAudioServiceImpl questionAudioService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ExportServiceManageRepo exportServiceManageRepo;
|
|
|
-
|
|
|
@Autowired
|
|
|
private SysProperty sysProperty;
|
|
|
|
|
|
- @Autowired
|
|
|
- private RedisTemplate<String, Object> redisTemplate;
|
|
|
-
|
|
|
@Autowired
|
|
|
private CoursePaperCloudService coursePaperCloudService;
|
|
|
|
|
|
@Autowired
|
|
|
private CourseService courseService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExtractConfigPaperCache extractConfigPaperCache;
|
|
|
+ @Autowired
|
|
|
+ private BasePaperCache basePaperCache;
|
|
|
+ @Autowired
|
|
|
+ private QuestionCache questionCache;
|
|
|
+ @Autowired
|
|
|
+ private QuestionAnswerCache questionAnswerCache;
|
|
|
|
|
|
private Random random = new Random();
|
|
|
|
|
@@ -1450,8 +1451,7 @@ public class PaperServiceImpl implements PaperService {
|
|
|
@Override
|
|
|
public String findQuestionStructure(String paperId) throws Exception {
|
|
|
//根据paperId查询新的对象
|
|
|
- ExportServiceManage esm = exportServiceManageRepo.findByOrgName("陕西师范大学");
|
|
|
- ExportPaperAbstractService exportPaperAbstractService = (ExportPaperAbstractService) SpringContextUtils.getBeanById(esm.getExportServiceName());
|
|
|
+ ExportPaperAbstractService exportPaperAbstractService = (ExportPaperAbstractService) SpringContextUtils.getBeanById("sxsfExportPaperService");
|
|
|
PaperExp paperExp = exportPaperAbstractService.initPaperExp(paperId);
|
|
|
log.info("已经获取试卷");
|
|
|
//得到试卷中的客观大题
|
|
@@ -1849,20 +1849,24 @@ public class PaperServiceImpl implements PaperService {
|
|
|
|
|
|
private void clearPaperCache(String paperId) {
|
|
|
//清理与当前试卷相关的缓存
|
|
|
- final String patternKey = CACHE_KEY_PAPER + "*" + paperId;
|
|
|
- Set<String> keys = redisTemplate.keys(patternKey);
|
|
|
- if (CollectionUtils.isNotEmpty(keys)) {
|
|
|
- redisTemplate.delete(keys);
|
|
|
- }
|
|
|
+// final String patternKey = CACHE_KEY_PAPER + "*" + paperId;
|
|
|
+// Set<String> keys = redisTemplate.keys(patternKey);
|
|
|
+// if (CollectionUtils.isNotEmpty(keys)) {
|
|
|
+// redisTemplate.delete(keys);
|
|
|
+// }
|
|
|
+ extractConfigPaperCache.remove(paperId);
|
|
|
+ basePaperCache.remove(paperId);
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
- }
|
|
|
+// final String patternKey = CACHE_KEY_QUESTION + "*" + questionId;
|
|
|
+// Set<String> keys = redisTemplate.keys(patternKey);
|
|
|
+// if (CollectionUtils.isNotEmpty(keys)) {
|
|
|
+// redisTemplate.delete(keys);
|
|
|
+// }
|
|
|
+ questionCache.remove(questionId);
|
|
|
+ questionAnswerCache.remove(questionId);
|
|
|
}
|
|
|
|
|
|
}
|