fix: 导出数据出错

This commit is contained in:
taojinlong 2024-06-11 12:19:45 +08:00
parent b9a05adc6c
commit 1cdde77f32
2 changed files with 8 additions and 2 deletions

View File

@ -54,6 +54,10 @@ public class AuthUtils {
return userDto;
}
public static void setUser(CurrentUserDto user) {
USER_INFO.set(user);
}
public static void setProxyUser(Long userId) {
CurrentUserDto currentUserDto = proxyAuthService.queryCacheUserDto(userId);
USER_INFO.set(currentUserDto);

View File

@ -322,7 +322,7 @@ public class ExportCenterService {
ChartViewDTO chartViewInfo = chartViewService.getData(request.getViewId(), componentFilterInfo);
List<Object[]> tableRow = (List) chartViewInfo.getData().get("sourceData");
request.setDetails(tableRow);
if("dataset".equals(request.getDownloadType())){
if ("dataset".equals(request.getDownloadType())) {
request.setHeader((String[]) chartViewInfo.getData().get("header"));
request.setExcelTypes((Integer[]) chartViewInfo.getData().get("dsTypes"));
}
@ -390,6 +390,7 @@ public class ExportCenterService {
boolean isCreated = directory.mkdir();
CurrentUserDto currentUserDto = AuthUtils.getUser();
Future future = scheduledThreadPoolExecutor.submit(() -> {
AuthUtils.setUser(currentUserDto);
try {
exportTask.setExportStatus("IN_PROGRESS");
exportTaskMapper.updateByPrimaryKey(exportTask);
@ -415,7 +416,7 @@ public class ExportCenterService {
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
//设置单元格填充样式(使用纯色背景颜色填充)
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
if ("table-info".equals(request.getViewType())||"dataset".equals(request.getDownloadType())) {
if ("table-info".equals(request.getViewType()) || "dataset".equals(request.getDownloadType())) {
exportTableDetails(request, wb, cellStyle, detailsSheet);
} else {
Boolean mergeHead = false;
@ -1343,6 +1344,7 @@ public class ExportCenterService {
map.put("data", jsonArray);
return map;
}
private static final String LOG_RETENTION = "30";
public void cleanLog() {