diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java index a470cf055..b1e328453 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/searchcenter/service/impl/DocumentSearchServiceImpl.java @@ -47,6 +47,7 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -99,6 +100,13 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService { } //删除英文标题 mapList.remove(index); + for (Map map : mapList) { + if("title".equals(map.get("db_field_name")) + && CutEnum.EN.getValue().equals(cut)){ + map.put("db_field_name","title_en"); + } + } + //添加正文 Map map = new HashMap<>(); if(CutEnum.CN.getValue().equals(cut)){ @@ -213,7 +221,7 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService { JSONArray jsonArrySort = new JSONArray(); JSONObject sort = new JSONObject(); Map mapSort = new HashMap<>(); - Map mapSortTemp = new HashMap<>(); + Map mapSortTemp = new LinkedHashMap<>(); if(StringUtils.isNotBlank(orderBy) && StringUtils.isNotBlank(orderByField)){ //orderBy=1正序,orderBy=1倒序 if("1".equals(orderBy)){ @@ -227,10 +235,28 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService { mapSortTemp.put(orderByField,mapSort); } }else{ - mapSortTemp.put("serial_number.keyword","asc"); + if(ObjectUtils.isNotEmpty(((Map) map.get("mapOne")).get("serial_number")) + || ObjectUtils.isNotEmpty(((Map) map.get("mapTwo")).get("serial_number")) + || ObjectUtils.isNotEmpty(((Map) map.get("mapOne")).get("title")) + || ObjectUtils.isNotEmpty(((Map) map.get("mapTwo")).get("title")) + || ObjectUtils.isNotEmpty(((Map) map.get("mapOne")).get("title_en")) + || ObjectUtils.isNotEmpty(((Map) map.get("mapTwo")).get("title_en"))){ + Map score = new HashMap<>(); + score.put("order","desc"); + mapSortTemp.put("_score",score); + +// Map map1 = new HashMap<>(); +// map1.put("order","desc"); +// mapSortTemp.put("serial_number.keyword",map1); + sort = new JSONObject(mapSortTemp); + }else{ + mapSortTemp.put("serial_number.keyword","asc"); + sort.putAll(mapSortTemp); + } +// sort.putAll(mapSortTemp); // mapSortTemp.put("create_time","desc"); } - sort.putAll(mapSortTemp); + jsonArrySort.add(sort); //封装查询条件 @@ -330,26 +356,67 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService { String value = (String) entry.getValue(); if (ObjectUtils.isNotEmpty(value)) { for (String s : value.split(",")) { - Map map = new HashMap<>(); - Map queryMap = new HashMap<>(); - Map queryMapTemp = new HashMap<>(); + JSONArray should = new JSONArray(); + s = s.toLowerCase(); + if(s.contains(" ")){ + for (String valueTemp : s.split(" ")) { + Map mapTemp = new HashMap(); + mapTemp.put(key,"*"+valueTemp+"*"); + Map map1 = new HashMap<>(); + map1.put("wildcard",mapTemp); + should.add(map1); + } + JSONObject jsonObject = jeroElasticsearchTemplate.buildBoolQuery(null, null, should); + must.add(jsonObject); + }else{ + Map map = new HashMap<>(); + Map queryMap = new HashMap<>(); + Map queryMapTemp = new HashMap<>(); - if (key.equals("serial_number")){ - s = s.toLowerCase(); - queryMap.put(key, "*" + s + "*"); - map.put("wildcard", queryMap); - } else { - s = s.toLowerCase(); - queryMapTemp.put("query", s); - queryMapTemp.put("minimum_should_match", 2); - queryMap.put(key, queryMapTemp); - map.put("match",queryMap); + if (key.equals("serial_number")){ + s = s.toLowerCase(); + queryMap.put(key, "*" + s + "*"); + map.put("wildcard", queryMap); + } else { + s = s.toLowerCase(); + queryMapTemp.put("query", s); + queryMapTemp.put("minimum_should_match", 2); + queryMap.put(key, queryMapTemp); + map.put("match",queryMap); + } + must.add(map); } - must.add(map); } } } } + //封装输入框查询条件 +// if (ObjectUtils.isNotEmpty(inputMap)) { +// for (Map.Entry entry : inputMap.entrySet()) { +// String key = entry.getKey(); +// String value = (String) entry.getValue(); +// if (ObjectUtils.isNotEmpty(value)) { +// for (String s : value.split(",")) { +// Map map = new HashMap<>(); +// Map queryMap = new HashMap<>(); +// Map queryMapTemp = new HashMap<>(); +// +// if (key.equals("serial_number")){ +// s = s.toLowerCase(); +// queryMap.put(key, "*" + s + "*"); +// map.put("wildcard", queryMap); +// } else { +// s = s.toLowerCase(); +// queryMapTemp.put("query", s); +// queryMapTemp.put("minimum_should_match", 2); +// queryMap.put(key, queryMapTemp); +// map.put("match",queryMap); +// } +// must.add(map); +// } +// } +// } +// } //封装下拉,树形查询条件 if (ObjectUtils.isNotEmpty(otherMap)) { for (Map.Entry entry : otherMap.entrySet()) { diff --git a/jero-web/src/views/documentTools/searchCenter/components/DocumentLibrary.vue b/jero-web/src/views/documentTools/searchCenter/components/DocumentLibrary.vue index a703aee1f..d68268d33 100644 --- a/jero-web/src/views/documentTools/searchCenter/components/DocumentLibrary.vue +++ b/jero-web/src/views/documentTools/searchCenter/components/DocumentLibrary.vue @@ -62,7 +62,8 @@
{{$t('reset')}} - {{$t('query')}} + {{$t('query')}} +
@@ -106,13 +107,29 @@ {{$t('Push')}} - + + + + + + - + + + + + + + @@ -246,7 +263,7 @@ components: { libraryPush }, - mixins:[ResizeHeader, ResizeColumnProvide], + mixins: [ResizeHeader, ResizeColumnProvide], data() { return { searchOption: [], @@ -363,7 +380,7 @@ searchQueryOne: {}, orderBy: '1', orderByField: '', - language:localStorage.getItem('language'), + language: localStorage.getItem('language') } }, watch: { @@ -632,10 +649,15 @@ postAction(this.url.getInfoList, query).then((res) => { if (res.success) { this.dataSource = res.result.records + let text = this.queryParam[this.selectModel] ? this.queryParam[this.selectModel].split(' ') : [] this.dataSource.forEach((val) => { - if (val[this.selectModel] && val[this.selectModel].includes(this.queryParam[this.selectModel])) { - val[this.selectModel] = val[this.selectModel].replace(this.queryParam[this.selectModel], `${this.queryParam[this.selectModel]}`) - } + text.forEach(ol => { + // if (val[this.selectModel] && val[this.selectModel].includes(ol)) { + if (val[this.selectModel]) { + val[this.selectModel] = val[this.selectModel].replace(ol, `${ol}`) + } + // } + }) }) this.total = res.result.total this.loading = false @@ -703,7 +725,7 @@ } else if (fileSuffix == '.xlsx' || fileSuffix == '.xls') { let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.id + fileSuffix) window.open(url, '_blank') - }else if(fileSuffix == '.png' || fileSuffix == '.jpeg' || fileSuffix == '.gif' || fileSuffix == '.jpg'){ + } else if (fileSuffix == '.png' || fileSuffix == '.jpeg' || fileSuffix == '.gif' || fileSuffix == '.jpg') { let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadImgUrl + '/' + fileQuery.id + fileSuffix) window.open(url, '_blank') } else { @@ -741,7 +763,7 @@ }