文档库--es新增
This commit is contained in:
+55
-39
@@ -243,9 +243,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
try {
|
try {
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
jeroElasticsearchTemplate.delete(SearchEnum.INDEX_NAME_DOCUMENT.getValue(), SearchEnum.TYPE_NAME_DOCUMENT.getValue(), id);
|
jeroElasticsearchTemplate.delete(SearchEnum.INDEX_NAME_DOCUMENT.getValue(), SearchEnum.TYPE_NAME_DOCUMENT.getValue(), id);
|
||||||
|
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH.getValue(), SearchEnum.FULL_TEXT_SEARCH.getValue(), id);
|
||||||
for (String fileId : fileIdList) {
|
for (String fileId : fileIdList) {
|
||||||
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH.getValue(), SearchEnum.FULL_TEXT_SEARCH.getValue(), id+fileId);
|
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH.getValue(), SearchEnum.FULL_TEXT_SEARCH.getValue(), id+fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("文档库删除es失败");
|
log.error("文档库删除es失败");
|
||||||
@@ -968,6 +970,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
map.remove("corresponding_standard_id");
|
map.remove("corresponding_standard_id");
|
||||||
//字段属性
|
//字段属性
|
||||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
|
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
|
||||||
|
//获取搜索中心字段
|
||||||
|
List<OnlCgformField> searchFieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(e.getIsShowSearch())).collect(Collectors.toList());
|
||||||
//文件类型字段
|
//文件类型字段
|
||||||
List<OnlCgformField> fieldFileList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
List<OnlCgformField> fieldFileList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||||
//树形数据字典
|
//树形数据字典
|
||||||
@@ -1053,32 +1057,60 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
List<OSSFile> fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ","));
|
List<OSSFile> fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ","));
|
||||||
List<Map<String,Object>> mapListTemp = new ArrayList<>();
|
List<Map<String,Object>> mapListTemp = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
for (OSSFile ossFile : fileInfos) {
|
if(fileInfos.size() != 0){
|
||||||
Map<String,Object> stringMap = new HashMap<>();
|
for (OSSFile ossFile : fileInfos) {
|
||||||
String fileText = "";
|
Map<String,Object> stringMap = new HashMap<>();
|
||||||
if(ossFile.getFileName().endsWith(".doc")
|
String fileText = "";
|
||||||
|| ossFile.getFileName().endsWith(".docx")
|
if(ossFile.getFileName().endsWith(".doc")
|
||||||
|| ossFile.getFileName().endsWith(".DOC")
|
|| ossFile.getFileName().endsWith(".docx")
|
||||||
|| ossFile.getFileName().endsWith(".DOCX")){
|
|| ossFile.getFileName().endsWith(".DOC")
|
||||||
String wordContent = ReadWordUtil.readWord(ossFile.getUrl());
|
|| ossFile.getFileName().endsWith(".DOCX")){
|
||||||
if(StringUtils.isNotBlank(wordContent)){
|
String wordContent = ReadWordUtil.readWord(ossFile.getUrl());
|
||||||
fileText = wordContent;
|
if(StringUtils.isNotBlank(wordContent)){
|
||||||
|
fileText = wordContent;
|
||||||
|
}
|
||||||
|
}else if(ossFile.getFileName().endsWith(".pdf")||ossFile.getFileName().endsWith(".PDF")){
|
||||||
|
String pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl());
|
||||||
|
if(StringUtils.isNotBlank(pdfContent)){
|
||||||
|
fileText = pdfContent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else if(ossFile.getFileName().endsWith(".pdf")||ossFile.getFileName().endsWith(".PDF")){
|
for (OnlCgformField onlCgformField : searchFieldList) {
|
||||||
String pdfContent = ReadPdfUtil.readPdf(ossFile.getUrl());
|
String s = (String) map.get(onlCgformField.getDbFieldName());
|
||||||
if(StringUtils.isNotBlank(pdfContent)){
|
if(StringUtils.isBlank(s)){
|
||||||
fileText = pdfContent;
|
s = "";
|
||||||
|
}
|
||||||
|
stringMap.put(onlCgformField.getDbFieldName(),s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stringMap.put("id",idTemp+ossFile.getId());
|
||||||
|
stringMap.put("module_type", "文档库");
|
||||||
|
stringMap.put("serial_number", map.get("serial_number"));
|
||||||
|
stringMap.put("title", map.get("title"));
|
||||||
|
stringMap.put("content", sb.toString());
|
||||||
|
stringMap.put("file_text",fileText);
|
||||||
|
stringMap.put("file_name",ossFile.getFileName());
|
||||||
|
mapListTemp.add(stringMap);
|
||||||
}
|
}
|
||||||
stringMap.put("id",idTemp+ossFile.getId());
|
}else{
|
||||||
|
Map<String,Object> stringMap = new HashMap<>();
|
||||||
|
for (OnlCgformField onlCgformField : searchFieldList) {
|
||||||
|
String s = (String) map.get(onlCgformField.getDbFieldName());
|
||||||
|
if(StringUtils.isBlank(s)){
|
||||||
|
s = "";
|
||||||
|
}
|
||||||
|
stringMap.put(onlCgformField.getDbFieldName(),s);
|
||||||
|
}
|
||||||
|
stringMap.put("id",idTemp);
|
||||||
stringMap.put("module_type", "文档库");
|
stringMap.put("module_type", "文档库");
|
||||||
stringMap.put("serial_number", map.get("serial_number"));
|
stringMap.put("serial_number", map.get("serial_number"));
|
||||||
stringMap.put("title", map.get("title"));
|
stringMap.put("title", map.get("title"));
|
||||||
stringMap.put("content", sb.toString());
|
stringMap.put("content", sb.toString());
|
||||||
stringMap.put("file_text",fileText);
|
stringMap.put("file_text","");
|
||||||
stringMap.put("file_name",ossFile.getFileName());
|
stringMap.put("file_name","");
|
||||||
mapListTemp.add(stringMap);
|
mapListTemp.add(stringMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("文档库新增es错误");
|
log.error("文档库新增es错误");
|
||||||
}
|
}
|
||||||
@@ -1353,11 +1385,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
//数据值
|
//数据值
|
||||||
StringBuilder valuesBuilder = new StringBuilder();
|
StringBuilder valuesBuilder = new StringBuilder();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
Map<String,Object> mapFullText = new HashMap<>();
|
|
||||||
mapFullText.put("id", id);
|
|
||||||
mapFullText.put("module_type", "文档库");
|
|
||||||
mapFullText.put("serial_number", map.get("serial_number"));
|
|
||||||
mapFullText.put("title", map.get("title"));
|
|
||||||
List<List<String>> fileTextList = new ArrayList<>();
|
List<List<String>> fileTextList = new ArrayList<>();
|
||||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
@@ -1416,23 +1444,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
}
|
}
|
||||||
valuesBuilder.append("'" + value + "'" + ",");
|
valuesBuilder.append("'" + value + "'" + ",");
|
||||||
}
|
}
|
||||||
// //判断文件是否修改
|
|
||||||
// if (ObjectUtils.isNotEmpty(dataList.get(0).get(key)) && !dataList.get(0).get(key).equals(value)) {
|
|
||||||
// String valueTemp = UUID.randomUUID().toString().replace("-", "");
|
|
||||||
// //修改文件表关联信息connect_id
|
|
||||||
// List<OSSFile> oSSFileList = new ArrayList<>();
|
|
||||||
// for (String fileId : value.toString().split(",")) {
|
|
||||||
// OSSFile ossFile = new OSSFile();
|
|
||||||
// ossFile.setId(fileId);
|
|
||||||
// ossFile.setConnectId(valueTemp);
|
|
||||||
// oSSFileList.add(ossFile);
|
|
||||||
// }
|
|
||||||
// iOSSFileService.updateFileInfo(oSSFileList);
|
|
||||||
// valuesBuilder.append("'" + valueTemp + "'" + ",");
|
|
||||||
// } else {
|
|
||||||
// valuesBuilder.append("'" + value + "'" + ",");
|
|
||||||
// }
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//编辑时replaced_standard被代替标准不存值,通过查询得到
|
//编辑时replaced_standard被代替标准不存值,通过查询得到
|
||||||
if ("replaced_standard".equals(key)) {
|
if ("replaced_standard".equals(key)) {
|
||||||
@@ -1445,6 +1456,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
fieldsBuilder.append(key + ",");
|
fieldsBuilder.append(key + ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Map<String,Object> mapFullText = new HashMap<>();
|
||||||
|
mapFullText.put("id", id);
|
||||||
|
mapFullText.put("module_type", "文档库");
|
||||||
|
mapFullText.put("serial_number", map.get("serial_number"));
|
||||||
|
mapFullText.put("title", map.get("title"));
|
||||||
mapFullText.put("file_text", fileTextList);
|
mapFullText.put("file_text", fileTextList);
|
||||||
mapFullText.put("content", sb.toString());
|
mapFullText.put("content", sb.toString());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user