|
@@ -96,16 +96,15 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
|
* @param accessUser
|
|
|
*/
|
|
|
private void uploadPaperWord(Map<String,Object> dataMap,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum){
|
|
|
- String paperfileName = extractConfig.getCourseName()+"_"+extractConfig.getCourseCode()+"_"+currNum+"_试卷";
|
|
|
+ String paperfileName = currNum+"_"+ExamFileType.PAPER.name();
|
|
|
try {
|
|
|
DocxProcessUtil.exportPaper(dataMap, paperfileName,SXSF_TEMPLATE_PAPER);
|
|
|
DocxProcessUtil.processImage(paperfileName,getPkgList(paperId));
|
|
|
File paperFile = new File(TEMP_FILE_EXP+paperfileName+DOCX_SUFFIX);
|
|
|
String paperFilePath = uploadUrl+paperfileName+DOCX_SUFFIX;
|
|
|
- //上传至又拍云
|
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
|
upyun.writeFile(paperFilePath, paperFile,true);
|
|
|
- examFileService.saveExamFile(new ExamFile(extractConfig,paperfileName+DOCX_SUFFIX,paperFilePath,ExamFileType.PAPER),accessUser);
|
|
|
+ examFileService.saveExamFile(new ExamFile(extractConfig,paperFilePath,ExamFileType.PAPER,DOCX_SUFFIX),accessUser);
|
|
|
paperFile.delete();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -121,16 +120,15 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
|
* @param accessUser
|
|
|
*/
|
|
|
private void uploadAnswerWord(Map<String,Object> dataMap,ExtractConfig extractConfig,String paperId,AccessUser accessUser,String currNum){
|
|
|
- String answerFileName = extractConfig.getCourseName()+"_"+extractConfig.getCourseCode()+"_"+currNum+"_答案";
|
|
|
+ String answerFileName = currNum+"_"+ExamFileType.ANSWER.name();
|
|
|
try {
|
|
|
DocxProcessUtil.exportAnswer(dataMap,answerFileName,SXSF_TEMPLATE_ANSWER);
|
|
|
DocxProcessUtil.processImage(answerFileName,getPkgList(paperId));
|
|
|
File answerFile = new File(TEMP_FILE_EXP+answerFileName+DOCX_SUFFIX);
|
|
|
String answerFilePath = uploadUrl+answerFileName+DOCX_SUFFIX;
|
|
|
- //上传至又拍云
|
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
|
upyun.writeFile(answerFilePath, answerFile,true);
|
|
|
- examFileService.saveExamFile(new ExamFile(extractConfig,answerFileName+DOCX_SUFFIX,answerFilePath,ExamFileType.ANSWER),accessUser);
|
|
|
+ examFileService.saveExamFile(new ExamFile(extractConfig,answerFilePath,ExamFileType.ANSWER,DOCX_SUFFIX),accessUser);
|
|
|
answerFile.delete();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -151,6 +149,7 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
|
* @return
|
|
|
*/
|
|
|
private void exportObjectiveQuestionStructures(Map<String,Object> dataMap,ExtractConfig extractConfig,AccessUser accessUser,String currNum,List<QuestionTypeNum> questionTypeNums){
|
|
|
+ String objectiveFilename = currNum+"_"+ExamFileType.PAPER_STRUCTURE_OBJECTIVE.name();
|
|
|
PaperExp paperExp = (PaperExp) dataMap.get("paper");
|
|
|
List<PaperDetailExp> objectiveDetails = paperExp.getObjectiveDetails();
|
|
|
//根据试卷结构导出设置中的数量补齐客观题
|
|
@@ -161,19 +160,15 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
|
objectiveQuestionStructureList.add(new ObjectiveQuestionStructure(paperExp,paperDetailExp,unit));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
ExcelWriter objectiveExcelExporter = new ExcelWriter(ObjectiveQuestionStructure.class);
|
|
|
- String objectiveFilename = extractConfig.getCourseName()+"_"+extractConfig.getCourseCode()+"_"+currNum+"_客观题";
|
|
|
try {
|
|
|
File file = new File(TEMP_FILE_EXP+objectiveFilename+".xlsx");
|
|
|
FileOutputStream out = new FileOutputStream(file);
|
|
|
objectiveExcelExporter.write(objectiveFilename,objectiveQuestionStructureList,out);
|
|
|
- //上传至又拍云
|
|
|
String objectiveFilePath = uploadUrl+objectiveFilename+".xlsx";
|
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
|
upyun.writeFile(objectiveFilePath,file,true);
|
|
|
- //保存记录
|
|
|
- examFileService.saveExamFile(new ExamFile(extractConfig,objectiveFilename+".xlsx",uploadUrl+objectiveFilename+".xlsx",ExamFileType.PAPER_STRUCTURE_OBJECTIVE),accessUser);
|
|
|
+ examFileService.saveExamFile(new ExamFile(extractConfig,objectiveFilePath,ExamFileType.PAPER_STRUCTURE_OBJECTIVE,EXCEL_SUFFIX),accessUser);
|
|
|
file.delete();
|
|
|
} catch (FileNotFoundException e) {
|
|
|
e.printStackTrace();
|
|
@@ -246,6 +241,7 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
|
* @return
|
|
|
*/
|
|
|
private void exportSubjectiveQuestionStructures(Map<String,Object> dataMap,ExtractConfig extractConfig,AccessUser accessUser,String currNum){
|
|
|
+ String subjectiveFileName = currNum+"_"+ExamFileType.PAPER_STRUCTURE_SUBJECTIVE.name();
|
|
|
PaperExp paperExp = (PaperExp) dataMap.get("paper");
|
|
|
List<PaperDetailExp> subjectiveDetails = paperExp.getSubjectiveDetails();
|
|
|
List<SubjectiveQuestionStructure> subjectiveQuestionStructureList = new ArrayList<SubjectiveQuestionStructure>();
|
|
@@ -255,17 +251,14 @@ public class SxsfExportPaperService extends ExportPaperAbstractService {
|
|
|
}
|
|
|
}
|
|
|
ExcelWriter subjectiveExcelExporter = new ExcelWriter(SubjectiveQuestionStructure.class);
|
|
|
- String subjectiveFileName = extractConfig.getCourseName()+"_"+extractConfig.getCourseCode()+"_"+currNum+"_主观题";
|
|
|
try {
|
|
|
- File file = new File(TEMP_FILE_EXP+subjectiveFileName+".xlsx");
|
|
|
+ File file = new File(TEMP_FILE_EXP+subjectiveFileName+EXCEL_SUFFIX);
|
|
|
FileOutputStream out = new FileOutputStream(file);
|
|
|
subjectiveExcelExporter.write(subjectiveFileName,subjectiveQuestionStructureList,out);
|
|
|
- //上传至又拍云
|
|
|
- String subjectiveFilePath = uploadUrl+subjectiveFileName+".xlsx";
|
|
|
+ String subjectiveFilePath = uploadUrl+subjectiveFileName+EXCEL_SUFFIX;
|
|
|
UpYun upyun = new UpYun(bucketName,userName,password);
|
|
|
upyun.writeFile(subjectiveFilePath,file,true);
|
|
|
- //保存记录
|
|
|
- examFileService.saveExamFile(new ExamFile(extractConfig,subjectiveFileName+".xlsx",uploadUrl+subjectiveFileName+".xlsx",ExamFileType.PAPER_STRUCTURE_SUBJECTIVE),accessUser);
|
|
|
+ examFileService.saveExamFile(new ExamFile(extractConfig,subjectiveFilePath,ExamFileType.PAPER_STRUCTURE_SUBJECTIVE,EXCEL_SUFFIX),accessUser);
|
|
|
file.delete();
|
|
|
} catch (FileNotFoundException e) {
|
|
|
e.printStackTrace();
|