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

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