|
@@ -40,6 +40,8 @@ import com.qmth.teachcloud.mark.service.ScanAnswerCardService;
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -63,6 +65,8 @@ import java.util.stream.Stream;
|
|
|
@Service
|
|
|
public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> implements ExamCardService {
|
|
|
|
|
|
+ private final static Logger log = LoggerFactory.getLogger(ExamCardServiceImpl.class);
|
|
|
+
|
|
|
@Resource
|
|
|
private BasicExamRuleService basicExamRuleService;
|
|
|
@Resource
|
|
@@ -452,10 +456,13 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
// HTML文件
|
|
|
String htmlContent = createPdfUtil.replaceBlankHtmlContent(examCard.getHtmlContent(), examCard.getCourseId());
|
|
|
File htmlFile = new File(downloadFilePath, title + SystemConstant.HTML_PREFIX);
|
|
|
+ log.info("html新创建前文件名:{}", htmlFile.getAbsolutePath());
|
|
|
if (!htmlFile.exists()) {
|
|
|
htmlFile.createNewFile();
|
|
|
}
|
|
|
+ log.info("html创建后文件名:{}", htmlFile.getAbsolutePath());
|
|
|
FileUtil.writeContent(htmlFile, htmlContent);
|
|
|
+ log.info("html写入内容后文件名:{}", htmlFile.getAbsolutePath());
|
|
|
|
|
|
// PDF文件
|
|
|
if (StringUtils.isNotBlank(examCard.getBlankCardPath())) {
|
|
@@ -463,10 +470,13 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
fileUploadService.downloadFile(examCard.getBlankCardPath(), pdfFileName);
|
|
|
} else {
|
|
|
File pdfFile = new File(downloadFilePath, title + SystemConstant.PDF_PREFIX);
|
|
|
+ log.info("pdf新创建前文件名:{}", pdfFile.getAbsolutePath());
|
|
|
if (!pdfFile.exists()) {
|
|
|
pdfFile.createNewFile();
|
|
|
}
|
|
|
+ log.info("pdf创建后文件名:{}", pdfFile.getAbsolutePath());
|
|
|
HtmlToPdfUtil.convert(htmlFile.getPath(), pdfFile.getPath(), "8K".equals(examCard.getPageSize()) ? PageSizeEnum.K8 : PageSizeEnum.valueOf(examCard.getPageSize()));
|
|
|
+ log.info("pdf写入内容后文件名:{}", pdfFile.getAbsolutePath());
|
|
|
}
|
|
|
|
|
|
// JPG文件
|
|
@@ -500,7 +510,7 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
|
if (Objects.nonNull(rootPath)) {
|
|
|
- FileUtil.deleteDirectory(rootPath);
|
|
|
+// FileUtil.deleteDirectory(rootPath);
|
|
|
}
|
|
|
}
|
|
|
}
|