Merge pull request #10209 from dataease/dev

merge v1.18.21
This commit is contained in:
fit2cloudrd 2024-06-12 11:19:04 +08:00 committed by GitHub
commit 6b96b42107
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 17 additions and 16 deletions

View File

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

View File

@ -951,7 +951,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
break; break;
case pg: case pg:
PgConfiguration pgConfiguration = new Gson().fromJson(datasource.getConfiguration(), PgConfiguration.class); PgConfiguration pgConfiguration = new Gson().fromJson(datasource.getConfiguration(), PgConfiguration.class);
if (!pgConfiguration.getDataBase().matches("^[0-9a-zA-Z_]{1,}$")) { if (!pgConfiguration.getDataBase().matches("^[0-9a-zA-Z_.-]{1,}$")) {
throw new Exception("Invalid database name"); throw new Exception("Invalid database name");
} }
break; break;

View File

@ -988,14 +988,8 @@ public class PgQueryProvider extends QueryProvider {
} }
public String getTotalCount(boolean isTable, String sql, Datasource ds) { public String getTotalCount(boolean isTable, String sql, Datasource ds) {
if (isTable) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
String tableWithSchema = String.format(PgConstants.KEYWORD_TABLE, schema) + "." + String.format(PgConstants.KEYWORD_TABLE, sql);
return "SELECT COUNT(*) from " + tableWithSchema;
} else {
return null; return null;
} }
}
@Override @Override
public String createRawQuerySQL(String table, List<DatasetTableField> fields, Datasource ds) { public String createRawQuerySQL(String table, List<DatasetTableField> fields, Datasource ds) {
@ -1007,7 +1001,7 @@ public class PgQueryProvider extends QueryProvider {
if (ds != null) { if (ds != null) {
String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema(); String schema = new Gson().fromJson(ds.getConfiguration(), JdbcConfiguration.class).getSchema();
String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table); String tableWithSchema = String.format(SqlServerSQLConstants.KEYWORD_TABLE, schema) + "." + String.format(SqlServerSQLConstants.KEYWORD_TABLE, table);
return MessageFormat.format("SELECT {0} FROM {1} LIMIT DE_PAGE_SIZE OFFSET DE_OFFSET ", StringUtils.join(array, ","), tableWithSchema); return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), tableWithSchema);
} else { } else {
return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table); return MessageFormat.format("SELECT {0} FROM {1} ", StringUtils.join(array, ","), table);
} }

View File

@ -181,7 +181,7 @@ public class DatasourceService {
}); });
if (!datasourceDTO.getType().equalsIgnoreCase(DatasourceTypes.api.toString())) { if (!datasourceDTO.getType().equalsIgnoreCase(DatasourceTypes.api.toString())) {
JdbcConfiguration configuration = new Gson().fromJson(datasourceDTO.getConfiguration(), JdbcConfiguration.class); JdbcConfiguration configuration = new Gson().fromJson(datasourceDTO.getConfiguration(), JdbcConfiguration.class);
if (StringUtils.isNotEmpty(configuration.getCustomDriver()) && !configuration.getCustomDriver().equalsIgnoreCase("default")) { if (StringUtils.isNotEmpty(configuration.getCustomDriver()) && !configuration.getCustomDriver().startsWith("default-")) {
datasourceDTO.setCalculationMode(DatasourceCalculationMode.DIRECT); datasourceDTO.setCalculationMode(DatasourceCalculationMode.DIRECT);
} }
JSONObject jsonObject = JSONObject.parseObject(datasourceDTO.getConfiguration()); JSONObject jsonObject = JSONObject.parseObject(datasourceDTO.getConfiguration());

View File

@ -322,7 +322,7 @@ public class ExportCenterService {
ChartViewDTO chartViewInfo = chartViewService.getData(request.getViewId(), componentFilterInfo); ChartViewDTO chartViewInfo = chartViewService.getData(request.getViewId(), componentFilterInfo);
List<Object[]> tableRow = (List) chartViewInfo.getData().get("sourceData"); List<Object[]> tableRow = (List) chartViewInfo.getData().get("sourceData");
request.setDetails(tableRow); request.setDetails(tableRow);
if("dataset".equals(request.getDownloadType())){ if ("dataset".equals(request.getDownloadType())) {
request.setHeader((String[]) chartViewInfo.getData().get("header")); request.setHeader((String[]) chartViewInfo.getData().get("header"));
request.setExcelTypes((Integer[]) chartViewInfo.getData().get("dsTypes")); request.setExcelTypes((Integer[]) chartViewInfo.getData().get("dsTypes"));
} }
@ -388,7 +388,9 @@ public class ExportCenterService {
String dataPath = exportData_path + exportTask.getId(); String dataPath = exportData_path + exportTask.getId();
File directory = new File(dataPath); File directory = new File(dataPath);
boolean isCreated = directory.mkdir(); boolean isCreated = directory.mkdir();
CurrentUserDto currentUserDto = AuthUtils.getUser();
Future future = scheduledThreadPoolExecutor.submit(() -> { Future future = scheduledThreadPoolExecutor.submit(() -> {
AuthUtils.setUser(currentUserDto);
try { try {
exportTask.setExportStatus("IN_PROGRESS"); exportTask.setExportStatus("IN_PROGRESS");
exportTaskMapper.updateByPrimaryKey(exportTask); exportTaskMapper.updateByPrimaryKey(exportTask);
@ -414,7 +416,7 @@ public class ExportCenterService {
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
//设置单元格填充样式(使用纯色背景颜色填充) //设置单元格填充样式(使用纯色背景颜色填充)
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); 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); exportTableDetails(request, wb, cellStyle, detailsSheet);
} else { } else {
Boolean mergeHead = false; Boolean mergeHead = false;
@ -542,7 +544,7 @@ public class ExportCenterService {
} }
wb.close(); wb.close();
if (ObjectUtils.isNotEmpty(AuthUtils.getUser())) { if (ObjectUtils.isNotEmpty(currentUserDto)) {
String viewId = request.getViewId(); String viewId = request.getViewId();
ChartViewWithBLOBs chartViewWithBLOBs = chartViewService.get(viewId); ChartViewWithBLOBs chartViewWithBLOBs = chartViewService.get(viewId);
String pid = chartViewWithBLOBs.getSceneId(); String pid = chartViewWithBLOBs.getSceneId();
@ -1342,6 +1344,7 @@ public class ExportCenterService {
map.put("data", jsonArray); map.put("data", jsonArray);
return map; return map;
} }
private static final String LOG_RETENTION = "30"; private static final String LOG_RETENTION = "30";
public void cleanLog() { public void cleanLog() {

View File

@ -1,6 +1,6 @@
{ {
"name": "dataease", "name": "dataease",
"version": "1.18.20", "version": "1.18.21",
"description": "dataease front", "description": "dataease front",
"private": true, "private": true,
"scripts": { "scripts": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 202 KiB

View File

@ -1,6 +1,6 @@
{ {
"name": "dataease-mobile", "name": "dataease-mobile",
"version": "1.18.20", "version": "1.18.21",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "npm run dev:h5", "serve": "npm run dev:h5",

View File

@ -9,7 +9,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<dataease.version>1.18.20</dataease.version> <dataease.version>1.18.21</dataease.version>
<poi.version>4.1.1</poi.version> <poi.version>4.1.1</poi.version>
<xmlbeans.version>3.1.0</xmlbeans.version> <xmlbeans.version>3.1.0</xmlbeans.version>
</properties> </properties>