diff --git a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/QueryFacadeImpl.java b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/QueryFacadeImpl.java index f7c2aee58..4b68d3b6c 100644 --- a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/QueryFacadeImpl.java +++ b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/QueryFacadeImpl.java @@ -137,6 +137,7 @@ public void doManage() { } response.setSuccess(false); response.setMessage(t.getMessage()); + result.setData(response); JsonResult.fillFailResultTo(result, t.getMessage()); } } @@ -198,6 +199,7 @@ public void doManage() { } response.setSuccess(false); response.setMessage(t.getMessage()); + result.setData(response); JsonResult.fillFailResultTo(result, t.getMessage()); } } diff --git a/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/common/FilterUtil.java b/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/common/FilterUtil.java index 21fb2d852..8792f6361 100644 --- a/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/common/FilterUtil.java +++ b/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/common/FilterUtil.java @@ -3,13 +3,6 @@ */ package io.holoinsight.server.meta.core.common; -import java.util.*; -import java.util.Map.Entry; -import java.util.function.Function; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - import com.google.common.collect.Maps; import io.holoinsight.server.common.J; import io.holoinsight.server.meta.common.model.QueryExample; @@ -18,10 +11,20 @@ import io.holoinsight.server.meta.core.service.bitmap.condition.OrCondition; import org.springframework.util.CollectionUtils; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.function.Function; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; + import static io.holoinsight.server.meta.common.util.ConstModel.default_app; import static io.holoinsight.server.meta.common.util.ConstModel.default_hostname; import static io.holoinsight.server.meta.common.util.ConstModel.default_ip; -import static io.holoinsight.server.meta.core.service.bitmap.BitmapDataCoreService.UK_FIELD; /** * @author jinyan.ljw @@ -45,7 +48,7 @@ public static MetaCondition buildDimCondition(QueryExample queryExample, andCondition.setAll(true); } else { filters.forEach((type, entries) -> { - type = type.contains(".") ? type.split("\\.")[0] : type; + // type = type.contains(".") ? type.split("\\.")[0] : type; if (REGEX_FILTERS_KEY.equals(type)) { entries.forEach((k, v) -> { AndCondition andCondition = orCondition.and(); @@ -161,13 +164,15 @@ public static List filterData(Collection> items, private static Object getRealVal(String key, Map map) { if (key.contains(".")) { - String[] eqItemKeys = key.split("\\."); - Object value0 = map.get(eqItemKeys[0]); + int doxIndex = key.indexOf('.'); + String firstKey = key.substring(0, doxIndex); + String secondKey = key.substring(doxIndex + 1); + Object value0 = map.get(firstKey); if (Objects.isNull(value0)) { return null; } Map keyItem = (Map) value0; - return keyItem.get(eqItemKeys[1]); + return keyItem.get(secondKey); } else { return map.get(key); } diff --git a/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/service/hashmap/HashMapDataCoreService.java b/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/service/hashmap/HashMapDataCoreService.java index 17f27ce01..43743f361 100644 --- a/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/service/hashmap/HashMapDataCoreService.java +++ b/server/meta/meta-core/src/main/java/io/holoinsight/server/meta/core/service/hashmap/HashMapDataCoreService.java @@ -208,7 +208,26 @@ private String buildIndex(List indexKeys, Map metaRows) StringBuilder builder = new StringBuilder(); boolean containAllKeys = true; for (String key : indexKeys) { - Object value = metaRows.get(key); + Object value; + // 支持两层 key 索引 + if (key.contains(".")) { + int doxIndex = key.indexOf('.'); + String firstKey = key.substring(0, doxIndex); + String secondKey = key.substring(doxIndex + 1); + Object o = metaRows.get(firstKey); + if (Objects.isNull(o)) { + value = null; + } else { + Map map = J.toMap(J.toJson(o)); + if (null == map) { + value = null; + } else { + value = map.get(secondKey); + } + } + } else { + value = metaRows.get(key); + } if (Objects.isNull(value)) { containAllKeys = false; builder.append(EMPTY_VALUE);