xiatian 1 год назад
Родитель
Сommit
92884c2b37

+ 20 - 20
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/PaperStructService.java

@@ -8,6 +8,24 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
+import cn.com.qmth.examcloud.api.commons.security.bean.User;
+import cn.com.qmth.examcloud.api.commons.security.bean.UserDataRule;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
+import cn.com.qmth.examcloud.core.basic.api.request.GetCourseReq;
+import cn.com.qmth.examcloud.core.basic.api.response.GetCourseResp;
+import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
+import cn.com.qmth.examcloud.core.questions.base.Model;
+import cn.com.qmth.examcloud.core.questions.base.enums.PaperStructType;
+import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
+import cn.com.qmth.examcloud.core.questions.dao.PaperStructRepo;
+import cn.com.qmth.examcloud.core.questions.dao.QuesTypeNameRepo;
+import cn.com.qmth.examcloud.core.questions.dao.entity.dto.CoursePropertyNumberDto;
+import cn.com.qmth.examcloud.core.questions.dao.entity.dto.PaperDetailUnitStructDto;
+import cn.com.qmth.examcloud.core.questions.service.bean.dto.QuesNameDto;
+import cn.com.qmth.examcloud.core.questions.service.cache.PaperStructCache;
+import cn.com.qmth.examcloud.support.CacheConstants;
+import cn.com.qmth.examcloud.web.redis.RedisClient;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.bson.types.ObjectId;
@@ -22,30 +40,11 @@ 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.stereotype.Service;
-
-import cn.com.qmth.examcloud.api.commons.security.bean.User;
-import cn.com.qmth.examcloud.api.commons.security.bean.UserDataRule;
-import cn.com.qmth.examcloud.commons.exception.StatusException;
-import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
-import cn.com.qmth.examcloud.core.basic.api.request.GetCourseReq;
-import cn.com.qmth.examcloud.core.basic.api.response.GetCourseResp;
-import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
-import cn.com.qmth.examcloud.core.questions.base.Model;
-import cn.com.qmth.examcloud.core.questions.base.enums.PaperStructType;
-import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
-import cn.com.qmth.examcloud.core.questions.dao.PaperStructRepo;
-import cn.com.qmth.examcloud.core.questions.dao.QuesTypeNameRepo;
 import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailStruct;
 import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailUnitStruct;
 import cn.com.qmth.examcloud.core.questions.dao.entity.PaperStruct;
 import cn.com.qmth.examcloud.core.questions.dao.entity.PaperStructSearchInfo;
 import cn.com.qmth.examcloud.core.questions.dao.entity.QuesTypeName;
-import cn.com.qmth.examcloud.core.questions.dao.entity.dto.CoursePropertyNumberDto;
-import cn.com.qmth.examcloud.core.questions.dao.entity.dto.PaperDetailUnitStructDto;
-import cn.com.qmth.examcloud.core.questions.service.bean.dto.QuesNameDto;
-import cn.com.qmth.examcloud.core.questions.service.cache.PaperStructCache;
-import cn.com.qmth.examcloud.support.CacheConstants;
-import cn.com.qmth.examcloud.web.redis.RedisClient;
 
 /**
  * Created by songyue on 16/12/28.
@@ -515,6 +514,7 @@ public class PaperStructService {
         // 从redis缓存中获取
         PaperStructCache ps = redisClient.get(key, PaperStructCache.class, cacheTimeOut);
         if (ps != null) {
+//            localPaperStructCache.put(key, ps);
             log.warn("从【Redis缓存】中获取抽卷模板! key:{}", key);
             return ps;
         }
@@ -522,7 +522,7 @@ public class PaperStructService {
         // 从数据库中获取
         Query query = new Query();
         query.addCriteria(Criteria.where("_id").is(new ObjectId(paperStructId)));
-        ps = this.mongoTemplate.findOne(query,PaperStructCache.class,"paperStruct");
+        ps = this.mongoTemplate.findOne(query, PaperStructCache.class, "paperStruct");
         if (ps == null) {
             throw new StatusException("未找到试卷结构:" + paperStructId);
         }

+ 1 - 0
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/RandomPaperServiceImpl.java

@@ -1179,6 +1179,7 @@ public class RandomPaperServiceImpl implements RandomPaperService {
         if (rp != null) {
         	String questionKey = CacheConstants.CACHE_Q_RANDOM_PAPER_QUESTION + randomPaperId;
         	redisClient.expire(questionKey, cacheTimeOut);
+//            localRandomPaperCache.put(key, rp);
             log.warn("从【Redis缓存】中获取抽卷模板! key:{}", key);
             return rp;
         }