文档库--读取文件内容
This commit is contained in:
+30
-5
@@ -1136,7 +1136,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
fileText = wordContent;
|
fileText = wordContent;
|
||||||
}
|
}
|
||||||
} else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) {
|
} else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) {
|
||||||
String pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl());
|
String pdfContent = null;
|
||||||
|
try {
|
||||||
|
pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("文档库: 读取PDF文件内容失败");
|
||||||
|
}
|
||||||
if (StringUtils.isNotBlank(pdfContent)) {
|
if (StringUtils.isNotBlank(pdfContent)) {
|
||||||
fileText = pdfContent;
|
fileText = pdfContent;
|
||||||
}
|
}
|
||||||
@@ -1225,12 +1230,22 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
|| ossFile.getFileName().endsWith(".docx")
|
|| ossFile.getFileName().endsWith(".docx")
|
||||||
|| ossFile.getFileName().endsWith(".DOC")
|
|| ossFile.getFileName().endsWith(".DOC")
|
||||||
|| ossFile.getFileName().endsWith(".DOCX")) {
|
|| ossFile.getFileName().endsWith(".DOCX")) {
|
||||||
String wordContent = ReadWordUtil.readWord(ossFile.getUrl());
|
String wordContent = null;
|
||||||
|
try {
|
||||||
|
wordContent = ReadWordUtil.readWord(ossFile.getUrl());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("文档库:读取word内容失败");
|
||||||
|
}
|
||||||
if (StringUtils.isNotBlank(wordContent)) {
|
if (StringUtils.isNotBlank(wordContent)) {
|
||||||
result.add(wordContent);
|
result.add(wordContent);
|
||||||
}
|
}
|
||||||
} else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) {
|
} else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) {
|
||||||
String pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl());
|
String pdfContent = null;
|
||||||
|
try {
|
||||||
|
pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("文档库:读取pdf内容失败");
|
||||||
|
}
|
||||||
if (StringUtils.isNotBlank(pdfContent)) {
|
if (StringUtils.isNotBlank(pdfContent)) {
|
||||||
result.add(pdfContent);
|
result.add(pdfContent);
|
||||||
}
|
}
|
||||||
@@ -1565,12 +1580,22 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
|| ossFile.getFileName().endsWith(".docx")
|
|| ossFile.getFileName().endsWith(".docx")
|
||||||
|| ossFile.getFileName().endsWith(".DOC")
|
|| ossFile.getFileName().endsWith(".DOC")
|
||||||
|| ossFile.getFileName().endsWith(".DOCX")) {
|
|| ossFile.getFileName().endsWith(".DOCX")) {
|
||||||
String wordContent = ReadWordUtil.readWord(ossFile.getUrl());
|
String wordContent = null;
|
||||||
|
try {
|
||||||
|
wordContent = ReadWordUtil.readWord(ossFile.getUrl());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("文档库:读取word文件内容失败");
|
||||||
|
}
|
||||||
if (StringUtils.isNotBlank(wordContent)) {
|
if (StringUtils.isNotBlank(wordContent)) {
|
||||||
fileText = wordContent;
|
fileText = wordContent;
|
||||||
}
|
}
|
||||||
} else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) {
|
} else if (ossFile.getFileName().endsWith(".pdf") || ossFile.getFileName().endsWith(".PDF")) {
|
||||||
String pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl());
|
String pdfContent = null;
|
||||||
|
try {
|
||||||
|
pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("文档库读取PDF文件内容失败");
|
||||||
|
}
|
||||||
if (StringUtils.isNotBlank(pdfContent)) {
|
if (StringUtils.isNotBlank(pdfContent)) {
|
||||||
fileText = pdfContent;
|
fileText = pdfContent;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user