文档库--编辑添加es
This commit is contained in:
+83
-6
@@ -393,6 +393,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList(onlCgformArea);
|
||||
//字段属性
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
//文件类型字段
|
||||
List<OnlCgformField> fieldFileList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
//过滤出字段为树形结构的
|
||||
|
||||
if (fieldList.size() != 0) {
|
||||
@@ -1055,7 +1057,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
// mapFullText.put("content", sb.toString());
|
||||
//多文件es iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ","));
|
||||
List<String> fileIdList = oSSFileAll.stream().map(OSSFile::getId).collect(Collectors.toList());
|
||||
|
||||
List<OSSFile> fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ","));
|
||||
List<Map<String,Object>> mapListTemp = new ArrayList<>();
|
||||
try {
|
||||
@@ -1343,6 +1344,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
map.remove("corresponding_standard_id");
|
||||
//字段属性
|
||||
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> fieldDateList = fieldList.stream()
|
||||
.filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
@@ -1389,6 +1392,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
List<List<String>> fileTextList = new ArrayList<>();
|
||||
List<OSSFile> oSSFileAll = new ArrayList<>();
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
@@ -1426,11 +1430,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
oSSFileList.add(ossFile);
|
||||
}
|
||||
if(oSSFileList.size() != 0){
|
||||
oSSFileAll.addAll(oSSFileList);
|
||||
//读取word或PDF文件内容
|
||||
List<String> list = readFileContent(oSSFileList);
|
||||
if(list.size() != 0){
|
||||
fileTextList.add(list) ;
|
||||
}
|
||||
// List<String> list = readFileContent(oSSFileList);
|
||||
// if(list.size() != 0){
|
||||
// fileTextList.add(list) ;
|
||||
// }
|
||||
}
|
||||
iOSSFileService.updateFileInfo(oSSFileList);
|
||||
valuesBuilder.append("'" + valueTemp + "'" + ",");
|
||||
@@ -1466,6 +1471,68 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
mapFullText.put("file_text", fileTextList);
|
||||
mapFullText.put("content", sb.toString());
|
||||
|
||||
List<String> fileIdList = oSSFileAll.stream().map(OSSFile::getId).collect(Collectors.toList());
|
||||
List<OSSFile> fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ","));
|
||||
List<Map<String,Object>> mapListTemp = new ArrayList<>();
|
||||
try {
|
||||
if(fileInfos.size() != 0){
|
||||
for (OSSFile ossFile : fileInfos) {
|
||||
Map<String,Object> stringMap = new HashMap<>();
|
||||
String fileText = "";
|
||||
if(ossFile.getFileName().endsWith(".doc")
|
||||
|| ossFile.getFileName().endsWith(".docx")
|
||||
|| ossFile.getFileName().endsWith(".DOC")
|
||||
|| ossFile.getFileName().endsWith(".DOCX")){
|
||||
String wordContent = ReadWordUtil.readWord(ossFile.getUrl());
|
||||
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;
|
||||
}
|
||||
}
|
||||
for (OnlCgformField onlCgformField : searchFieldList) {
|
||||
String s = (String) map.get(onlCgformField.getDbFieldName());
|
||||
if(StringUtils.isBlank(s)){
|
||||
s = "";
|
||||
}
|
||||
stringMap.put(onlCgformField.getDbFieldName(),s);
|
||||
}
|
||||
|
||||
stringMap.put("id",(String) map.get("id")+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);
|
||||
}
|
||||
}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",(String) map.get("id"));
|
||||
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","");
|
||||
stringMap.put("file_name","");
|
||||
mapListTemp.add(stringMap);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("文档库新增es错误");
|
||||
}
|
||||
|
||||
String insertField = fieldsBuilder.substring(0, fieldsBuilder.length() - 1);
|
||||
String insertValue = valuesBuilder.substring(0, valuesBuilder.length() - 1);
|
||||
|
||||
@@ -2937,9 +3004,16 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
//查询文档
|
||||
List<Map<String, Object>> mapList = bussDocumentLibraryEOMapper.selectMapsAll(documentIds);
|
||||
List<String> serialNumberList = new ArrayList<>();
|
||||
List<String> hrefList = new ArrayList<>();
|
||||
for (Map<String, Object> map : mapList) {
|
||||
serialNumberList.add((String) map.get("serial_number"));
|
||||
String href = "<a href='/docManage/library/detail?id:" + (String) map.get("id") +
|
||||
"&title:" + (String) map.get("title") +
|
||||
"&serial_number:" + (String) map.get("serial_number") + "'" + " target='_blank'>" + (String) map.get("serial_number") + "</a>,";
|
||||
hrefList.add(href);
|
||||
}
|
||||
|
||||
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String content = sysUser.getRealname() + "向内推送了" + StringUtils.join(serialNumberList, ",") + ",请注意查看。";
|
||||
String contentInfo = sysUser.getRealname() + "向内推送了" + StringUtils.join(serialNumberList, ",") + ",请注意查看。";
|
||||
@@ -2948,7 +3022,10 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
||||
//飞书
|
||||
try {
|
||||
iFeishuService.batchSendMessage(new String[thirdIdList.size()], content, "转发推送", null);
|
||||
for (String s : hrefList) {
|
||||
String msg = sysUser.getRealname() + "推送了" + s;
|
||||
iFeishuService.batchSendMessage(new String[thirdIdList.size()], content, "转发推送", msg);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("飞书推送失败");
|
||||
}
|
||||
|
||||
+2
-2
@@ -380,11 +380,11 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
|
||||
IPage page = new Page(searchVO.getPage(), searchVO.getPageSize());
|
||||
if (StringUtils.isNotBlank(selectValueTwo)) {
|
||||
//二次搜索的结果
|
||||
page.setTotal(Long.parseLong(String.valueOf(mapListTwo.size())));
|
||||
page.setTotal(Long.parseLong(String.valueOf(((Map) search.get("hits")).get("total"))));
|
||||
page.setRecords(mapListTwo);
|
||||
} else {
|
||||
//首次搜索的结果
|
||||
page.setTotal(Long.parseLong(String.valueOf(mapList.size())));
|
||||
page.setTotal(Long.parseLong(String.valueOf(((Map) search.get("hits")).get("total"))));
|
||||
page.setRecords(mapList);
|
||||
}
|
||||
return page;
|
||||
|
||||
Reference in New Issue
Block a user