fix:【数据大屏】数据大屏导出图表数据没有表头

This commit is contained in:
taojinlong
2025-04-06 20:19:09 +08:00
committed by taojinlong
parent 3245a1a859
commit e7126b31ad
2 changed files with 5 additions and 6 deletions

View File

@@ -338,7 +338,7 @@ public class ChartDataServer implements ChartDataApi {
Map<String, Object> customAttr = viewInfo.getCustomAttr();
Map<String, Object> tableHeaderMap = (Map<String, Object>) customAttr.get("tableHeader");
if (Boolean.valueOf(tableHeaderMap.get("headerGroup").toString())) {
if (tableHeaderMap.get("headerGroup") != null && Boolean.valueOf(tableHeaderMap.get("headerGroup").toString())) {
tableHeader = JsonUtil.parseObject((String) JsonUtil.toJSONString(customAttr.get("tableHeader")), TableHeader.class);
for (TableHeader.ColumnInfo column : tableHeader.getHeaderGroupConfig().getColumns()) {
totalDepth = Math.max(totalDepth, getDepth(column, 1));
@@ -450,10 +450,8 @@ public class ChartDataServer implements ChartDataApi {
Cell cell = row.createCell(j);
if (i == 0) {// 头部
if (tableHeader != null) {
cell.setCellValue(cellValObj.toString());
cell.setCellStyle(cellStyle);
}
cell.setCellValue(cellValObj.toString());
cell.setCellStyle(cellStyle);
//设置列的宽度
detailsSheet.setColumnWidth(j, 255 * 20);
} else if (cellValObj != null) {

View File

@@ -62,6 +62,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.stream.Collectors;
@@ -1458,7 +1459,7 @@ public class DatasourceServer implements DatasourceApi {
if (exception.getCause() == null) {
return exception.getMessage();
}
if (exception instanceof DEException && !(exception.getCause() instanceof DEException)) {
if (exception instanceof DEException && (!(exception.getCause() instanceof DEException) && !(exception.getCause() instanceof InvocationTargetException))) {
return exception.getMessage();
}
exception = exception.getCause();