Merge pull request #8151 from dataease/pr@dev@feat_permissions

Pr@dev@feat permissions
This commit is contained in:
taojinlong 2024-02-26 14:52:39 +08:00 committed by GitHub
commit 2d2e753e7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 24 deletions

View File

@ -436,6 +436,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
int queryTimeout = jdbcConfiguration.getQueryTimeout() > 0 ? jdbcConfiguration.getQueryTimeout() : 0;
try (Connection con = getConnection(datasourceRequest); Statement statement = getStatement(con, queryTimeout); ResultSet resultSet = statement.executeQuery(queryStr)) {
} catch (Exception e) {
e.printStackTrace();
LogUtil.error("Datasource is invalid: " + datasourceRequest.getDatasource().getName(), e);
DataEaseException.throwException(e.getMessage());
}
@ -580,11 +581,11 @@ public class JdbcProvider extends DefaultJdbcProvider {
if (isDefaultClassLoader(customDriver)) {
driverClassName = defaultDriver;
jdbcClassLoader = extendedJdbcClassLoader;
for (DataSourceType value : SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values()) {
if (value.getType().equalsIgnoreCase(datasourceRequest.getDatasource().getType())) {
surpportVersions = value.getSurpportVersions();
}
}
// for (DataSourceType value : SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values()) {
// if (value.getType().equalsIgnoreCase(datasourceRequest.getDatasource().getType())) {
// surpportVersions = value.getSurpportVersions();
// }
// }
} else {
if (deDriver == null) {
deDriver = deDriverMapper.selectByPrimaryKey(customDriver);

View File

@ -993,7 +993,7 @@ public class PgQueryProvider extends QueryProvider {
String tableWithSchema = String.format(PgConstants.KEYWORD_TABLE, schema) + "." + String.format(PgConstants.KEYWORD_TABLE, sql);
return "SELECT COUNT(*) from " + tableWithSchema;
} else {
return "SELECT COUNT(*) from ( " + sqlFix(sql) + " ) DE_COUNT_TEMP";
return null;
}
}

View File

@ -8,6 +8,7 @@ import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.Feature;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@ -2355,7 +2356,7 @@ public class DataSetTableService {
}
String json = JSON.toJSONString(noModelDataListener.getData());
List<List<String>> data = JSON.parseObject(json, new TypeReference<List<List<String>>>() {
});
}, Feature.IgnoreNotMatch);
data = (isPreview && noModelDataListener.getData().size() > 1000 ? new ArrayList<>(data.subList(0, 1000)) : data);
if (isPreview) {
for (int i = 0; i < data.size(); i++) {
@ -2379,15 +2380,7 @@ public class DataSetTableService {
public List<ExcelSheetData> parseExcel(String filename, InputStream inputStream, boolean isPreview) throws Exception {
List<ExcelSheetData> excelSheetDataList = new ArrayList<>();
String suffix = filename.substring(filename.lastIndexOf(".") + 1);
if (StringUtils.equalsIgnoreCase(suffix, "xls")) {
ExcelXlsReader excelXlsReader = new ExcelXlsReader();
excelXlsReader.setObtainedNum(1000);
excelXlsReader.process(inputStream);
excelSheetDataList = excelXlsReader.totalSheets;
}
if (StringUtils.equalsIgnoreCase(suffix, "xlsx")) {
excelSheetDataList = excelSheetDataList(inputStream, isPreview);
}
if (StringUtils.equalsIgnoreCase(suffix, "csv")) {
List<TableField> fields = new ArrayList<>();

View File

@ -757,14 +757,7 @@ public class ExtractDataService {
for (ExcelSheetData excelSheetData : excelSheetDataList) {
String suffix = excelSheetData.getPath().substring(excelSheetData.getPath().lastIndexOf(".") + 1);
List<ExcelSheetData> totalSheets = new ArrayList<>();
if (StringUtils.equalsIgnoreCase(suffix, "xls")) {
ExcelXlsReader excelXlsReader = new ExcelXlsReader();
excelXlsReader.process(new FileInputStream(excelSheetData.getPath()));
totalSheets = excelXlsReader.totalSheets;
}
if (StringUtils.equalsIgnoreCase(suffix, "xlsx")) {
totalSheets = dataSetTableService.excelSheetDataList(new FileInputStream(excelSheetData.getPath()), false);
}
if (StringUtils.equalsIgnoreCase(suffix, "csv")) {
List<TableField> fields = new ArrayList<>();