|
@ -335,7 +335,8 @@ public class AggregationBuildHandler {
|
|
List<String> cloumnList = new ArrayList<>();
|
|
List<String> cloumnList = new ArrayList<>();
|
|
List<ViewDimension> colDimensionList = viewDimensionDao.getColDimensionList(viewId);
|
|
List<ViewDimension> colDimensionList = viewDimensionDao.getColDimensionList(viewId);
|
|
for (ViewDimension colViewDimension : colDimensionList) {
|
|
for (ViewDimension colViewDimension : colDimensionList) {
|
|
cloumnList.add(colViewDimension.getDimensionCode());
|
|
|
|
|
|
String aggCode = getDimensionAggCode(colViewDimension.getCubeCode(), colViewDimension.getDimensionCode());
|
|
|
|
cloumnList.add(aggCode);
|
|
}
|
|
}
|
|
return cloumnList;
|
|
return cloumnList;
|
|
}
|
|
}
|
|
@ -350,29 +351,32 @@ public class AggregationBuildHandler {
|
|
// 视图各组组内顶层行维度(升序)
|
|
// 视图各组组内顶层行维度(升序)
|
|
List<ViewDimension> groupTopRowDimensionList = viewDimensionDao.getGroupTopRowDimensionList(viewId);
|
|
List<ViewDimension> groupTopRowDimensionList = viewDimensionDao.getGroupTopRowDimensionList(viewId);
|
|
for (ViewDimension viewDimension : groupTopRowDimensionList) {
|
|
for (ViewDimension viewDimension : groupTopRowDimensionList) {
|
|
String aggType = "-terms";
|
|
|
|
String dataType = cubeService.findDimensionDataType("cubeCode:1", viewDimension.getDimensionCode());
|
|
|
|
if(!StringUtils.isEmpty(dataType)){
|
|
|
|
if(dataType.equals("date")){
|
|
|
|
aggType = "-date_histogram";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rowList.add(viewDimension.getDimensionCode() + aggType);
|
|
|
|
|
|
String aggCode = getDimensionAggCode(viewDimension.getCubeCode(), viewDimension.getDimensionCode());
|
|
|
|
rowList.add(aggCode);
|
|
List<ViewDimension> otherRowDimensionList = viewDimensionDao.getGroupOtherRowDimensionList(viewId, viewDimension.getGroupRow());
|
|
List<ViewDimension> otherRowDimensionList = viewDimensionDao.getGroupOtherRowDimensionList(viewId, viewDimension.getGroupRow());
|
|
for (ViewDimension otherViewDimension : otherRowDimensionList) {
|
|
for (ViewDimension otherViewDimension : otherRowDimensionList) {
|
|
rowList.add(otherViewDimension.getDimensionCode() + aggType);;
|
|
|
|
|
|
String otherAggCode = getDimensionAggCode(otherViewDimension.getCubeCode(), viewDimension.getDimensionCode());
|
|
|
|
rowList.add(otherAggCode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return rowList;
|
|
return rowList;
|
|
}
|
|
}
|
|
|
|
|
|
private List<Aggregation> getAggregationList(Iterator<Terms.Bucket> gradeBucket){
|
|
|
|
List<Aggregation> aggregationList = new ArrayList<>();
|
|
|
|
while (gradeBucket.hasNext()) {
|
|
|
|
Terms.Bucket b = gradeBucket.next();
|
|
|
|
aggregationList = b.getAggregations().asList();
|
|
|
|
|
|
/**
|
|
|
|
* 查询数据集中维度的数据类型
|
|
|
|
* @param cubeCode
|
|
|
|
* @param dimensionCode
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public String getDimensionAggCode(String cubeCode,String dimensionCode){
|
|
|
|
String aggType = "-terms";
|
|
|
|
String dataType = cubeService.findDimensionDataType(cubeCode, dimensionCode);
|
|
|
|
if(!StringUtils.isEmpty(dataType)){
|
|
|
|
if(dataType.equals("date")){
|
|
|
|
aggType = "-date_histogram";
|
|
|
|
}
|
|
}
|
|
}
|
|
return aggregationList;
|
|
|
|
|
|
return dimensionCode + aggType;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|