Browse Source

题库后端提交。

weiwenhai 6 năm trước cách đây
mục cha
commit
35c5cce1a8

+ 23 - 0
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/export/NkdxExportPaperService.java

@@ -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");
 		}
 	}
 

+ 2 - 2
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigFileServiceImpl.java

@@ -425,10 +425,10 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
             if (extractConfig == null) {
                 throw new RuntimeException("该考试下的课程“" + examCourseDto.getCourseName() + "”没有制定调卷规则,不能批量导出,请保存调卷规则生成文件");
             }
-            if (extractConfig.getIfFinish() == null || extractConfig.getIfFinish() == 0) {
+            /*if (extractConfig.getIfFinish() == null || extractConfig.getIfFinish() == 0) {
                 throw new RuntimeException("该考试下的课程“" + examCourseDto.getCourseName() + "”考试文件没有生成,不能批量导出,请保存调卷规则生成文件");
             }
-            checkExamFileExists(examId, examCourseDto.getCourseCode(), exportType, examCourseDto.getCourseName());
+            checkExamFileExists(examId, examCourseDto.getCourseCode(), exportType, examCourseDto.getCourseName());*/
             List<ExamPaper> examPapers = extractConfig.getExamPaperList();
             if(examPapers == null || examPapers.size()<1){
             	throw new RuntimeException("该考试下的课程“" + examCourseDto.getCourseName() + "”没有绑定试卷。");

+ 5 - 5
examcloud-core-questions-starter/src/main/resources/logback-spring.xml

@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration debug="true" scan="true" scanPeriod="30 seconds">
 
-	<springProperty scope="context" name="logLevel" source="$log.level.default" />
-
 	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
 		<encoder>
 			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}| %level | %X{TRACE_ID} - %X{KEY} | %m | [%class:%line]%n</pattern>
@@ -11,13 +9,14 @@
 
 	<!-- debug 日志 -->
 	<appender name="DEBUG_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
-		<file>./logs/debug/core.questions.debug.log</file>
+		<file>${logRootPath}/debug/core.questions.debug.log</file>
 		<encoder>
 			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}| %level | %X{TRACE_ID} - %X{KEY} | %m | [%class:%line]%n</pattern>
 		</encoder>
 		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-			<fileNamePattern>./logs/debug/core.questions.debug.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
+			<fileNamePattern>${logRootPath}/logs/debug/core.questions.debug.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
 			<maxHistory>50</maxHistory>
+			<totalSizeCap>5GB</totalSizeCap>
 			<maxFileSize>100MB</maxFileSize>
 		</rollingPolicy>
 	</appender>
@@ -29,8 +28,9 @@
 			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}| %level | %X{TRACE_ID} - %X{KEY} | %m%n</pattern>
 		</encoder>
 		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-			<fileNamePattern>./logs/interface/core.questions.interface.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
+			<fileNamePattern>${logRootPath}/logs/interface/core.questions.interface.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
 			<maxHistory>50</maxHistory>
+			<totalSizeCap>5GB</totalSizeCap>
 			<maxFileSize>100MB</maxFileSize>
 		</rollingPolicy>
 	</appender>