搜索中心--默认展示基础数据

This commit is contained in:
zhn
2022-04-01 14:46:15 +08:00
parent c969e356e1
commit 4818ddca4e
2 changed files with 70 additions and 97 deletions
@@ -127,6 +127,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
@Value(value = "${jero.path.upload}")
private String uploadpath;
public static final String SEARCH_FLAG = "";
/**
* 通过id删除
@@ -1161,11 +1163,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
if (oSSFileList.size() != 0) {
oSSFileAll.addAll(oSSFileList);
//读取word或PDF文件内容
// List<String> list = readFileContent(oSSFileList);
// if(list.size() != 0){
// fileTextList.add(list) ;
// }
}
iOSSFileService.updateFileInfo(oSSFileList);
valuesBuilder.append("," + "'" + valueTemp + "'");
@@ -1184,7 +1181,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
List<Map<String, Object>> mapListTempCn = new ArrayList<>();
List<Map<String, Object>> mapListTempEn = new ArrayList<>();
try {
String cutCn = CutEnum.CN.getValue();
String cutEn = CutEnum.EN.getValue();
if (fileInfos.size() != 0) {
Map<String, Object> mapBaseDateCn = new HashMap<>();
Map<String, Object> mapBaseDateEn = new HashMap<>();
for (OSSFile ossFile : fileInfos) {
Map<String, Object> stringMapCn = new HashMap<>();
Map<String, Object> stringMapEn = new HashMap<>();
@@ -1216,75 +1217,53 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
for (OnlCgformField onlCgformField : searchFieldList) {
String s = (String) map.get(onlCgformField.getDbFieldName());
// if (StringUtils.isBlank(s)) {
// s = "";
// }
if(StringUtils.isNotBlank(s)){
stringMapCn.put(onlCgformField.getDbFieldName(), s);
stringMapEn.put(onlCgformField.getDbFieldName(), s);
}
}
String cutCn = CutEnum.CN.getValue();
String cutEn = CutEnum.EN.getValue();
//封装中文的全文内容(es)
putMapCn(idTemp + ossFile.getId(),
(String) map.get("serial_number"),
"文档库",
sbCn.toString(),
(String) map.get("title"),
fileText,
ossFile.getFileName(),
cutCn,
stringMapCn);
//封装英文的全文内容(es)
putMapCn(idTemp + ossFile.getId(),
(String) map.get("serial_number"),
"document library",
sbEn.toString(),
(String) map.get("title"),
fileText,
ossFile.getFileName(),
cutEn,
stringMapEn);
//文件相关封装中文的全文内容(es)
putMapCn(idTemp + ossFile.getId(), (String) map.get("serial_number"), "文档库",
sbCn.toString(), (String) map.get("title"), fileText,
ossFile.getFileName(), cutCn, stringMapCn, null);
//文件相关封装英文的全文内容(es)
putMapCn(idTemp + ossFile.getId(), (String) map.get("serial_number"), "document library",
sbEn.toString(), (String) map.get("title"), fileText,
ossFile.getFileName(), cutEn, stringMapEn, null);
mapListTempCn.add(stringMapCn);
mapListTempEn.add(stringMapEn);
}
//基础数据(中文)
putMapCn(idTemp, (String) map.get("serial_number"), "文档库",
sbCn.toString(), (String) map.get("title"), "", "",
cutCn, mapBaseDateCn,SEARCH_FLAG);
//基础数据(英文)
putMapCn(idTemp, (String) map.get("serial_number"), "document library",
sbEn.toString(), (String) map.get("title"), "", "",
cutEn, mapBaseDateEn,SEARCH_FLAG);
mapListTempCn.add(mapBaseDateCn);
mapListTempEn.add(mapBaseDateEn);
} else {
Map<String, Object> stringMapCn = new HashMap<>();
Map<String, Object> stringMapEn = new HashMap<>();
for (OnlCgformField onlCgformField : searchFieldList) {
String s = (String) map.get(onlCgformField.getDbFieldName());
// if (StringUtils.isBlank(s)) {
// s = "";
// }
if(StringUtils.isNotBlank(s)){
stringMapCn.put(onlCgformField.getDbFieldName(), s);
stringMapEn.put(onlCgformField.getDbFieldName(), s);
}
}
String cutCn = CutEnum.CN.getValue();
String cutEn = CutEnum.EN.getValue();
//封装中文的全文内容(es)
putMapCn(idTemp,
(String) map.get("serial_number"),
"文档库",
sbCn.toString(),
(String) map.get("title"),
"",
"",
cutCn,
stringMapCn);
(String) map.get("serial_number"), "文档库", sbCn.toString(),
(String) map.get("title"), "", "",
cutCn, stringMapCn, SEARCH_FLAG);
//封装英文的全文内容(es)
putMapCn(idTemp,
(String) map.get("serial_number"),
"document library",
sbEn.toString(),
(String) map.get("title"),
"",
"",
cutEn,
stringMapEn);
putMapCn(idTemp, (String) map.get("serial_number"), "document library", sbEn.toString(),
(String) map.get("title"), "", "",
cutEn, stringMapEn,SEARCH_FLAG);
mapListTempCn.add(stringMapCn);
mapListTempEn.add(stringMapEn);
}
@@ -1706,6 +1685,10 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
List<Map<String, Object>> mapListTempEn = new ArrayList<>();
try {
if (fileInfos.size() != 0) {
String cutCn = CutEnum.CN.getValue();
String cutEn = CutEnum.EN.getValue();
Map<String, Object> mapBaseDateCn = new HashMap<>();
Map<String, Object> mapBaseDateEn = new HashMap<>();
for (OSSFile ossFile : fileInfos) {
Map<String, Object> stringMapCn = new HashMap<>();
Map<String, Object> stringMapEn = new HashMap<>();
@@ -1739,41 +1722,34 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if(FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) && StringUtils.isNotBlank(s)){
s = s.split(" ")[0];
}
// if (StringUtils.isBlank(s)) {
// s = "";
// }
if(StringUtils.isNotBlank(s)){
stringMapCn.put(onlCgformField.getDbFieldName(), s);
stringMapEn.put(onlCgformField.getDbFieldName(), s);
}
}
String cutCn = CutEnum.CN.getValue();
String cutEn = CutEnum.EN.getValue();
//封装中文的全文内容(es)
putMapCn((String) map.get("id") + ossFile.getId(),
(String) map.get("serial_number"),
"文档库",
sbCn.toString(),
(String) map.get("title"),
fileText,
ossFile.getFileName(),
cutCn,
stringMapCn);
putMapCn((String) map.get("id") + ossFile.getId(), (String) map.get("serial_number"), "文档库",
sbCn.toString(), (String) map.get("title"), fileText, ossFile.getFileName(),
cutCn, stringMapCn,null);
//封装英文的全文内容(es)
putMapCn((String) map.get("id") + ossFile.getId(),
(String) map.get("serial_number"),
"document library",
sbEn.toString(),
(String) map.get("title"),
fileText,
ossFile.getFileName(),
cutEn,
stringMapEn);
putMapCn((String) map.get("id") + ossFile.getId(), (String) map.get("serial_number"), "document library",
sbEn.toString(), (String) map.get("title"), fileText, ossFile.getFileName(),
cutEn, stringMapEn,null);
mapListTempCn.add(stringMapCn);
mapListTempEn.add(stringMapEn);
}
//基础数据中文(es)
putMapCn((String) map.get("id"), (String) map.get("serial_number"), "文档库",
sbCn.toString(), (String) map.get("title"), "", "",
cutCn, mapBaseDateCn,SEARCH_FLAG);
//基础数据英文(es)
putMapCn((String) map.get("id"), (String) map.get("serial_number"), "document library",
sbEn.toString(), (String) map.get("title"), "", "",
cutEn, mapBaseDateEn,SEARCH_FLAG);
mapListTempCn.add(mapBaseDateCn);
mapListTempEn.add(mapBaseDateEn);
} else {
Map<String, Object> stringMapCn = new HashMap<>();
Map<String, Object> stringMapEn = new HashMap<>();
@@ -1782,9 +1758,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if(FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) && StringUtils.isNotBlank(s)){
s = s.split(" ")[0];
}
// if (StringUtils.isBlank(s)) {
// s = "";
// }
if(StringUtils.isNotBlank(s)){
stringMapCn.put(onlCgformField.getDbFieldName(), s);
stringMapEn.put(onlCgformField.getDbFieldName(), s);
@@ -1793,25 +1766,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String cutCn = CutEnum.CN.getValue();
String cutEn = CutEnum.EN.getValue();
//封装中文的全文内容(es)
putMapCn((String) map.get("id"),
(String) map.get("serial_number"),
"文档库",
sbCn.toString(),
(String) map.get("title"),
"",
"",
cutCn,
stringMapCn);
putMapCn((String) map.get("id"), (String) map.get("serial_number"), "文档库",
sbCn.toString(), (String) map.get("title"), "", "",
cutCn, stringMapCn,SEARCH_FLAG);
//封装英文的全文内容(es)
putMapCn((String) map.get("id"),
(String) map.get("serial_number"),
"document library",
sbEn.toString(),
(String) map.get("title"),
"",
"",
cutEn,
stringMapEn);
putMapCn((String) map.get("id"), (String) map.get("serial_number"), "document library",
sbEn.toString(), (String) map.get("title"), "", "",
cutEn, stringMapEn,SEARCH_FLAG);
mapListTempCn.add(stringMapCn);
mapListTempEn.add(stringMapEn);
@@ -4082,7 +4043,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
private void putMapCn(String id,String serialNumber,String moduleType,
String content,String title,String fileText,
String fileName,String cut,Map<String, Object> stringMap){
String fileName,String cut,Map<String, Object> stringMap,
String flag){
stringMap.put("id", id);
stringMap.put("serial_number", serialNumber);
stringMap.put("module_type", moduleType);
@@ -4091,6 +4053,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
stringMap.put("file_text", fileText);
stringMap.put("file_name", fileName);
stringMap.put("cut",cut);
stringMap.put("flag",flag);
}
@@ -64,6 +64,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
private IOnlCgformCollectionService iOnlCgformCollectionService;
@Autowired
private IOnlCgformSubscribeService iOnlCgformSubscribeService;
public static final String SEARCH_FLAG = "";
@Override
@@ -303,6 +304,10 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
@Override
public IPage getFullTextInfoList(SearchVO searchVO) {
if(StringUtils.isBlank(searchVO.getSelectValue())){
searchVO.setSelectValue(SEARCH_FLAG);
}
//判断索引是否存在
boolean flagTemp = true;
if(CutEnum.CN.getValue().equals(searchVO.getCut())){
@@ -326,6 +331,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
fieldList.add("content");
fieldList.add("file_name");
fieldList.add("id");
fieldList.add("flag");
JSONArray queryMapJson = new JSONArray();
JSONArray queryMapJsonTwo = new JSONArray();
JSONArray queryMapJsonThree = new JSONArray();
@@ -606,6 +612,9 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
*/
@Override
public IPage getParagraphInfoList(Map<String, Object> map) {
if(ObjectUtils.isEmpty(map.get("mapOne"))){
((Map<String, Object>) map.get("mapOne")).put("flag",SEARCH_FLAG);
}
String cut = (String) map.get("cut");
//module_type 代表文档库的段落
//判断索引是否存在
@@ -627,6 +636,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
.collect(Collectors.toList());
List<String> inputFieldList = inputOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
inputFieldList.add("file_text");//在输入框的类型中添加正文字段
inputFieldList.add("flag");//标识(默认展示基础数据,不展示文件数据)
Map<String, Object> mapOne = (Map<String, Object>) map.get("mapOne");