fix(X-Pack): 定时报告无过滤条件报错 NPE

This commit is contained in:
fit2cloud-chenyw
2025-04-08 17:03:07 +08:00
committed by fit2cloud-chenyw
parent fe70ace7ec
commit 286062fe8b

View File

@@ -77,6 +77,8 @@ public class CoreVisualizationExportManage {
ChartExtRequest extRequest = chartExtRequestMap.get(view.getId());
if (ObjectUtils.isNotEmpty(extRequest)) {
view.setChartExtRequest(extRequest);
} else {
view.setChartExtRequest(buildDefaultRequest());
}
view.getChartExtRequest().setUser(AuthUtils.getUser().getUserId());
view.setTitle((i + 1) + "-" + view.getTitle());
@@ -202,6 +204,16 @@ public class CoreVisualizationExportManage {
return extRequestMap;
}
private ChartExtRequest buildDefaultRequest() {
ChartExtRequest chartExtRequest = new ChartExtRequest();
chartExtRequest.setQueryFrom("panel");
chartExtRequest.setFilter(new ArrayList<>());
chartExtRequest.setResultCount(Math.toIntExact(ExportCenterUtils.getExportLimit("view")));
chartExtRequest.setResultMode(ChartConstants.VIEW_RESULT_MODE.ALL);
chartExtRequest.setPageSize(ExportCenterUtils.getExportLimit("view"));
return chartExtRequest;
}
private Map<String, ChartExtRequest> buildViewRequest(DataVisualizationVO panelDto, Boolean justView) {
String componentsJson = panelDto.getComponentData();
List<Map<String, Object>> components = JsonUtil.parseList(componentsJson, tokenType);