|
@@ -6,6 +6,8 @@ import java.util.List;
|
|
|
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLog;
|
|
|
+import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLogFactory;
|
|
|
import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
|
import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
|
|
|
import cn.com.qmth.examcloud.core.questions.base.enums.ExamFileType;
|
|
@@ -26,9 +28,15 @@ import cn.com.qmth.examcloud.core.questions.service.bean.dto.PaperExp;
|
|
|
@Service("nkdxExportPaperService")
|
|
|
public class NkdxExportPaperService extends ExportPaperAbstractService {
|
|
|
|
|
|
+ protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
|
|
|
+
|
|
|
@Override
|
|
|
public void downloadPaper(String paperId,String zipFileName,String examType) throws Exception {
|
|
|
+ log.debug("题库开始下载试卷...");
|
|
|
+ long startTime = System.currentTimeMillis();
|
|
|
PaperExp paperExp = super.initPaperExp(paperId);
|
|
|
+ long paperExpTime = System.currentTimeMillis();
|
|
|
+ log.debug("拼装导出对象耗时:"+ (paperExpTime - startTime)+"ms");
|
|
|
if(paperExp!=null){
|
|
|
String paperfileName = paperExp.getName()+"_"+paperExp.getCourseNo()+"_"+ExamFileType.PAPER.getName()+DOCX_SUFFIX;
|
|
|
File file = new File(TEMP_FILE_EXP+File.separator+zipFileName+File.separator+paperfileName);
|
|
@@ -37,22 +45,37 @@ public class NkdxExportPaperService extends ExportPaperAbstractService {
|
|
|
paperExp.setExamRemarkWord(DocxProcessUtil.html2Docx(wordMLPackage, CommonUtils.formatHtml(paperExp.getExamRemark())));
|
|
|
DocxProcessUtil.exportWordNew(paperExp, file,NKDX_TMPLATE_PAPER);
|
|
|
}else{
|
|
|
+ long docxTime = System.currentTimeMillis();
|
|
|
DocxProcessUtil.exportWordNew(paperExp, file,NKDX_TMPLATE_PAPER);
|
|
|
+ long docxEndTime = System.currentTimeMillis();
|
|
|
+ log.debug("处理word文字耗时:"+ (docxEndTime - docxTime)+"ms");
|
|
|
}
|
|
|
+ long docxImgTime = System.currentTimeMillis();
|
|
|
DocxProcessUtil.processImage(zipFileName+File.separator+paperfileName,getPkgList(paperId));
|
|
|
+ long docxImgEndTime = System.currentTimeMillis();
|
|
|
+ log.debug("处理word文字+图片耗时:"+ (docxImgEndTime - docxImgTime)+"ms");
|
|
|
//下载音频
|
|
|
super.downloadAudio(paperExp, zipFileName);
|
|
|
+ long aduioTime = System.currentTimeMillis();
|
|
|
+ log.debug("处理音频耗时:"+ (aduioTime - docxImgEndTime)+"ms");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void downloadPaperAnswer(String paperId, String zipFileName)throws Exception {
|
|
|
+ log.debug("题库开始下载答案...");
|
|
|
+ long startTime = System.currentTimeMillis();
|
|
|
PaperExp paperExp = initPaperExp(paperId);
|
|
|
+ long paperExpTime = System.currentTimeMillis();
|
|
|
+ log.debug("拼装导出对象耗时:"+ (paperExpTime - startTime)+"ms");
|
|
|
if(paperExp!=null){
|
|
|
String answerFileName = paperExp.getName()+"_"+paperExp.getCourseNo()+"_"+ExamFileType.ANSWER.getName()+DOCX_SUFFIX;
|
|
|
File file = new File(TEMP_FILE_EXP+File.separator+zipFileName+File.separator+answerFileName);
|
|
|
+ long docxTime = System.currentTimeMillis();
|
|
|
DocxProcessUtil.exportWordNew(paperExp,file,NKDX_TMPLATE_ANSWER);
|
|
|
DocxProcessUtil.processImage(zipFileName+File.separator+answerFileName,getPkgList(paperId));
|
|
|
+ long docxEndTime = System.currentTimeMillis();
|
|
|
+ log.debug("处理word文字+图片耗时:"+ (docxEndTime - docxTime)+"ms");
|
|
|
}
|
|
|
}
|
|
|
|