fix:79203

This commit is contained in:
梁琦涛
2023-12-11 21:40:56 +08:00
parent 846cfa6640
commit d846817bd8
@@ -571,9 +571,10 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
objVO.setItemText(dict.getText());
objVO.setItemValue(dict.getValue());
if(!CollectionUtils.isEmpty(list)){
Optional<LawsHomeNormalSearchCountVO> op = list.stream().filter(o -> !StringUtils.isBlank(o.getDict()) && Arrays.asList(o.getDict().split(",")).contains(dict.getValue()) && Objects.equals(o.getFieldName(),data)).findFirst();
if(op.isPresent()){
objVO.setStatisticsCount(op.get().getCount());
List<LawsHomeNormalSearchCountVO> opList = list.stream().filter(o -> !StringUtils.isBlank(o.getDict()) && Arrays.asList(o.getDict().split(",")).contains(dict.getValue()) && Objects.equals(o.getFieldName(),data)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(opList)){
Integer str = opList.stream().map(o->Integer.parseInt(o.getCount())).reduce((x,y) ->x+y).get();
objVO.setStatisticsCount(String.valueOf(str));
}else{
objVO.setStatisticsCount("0");
}
@@ -610,9 +611,6 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
}
Map<String,String> mapDict = new HashMap<>();
if(!StringUtils.isBlank(homeNormalSearchDTO.getResourceType())){
mapDict.put(RESOURCE_TYPE,homeNormalSearchDTO.getResourceType());
}
if(!StringUtils.isBlank(homeNormalSearchDTO.getStandardClass())){
mapDict.put(STANDARD_CLASS,homeNormalSearchDTO.getStandardClass());
}
@@ -640,6 +638,13 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
JSONObject jsonAll = new JSONObject();
JSONArray queryMapJsonAll = new JSONArray();
JSONArray queryMapJsonDict = new JSONArray();
if(!StringUtils.isBlank(homeNormalSearchDTO.getResourceType())){
Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map2.put(RESOURCE_TYPE,homeNormalSearchDTO.getResourceType());
map1.put("match_phrase",map2);
queryMapJsonDict.add(map1);
}
mapDict.forEach((k,v)->{
Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
@@ -891,6 +896,16 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if (StringUtils.isNotBlank(searchContent)) {
getQueryMapJson(queryMapJson, searchContent, CONTENT);
}
if(!StringUtils.isBlank(homeNormalSearchDTO.getResourceType())){
JSONArray queryResourceType = new JSONArray();
Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map1.put(RESOURCE_TYPE,homeNormalSearchDTO.getResourceType());
map2.put("match_phrase",map1);
queryResourceType.add(map2);
JSONObject object = jeroElasticsearchTemplate.buildBoolQuery(queryResourceType,null,null);
queryAll.add(object);
}
if(CollectionUtils.isNotEmpty(queryMapJson)){
JSONObject object = jeroElasticsearchTemplate.buildBoolQuery(null,null,queryMapJson);
queryAll.add(object);