Merge pull request #8151 from dataease/pr@dev@feat_permissions
Pr@dev@feat permissions
This commit is contained in:
commit
2d2e753e7d
@ -436,6 +436,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
|
|||||||
int queryTimeout = jdbcConfiguration.getQueryTimeout() > 0 ? jdbcConfiguration.getQueryTimeout() : 0;
|
int queryTimeout = jdbcConfiguration.getQueryTimeout() > 0 ? jdbcConfiguration.getQueryTimeout() : 0;
|
||||||
try (Connection con = getConnection(datasourceRequest); Statement statement = getStatement(con, queryTimeout); ResultSet resultSet = statement.executeQuery(queryStr)) {
|
try (Connection con = getConnection(datasourceRequest); Statement statement = getStatement(con, queryTimeout); ResultSet resultSet = statement.executeQuery(queryStr)) {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
LogUtil.error("Datasource is invalid: " + datasourceRequest.getDatasource().getName(), e);
|
LogUtil.error("Datasource is invalid: " + datasourceRequest.getDatasource().getName(), e);
|
||||||
DataEaseException.throwException(e.getMessage());
|
DataEaseException.throwException(e.getMessage());
|
||||||
}
|
}
|
||||||
@ -580,11 +581,11 @@ public class JdbcProvider extends DefaultJdbcProvider {
|
|||||||
if (isDefaultClassLoader(customDriver)) {
|
if (isDefaultClassLoader(customDriver)) {
|
||||||
driverClassName = defaultDriver;
|
driverClassName = defaultDriver;
|
||||||
jdbcClassLoader = extendedJdbcClassLoader;
|
jdbcClassLoader = extendedJdbcClassLoader;
|
||||||
for (DataSourceType value : SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values()) {
|
// for (DataSourceType value : SpringContextUtil.getApplicationContext().getBeansOfType(DataSourceType.class).values()) {
|
||||||
if (value.getType().equalsIgnoreCase(datasourceRequest.getDatasource().getType())) {
|
// if (value.getType().equalsIgnoreCase(datasourceRequest.getDatasource().getType())) {
|
||||||
surpportVersions = value.getSurpportVersions();
|
// surpportVersions = value.getSurpportVersions();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
if (deDriver == null) {
|
if (deDriver == null) {
|
||||||
deDriver = deDriverMapper.selectByPrimaryKey(customDriver);
|
deDriver = deDriverMapper.selectByPrimaryKey(customDriver);
|
||||||
|
|||||||
@ -993,7 +993,7 @@ public class PgQueryProvider extends QueryProvider {
|
|||||||
String tableWithSchema = String.format(PgConstants.KEYWORD_TABLE, schema) + "." + String.format(PgConstants.KEYWORD_TABLE, sql);
|
String tableWithSchema = String.format(PgConstants.KEYWORD_TABLE, schema) + "." + String.format(PgConstants.KEYWORD_TABLE, sql);
|
||||||
return "SELECT COUNT(*) from " + tableWithSchema;
|
return "SELECT COUNT(*) from " + tableWithSchema;
|
||||||
} else {
|
} else {
|
||||||
return "SELECT COUNT(*) from ( " + sqlFix(sql) + " ) DE_COUNT_TEMP";
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.alibaba.excel.metadata.CellData;
|
|||||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
import com.alibaba.excel.read.metadata.ReadSheet;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.TypeReference;
|
import com.alibaba.fastjson.TypeReference;
|
||||||
|
import com.alibaba.fastjson.parser.Feature;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
@ -2355,7 +2356,7 @@ public class DataSetTableService {
|
|||||||
}
|
}
|
||||||
String json = JSON.toJSONString(noModelDataListener.getData());
|
String json = JSON.toJSONString(noModelDataListener.getData());
|
||||||
List<List<String>> data = JSON.parseObject(json, new TypeReference<List<List<String>>>() {
|
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);
|
data = (isPreview && noModelDataListener.getData().size() > 1000 ? new ArrayList<>(data.subList(0, 1000)) : data);
|
||||||
if (isPreview) {
|
if (isPreview) {
|
||||||
for (int i = 0; i < data.size(); i++) {
|
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 {
|
public List<ExcelSheetData> parseExcel(String filename, InputStream inputStream, boolean isPreview) throws Exception {
|
||||||
List<ExcelSheetData> excelSheetDataList = new ArrayList<>();
|
List<ExcelSheetData> excelSheetDataList = new ArrayList<>();
|
||||||
String suffix = filename.substring(filename.lastIndexOf(".") + 1);
|
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);
|
excelSheetDataList = excelSheetDataList(inputStream, isPreview);
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.equalsIgnoreCase(suffix, "csv")) {
|
if (StringUtils.equalsIgnoreCase(suffix, "csv")) {
|
||||||
List<TableField> fields = new ArrayList<>();
|
List<TableField> fields = new ArrayList<>();
|
||||||
|
|||||||
@ -757,14 +757,7 @@ public class ExtractDataService {
|
|||||||
for (ExcelSheetData excelSheetData : excelSheetDataList) {
|
for (ExcelSheetData excelSheetData : excelSheetDataList) {
|
||||||
String suffix = excelSheetData.getPath().substring(excelSheetData.getPath().lastIndexOf(".") + 1);
|
String suffix = excelSheetData.getPath().substring(excelSheetData.getPath().lastIndexOf(".") + 1);
|
||||||
List<ExcelSheetData> totalSheets = new ArrayList<>();
|
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);
|
totalSheets = dataSetTableService.excelSheetDataList(new FileInputStream(excelSheetData.getPath()), false);
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.equalsIgnoreCase(suffix, "csv")) {
|
if (StringUtils.equalsIgnoreCase(suffix, "csv")) {
|
||||||
List<TableField> fields = new ArrayList<>();
|
List<TableField> fields = new ArrayList<>();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user