feat: There is no way the, 优化ES kkkkkkkkkkk

This commit is contained in:
super_liu
2022-05-01 13:30:54 +08:00
parent 415af05e8b
commit 529ece1f95
@@ -111,6 +111,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.sql.Clob;
@@ -2973,20 +2974,20 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
// 判断文件是docx还是PDF
if (null != attFileEO.getFileSuffix() && (attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("doc") || attFileEO.getFileSuffix().equals("DOC") || attFileEO.getFileSuffix().equals("DOCX") || attFileEO.getFileSuffix().equals("ppt") || attFileEO.getFileSuffix().equals("pptx"))) {
if (attFileEO.getFileSuffix().equals("doc") || attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("DOC") || attFileEO.getFileSuffix().equals("DOCX")) {
FileInputStream fis = new FileInputStream(readFilePath);
if (FileMagic.valueOf(fis) == FileMagic.OOXML) {
XWPFDocument doc = new XWPFDocument(fis);
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File(readFilePath)));
if (FileMagic.valueOf(bis) == FileMagic.OOXML) {
XWPFDocument doc = new XWPFDocument(bis);
XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
String txt = extractor.getText();
content.append(txt);
extractor.close();
}else {
WordExtractor wordExtractor = new WordExtractor(fis);
WordExtractor wordExtractor = new WordExtractor(bis);
String txt = wordExtractor.getText();
content.append(txt);
wordExtractor.close();
}
fis.close();
bis.close();
} else {
OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);