From ab458ce073ae53ce46c318ce800d93e9f418aa5e Mon Sep 17 00:00:00 2001 From: SUNJIABIN Date: Fri, 2 Jun 2023 16:05:08 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=B0=86=E4=BC=81=E4=B8=9A=E6=A0=87?= =?UTF-8?q?=E5=87=86=E6=A0=B9=E6=8D=AE=E4=BB=A3=E6=9B=BF=E6=A0=87=E5=87=86?= =?UTF-8?q?=E5=8F=B7=E4=BF=AE=E6=94=B9=E6=96=87=E6=9C=AC=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=9A=84=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=88=90=E6=AF=8F=E5=A4=A9=E6=97=A9=E6=99=A8=E5=9B=9B=E7=82=B9?= =?UTF-8?q?=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/adc/da/slrs/sarBussionessStandState/sync/StateSync.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStandState/sync/StateSync.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStandState/sync/StateSync.java index 20f965d6..854c2989 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStandState/sync/StateSync.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStandState/sync/StateSync.java @@ -290,7 +290,7 @@ public class StateSync { /** * 企业标准更新文本状态定时器 */ - @Scheduled(cron = "0 0 5 * * ?") //每天早晨五点执行 + @Scheduled(cron = "0 0 4 * * ?") //每天早晨四点执行 public void timeSarBussionessStand(){ if (isNotScheduled){ logger.info("开始执行企业标准更新文本状态定时器"); From 859293ab7ffe254999bf1878d01a035e3ea644da Mon Sep 17 00:00:00 2001 From: SUNJIABIN Date: Fri, 2 Jun 2023 16:49:18 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=81=E6=A0=87?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E6=97=B6=E5=AF=B9=E8=AF=84=E5=88=86=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=97=B6=E7=9A=84=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workFlow/service/ActSarItemsBussEOService.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/adc-da-activiti/src/main/java/com/adc/da/workFlow/service/ActSarItemsBussEOService.java b/adc-da-activiti/src/main/java/com/adc/da/workFlow/service/ActSarItemsBussEOService.java index 150b46a8..2c6a0f40 100644 --- a/adc-da-activiti/src/main/java/com/adc/da/workFlow/service/ActSarItemsBussEOService.java +++ b/adc-da-activiti/src/main/java/com/adc/da/workFlow/service/ActSarItemsBussEOService.java @@ -563,11 +563,15 @@ public class ActSarItemsBussEOService { }); } }); - if (evaluations.get(0).getProcessNode().equals("重新技术委员会评审、评审意见修改")){ - qualityEvaluationService.saveBatch(evaluations); - qualityEvaluationDao.updateByProcessNode(evaluations.get(0).getLawId()); - }else { - qualityEvaluationService.saveBatch(evaluations); + for (QualityEvaluation qualityEvaluation :evaluations){ + if (qualityEvaluation.getProcessNode().equals("重新技术委员会评审、评审意见修改")){ + //qualityEvaluationService.saveBatch(evaluations); + qualityEvaluationService.save(qualityEvaluation); + qualityEvaluationDao.updateByProcessNode(evaluations.get(0).getLawId()); + }else { + //qualityEvaluationService.saveBatch(evaluations); + qualityEvaluationService.save(qualityEvaluation); + } } } } From 4d2604aea5ac093765ff017fd1f9fb8f190549d4 Mon Sep 17 00:00:00 2001 From: gaojiabao Date: Fri, 2 Jun 2023 17:04:13 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E5=A4=84=E5=A5=B3=E8=BD=ACpdf=20=E6=9D=83=E9=99=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adc-da-sys/pom.xml | 13 +++--- .../service/impl/AttFileEOServiceImpl.java | 41 ++++++++++--------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/adc-da-sys/pom.xml b/adc-da-sys/pom.xml index c928a9e0..59aaa818 100644 --- a/adc-da-sys/pom.xml +++ b/adc-da-sys/pom.xml @@ -23,14 +23,15 @@ - com.documents4j - documents4j-local - 1.0.3 + org.docx4j + docx4j + 6.0.1 + - com.documents4j - documents4j-transformer-msoffice-word - 1.0.3 + org.docx4j + docx4j-export-fo + 6.1.0 diff --git a/adc-da-sys/src/main/java/com/adc/da/att/service/impl/AttFileEOServiceImpl.java b/adc-da-sys/src/main/java/com/adc/da/att/service/impl/AttFileEOServiceImpl.java index 6af3c8da..66882fc2 100644 --- a/adc-da-sys/src/main/java/com/adc/da/att/service/impl/AttFileEOServiceImpl.java +++ b/adc-da-sys/src/main/java/com/adc/da/att/service/impl/AttFileEOServiceImpl.java @@ -8,12 +8,17 @@ import com.adc.da.sys.constant.ValidFlagEnum; import com.adc.da.util.FileUtil; import com.adc.da.util.UUIDUtils; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.documents4j.api.DocumentType; -import com.documents4j.api.IConverter; -import com.documents4j.job.LocalConverter; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.docx4j.Docx4J; +import org.docx4j.convert.out.FOSettings; +import org.docx4j.fonts.IdentityPlusMapper; +import org.docx4j.fonts.Mapper; +import org.docx4j.fonts.PhysicalFont; +import org.docx4j.fonts.PhysicalFonts; +import org.docx4j.openpackaging.packages.WordprocessingMLPackage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -602,35 +607,31 @@ public class AttFileEOServiceImpl extends ServiceImpl i if(fileInfo != null){ File fileWord = new File(src+fileInfo.getFilePath()+fileInfo.getFileName()); logger.info("==================================fileWord文件路径========================"+src+fileInfo.getFilePath()+fileInfo.getFileName()); - AttFileVo attFileVo = saveFileInfo(fileWord); - // 保存后 开始转换为 pdf版本 - File inputWord = new File(src+attFileVo.getFilePath()+attFileVo.getFileName()); - logger.info("==================================inputWord文件路径========================"+src+attFileVo.getFilePath()+attFileVo.getFileName()); String filePdfName = ""; - if(StringUtils.isNotBlank(attFileVo.getFileName())){ - String[] split = attFileVo.getFileName().split("\\."); + if(StringUtils.isNotBlank(fileInfo.getFileName())){ + String[] split = fileInfo.getFileName().split("\\."); filePdfName = split[0]+".pdf"; } - File outputFile = new File(src+fileInfo.getFilePath()+filePdfName); logger.info("==================================outputFile文件路径========================"+src+fileInfo.getFilePath()+filePdfName); try { - InputStream docxInputStream = new FileInputStream(inputWord); - OutputStream outputStream = new FileOutputStream(outputFile); - IConverter converter = LocalConverter.builder().build(); - converter.convert(docxInputStream).as(DocumentType.DOCX).to(outputStream).as(DocumentType.PDF).execute(); - outputStream.close(); + WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(fileWord); + Mapper fontMapper = new IdentityPlusMapper(); + PhysicalFont font = PhysicalFonts.getPhysicalFonts().get("Comic Sans MS"); + fontMapper.put("Calibri", font); + wordMLPackage.setFontMapper(fontMapper); + OutputStream os = new java.io.FileOutputStream(src+fileInfo.getFilePath()+filePdfName); + FOSettings foSettings = Docx4J.createFOSettings(); + foSettings.setWmlPackage(wordMLPackage); + Docx4J.toFO(foSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL); + File outputFile = new File(src+fileInfo.getFilePath()+filePdfName); + // 读取docx文件 // 合法存入当前文件 if(outputFile.exists()){ logger.info("==================================word.docx转换成功========================"); attFileVoPdf = saveFileInfo(outputFile); //存入成功以后 删除word 版本 if(attFileVoPdf != null) { - if (inputWord.exists()) { - inputWord.delete(); - deleteById(attFileVo.getId()); - logger.info("==================================word.docx删除成功========================"); - } if (outputFile.exists()) { outputFile.delete(); logger.info("==================================word.pdf删除成功========================"); From 052b083ebb663aa5c62e73814f3da5f6a935badf Mon Sep 17 00:00:00 2001 From: SUNJIABIN Date: Fri, 2 Jun 2023 17:19:12 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=81=E6=A0=87?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E6=97=B6=E5=AF=B9=E8=AF=84=E5=88=86=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=97=B6=E7=9A=84=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/adc/da/workFlow/service/ActSarItemsBussEOService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adc-da-activiti/src/main/java/com/adc/da/workFlow/service/ActSarItemsBussEOService.java b/adc-da-activiti/src/main/java/com/adc/da/workFlow/service/ActSarItemsBussEOService.java index 2c6a0f40..9d33d1a9 100644 --- a/adc-da-activiti/src/main/java/com/adc/da/workFlow/service/ActSarItemsBussEOService.java +++ b/adc-da-activiti/src/main/java/com/adc/da/workFlow/service/ActSarItemsBussEOService.java @@ -567,7 +567,7 @@ public class ActSarItemsBussEOService { if (qualityEvaluation.getProcessNode().equals("重新技术委员会评审、评审意见修改")){ //qualityEvaluationService.saveBatch(evaluations); qualityEvaluationService.save(qualityEvaluation); - qualityEvaluationDao.updateByProcessNode(evaluations.get(0).getLawId()); + qualityEvaluationDao.updateByProcessNode(qualityEvaluation.getLawId()); }else { //qualityEvaluationService.saveBatch(evaluations); qualityEvaluationService.save(qualityEvaluation);