|
@@ -1,32 +1,5 @@
|
|
package cn.com.qmth.examcloud.core.questions.service;
|
|
package cn.com.qmth.examcloud.core.questions.service;
|
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Collection;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
-
|
|
|
|
-import org.apache.commons.collections.CollectionUtils;
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
-import org.bson.types.ObjectId;
|
|
|
|
-import org.slf4j.Logger;
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
|
-import org.springframework.data.domain.PageImpl;
|
|
|
|
-import org.springframework.data.domain.PageRequest;
|
|
|
|
-import org.springframework.data.domain.Sort;
|
|
|
|
-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 com.google.common.cache.Cache;
|
|
|
|
-import com.google.common.cache.CacheBuilder;
|
|
|
|
-
|
|
|
|
import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
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.api.commons.security.bean.UserDataRule;
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
@@ -39,17 +12,34 @@ 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.base.question.enums.QuesStructType;
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperStructRepo;
|
|
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.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.*;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.dto.CoursePropertyNumberDto;
|
|
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.dao.entity.dto.PaperDetailUnitStructDto;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.dto.QuesNameDto;
|
|
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.core.questions.service.cache.PaperStructCache;
|
|
import cn.com.qmth.examcloud.support.CacheConstants;
|
|
import cn.com.qmth.examcloud.support.CacheConstants;
|
|
import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
|
|
+import com.google.common.cache.Cache;
|
|
|
|
+import com.google.common.cache.CacheBuilder;
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.bson.types.ObjectId;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
|
+import org.springframework.data.domain.PageImpl;
|
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
|
+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 java.math.BigDecimal;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by songyue on 16/12/28.
|
|
* Created by songyue on 16/12/28.
|
|
@@ -519,6 +509,7 @@ public class PaperStructService {
|
|
// 从redis缓存中获取
|
|
// 从redis缓存中获取
|
|
ps = redisClient.get(key, PaperStructCache.class, cacheTimeOut);
|
|
ps = redisClient.get(key, PaperStructCache.class, cacheTimeOut);
|
|
if (ps != null) {
|
|
if (ps != null) {
|
|
|
|
+ localPaperStructCache.put(key, ps);
|
|
log.warn("从【Redis缓存】中获取抽卷模板! key:{}", key);
|
|
log.warn("从【Redis缓存】中获取抽卷模板! key:{}", key);
|
|
return ps;
|
|
return ps;
|
|
}
|
|
}
|
|
@@ -526,7 +517,7 @@ public class PaperStructService {
|
|
// 从数据库中获取
|
|
// 从数据库中获取
|
|
Query query = new Query();
|
|
Query query = new Query();
|
|
query.addCriteria(Criteria.where("_id").is(new ObjectId(paperStructId)));
|
|
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) {
|
|
if (ps == null) {
|
|
throw new StatusException("未找到试卷结构:" + paperStructId);
|
|
throw new StatusException("未找到试卷结构:" + paperStructId);
|
|
}
|
|
}
|