|
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.itextpdf.text.Element;
|
|
|
import com.itextpdf.text.pdf.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
import org.apache.poi.util.IOUtils;
|
|
|
import org.springblade.archive.entity.ArchiveFormulaConfig;
|
|
@@ -18,6 +19,7 @@ import org.springblade.archive.utils.FileUtils;
|
|
|
import org.springblade.archive.utils.FormulaUtil;
|
|
|
import org.springblade.business.entity.ArchiveFile;
|
|
|
import org.springblade.business.feign.ArchiveFileClient;
|
|
|
+import org.springblade.common.constant.OssConstant;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.common.vo.DataVO;
|
|
@@ -288,7 +290,8 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
|
|
|
Map<String, Object> dataInfo = new HashMap<>();
|
|
|
|
|
|
ArchiveFormulaConfig multiLineconfig = null;
|
|
|
- String fileName = NAME_MAP.get(number)+ "-" + archivesAuto.getId();
|
|
|
+ //采取
|
|
|
+ String fileName = FileUtils.generateFilename(number,0,archivesAuto.getId());
|
|
|
|
|
|
for (ArchiveFormulaConfig config : formulaConfigs) {
|
|
|
String coords = config.getCoords();
|
|
@@ -547,7 +550,7 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
|
|
|
FileOutputStream outputStream = new FileOutputStream(excelPath);
|
|
|
workbook.write(outputStream);
|
|
|
FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
|
|
|
- BladeFile bladeFile = newIOSSClient.uploadFile(fileName + ".pdf", pdfPath);
|
|
|
+ BladeFile bladeFile = newIOSSClient.uploadFile(fileName + ".pdf", OssConstant.TEMP_DIRECTORY, pdfPath);
|
|
|
|
|
|
String pdfLink = "";
|
|
|
if (bladeFile!= null ){
|
|
@@ -740,7 +743,7 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
|
|
|
* @param fileName
|
|
|
* @return
|
|
|
*/
|
|
|
- public String MergePdfAndUpload(List<String> urlList,String fileName) {
|
|
|
+ public String MergePdfAndUpload(List<String> urlList,String fileName,String filePath) {
|
|
|
String url = "";
|
|
|
Long id = SnowFlakeUtil.getId();
|
|
|
String trialPdf = FileUtils.LocalPath + "/pdf/" + id + ".pdf";
|
|
@@ -748,8 +751,15 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
|
|
|
try {
|
|
|
//合并pdf
|
|
|
FileUtils.mergePdfPublicMethods(urlList,trialPdf);
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(filePath)) {
|
|
|
+ filePath = OssConstant.TEMP_DIRECTORY;
|
|
|
+ }
|
|
|
+
|
|
|
+ fileName += (OssConstant.SEPARATOR + id);
|
|
|
+
|
|
|
//上传到oss
|
|
|
- BladeFile file = newIOSSClient.uploadFile(fileName+ ".pdf",trialPdf);
|
|
|
+ BladeFile file = newIOSSClient.uploadFile(fileName+ ".pdf", filePath,trialPdf);
|
|
|
url = file.getLink();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|