Browse Source

完善视图聚合。

zhangjinjun 6 năm trước cách đây
mục cha
commit
94b2417d8c
1 tập tin đã thay đổi với 15 bổ sung13 xóa
  1. 15 13
      src/main/java/com/yihu/quota/service/view/ViewService.java

+ 15 - 13
src/main/java/com/yihu/quota/service/view/ViewService.java

@ -165,19 +165,21 @@ public class ViewService extends BaseJpaService<View, ViewDao> {
            } else {
                // 视图展示为数值类型的场合
                // 如果有多个多维数据集时,添加指标的过滤条件,指定其数据来自哪个多维数据集。
                for (ViewQuota quota : viewQuotaList) {
                    ViewQuotaFilter indexFilter = new ViewQuotaFilter();
                    indexFilter.setDimensionCode("_index");
                    indexFilter.setCompareType("and");
                    indexFilter.setCompareType("belong");
                    indexFilter.setFilterValue(quota.getEsIndex());
                    quota.getQuotaFilterList().add(indexFilter);
                    ViewQuotaFilter typeFilter = new ViewQuotaFilter();
                    typeFilter.setDimensionCode("_type");
                    typeFilter.setCompareType("and");
                    typeFilter.setCompareType("belong");
                    typeFilter.setFilterValue(quota.getEsType());
                    quota.getQuotaFilterList().add(typeFilter);
                if (indexCount > 1) {
                    for (ViewQuota quota : viewQuotaList) {
                        ViewQuotaFilter indexFilter = new ViewQuotaFilter();
                        indexFilter.setDimensionCode("_index");
                        indexFilter.setCompareType("and");
                        indexFilter.setCompareType("belong");
                        indexFilter.setFilterValue(quota.getEsIndex());
                        quota.getQuotaFilterList().add(indexFilter);
                        ViewQuotaFilter typeFilter = new ViewQuotaFilter();
                        typeFilter.setDimensionCode("_type");
                        typeFilter.setCompareType("and");
                        typeFilter.setCompareType("belong");
                        typeFilter.setFilterValue(quota.getEsType());
                        quota.getQuotaFilterList().add(typeFilter);
                    }
                }
                // 因为该场合没有行/列维度,直接对指标聚合。
                List<AbstractAggregationBuilder> quotaAggList = this.gatherQuotaMetricsAgg(viewQuotaList, null);