Bladeren bron

完善视图聚合。

zhangjinjun 6 jaren geleden
bovenliggende
commit
94b2417d8c
1 gewijzigde bestanden met toevoegingen van 15 en 13 verwijderingen
  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);