Merge branch 'develop_migration' into 'develop_master'
Develop migration See merge request LiuChao/foton-slrs-system-rest!482
This commit is contained in:
+2
-2
@@ -84,7 +84,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
|||||||
searchRequestBuilder = client.prepareSearch(searchInfoEO.getSelectIndex())
|
searchRequestBuilder = client.prepareSearch(searchInfoEO.getSelectIndex())
|
||||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||||
.setFrom((searchInfoEO.getPage()-1)*searchInfoEO.getPageSize())
|
.setFrom((searchInfoEO.getPage()-1)*searchInfoEO.getPageSize())
|
||||||
.addSort("issue_time_order", SortOrder.DESC)
|
.addSort("issue_time_data", SortOrder.DESC)
|
||||||
.setSize(searchInfoEO.getPageSize());
|
.setSize(searchInfoEO.getPageSize());
|
||||||
|
|
||||||
if(searchInfoEO.getSelectIndex().equals("stand")) {
|
if(searchInfoEO.getSelectIndex().equals("stand")) {
|
||||||
@@ -211,7 +211,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
|||||||
searchRequestBuilder = client.prepareSearch(searchInfoEO.getSelectIndex())
|
searchRequestBuilder = client.prepareSearch(searchInfoEO.getSelectIndex())
|
||||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||||
.setFrom((searchInfoEO.getPage()-1)*searchInfoEO.getPageSize())
|
.setFrom((searchInfoEO.getPage()-1)*searchInfoEO.getPageSize())
|
||||||
.addSort("issue_time_order", SortOrder.DESC)
|
.addSort("issue_time_data", SortOrder.DESC)
|
||||||
.setSize(searchInfoEO.getPageSize());
|
.setSize(searchInfoEO.getPageSize());
|
||||||
|
|
||||||
if(searchInfoEO.getSelectIndex().equals("stand")) {
|
if(searchInfoEO.getSelectIndex().equals("stand")) {
|
||||||
|
|||||||
+19
-12
@@ -3080,19 +3080,30 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
|||||||
String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
|
String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||||
try {
|
try {
|
||||||
// 判断文件是docx还是PDF
|
// 判断文件是docx还是PDF
|
||||||
if (attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("doc")) {
|
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")) {
|
if (attFileEO.getFileSuffix().equals("doc") || attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("DOC") || attFileEO.getFileSuffix().equals("DOCX")) {
|
||||||
FileInputStream fis = new FileInputStream(readFilePath);
|
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(new File(readFilePath)));
|
||||||
WordExtractor wordExtractor = new WordExtractor(fis);
|
if (FileMagic.valueOf(bis) == FileMagic.OOXML) {
|
||||||
String txt = wordExtractor.getText();
|
XWPFDocument doc = new XWPFDocument(bis);
|
||||||
content.append(txt);
|
XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
|
||||||
|
String txt = extractor.getText();
|
||||||
|
content.append(txt);
|
||||||
|
extractor.close();
|
||||||
|
}else {
|
||||||
|
WordExtractor wordExtractor = new WordExtractor(bis);
|
||||||
|
String txt = wordExtractor.getText();
|
||||||
|
content.append(txt);
|
||||||
|
wordExtractor.close();
|
||||||
|
}
|
||||||
|
bis.close();
|
||||||
} else {
|
} else {
|
||||||
OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
|
OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
|
||||||
XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
|
XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
|
||||||
String txt = extractor.getText();
|
String txt = extractor.getText();
|
||||||
content.append(txt);
|
content.append(txt);
|
||||||
|
opcPackage.close();
|
||||||
}
|
}
|
||||||
} else if (attFileEO.getFileSuffix().equals("pdf")) {
|
} else {
|
||||||
PDDocument document = PDDocument.load(new File(readFilePath));
|
PDDocument document = PDDocument.load(new File(readFilePath));
|
||||||
document.getClass();
|
document.getClass();
|
||||||
if (!document.isEncrypted()) {
|
if (!document.isEncrypted()) {
|
||||||
@@ -3103,12 +3114,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
|||||||
// String[] lines = pdfFileInText.split("\\r?\\n");
|
// String[] lines = pdfFileInText.split("\\r?\\n");
|
||||||
content.append(pdfFileInText);
|
content.append(pdfFileInText);
|
||||||
}
|
}
|
||||||
|
document.close();
|
||||||
}
|
}
|
||||||
// String readFilePath = "E:\\上汽企标流程总览.pdf";
|
|
||||||
// FileInputStream fis = new FileInputStream(readFilePath);
|
|
||||||
// WordExtractor wordExtractor = new WordExtractor(fis);
|
|
||||||
// String txt = wordExtractor.getText();
|
|
||||||
// content.append(txt);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("搜索中心修改数据读取文档内容时失败");
|
logger.error("搜索中心修改数据读取文档内容时失败");
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
|
|||||||
Reference in New Issue
Block a user