Merge branch 'develop_migration' into 'develop_master'
Develop migration See merge request LiuChao/foton-slrs-system-rest!526
This commit is contained in:
+15
-16
@@ -220,27 +220,26 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
String sortField2 = "";
|
||||
String sortField3 = "";
|
||||
if("laws".equals(searchInfoEO.getSelectIndex())){
|
||||
sortField = "lawsYear";
|
||||
sortField1 = "lawsType";
|
||||
sortField2 = "lawsNumber";
|
||||
sortField1 = "lawsNumber";
|
||||
sortField2 = "lawsYear";
|
||||
sortField3 = "lawsType.keyword";
|
||||
}else {
|
||||
sortField = "standYear";
|
||||
sortField1 = "standSort";
|
||||
sortField2 = "standNumber";
|
||||
sortField1 = "standNumber";
|
||||
sortField2 = "standYear";
|
||||
sortField3 = "standSort.keyword";
|
||||
}
|
||||
searchRequestBuilder = client.prepareSearch(searchInfoEO.getSelectIndex())
|
||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||
.setFrom((searchInfoEO.getPage()-1)*searchInfoEO.getPageSize())
|
||||
.addSort(new ScoreSortBuilder().order(SortOrder.DESC))
|
||||
.addSort("standSortOrder", SortOrder.ASC)
|
||||
.addSort(sortField1, SortOrder.ASC)
|
||||
.addSort(sortField2, SortOrder.ASC)
|
||||
.addSort(sortField, SortOrder.DESC)
|
||||
.addSort(sortField2, SortOrder.DESC)
|
||||
.addSort(sortField3, SortOrder.ASC)
|
||||
.addSort("issue_time_data", SortOrder.DESC)
|
||||
.setSize(searchInfoEO.getPageSize());
|
||||
|
||||
if(StringUtils.isNotBlank(searchInfoEO.getSelectType()) && !"titleSearch".equals(searchInfoEO.getSelectType())) {
|
||||
if(StringUtils.isNotBlank(searchInfoEO.getSelectIndex())) {
|
||||
if(searchInfoEO.getSelectIndex().equals("stand")) {
|
||||
boolQueryShould = queryStandMsg(searchInfoEO,boolQueryMust,searchRequestBuilder);
|
||||
} else if(searchInfoEO.getSelectIndex().equals("laws")){
|
||||
@@ -1472,10 +1471,10 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
// }
|
||||
// }
|
||||
boolQueryShould
|
||||
.should(QueryBuilders.wildcardQuery("sortTitle.keyword", searchInfoEO.getSelectValue().toUpperCase() + "*").boost(1005f))
|
||||
.should(QueryBuilders.wildcardQuery("numberTitle.keyword", searchInfoEO.getSelectValue().toUpperCase() + "*").boost(1004f))
|
||||
.should(QueryBuilders.wildcardQuery("yearOrder.keyword", searchInfoEO.getSelectValue().toUpperCase() + "*").boost(1003f))
|
||||
.should(QueryBuilders.wildcardQuery("nameTitle.keyword", "*" + searchInfoEO.getSelectValue().toUpperCase() + "*").boost(1002f))
|
||||
.should(QueryBuilders.wildcardQuery("sortTitle.keyword", searchInfoEO.getSelectValue().toUpperCase()).boost(1005f))
|
||||
.should(QueryBuilders.termQuery("numberTitle", searchInfoEO.getSelectValue().toUpperCase()).boost(1004f))
|
||||
.should(QueryBuilders.wildcardQuery("yearOrder.keyword", searchInfoEO.getSelectValue().toUpperCase()).boost(1003f))
|
||||
.should(QueryBuilders.wildcardQuery("nameTitle.keyword", searchInfoEO.getSelectValue().toUpperCase()).boost(1002f))
|
||||
.should(QueryBuilders.wildcardQuery("title.keyword", "*" + searchInfoEO.getSelectValue().toUpperCase() + "*").boost(1000f));
|
||||
// queryBuilder1 = QueryBuilders.multiMatchQuery(searchInfoEO.getSelectValue(),
|
||||
// "sortTitle","numberTitle","yearOrder","nameTitle","title"
|
||||
@@ -1520,11 +1519,11 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
searchRequestBuilder = client.prepareSearch("fulltextserch")
|
||||
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
|
||||
.highlighter(hiBuilder)
|
||||
// .addSort(new ScoreSortBuilder().order(SortOrder.DESC))
|
||||
.addSort(new ScoreSortBuilder().order(SortOrder.DESC))
|
||||
.addSort("standTypeOrder",SortOrder.ASC)
|
||||
.addSort("standSortOrder",SortOrder.ASC)
|
||||
// .addSort("numberTitle.keyword",SortOrder.ASC)
|
||||
.addSort("yearOrder",SortOrder.DESC)
|
||||
.addSort("numberTitle",SortOrder.ASC)
|
||||
.addSort("yearOrder.keyword",SortOrder.DESC)
|
||||
.addSort("sortTitle.keyword",SortOrder.ASC)
|
||||
.setFrom((searchInfoEO.getPage()-1)*searchInfoEO.getPageSize())
|
||||
.setSize(searchInfoEO.getPageSize());
|
||||
|
||||
+18
-3
@@ -151,6 +151,13 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
|
||||
|
||||
//查询字典表,形成Hash映射提升速度
|
||||
List<DicTypeEO> dicInfo = dicTypeEODao.getDicInfo("dic_id","dic_type_code", "dic_type_name","show_index");
|
||||
dicInfo = dicInfo.stream().filter(dicTypeEO -> {
|
||||
if(StringUtils.isNotBlank(dicTypeEO.getDicTypeCode())){
|
||||
dicTypeEO.setDicTypeCode(dicTypeEO.getDicTypeCode().replace(" ",""));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
Map<String, Integer> dicMap = dicInfo.stream()
|
||||
.filter(item-> ("2klxdk7fo3tvpvin70dk".equals(item.getDicId()) || "18mg1g4x0rwubcto7fdd".equals(item.getDicId()) || "08rerbsn8ucjfk13z2ci".equals(item.getDicId()) || "pnv0ik979yqogocqujwo".equals(item.getDicId())) && !item.getDicTypeCode().isEmpty())
|
||||
.collect(Collectors.toMap(DicTypeEO::getDicTypeCode,DicTypeEO::getShowIndex,(value1, value2 )->value2));
|
||||
@@ -267,6 +274,7 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
|
||||
fullTextSearchEO.put("sortTitle", String.valueOf(attrInfoMap.get("standSort")));
|
||||
fullTextSearchEO.put("numberTitle", String.valueOf(attrInfoMap.get("standNumber")));
|
||||
fullTextSearchEO.put("nameTitle", String.valueOf(attrInfoMap.get("standName")));
|
||||
fullTextSearchEO.put("nameEnTitle", String.valueOf(attrInfoMap.get("standEnName")));
|
||||
fullTextSearchEO.put("textStatusFull", attrInfoMap.getOrDefault("textStatusName",""));
|
||||
|
||||
|
||||
@@ -348,6 +356,7 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
|
||||
fullTextSearchEO.put("sortTitle", String.valueOf(attrInfoMap.get("lawsTypeName")));
|
||||
fullTextSearchEO.put("numberTitle", String.valueOf(attrInfoMap.get("lawsNumber")));
|
||||
fullTextSearchEO.put("nameTitle", String.valueOf(attrInfoMap.get("lawsName")));
|
||||
fullTextSearchEO.put("nameEnTitle", String.valueOf(attrInfoMap.get("lawsEnName")));
|
||||
fullTextSearchEO.put("textStatusFull", attrInfoMap.getOrDefault("lawsTextStateName",""));
|
||||
|
||||
|
||||
@@ -410,6 +419,7 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
|
||||
fullTextSearchEO.put("sortTitle", String.valueOf(attrInfoMap.get("standSort")));
|
||||
fullTextSearchEO.put("numberTitle", String.valueOf(attrInfoMap.get("standNumber")));
|
||||
fullTextSearchEO.put("nameTitle", String.valueOf(attrInfoMap.get("stand_name")));
|
||||
fullTextSearchEO.put("nameEnTitle", String.valueOf(attrInfoMap.get("stand_en_name")));
|
||||
fullTextSearchEO.put("textStatusFull", attrInfoMap.getOrDefault("textStatusBussName",""));
|
||||
|
||||
if (null != attrInfoMap.get("issueTime") && !"".equals(attrInfoMap.get("issueTime")) && !"null".equals(attrInfoMap.get("issueTime"))) {
|
||||
@@ -423,9 +433,14 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
|
||||
return fullTextSearchEO;
|
||||
}
|
||||
|
||||
private String esStateOrder(String data, Map<String,Integer> dicMap){
|
||||
if(StringUtils.isNotBlank(data) && dicMap.get(data.toUpperCase()) != null){
|
||||
return String.valueOf(dicMap.get(data.toUpperCase()));
|
||||
private String esStateOrder(String data, Map<String, Integer> dicMap){
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
data = data.replace(" ","");
|
||||
if(dicMap.get(data.trim().toUpperCase()) != null){
|
||||
return String.valueOf(dicMap.get(data.trim().toUpperCase()));
|
||||
}else {
|
||||
return "99999";
|
||||
}
|
||||
}else {
|
||||
return "99999";
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.sys.entity.DicTypeEO;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import net.sf.json.JSONObject;
|
||||
@@ -121,7 +122,22 @@ public class SendBussMQService {
|
||||
saveMap.put("put_time_data",-1000000000000000000L);
|
||||
}
|
||||
|
||||
//查询字典表,形成Hash映射提升速度
|
||||
List<DicTypeEO> dicInfo = dicTypeEODao.getDicInfo("dic_id","dic_type_code", "dic_type_name","show_index");
|
||||
dicInfo = dicInfo.stream().filter(dicTypeEO -> {
|
||||
if(org.apache.commons.lang3.StringUtils.isNotBlank(dicTypeEO.getDicTypeCode())){
|
||||
dicTypeEO.setDicTypeCode(dicTypeEO.getDicTypeCode().replace(" ",""));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
Map<String, Integer> dicMap = dicInfo.stream()
|
||||
.filter(item-> ("2klxdk7fo3tvpvin70dk".equals(item.getDicId()) || "18mg1g4x0rwubcto7fdd".equals(item.getDicId()) || "08rerbsn8ucjfk13z2ci".equals(item.getDicId()) || "pnv0ik979yqogocqujwo".equals(item.getDicId())) && !item.getDicTypeCode().isEmpty())
|
||||
.collect(Collectors.toMap(DicTypeEO::getDicTypeCode,DicTypeEO::getShowIndex,(value1, value2 )->value2));
|
||||
|
||||
|
||||
saveMap.put("id",infoEO.getId());
|
||||
saveMap.put("standSortOrder",esStateOrder(String.valueOf(infoEO.getStandSort()),dicMap));
|
||||
saveMap.put("standSort",infoEO.getStandSort());
|
||||
saveMap.put("stand_sort",infoEO.getStandSort());
|
||||
if(StringUtils.isNotEmpty(infoEO.getStandSort())){
|
||||
@@ -217,6 +233,19 @@ public class SendBussMQService {
|
||||
}
|
||||
}
|
||||
|
||||
private String esStateOrder(String data, Map<String, Integer> dicMap){
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
data = data.replace(" ","");
|
||||
if(dicMap.get(data.trim().toUpperCase()) != null){
|
||||
return String.valueOf(dicMap.get(data.trim().toUpperCase()));
|
||||
}else {
|
||||
return "99999";
|
||||
}
|
||||
}else {
|
||||
return "99999";
|
||||
}
|
||||
}
|
||||
|
||||
private String filterStringIsNotBlank(String str,boolean boo){
|
||||
String f = ",";
|
||||
return (str == null || str.equals("") || str.equals("null")) ? "" : (boo ? str+f : str);
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.adc.da.slrs.sarLawsStandInfo.entity.SarLawsStandInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.sys.entity.DicTypeEO;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.rabbitmq.client.Channel;
|
||||
@@ -85,6 +86,20 @@ public class SendLawsMQService {
|
||||
FZRQFSRQ = "1";
|
||||
}
|
||||
|
||||
//查询字典表,形成Hash映射提升速度
|
||||
List<DicTypeEO> dicInfo = dicTypeEODao.getDicInfo("dic_id","dic_type_code", "dic_type_name","show_index");
|
||||
dicInfo = dicInfo.stream().filter(dicTypeEO -> {
|
||||
if(org.apache.commons.lang3.StringUtils.isNotBlank(dicTypeEO.getDicTypeCode())){
|
||||
dicTypeEO.setDicTypeCode(dicTypeEO.getDicTypeCode().replace(" ",""));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
Map<String, Integer> dicMap = dicInfo.stream()
|
||||
.filter(item-> ("2klxdk7fo3tvpvin70dk".equals(item.getDicId()) || "18mg1g4x0rwubcto7fdd".equals(item.getDicId()) || "08rerbsn8ucjfk13z2ci".equals(item.getDicId()) || "pnv0ik979yqogocqujwo".equals(item.getDicId())) && !item.getDicTypeCode().isEmpty())
|
||||
.collect(Collectors.toMap(DicTypeEO::getDicTypeCode,DicTypeEO::getShowIndex,(value1, value2 )->value2));
|
||||
|
||||
|
||||
String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr();
|
||||
Map<String,Object> attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr);
|
||||
Map<String,Object> infoMap = infoEO.getAttrInfoCaseMap();
|
||||
@@ -151,6 +166,7 @@ public class SendLawsMQService {
|
||||
List<String> valArr = Arrays.asList(infoEO.getLawsType().split(","));
|
||||
lawsTypeName = dicTypeEODao.getDicNamesByCodes(valArr,"");
|
||||
}
|
||||
saveMap.put("standSortOrder",esStateOrder(infoEO.getLawsType(),dicMap));
|
||||
saveMap.put("lawsType",infoEO.getLawsType());
|
||||
saveMap.put("lawsTypeName",lawsTypeName);
|
||||
saveMap.put("lawsNumber",infoEO.getLawsNumber());
|
||||
@@ -266,6 +282,19 @@ public class SendLawsMQService {
|
||||
}
|
||||
}
|
||||
|
||||
private String esStateOrder(String data, Map<String, Integer> dicMap){
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
data = data.replace(" ","");
|
||||
if(dicMap.get(data.trim().toUpperCase()) != null){
|
||||
return String.valueOf(dicMap.get(data.trim().toUpperCase()));
|
||||
}else {
|
||||
return "99999";
|
||||
}
|
||||
}else {
|
||||
return "99999";
|
||||
}
|
||||
}
|
||||
|
||||
private String filterStringIsNotBlank(String str,boolean boo){
|
||||
String f = ",";
|
||||
return (str == null || str.equals("") || str.equals("null")) ? "" : (boo ? str+f : str);
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.sys.entity.DicTypeEO;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import net.sf.json.JSONObject;
|
||||
@@ -87,6 +88,20 @@ public class SendStandMQService {
|
||||
Map<String,Object> infoMap = infoEO.getAttrInfoMap();
|
||||
Map<String,String> infoEOMapItems = infoEO.getMapItems();
|
||||
|
||||
//查询字典表,形成Hash映射提升速度
|
||||
List<DicTypeEO> dicInfo = dicTypeEODao.getDicInfo("dic_id","dic_type_code", "dic_type_name","show_index");
|
||||
dicInfo = dicInfo.stream().filter(dicTypeEO -> {
|
||||
if(org.apache.commons.lang3.StringUtils.isNotBlank(dicTypeEO.getDicTypeCode())){
|
||||
dicTypeEO.setDicTypeCode(dicTypeEO.getDicTypeCode().replace(" ",""));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
Map<String, Integer> dicMap = dicInfo.stream()
|
||||
.filter(item-> ("2klxdk7fo3tvpvin70dk".equals(item.getDicId()) || "18mg1g4x0rwubcto7fdd".equals(item.getDicId()) || "08rerbsn8ucjfk13z2ci".equals(item.getDicId()) || "pnv0ik979yqogocqujwo".equals(item.getDicId())) && !item.getDicTypeCode().isEmpty())
|
||||
.collect(Collectors.toMap(DicTypeEO::getDicTypeCode,DicTypeEO::getShowIndex,(value1, value2 )->value2));
|
||||
|
||||
|
||||
// 往索引表中插入数据
|
||||
String getCodeName = "";
|
||||
Map<String,Object> saveMap = new HashMap<>();
|
||||
@@ -101,6 +116,7 @@ public class SendStandMQService {
|
||||
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getCountry(),"RFRFRFSCXVB");
|
||||
saveMap.put("countryShow",codeName);
|
||||
}
|
||||
saveMap.put("standSortOrder",esStateOrder(String.valueOf(infoEO.getStandSort()),dicMap));
|
||||
saveMap.put("standSort",infoEO.getStandSort());
|
||||
saveMap.put("stand_sort",infoEO.getStandSort());
|
||||
if (StringUtils.isNotEmpty(infoEO.getStandSort())) {
|
||||
@@ -252,6 +268,19 @@ public class SendStandMQService {
|
||||
}
|
||||
}
|
||||
|
||||
private String esStateOrder(String data, Map<String, Integer> dicMap){
|
||||
if(StringUtils.isNotBlank(data)){
|
||||
data = data.replace(" ","");
|
||||
if(dicMap.get(data.trim().toUpperCase()) != null){
|
||||
return String.valueOf(dicMap.get(data.trim().toUpperCase()));
|
||||
}else {
|
||||
return "99999";
|
||||
}
|
||||
}else {
|
||||
return "99999";
|
||||
}
|
||||
}
|
||||
|
||||
private String filterStringIsNotBlank(String str,boolean boo){
|
||||
String f = ",";
|
||||
return (str == null || str.equals("") || str.equals("null")) ? "" : (boo ? str+f : str);
|
||||
|
||||
@@ -3,6 +3,9 @@ bussstand/bussstand/_mapping?pretty&include_type_name=true
|
||||
{
|
||||
"bussstand": {
|
||||
"properties": {
|
||||
"standSortOrder": {
|
||||
"type": "integer"
|
||||
},
|
||||
"BARQ": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
|
||||
@@ -52,16 +52,7 @@ fulltextserch/fulltextserch/_mapping?pretty&include_type_name=true
|
||||
"fielddata": true
|
||||
},
|
||||
"numberTitle": {
|
||||
"type": "text",
|
||||
"analyzer": "ik_max_word",
|
||||
"search_analyzer": "ik_max_word",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
},
|
||||
"fielddata": true
|
||||
"type": "integer"
|
||||
},
|
||||
"nameTitle": {
|
||||
"type": "text",
|
||||
|
||||
@@ -3,6 +3,9 @@ laws/laws/_mapping?pretty&include_type_name=true
|
||||
{
|
||||
"laws": {
|
||||
"properties": {
|
||||
"standSortOrder": {
|
||||
"type": "integer"
|
||||
},
|
||||
"BDTWJHLAWS": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
|
||||
@@ -3,6 +3,9 @@ stand/stand/_mapping?pretty&include_type_name=true
|
||||
{
|
||||
"stand": {
|
||||
"properties": {
|
||||
"standSortOrder": {
|
||||
"type": "integer"
|
||||
},
|
||||
"BARQ": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
索引/_update_by_query
|
||||
|
||||
{
|
||||
"script": {
|
||||
"source": "ctx._source['standSortOrder']=51"
|
||||
},
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"match": {
|
||||
"sortTitle.keyword": "QC/T"
|
||||
}
|
||||
}
|
||||
],
|
||||
"must_not": [],
|
||||
"should": []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
根据是否存在"ipsub"字段,如果不存在,给信息增加字段"ipsub",并且赋值0
|
||||
POST my_index / _update_by_query
|
||||
|
||||
{
|
||||
"script": {
|
||||
"source": "ctx._source['standSortOrder']=0"
|
||||
},
|
||||
"query": {
|
||||
"bool": {
|
||||
"must_not": [{
|
||||
"exists": {
|
||||
"field": "standSortOrder"
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user