|
@@ -14,6 +14,8 @@ import javax.annotation.Resource;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.bson.types.ObjectId;
|
|
import org.bson.types.ObjectId;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.PageImpl;
|
|
import org.springframework.data.domain.PageImpl;
|
|
@@ -82,6 +84,7 @@ import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class RandomPaperServiceImpl implements RandomPaperService {
|
|
public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(RandomPaperService.class);
|
|
private static int cacheTimeOut = 2 * 60 * 60;
|
|
private static int cacheTimeOut = 2 * 60 * 60;
|
|
@Autowired
|
|
@Autowired
|
|
private MongoTemplate mongoTemplate;
|
|
private MongoTemplate mongoTemplate;
|
|
@@ -906,8 +909,14 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public DefaultPaper getRandomPaper(String randomPaperId, Integer playTime) {
|
|
public DefaultPaper getRandomPaper(String randomPaperId, Integer playTime) {
|
|
|
|
+ log.warn("开始抽卷");
|
|
|
|
+ long d1=System.currentTimeMillis();
|
|
RandomPaperCache rp = getByCache(randomPaperId);
|
|
RandomPaperCache rp = getByCache(randomPaperId);
|
|
|
|
+ long d2=System.currentTimeMillis();
|
|
|
|
+ log.warn("获取抽卷模板耗时(ms):"+(d2-d1));
|
|
PaperStruct ps = paperStructService.getByCache(rp.getPaperStructId());
|
|
PaperStruct ps = paperStructService.getByCache(rp.getPaperStructId());
|
|
|
|
+ long d3=System.currentTimeMillis();
|
|
|
|
+ log.warn("获取组卷结构耗时(ms):"+(d3-d2));
|
|
CreateDefaultPaperParam param = new CreateDefaultPaperParam();
|
|
CreateDefaultPaperParam param = new CreateDefaultPaperParam();
|
|
param.setFullyObjective(true);
|
|
param.setFullyObjective(true);
|
|
param.setRp(rp);
|
|
param.setRp(rp);
|
|
@@ -920,6 +929,7 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
if (CollectionUtils.isNotEmpty(ps.getPaperDetailStructs())) {
|
|
if (CollectionUtils.isNotEmpty(ps.getPaperDetailStructs())) {
|
|
int detailNumber = 0;
|
|
int detailNumber = 0;
|
|
for (PaperDetailStruct ds : ps.getPaperDetailStructs()) {
|
|
for (PaperDetailStruct ds : ps.getPaperDetailStructs()) {
|
|
|
|
+ long f1=System.currentTimeMillis();
|
|
DefaultQuestionGroup detail = new DefaultQuestionGroup();
|
|
DefaultQuestionGroup detail = new DefaultQuestionGroup();
|
|
details.add(detail);
|
|
details.add(detail);
|
|
detail.setGroupName(ds.getName());
|
|
detail.setGroupName(ds.getName());
|
|
@@ -935,12 +945,17 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
createUnitByBlueProp(param);
|
|
createUnitByBlueProp(param);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ long f2=System.currentTimeMillis();
|
|
|
|
+ log.warn("蓝图抽卷一个大题耗时(ms):"+(f2-f1));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ long d4=System.currentTimeMillis();
|
|
|
|
+ log.warn("蓝图抽卷耗时(ms):"+(d4-d3));
|
|
} else if (PaperStructType.EXACT.equals(ps.getPaperStrucType())) {
|
|
} else if (PaperStructType.EXACT.equals(ps.getPaperStrucType())) {
|
|
if (CollectionUtils.isNotEmpty(ps.getPaperDetailStructs())) {
|
|
if (CollectionUtils.isNotEmpty(ps.getPaperDetailStructs())) {
|
|
int detailNumber = 0;
|
|
int detailNumber = 0;
|
|
for (PaperDetailStruct ds : ps.getPaperDetailStructs()) {
|
|
for (PaperDetailStruct ds : ps.getPaperDetailStructs()) {
|
|
|
|
+ long f1=System.currentTimeMillis();
|
|
DefaultQuestionGroup detail = new DefaultQuestionGroup();
|
|
DefaultQuestionGroup detail = new DefaultQuestionGroup();
|
|
details.add(detail);
|
|
details.add(detail);
|
|
detail.setGroupName(ds.getName());
|
|
detail.setGroupName(ds.getName());
|
|
@@ -957,10 +972,15 @@ public class RandomPaperServiceImpl implements RandomPaperService {
|
|
param.setUs(us);
|
|
param.setUs(us);
|
|
createUnitByExact(param);
|
|
createUnitByExact(param);
|
|
}
|
|
}
|
|
|
|
+ long f2=System.currentTimeMillis();
|
|
|
|
+ log.warn("精确抽卷一个大题耗时(ms):"+(f2-f1));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ long d4=System.currentTimeMillis();
|
|
|
|
+ log.warn("精确抽卷耗时(ms):"+(d4-d3));
|
|
}
|
|
}
|
|
paper.setFullyObjective(param.getFullyObjective());
|
|
paper.setFullyObjective(param.getFullyObjective());
|
|
|
|
+ log.warn("结束抽卷");
|
|
return paper;
|
|
return paper;
|
|
}
|
|
}
|
|
|
|
|