feat: There is no way the, 优化ES 坑aaaaa

This commit is contained in:
super_liu
2022-05-01 02:24:31 +08:00
parent e5e1a5aab8
commit 1be6fa6579
3 changed files with 269 additions and 11 deletions
@@ -98,6 +98,7 @@ import org.apache.pdfbox.util.PDFTextStripper;
import org.apache.pdfbox.util.PDFTextStripperByArea;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.poifs.filesystem.FileMagic;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.json.JSONTokener;
@@ -2973,9 +2974,16 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
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);
WordExtractor wordExtractor = new WordExtractor(fis);
String txt = wordExtractor.getText();
content.append(txt);
if (FileMagic.valueOf(fis) == FileMagic.OOXML) {
XWPFDocument doc = new XWPFDocument(fis);
XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
String txt = extractor.getText();
content.append(txt);
}else {
WordExtractor wordExtractor = new WordExtractor(fis);
String txt = wordExtractor.getText();
content.append(txt);
}
} else {
OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);