|
@@ -3,6 +3,7 @@ package com.qmth.cqb.paper.service.impl;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.FileOutputStream;
|
|
import java.io.FileOutputStream;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -182,7 +183,7 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
|
|
}
|
|
}
|
|
//如果是普通类型的批量导出
|
|
//如果是普通类型的批量导出
|
|
if(exportModel.getExportWay()==ExportWay.BATCH){
|
|
if(exportModel.getExportWay()==ExportWay.BATCH){
|
|
- List<String> paperIds = checkAllCourseByExamId(exportModel.getExamId(),exportStructure.getExportType());
|
|
|
|
|
|
+ Map<String,String> paperIds = checkAllCourseByExamId(exportModel.getExamId(),exportStructure.getExportType());
|
|
if(exportStructure.getExportType()==ExportType.NORMAL){
|
|
if(exportStructure.getExportType()==ExportType.NORMAL){
|
|
if(paperIds.size()>0&&exportModel.getExportContentList().contains(ExamFileType.PAPER_STRUCTURE_OBJECTIVE.name())){
|
|
if(paperIds.size()>0&&exportModel.getExportContentList().contains(ExamFileType.PAPER_STRUCTURE_OBJECTIVE.name())){
|
|
makePaperStructure(exportStructure.getExamName(),paperIds,exportStructure);
|
|
makePaperStructure(exportStructure.getExamName(),paperIds,exportStructure);
|
|
@@ -291,8 +292,8 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
|
|
* 查询该考试下是否所有课程都制定了调卷规则
|
|
* 查询该考试下是否所有课程都制定了调卷规则
|
|
* @param examId
|
|
* @param examId
|
|
*/
|
|
*/
|
|
- private List<String> checkAllCourseByExamId(String examId,ExportType exportType) {
|
|
|
|
- List<String> paperIdList = new ArrayList<String>();
|
|
|
|
|
|
+ private Map<String,String> checkAllCourseByExamId(String examId,ExportType exportType) {
|
|
|
|
+ Map<String,String> paperIdMap = new HashMap<String,String>();
|
|
List<ExamCourseDto> examCourseDtoList = examCourseClient.findExamCourseByExamId(examId);
|
|
List<ExamCourseDto> examCourseDtoList = examCourseClient.findExamCourseByExamId(examId);
|
|
for(ExamCourseDto examCourseDto:examCourseDtoList){
|
|
for(ExamCourseDto examCourseDto:examCourseDtoList){
|
|
ExtractConfig condition = new ExtractConfig();
|
|
ExtractConfig condition = new ExtractConfig();
|
|
@@ -310,11 +311,12 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
|
|
Set<Entry<String,String>> entry = finishedPaperIdMap.entrySet();
|
|
Set<Entry<String,String>> entry = finishedPaperIdMap.entrySet();
|
|
Iterator<Entry<String,String>> iterator = entry.iterator();
|
|
Iterator<Entry<String,String>> iterator = entry.iterator();
|
|
while(iterator.hasNext()){
|
|
while(iterator.hasNext()){
|
|
- String paperId = iterator.next().getValue();
|
|
|
|
- paperIdList.add(paperId);
|
|
|
|
|
|
+ Entry<String,String> next = iterator.next();
|
|
|
|
+ //paperId为key,paperType为value
|
|
|
|
+ paperIdMap.put(next.getValue(),next.getKey());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return paperIdList;
|
|
|
|
|
|
+ return paperIdMap;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -358,12 +360,12 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
|
|
* @param exportStructure
|
|
* @param exportStructure
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
- private void makePaperStructure(String examName,List<String> paperIds,ExportStructure exportStructure) throws Exception{
|
|
|
|
|
|
+ private void makePaperStructure(String examName,Map<String,String> paperIds,ExportStructure exportStructure) throws Exception{
|
|
logger.info("正在批量生成试卷结构...");
|
|
logger.info("正在批量生成试卷结构...");
|
|
List<QuestionTypeNum> questionTypeNums = exportStructure.getQuestionTypeNums();
|
|
List<QuestionTypeNum> questionTypeNums = exportStructure.getQuestionTypeNums();
|
|
-
|
|
|
|
|
|
+ //客观题集合
|
|
List<ObjectiveQuestionStructure> objectiveQuestionStructureList = new ArrayList<ObjectiveQuestionStructure>();
|
|
List<ObjectiveQuestionStructure> objectiveQuestionStructureList = new ArrayList<ObjectiveQuestionStructure>();
|
|
-
|
|
|
|
|
|
+ //主观题集合
|
|
List<SubjectiveQuestionStructure> subjectiveQuestionStructureList = new ArrayList<SubjectiveQuestionStructure>();
|
|
List<SubjectiveQuestionStructure> subjectiveQuestionStructureList = new ArrayList<SubjectiveQuestionStructure>();
|
|
|
|
|
|
ExportServiceManage esm = exportServiceManageRepo.findByOrgName(exportStructure.getOrgName());
|
|
ExportServiceManage esm = exportServiceManageRepo.findByOrgName(exportStructure.getOrgName());
|
|
@@ -371,28 +373,39 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
|
|
esm = exportServiceManageRepo.findByOrgName("陕西师范大学");
|
|
esm = exportServiceManageRepo.findByOrgName("陕西师范大学");
|
|
}
|
|
}
|
|
ExportPaperAbstractService exportPaperAbstractService = (ExportPaperAbstractService) SpringContextUtils.getBeanById(esm.getExportServiceName());
|
|
ExportPaperAbstractService exportPaperAbstractService = (ExportPaperAbstractService) SpringContextUtils.getBeanById(esm.getExportServiceName());
|
|
- for(String paperId:paperIds){
|
|
|
|
|
|
+ Set<Entry<String,String>> entrySet = paperIds.entrySet();
|
|
|
|
+ Iterator<Entry<String,String>> iterator = entrySet.iterator();
|
|
|
|
+
|
|
|
|
+ while(iterator.hasNext()){
|
|
|
|
+ Entry<String,String> entry = iterator.next();
|
|
|
|
+ String paperId = entry.getKey();
|
|
|
|
+ String paperType = entry.getValue();
|
|
|
|
+ logger.info("初始化试卷:"+paperId);
|
|
PaperExp paperExp = initPaperExpService.initPaperExp(paperId);
|
|
PaperExp paperExp = initPaperExpService.initPaperExp(paperId);
|
|
- //添加主观题
|
|
|
|
|
|
+ logger.info("处理客观题...");
|
|
|
|
+ //添加客观题
|
|
List<PaperDetailExp> objectiveDetails = exportPaperAbstractService.getAllObjectiveDetails(paperExp);
|
|
List<PaperDetailExp> objectiveDetails = exportPaperAbstractService.getAllObjectiveDetails(paperExp);
|
|
//得到补齐后的客观题大题
|
|
//得到补齐后的客观题大题
|
|
List<PaperDetailExp> paperDetailExps = exportPaperAbstractService.fillObjectiveQuestions(objectiveDetails, questionTypeNums);
|
|
List<PaperDetailExp> paperDetailExps = exportPaperAbstractService.fillObjectiveQuestions(objectiveDetails, questionTypeNums);
|
|
List<ObjectiveQuestionStructure> objectiveList = new ArrayList<ObjectiveQuestionStructure>();
|
|
List<ObjectiveQuestionStructure> objectiveList = new ArrayList<ObjectiveQuestionStructure>();
|
|
for(PaperDetailExp paperDetailExp:paperDetailExps){
|
|
for(PaperDetailExp paperDetailExp:paperDetailExps){
|
|
for(PaperDetailUnitExp unit:paperDetailExp.getPaperDetailUnits()){
|
|
for(PaperDetailUnitExp unit:paperDetailExp.getPaperDetailUnits()){
|
|
- objectiveList.add(new ObjectiveQuestionStructure(paperExp,paperDetailExp,unit));
|
|
|
|
|
|
+ objectiveList.add(new ObjectiveQuestionStructure(paperExp,paperDetailExp,unit,paperType));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
objectiveQuestionStructureList.addAll(objectiveList);
|
|
objectiveQuestionStructureList.addAll(objectiveList);
|
|
|
|
+ logger.info("处理客观题完成");
|
|
//添加主观题
|
|
//添加主观题
|
|
|
|
+ logger.info("处理主观题...");
|
|
List<PaperDetailExp> subjectiveDetails = exportPaperAbstractService.getAllSubjectiveDetails(paperExp);
|
|
List<PaperDetailExp> subjectiveDetails = exportPaperAbstractService.getAllSubjectiveDetails(paperExp);
|
|
List<SubjectiveQuestionStructure> subjectiveList = new ArrayList<SubjectiveQuestionStructure>();
|
|
List<SubjectiveQuestionStructure> subjectiveList = new ArrayList<SubjectiveQuestionStructure>();
|
|
for(PaperDetailExp paperDetailExp:subjectiveDetails){
|
|
for(PaperDetailExp paperDetailExp:subjectiveDetails){
|
|
for(PaperDetailUnitExp unit:paperDetailExp.getPaperDetailUnits()){
|
|
for(PaperDetailUnitExp unit:paperDetailExp.getPaperDetailUnits()){
|
|
- subjectiveList.add(new SubjectiveQuestionStructure(paperExp,paperDetailExp,unit));
|
|
|
|
|
|
+ subjectiveList.add(new SubjectiveQuestionStructure(paperExp,paperDetailExp,unit,paperType));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
subjectiveQuestionStructureList.addAll(subjectiveList);
|
|
subjectiveQuestionStructureList.addAll(subjectiveList);
|
|
|
|
+ logger.info("处理主观题完成");
|
|
}
|
|
}
|
|
|
|
|
|
ExcelWriter objectiveExcelExporter = new ExcelWriter(ObjectiveQuestionStructure.class);
|
|
ExcelWriter objectiveExcelExporter = new ExcelWriter(ObjectiveQuestionStructure.class);
|