合并分支 'dev_20230216' 到 'master'

Dev 20230216

查看合并请求 laws-foton-slrs/foton-slrs-system-rest!97
This commit is contained in:
高嵩
2023-06-02 17:20:17 +08:00
4 changed files with 38 additions and 32 deletions
@@ -563,11 +563,15 @@ public class ActSarItemsBussEOService {
});
}
});
if (evaluations.get(0).getProcessNode().equals("重新技术委员会评审、评审意见修改")){
qualityEvaluationService.saveBatch(evaluations);
qualityEvaluationDao.updateByProcessNode(evaluations.get(0).getLawId());
for (QualityEvaluation qualityEvaluation :evaluations){
if (qualityEvaluation.getProcessNode().equals("重新技术委员会评审、评审意见修改")){
//qualityEvaluationService.saveBatch(evaluations);
qualityEvaluationService.save(qualityEvaluation);
qualityEvaluationDao.updateByProcessNode(qualityEvaluation.getLawId());
}else {
qualityEvaluationService.saveBatch(evaluations);
//qualityEvaluationService.saveBatch(evaluations);
qualityEvaluationService.save(qualityEvaluation);
}
}
}
}
@@ -290,7 +290,7 @@ public class StateSync {
/**
* 企业标准更新文本状态定时器
*/
@Scheduled(cron = "0 0 5 * * ?") //每天早晨点执行
@Scheduled(cron = "0 0 4 * * ?") //每天早晨点执行
public void timeSarBussionessStand(){
if (isNotScheduled){
logger.info("开始执行企业标准更新文本状态定时器");
+7 -6
View File
@@ -23,14 +23,15 @@
<dependencies>
<dependency>
<groupId>com.documents4j</groupId>
<artifactId>documents4j-local</artifactId>
<version>1.0.3</version>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version>6.0.1</version>
</dependency>
<!-- 转出pdf需要 -->
<dependency>
<groupId>com.documents4j</groupId>
<artifactId>documents4j-transformer-msoffice-word</artifactId>
<version>1.0.3</version>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-export-fo</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
@@ -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<AttFileEODao, AttFileEO> 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删除成功========================");