forked from github/dataease
fix: 数据集导出出错
This commit is contained in:
parent
d9c4ece13d
commit
550258e06a
@ -3,6 +3,7 @@ package io.dataease.exportCenter.manage;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import io.dataease.api.chart.dto.ViewDetailField;
|
import io.dataease.api.chart.dto.ViewDetailField;
|
||||||
import io.dataease.api.chart.request.ChartExcelRequest;
|
import io.dataease.api.chart.request.ChartExcelRequest;
|
||||||
import io.dataease.api.chart.request.ChartExcelRequestInner;
|
import io.dataease.api.chart.request.ChartExcelRequestInner;
|
||||||
@ -10,6 +11,7 @@ import io.dataease.api.dataset.dto.DataSetExportRequest;
|
|||||||
import io.dataease.api.dataset.union.DatasetGroupInfoDTO;
|
import io.dataease.api.dataset.union.DatasetGroupInfoDTO;
|
||||||
import io.dataease.api.dataset.union.UnionDTO;
|
import io.dataease.api.dataset.union.UnionDTO;
|
||||||
import io.dataease.extensions.datasource.api.PluginManageApi;
|
import io.dataease.extensions.datasource.api.PluginManageApi;
|
||||||
|
import io.dataease.extensions.view.dto.DatasetRowPermissionsTreeObj;
|
||||||
import io.dataease.model.ExportTaskDTO;
|
import io.dataease.model.ExportTaskDTO;
|
||||||
import io.dataease.api.permissions.dataset.dto.DataSetRowPermissionsTreeDTO;
|
import io.dataease.api.permissions.dataset.dto.DataSetRowPermissionsTreeDTO;
|
||||||
import io.dataease.auth.bo.TokenUserBO;
|
import io.dataease.auth.bo.TokenUserBO;
|
||||||
@ -78,22 +80,24 @@ public class ExportCenterManage {
|
|||||||
DataVisualizationServer dataVisualizationServer;
|
DataVisualizationServer dataVisualizationServer;
|
||||||
@Resource
|
@Resource
|
||||||
private CoreChartViewMapper coreChartViewMapper;
|
private CoreChartViewMapper coreChartViewMapper;
|
||||||
|
@Resource
|
||||||
|
private PermissionManage permissionManage;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WsService wsService;
|
private WsService wsService;
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private PluginManageApi pluginManage;
|
private PluginManageApi pluginManage;
|
||||||
@Resource
|
@Resource
|
||||||
private SysParameterManage sysParameterManage;
|
private SysParameterManage sysParameterManage;
|
||||||
@Value("${export.core.size:10}")
|
@Value("${dataease.export.core.size:10}")
|
||||||
private int core;
|
private int core;
|
||||||
@Value("${export.max.size:10}")
|
@Value("${dataease.export.max.size:10}")
|
||||||
private int max;
|
private int max;
|
||||||
|
|
||||||
@Value("${export.dataset.limit:100000}")
|
@Value("${dataease.export.dataset.limit:100000}")
|
||||||
private int limit;
|
private int limit;
|
||||||
private final static String DATA_URL_TITLE = "data:image/jpeg;base64,";
|
private final static String DATA_URL_TITLE = "data:image/jpeg;base64,";
|
||||||
private static final String exportData_path = "/opt/dataease2.0/data/exportData/";
|
private static final String exportData_path = "/opt/dataease2.0/data/exportData/";
|
||||||
@Value("${extract.page.size:50000}")
|
@Value("${dataease.export.page.size:50000}")
|
||||||
private Integer extractPageSize;
|
private Integer extractPageSize;
|
||||||
static private List<String> STATUS = Arrays.asList("SUCCESS", "FAILED", "PENDING", "IN_PROGRESS", "ALL");
|
static private List<String> STATUS = Arrays.asList("SUCCESS", "FAILED", "PENDING", "IN_PROGRESS", "ALL");
|
||||||
private ScheduledThreadPoolExecutor scheduledThreadPoolExecutor;
|
private ScheduledThreadPoolExecutor scheduledThreadPoolExecutor;
|
||||||
@ -108,8 +112,6 @@ public class ExportCenterManage {
|
|||||||
@Resource
|
@Resource
|
||||||
private DatasetSQLManage datasetSQLManage;
|
private DatasetSQLManage datasetSQLManage;
|
||||||
@Resource
|
@Resource
|
||||||
private PermissionManage permissionManage;
|
|
||||||
@Resource
|
|
||||||
private DatasetTableFieldManage datasetTableFieldManage;
|
private DatasetTableFieldManage datasetTableFieldManage;
|
||||||
@Resource
|
@Resource
|
||||||
private DatasetDataManage datasetDataManage;
|
private DatasetDataManage datasetDataManage;
|
||||||
@ -347,7 +349,7 @@ public class ExportCenterManage {
|
|||||||
datasetTableFieldDTO.setFieldShortName(ele.getDataeaseName());
|
datasetTableFieldDTO.setFieldShortName(ele.getDataeaseName());
|
||||||
return datasetTableFieldDTO;
|
return datasetTableFieldDTO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
dto.setAllFields(allFields);
|
|
||||||
Map<String, Object> sqlMap = datasetSQLManage.getUnionSQLForEdit(dto, null);
|
Map<String, Object> sqlMap = datasetSQLManage.getUnionSQLForEdit(dto, null);
|
||||||
String sql = (String) sqlMap.get("sql");
|
String sql = (String) sqlMap.get("sql");
|
||||||
if (ObjectUtils.isEmpty(allFields)) {
|
if (ObjectUtils.isEmpty(allFields)) {
|
||||||
@ -358,6 +360,7 @@ public class ExportCenterManage {
|
|||||||
if (ObjectUtils.isEmpty(allFields)) {
|
if (ObjectUtils.isEmpty(allFields)) {
|
||||||
DEException.throwException(Translator.get("i18n_no_column_permission"));
|
DEException.throwException(Translator.get("i18n_no_column_permission"));
|
||||||
}
|
}
|
||||||
|
dto.setAllFields(allFields);
|
||||||
datasetDataManage.buildFieldName(sqlMap, allFields);
|
datasetDataManage.buildFieldName(sqlMap, allFields);
|
||||||
Map<Long, DatasourceSchemaDTO> dsMap = (Map<Long, DatasourceSchemaDTO>) sqlMap.get("dsMap");
|
Map<Long, DatasourceSchemaDTO> dsMap = (Map<Long, DatasourceSchemaDTO>) sqlMap.get("dsMap");
|
||||||
DatasourceUtils.checkDsStatus(dsMap);
|
DatasourceUtils.checkDsStatus(dsMap);
|
||||||
@ -373,12 +376,19 @@ public class ExportCenterManage {
|
|||||||
}
|
}
|
||||||
sql = Utils.replaceSchemaAlias(sql, dsMap);
|
sql = Utils.replaceSchemaAlias(sql, dsMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DataSetRowPermissionsTreeDTO> rowPermissionsTree = new ArrayList<>();
|
List<DataSetRowPermissionsTreeDTO> rowPermissionsTree = new ArrayList<>();
|
||||||
TokenUserBO user = AuthUtils.getUser();
|
TokenUserBO user = AuthUtils.getUser();
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
rowPermissionsTree = permissionManage.getRowPermissionsTree(dto.getId(), user.getUserId());
|
rowPermissionsTree = permissionManage.getRowPermissionsTree(dto.getId(), user.getUserId());
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotEmpty(request.getExpressionTree())) {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
DatasetRowPermissionsTreeObj datasetRowPermissionsTreeObj = gson.fromJson(request.getExpressionTree(), DatasetRowPermissionsTreeObj.class);
|
||||||
|
permissionManage.getField(datasetRowPermissionsTreeObj);
|
||||||
|
DataSetRowPermissionsTreeDTO dataSetRowPermissionsTreeDTO = new DataSetRowPermissionsTreeDTO();
|
||||||
|
dataSetRowPermissionsTreeDTO.setTree(datasetRowPermissionsTreeObj);
|
||||||
|
rowPermissionsTree.add(dataSetRowPermissionsTreeDTO);
|
||||||
|
}
|
||||||
|
|
||||||
Provider provider;
|
Provider provider;
|
||||||
if (crossDs) {
|
if (crossDs) {
|
||||||
@ -410,7 +420,7 @@ public class ExportCenterManage {
|
|||||||
datasourceRequest.setDsList(dsMap);
|
datasourceRequest.setDsList(dsMap);
|
||||||
Map<String, Object> previewData = datasetDataManage.buildPreviewData(provider.fetchResultField(datasourceRequest), allFields, desensitizationList);
|
Map<String, Object> previewData = datasetDataManage.buildPreviewData(provider.fetchResultField(datasourceRequest), allFields, desensitizationList);
|
||||||
List<Map<String, Object>> data = (List<Map<String, Object>>) previewData.get("data");
|
List<Map<String, Object>> data = (List<Map<String, Object>>) previewData.get("data");
|
||||||
if (p == 1L) {
|
if (p == 0L) {
|
||||||
CellStyle cellStyle = wb.createCellStyle();
|
CellStyle cellStyle = wb.createCellStyle();
|
||||||
Font font = wb.createFont();
|
Font font = wb.createFont();
|
||||||
font.setFontHeightInPoints((short) 12);
|
font.setFontHeightInPoints((short) 12);
|
||||||
|
@ -23,7 +23,6 @@ public class ConnectionObj implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
System.out.println("session.disconnect()");
|
|
||||||
session.disconnect();
|
session.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user