|
@@ -51,6 +51,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -337,7 +338,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
|
|
|
fileTempList.add(htmlFileTemp);
|
|
|
fileTempList.add(pdfFileTemp);
|
|
|
|
|
|
- FileCopyUtils.copy(htmlContent.getBytes(), htmlFileTemp);
|
|
|
+ FileCopyUtils.copy(htmlContent.getBytes(StandardCharsets.UTF_8), htmlFileTemp);
|
|
|
boolean oss = dictionaryConfig.sysDomain().isOss();
|
|
|
StringJoiner stringJoiner = new StringJoiner("");
|
|
|
StringJoiner pdfStringJoiner = new StringJoiner("");
|
|
@@ -387,7 +388,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
|
|
|
jsonObject.put(SystemConstant.UPLOAD_TYPE, new UploadFileEnum[]{
|
|
|
UploadFileEnum.HTML, UploadFileEnum.PDF
|
|
|
});
|
|
|
- basicAttachment = new BasicAttachment(jsonObject.toJSONString(), fileName, SystemConstant.HTML_PREFIX, new BigDecimal(htmlContent.getBytes().length), htmlFileMd5, userId);
|
|
|
+ basicAttachment = new BasicAttachment(jsonObject.toJSONString(), fileName, SystemConstant.HTML_PREFIX, new BigDecimal(htmlContent.getBytes(StandardCharsets.UTF_8).length), htmlFileMd5, userId);
|
|
|
basicAttachment.setPages(pdfDto.getActualPageCount());
|
|
|
basicAttachmentService.save(basicAttachment);
|
|
|
} catch (Exception e) {
|
|
@@ -416,7 +417,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
|
|
|
BasicAttachment basicAttachment = null;
|
|
|
File htmlFile = null, pdfFile = null;
|
|
|
try {
|
|
|
- byte[] bytes = htmlContent.getBytes();
|
|
|
+ byte[] bytes = htmlContent.getBytes(StandardCharsets.UTF_8);
|
|
|
int size = bytes.length;
|
|
|
boolean oss = dictionaryConfig.sysDomain().isOss();
|
|
|
StringJoiner stringJoiner = new StringJoiner("");
|
|
@@ -443,7 +444,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
|
|
|
htmlFile = SystemConstant.getFileTempVar(SystemConstant.HTML_PREFIX);
|
|
|
pdfFile = SystemConstant.getFileTempVar(SystemConstant.PDF_PREFIX);
|
|
|
|
|
|
- FileCopyUtils.copy(htmlContent.getBytes(), htmlFile);
|
|
|
+ FileCopyUtils.copy(htmlContent.getBytes(StandardCharsets.UTF_8), htmlFile);
|
|
|
|
|
|
String htmlFileMd5 = DigestUtils.md5Hex(new FileInputStream(htmlFile));
|
|
|
String pdfFileMd5 = DigestUtils.md5Hex(new FileInputStream(pdfFile));
|