|
@@ -108,8 +108,11 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
final String paperPdfPath = rootDir + "/" + FileUtils.randomUUID() + SUFFIX_PDF;
|
|
|
final String answerPdfPath = rootDir + "/" + FileUtils.randomUUID() + SUFFIX_PDF;
|
|
|
FileUtils.makeDirs(rootDir);
|
|
|
- ElectronUtils.toPdf(systemProperty.getDir(), paperHtmlUrl, paperPdfPath);
|
|
|
- ElectronUtils.toPdf(systemProperty.getDir(), answerHtmlUrl, answerPdfPath);
|
|
|
+ boolean paperResult = ElectronUtils.toPdf(systemProperty.getDir(), paperHtmlUrl, paperPdfPath);
|
|
|
+ boolean answerResult = ElectronUtils.toPdf(systemProperty.getDir(), answerHtmlUrl, answerPdfPath);
|
|
|
+ if (!paperResult || !answerResult) {
|
|
|
+ throw new StatusException(PRT_CODE_500, "转换PDF文件失败!");
|
|
|
+ }
|
|
|
|
|
|
//上传PDF至又拍云
|
|
|
String paperPdfUrl = upYunClient.upload(new File(paperPdfPath));
|
|
@@ -124,7 +127,7 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
log.error(e.getMessage());
|
|
|
}
|
|
|
if (paperP == 0) {
|
|
|
- throw new StatusException(PRT_CODE_400, "试卷页数不能为空!");
|
|
|
+ throw new StatusException(PRT_CODE_500, "试卷页数不能为0!");
|
|
|
}
|
|
|
|
|
|
CoursePaper oldCoursePaper = coursePaperRepository.findByExamIdAndPaperId(coursePaper.getExamId(), coursePaper.getPaperId());
|