|
@@ -13,13 +13,11 @@ import cn.com.qmth.examcloud.core.print.common.jpa.SpecUtils;
|
|
|
import cn.com.qmth.examcloud.core.print.common.upyun.SystemProperty;
|
|
|
import cn.com.qmth.examcloud.core.print.common.upyun.UpYunClient;
|
|
|
import cn.com.qmth.examcloud.core.print.common.utils.*;
|
|
|
-import cn.com.qmth.examcloud.core.print.entity.CoursePaper;
|
|
|
-import cn.com.qmth.examcloud.core.print.entity.CourseStatistic;
|
|
|
-import cn.com.qmth.examcloud.core.print.entity.ObjectiveQuestionStructure;
|
|
|
-import cn.com.qmth.examcloud.core.print.entity.SubjectiveQuestionStructure;
|
|
|
+import cn.com.qmth.examcloud.core.print.entity.*;
|
|
|
import cn.com.qmth.examcloud.core.print.enums.PaperStatus;
|
|
|
import cn.com.qmth.examcloud.core.print.repository.CoursePaperRepository;
|
|
|
import cn.com.qmth.examcloud.core.print.repository.CourseStatisticRepository;
|
|
|
+import cn.com.qmth.examcloud.core.print.repository.PrintingProjectRepository;
|
|
|
import cn.com.qmth.examcloud.core.print.service.CoursePaperService;
|
|
|
import cn.com.qmth.examcloud.core.print.service.ExamQuestionStructureService;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.coursepaper.*;
|
|
@@ -50,6 +48,8 @@ import static cn.com.qmth.examcloud.core.print.common.Constants.*;
|
|
|
public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
private static final Logger log = LoggerFactory.getLogger(CoursePaperServiceImpl.class);
|
|
|
@Autowired
|
|
|
+ private PrintingProjectRepository printingProjectRepository;
|
|
|
+ @Autowired
|
|
|
private CoursePaperRepository coursePaperRepository;
|
|
|
@Autowired
|
|
|
private CourseStatisticRepository courseStatisticRepository;
|
|
@@ -160,13 +160,21 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
final String answerPdfPath = rootDir + "/" + FileUtils.randomUUID() + SUFFIX_PDF;
|
|
|
FileUtils.makeDirs(rootDir);
|
|
|
|
|
|
- boolean paperResult = ElectronUtils.toPdf(systemProperty.getProfile(), systemProperty.getDir(), coursePaper.getPaperHtmlUrl(), paperPdfPath);
|
|
|
+ PrintingProject printingProject = printingProjectRepository.findByOrgIdAndExamId(coursePaper.getOrgId(), coursePaper.getExamId());
|
|
|
+ if (printingProject == null) {
|
|
|
+ log.warn(String.format("PrintingProject is not exist! orgId = %s ,examId = %s", coursePaper.getOrgId(), coursePaper.getExamId()));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ final String title = String.format("?examName=%s", this.urlParamEncode(printingProject.getExamName()));
|
|
|
+
|
|
|
+ boolean paperResult = ElectronUtils.toPdf(systemProperty.getProfile(), systemProperty.getDir(), coursePaper.getPaperHtmlUrl() + title, paperPdfPath);
|
|
|
if (!paperResult) {
|
|
|
log.warn(String.format("试卷页面转换PDF文件失败!paperId = %s", coursePaper.getPaperId()));
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- boolean answerResult = ElectronUtils.toPdf(systemProperty.getProfile(), systemProperty.getDir(), coursePaper.getAnswerHtmlUrl(), answerPdfPath);
|
|
|
+ boolean answerResult = ElectronUtils.toPdf(systemProperty.getProfile(), systemProperty.getDir(), coursePaper.getAnswerHtmlUrl() + title, answerPdfPath);
|
|
|
if (!answerResult) {
|
|
|
log.warn(String.format("答案页面转换PDF文件失败!paperId = %s", coursePaper.getPaperId()));
|
|
|
continue;
|