|
@@ -47,10 +47,10 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
Map<String,Object> dataMap = initExportPaper(paperId);
|
|
Map<String,Object> dataMap = initExportPaper(paperId);
|
|
List<String> fileList = new ArrayList<String>();
|
|
List<String> fileList = new ArrayList<String>();
|
|
if (dataMap.get("fileName") != null) {
|
|
if (dataMap.get("fileName") != null) {
|
|
- String paperfileName = (String) dataMap.get("fileName");
|
|
|
|
- String answerFileName = paperfileName+"__答案";
|
|
|
|
- DocxProcessUtil.exportPaper(dataMap, paperfileName,SXSF_TEMPLATE_PAPER);
|
|
|
|
- DocxProcessUtil.exportAnswer(dataMap,answerFileName,SXSF_TEMPLATE_ANSWER);
|
|
|
|
|
|
+ String paperfileName = (String) dataMap.get("fileName")+DOCX_SUFFIX;
|
|
|
|
+ String answerFileName = (String) dataMap.get("fileName")+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
|
|
|
|
+ DocxProcessUtil.exportWord(dataMap, paperfileName,SXSF_TEMPLATE_PAPER);
|
|
|
|
+ DocxProcessUtil.exportWord(dataMap,answerFileName,SXSF_TEMPLATE_ANSWER);
|
|
DocxProcessUtil.processImage(paperfileName,getPkgList(paperId));
|
|
DocxProcessUtil.processImage(paperfileName,getPkgList(paperId));
|
|
DocxProcessUtil.processImage(answerFileName,getPkgList(paperId));
|
|
DocxProcessUtil.processImage(answerFileName,getPkgList(paperId));
|
|
fileList.add(paperfileName);
|
|
fileList.add(paperfileName);
|
|
@@ -65,7 +65,6 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
if (dataMap.get("fileName") != null) {
|
|
if (dataMap.get("fileName") != null) {
|
|
String currNum = CommonUtils.getCurNum();
|
|
String currNum = CommonUtils.getCurNum();
|
|
ExportStructure exportStructure = (ExportStructure) exportStructureMap.get("exportStructure");
|
|
ExportStructure exportStructure = (ExportStructure) exportStructureMap.get("exportStructure");
|
|
-
|
|
|
|
List<QuestionTypeNum> questionTypeNums = new ArrayList<QuestionTypeNum>();
|
|
List<QuestionTypeNum> questionTypeNums = new ArrayList<QuestionTypeNum>();
|
|
if(exportStructure!=null){
|
|
if(exportStructure!=null){
|
|
questionTypeNums = exportStructure.getQuestionTypeNums();
|
|
questionTypeNums = exportStructure.getQuestionTypeNums();
|
|
@@ -96,12 +95,12 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
* @param accessUser
|
|
* @param accessUser
|
|
*/
|
|
*/
|
|
private void uploadPaperWord(Map<String,Object> dataMap,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum){
|
|
private void uploadPaperWord(Map<String,Object> dataMap,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum){
|
|
- String paperfileName = currNum+"_"+ExamFileType.PAPER.name();
|
|
|
|
|
|
+ String paperfileName = currNum+ExamFileType.PAPER.name()+DOCX_SUFFIX;
|
|
try {
|
|
try {
|
|
- DocxProcessUtil.exportPaper(dataMap, paperfileName,SXSF_TEMPLATE_PAPER);
|
|
|
|
|
|
+ DocxProcessUtil.exportWord(dataMap,paperfileName,SXSF_TEMPLATE_PAPER);
|
|
DocxProcessUtil.processImage(paperfileName,getPkgList(paperId));
|
|
DocxProcessUtil.processImage(paperfileName,getPkgList(paperId));
|
|
- File paperFile = new File(TEMP_FILE_EXP+paperfileName+DOCX_SUFFIX);
|
|
|
|
- String paperFilePath = uploadUrl+paperfileName+DOCX_SUFFIX;
|
|
|
|
|
|
+ File paperFile = new File(TEMP_FILE_EXP+paperfileName);
|
|
|
|
+ String paperFilePath = uploadUrl+paperfileName;
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
upyun.writeFile(paperFilePath, paperFile,true);
|
|
upyun.writeFile(paperFilePath, paperFile,true);
|
|
examFileService.saveExamFile(new ExamFile(extractConfig,paperFilePath,ExamFileType.PAPER,DOCX_SUFFIX),accessUser);
|
|
examFileService.saveExamFile(new ExamFile(extractConfig,paperFilePath,ExamFileType.PAPER,DOCX_SUFFIX),accessUser);
|
|
@@ -120,12 +119,12 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
* @param accessUser
|
|
* @param accessUser
|
|
*/
|
|
*/
|
|
private void uploadAnswerWord(Map<String,Object> dataMap,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum){
|
|
private void uploadAnswerWord(Map<String,Object> dataMap,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum){
|
|
- String answerFileName = currNum+"_"+ExamFileType.ANSWER.name();
|
|
|
|
|
|
+ String answerFileName = currNum+ExamFileType.ANSWER.name()+DOCX_SUFFIX;
|
|
try {
|
|
try {
|
|
- DocxProcessUtil.exportAnswer(dataMap,answerFileName,SXSF_TEMPLATE_ANSWER);
|
|
|
|
|
|
+ DocxProcessUtil.exportWord(dataMap,answerFileName,SXSF_TEMPLATE_ANSWER);
|
|
DocxProcessUtil.processImage(answerFileName,getPkgList(paperId));
|
|
DocxProcessUtil.processImage(answerFileName,getPkgList(paperId));
|
|
- File answerFile = new File(TEMP_FILE_EXP+answerFileName+DOCX_SUFFIX);
|
|
|
|
- String answerFilePath = uploadUrl+answerFileName+DOCX_SUFFIX;
|
|
|
|
|
|
+ File answerFile = new File(TEMP_FILE_EXP+answerFileName);
|
|
|
|
+ String answerFilePath = uploadUrl+answerFileName;
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
upyun.writeFile(answerFilePath, answerFile,true);
|
|
upyun.writeFile(answerFilePath, answerFile,true);
|
|
examFileService.saveExamFile(new ExamFile(extractConfig,answerFilePath,ExamFileType.ANSWER,DOCX_SUFFIX),accessUser);
|
|
examFileService.saveExamFile(new ExamFile(extractConfig,answerFilePath,ExamFileType.ANSWER,DOCX_SUFFIX),accessUser);
|
|
@@ -149,7 +148,7 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
private void exportObjectiveQuestionStructures(Map<String,Object> dataMap,ExtractConfig extractConfig,AccessUser accessUser,String currNum,List<QuestionTypeNum> questionTypeNums){
|
|
private void exportObjectiveQuestionStructures(Map<String,Object> dataMap,ExtractConfig extractConfig,AccessUser accessUser,String currNum,List<QuestionTypeNum> questionTypeNums){
|
|
- String objectiveFilename = currNum+"_"+ExamFileType.PAPER_STRUCTURE_OBJECTIVE.name();
|
|
|
|
|
|
+ String objectiveFilename = currNum+ExamFileType.PAPER_STRUCTURE_OBJECTIVE.name()+EXCEL_SUFFIX;
|
|
PaperExp paperExp = (PaperExp) dataMap.get("paper");
|
|
PaperExp paperExp = (PaperExp) dataMap.get("paper");
|
|
List<PaperDetailExp> objectiveDetails = paperExp.getObjectiveDetails();
|
|
List<PaperDetailExp> objectiveDetails = paperExp.getObjectiveDetails();
|
|
//根据试卷结构导出设置中的数量补齐客观题
|
|
//根据试卷结构导出设置中的数量补齐客观题
|
|
@@ -162,10 +161,10 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
}
|
|
}
|
|
ExcelWriter objectiveExcelExporter = new ExcelWriter(ObjectiveQuestionStructure.class);
|
|
ExcelWriter objectiveExcelExporter = new ExcelWriter(ObjectiveQuestionStructure.class);
|
|
try {
|
|
try {
|
|
- File file = new File(TEMP_FILE_EXP+objectiveFilename+".xlsx");
|
|
|
|
|
|
+ File file = new File(TEMP_FILE_EXP+objectiveFilename);
|
|
FileOutputStream out = new FileOutputStream(file);
|
|
FileOutputStream out = new FileOutputStream(file);
|
|
objectiveExcelExporter.write(objectiveFilename,objectiveQuestionStructureList,out);
|
|
objectiveExcelExporter.write(objectiveFilename,objectiveQuestionStructureList,out);
|
|
- String objectiveFilePath = uploadUrl+objectiveFilename+".xlsx";
|
|
|
|
|
|
+ String objectiveFilePath = uploadUrl+objectiveFilename;
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
upyun.writeFile(objectiveFilePath,file,true);
|
|
upyun.writeFile(objectiveFilePath,file,true);
|
|
examFileService.saveExamFile(new ExamFile(extractConfig,objectiveFilePath,ExamFileType.PAPER_STRUCTURE_OBJECTIVE,EXCEL_SUFFIX),accessUser);
|
|
examFileService.saveExamFile(new ExamFile(extractConfig,objectiveFilePath,ExamFileType.PAPER_STRUCTURE_OBJECTIVE,EXCEL_SUFFIX),accessUser);
|
|
@@ -228,7 +227,7 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
if(paperDetailExp.getUnitCount()>typeNum.getQuantity()){
|
|
if(paperDetailExp.getUnitCount()>typeNum.getQuantity()){
|
|
throw new RuntimeException("试卷:"+paperExp.getName()
|
|
throw new RuntimeException("试卷:"+paperExp.getName()
|
|
+"中"+quesStructType.getName()+"的数量:"+paperDetailExp.getUnitCount()
|
|
+"中"+quesStructType.getName()+"的数量:"+paperDetailExp.getUnitCount()
|
|
- + ",大于试卷结构导出设置的数量:"+typeNum.getQuantity()+",不符合导出规则");
|
|
|
|
|
|
+ + ",大于试卷结构导出设置的数量:"+typeNum.getQuantity()+",不符合试卷结构导出规则");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -241,7 +240,7 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
private void exportSubjectiveQuestionStructures(Map<String,Object> dataMap,ExtractConfig extractConfig,AccessUser accessUser,String currNum){
|
|
private void exportSubjectiveQuestionStructures(Map<String,Object> dataMap,ExtractConfig extractConfig,AccessUser accessUser,String currNum){
|
|
- String subjectiveFileName = currNum+"_"+ExamFileType.PAPER_STRUCTURE_SUBJECTIVE.name();
|
|
|
|
|
|
+ String subjectiveFileName = currNum+ExamFileType.PAPER_STRUCTURE_SUBJECTIVE.name()+EXCEL_SUFFIX;
|
|
PaperExp paperExp = (PaperExp) dataMap.get("paper");
|
|
PaperExp paperExp = (PaperExp) dataMap.get("paper");
|
|
List<PaperDetailExp> subjectiveDetails = paperExp.getSubjectiveDetails();
|
|
List<PaperDetailExp> subjectiveDetails = paperExp.getSubjectiveDetails();
|
|
List<SubjectiveQuestionStructure> subjectiveQuestionStructureList = new ArrayList<SubjectiveQuestionStructure>();
|
|
List<SubjectiveQuestionStructure> subjectiveQuestionStructureList = new ArrayList<SubjectiveQuestionStructure>();
|
|
@@ -252,10 +251,10 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
}
|
|
}
|
|
ExcelWriter subjectiveExcelExporter = new ExcelWriter(SubjectiveQuestionStructure.class);
|
|
ExcelWriter subjectiveExcelExporter = new ExcelWriter(SubjectiveQuestionStructure.class);
|
|
try {
|
|
try {
|
|
- File file = new File(TEMP_FILE_EXP+subjectiveFileName+EXCEL_SUFFIX);
|
|
|
|
|
|
+ File file = new File(TEMP_FILE_EXP+subjectiveFileName);
|
|
FileOutputStream out = new FileOutputStream(file);
|
|
FileOutputStream out = new FileOutputStream(file);
|
|
subjectiveExcelExporter.write(subjectiveFileName,subjectiveQuestionStructureList,out);
|
|
subjectiveExcelExporter.write(subjectiveFileName,subjectiveQuestionStructureList,out);
|
|
- String subjectiveFilePath = uploadUrl+subjectiveFileName+EXCEL_SUFFIX;
|
|
|
|
|
|
+ String subjectiveFilePath = uploadUrl+subjectiveFileName;
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
upyun.writeFile(subjectiveFilePath,file,true);
|
|
upyun.writeFile(subjectiveFilePath,file,true);
|
|
examFileService.saveExamFile(new ExamFile(extractConfig,subjectiveFilePath,ExamFileType.PAPER_STRUCTURE_SUBJECTIVE,EXCEL_SUFFIX),accessUser);
|
|
examFileService.saveExamFile(new ExamFile(extractConfig,subjectiveFilePath,ExamFileType.PAPER_STRUCTURE_SUBJECTIVE,EXCEL_SUFFIX),accessUser);
|