|
@@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.itextpdf.text.DocumentException;
|
|
import com.itextpdf.text.DocumentException;
|
|
import com.itextpdf.text.pdf.PdfReader;
|
|
import com.itextpdf.text.pdf.PdfReader;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
|
|
+import com.qmth.boot.tools.codec.CodecUtils;
|
|
|
|
+import com.qmth.boot.tools.models.ByteArray;
|
|
import com.qmth.distributed.print.business.bean.dto.PdfDto;
|
|
import com.qmth.distributed.print.business.bean.dto.PdfDto;
|
|
import com.qmth.distributed.print.business.bean.params.SerialNumberParams;
|
|
import com.qmth.distributed.print.business.bean.params.SerialNumberParams;
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
@@ -184,13 +186,17 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
|
|
HtmlToPdfUtil.convert(htmlFile.getPath(), destUrl, PageSizeEnum.A4);
|
|
HtmlToPdfUtil.convert(htmlFile.getPath(), destUrl, PageSizeEnum.A4);
|
|
// File pdfFile = asposePdfUtil.documentToPdf(htmlFile.getPath(), destUrl, PaperSize.A4);
|
|
// File pdfFile = asposePdfUtil.documentToPdf(htmlFile.getPath(), destUrl, PaperSize.A4);
|
|
String htmlFileMd5 = DigestUtils.md5Hex(new FileInputStream(htmlFile));
|
|
String htmlFileMd5 = DigestUtils.md5Hex(new FileInputStream(htmlFile));
|
|
- String pdfFileMd5 = DigestUtils.md5Hex(new FileInputStream(pdfFile));
|
|
|
|
|
|
+ byte[] data = ByteArray.fromFile(pdfFile).value();
|
|
|
|
+ String md5 = ByteArray.md5(data).toHexString();
|
|
|
|
+ InputStream ins = new ByteArrayInputStream(data);
|
|
|
|
+ //String pdfFileMd5 = DigestUtils.md5Hex(new FileInputStream(pdfFile));
|
|
PdfDto pdfDto = null;
|
|
PdfDto pdfDto = null;
|
|
if (oss) {//上传至oss
|
|
if (oss) {//上传至oss
|
|
pdfDto = PdfUtil.addPdfPage(pdfFile);
|
|
pdfDto = PdfUtil.addPdfPage(pdfFile);
|
|
// ossUtil.ossUpload(pdfDirNameStr, pdfFile, BinaryUtil.toBase64String(HexUtils.decodeHex(pdfFileMd5)));
|
|
// ossUtil.ossUpload(pdfDirNameStr, pdfFile, BinaryUtil.toBase64String(HexUtils.decodeHex(pdfFileMd5)));
|
|
- fileStoreUtil.ossUpload(pdfDirNameStr, pdfFile, BinaryUtil.toBase64String(HexUtils.decodeHex(pdfFileMd5)), fileStoreUtil.getUploadEnumByPath(pdfDirNameStr).getFssType());
|
|
|
|
|
|
+ fileStoreUtil.ossUpload(pdfDirNameStr, ins, md5, fileStoreUtil.getUploadEnumByPath(pdfDirNameStr).getFssType());
|
|
// htmlFile.delete();
|
|
// htmlFile.delete();
|
|
|
|
+ ins.close();
|
|
}
|
|
}
|
|
JSONObject attachmentPath = JSONObject.parseObject(examDetail.getAttachmentPath());
|
|
JSONObject attachmentPath = JSONObject.parseObject(examDetail.getAttachmentPath());
|
|
attachmentPath = Objects.isNull(attachmentPath) ? new JSONObject() : attachmentPath;
|
|
attachmentPath = Objects.isNull(attachmentPath) ? new JSONObject() : attachmentPath;
|
|
@@ -200,7 +206,7 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
|
|
object.put("printType", classifyEnum.name());
|
|
object.put("printType", classifyEnum.name());
|
|
object.put(SystemConstant.HTML_PATH, filePath);
|
|
object.put(SystemConstant.HTML_PATH, filePath);
|
|
object.put("htmlMd5", htmlFileMd5);
|
|
object.put("htmlMd5", htmlFileMd5);
|
|
- object.put("pdfMd5", pdfFileMd5);
|
|
|
|
|
|
+ object.put("pdfMd5", md5);
|
|
object.put(SystemConstant.PDF_PATH, pdfDirNameStr);
|
|
object.put(SystemConstant.PDF_PATH, pdfDirNameStr);
|
|
object.put(SystemConstant.TYPE, SystemConstant.OSS);
|
|
object.put(SystemConstant.TYPE, SystemConstant.OSS);
|
|
object.put(SystemConstant.UPLOAD_TYPE, new UploadFileEnum[]{
|
|
object.put(SystemConstant.UPLOAD_TYPE, new UploadFileEnum[]{
|