代码优化
This commit is contained in:
+2
-4
@@ -4898,15 +4898,13 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
objectQueryWrapper.eq("ORI_ATT_ID",fileId);
|
||||
objectQueryWrapper.eq("USE_MODEL","SOURCE_FILE");
|
||||
objectQueryWrapper.eq("FILE_SUFFIX","docx");
|
||||
// objectQueryWrapper.ne("FILE_SUFFIX","pdf");
|
||||
// objectQueryWrapper.ne("FILE_SUFFIX","PDF");
|
||||
List<SarBussStandFile> sarBussStandFiles = sarBussStandFileEODao.selectList(objectQueryWrapper);
|
||||
// 为空暂不处理 不为空则意味pdf生成失败
|
||||
if(!sarBussStandFiles.isEmpty()) {
|
||||
QueryWrapper<SarBussStandFile> objectQueryWrapperSarBussStandFile = new QueryWrapper<>();
|
||||
objectQueryWrapperSarBussStandFile.eq("ORI_ATT_ID", sarBussStandFiles.get(0).getOriAttId());
|
||||
objectQueryWrapperSarBussStandFile.eq("USE_MODEL", "WEB_FILE");
|
||||
List<SarBussStandFile> sarBussStandFilesList = sarBussStandFileEODao.selectList(objectQueryWrapperSarBussStandFile);
|
||||
if(!sarBussStandFilesList.isEmpty() && sarBussStandFilesList.size()==1){
|
||||
if(sarBussStandFilesList.isEmpty() && sarBussStandFilesList.size()==0){
|
||||
AttFileVo attFileVo = attFileEOService.wordConversionFilePdf(sarBussStandFiles.get(0).getOriAttId());
|
||||
if(attFileVo!=null){
|
||||
SarBussStandFile sarBussStandFile = new SarBussStandFile();
|
||||
|
||||
@@ -601,15 +601,19 @@ public class AttFileEOServiceImpl extends ServiceImpl<AttFileEODao, AttFileEO> i
|
||||
AttFileVo attFileVoPdf = null;
|
||||
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("\\.");
|
||||
filePdfName = split[0]+".pdf";
|
||||
}
|
||||
File outputFile = new File(src+fileInfo.getFilePath(),filePdfName);
|
||||
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);
|
||||
@@ -627,6 +631,10 @@ public class AttFileEOServiceImpl extends ServiceImpl<AttFileEODao, AttFileEO> i
|
||||
deleteById(attFileVo.getId());
|
||||
logger.info("==================================word.docx删除成功========================");
|
||||
}
|
||||
if (outputFile.exists()) {
|
||||
outputFile.delete();
|
||||
logger.info("==================================word.pdf删除成功========================");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user