Merge branch 'develop_master' into FOTON

This commit is contained in:
super_liu
2022-05-20 17:52:47 +08:00
2 changed files with 33 additions and 1 deletions
@@ -1253,6 +1253,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
searchRequestBuilder = client.prepareSearch("fulltextserch")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.highlighter(hiBuilder)
.addSort("sortTitle.keyword",SortOrder.ASC)
.addSort("issue_time_order",SortOrder.DESC)
.setFrom((searchInfoEO.getPage()-1)*searchInfoEO.getPageSize())
.setSize(searchInfoEO.getPageSize());
@@ -4,6 +4,8 @@ import com.adc.da.search.entity.FullTextSearchEO;
import com.adc.da.search.entity.StandLawsEO;
import com.adc.da.search.service.ElasticsearchService;
import com.adc.da.search.service.StandLawsSearchService;
import com.adc.da.sys.dao.DicTypeEODao;
import com.adc.da.sys.entity.DicTypeEO;
import com.adc.da.util.DateUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@@ -15,9 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Component
public class StandLawsSearchServiceImpl implements StandLawsSearchService {
@@ -34,6 +36,9 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
client = this.transportClient;
}
@Autowired
private DicTypeEODao dicTypeEODao;
@Autowired
private ElasticsearchService elasticsearchService;
@@ -124,6 +129,13 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
}
Map<String,Object> getFullTextSearchForMap(Map<String,Object> attrInfoMap){
//查询字典表,形成Hash映射提升速度
List<DicTypeEO> dicInfo = dicTypeEODao.getDicInfo("dic_id","dic_type_code", "dic_type_name","show_index");
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));
boolean isForeign = false;
Map<String,Object> fullTextSearchEO = new HashMap<>();
Map<String,String> mapItems = new TreeMap<>();
@@ -222,9 +234,16 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
}
}
}
contentBuilder.append("标准文本: ").append(attrInfoMap.get("content")).append(" ");
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
fullTextSearchEO.put("textContent",textContent.toString());
if ("FOREIGN".equals(String.valueOf(attrInfoMap.get("standType")))){
fullTextSearchEO.put("standTypeOrder","2");
}else {
fullTextSearchEO.put("standTypeOrder","1");
}
fullTextSearchEO.put("standSortOrder",esStateOrder(String.valueOf(attrInfoMap.get("standSort")),dicMap));
fullTextSearchEO.put("yearOrder", String.valueOf(attrInfoMap.get("standYear")));
fullTextSearchEO.put("sortTitle", String.valueOf(attrInfoMap.get("standSort")));
fullTextSearchEO.put("numberTitle", String.valueOf(attrInfoMap.get("standNumber")));
@@ -302,6 +321,8 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
contentBuilder.append("标准文本: ").append(attrInfoMap.get("content")).append(" ");
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
fullTextSearchEO.put("textContent",textContent.toString());
fullTextSearchEO.put("standTypeOrder","4");
fullTextSearchEO.put("standSortOrder",esStateOrder(String.valueOf(attrInfoMap.get("lawsTypeName")),dicMap));
fullTextSearchEO.put("yearOrder", String.valueOf(attrInfoMap.get("lawsYearName")));
fullTextSearchEO.put("sortTitle", String.valueOf(attrInfoMap.get("lawsTypeName")));
fullTextSearchEO.put("numberTitle", String.valueOf(attrInfoMap.get("lawsNumber")));
@@ -360,6 +381,8 @@ public class StandLawsSearchServiceImpl implements StandLawsSearchService {
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
fullTextSearchEO.put("textContent",textContent.toString());
fullTextSearchEO.put("standTypeOrder","3");
fullTextSearchEO.put("standSortOrder",esStateOrder(String.valueOf(attrInfoMap.get("standSort")),dicMap));
fullTextSearchEO.put("yearOrder", String.valueOf(attrInfoMap.get("standYear")));
fullTextSearchEO.put("sortTitle", String.valueOf(attrInfoMap.get("standSort")));
fullTextSearchEO.put("numberTitle", String.valueOf(attrInfoMap.get("standNumber")));
@@ -376,6 +399,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()));
}else {
return "99999";
}
}
private String dateFormatToStr(String dateStr){
if(dateStr == null || dateStr.equals("")){
return "";