提交 746e6c49 authored 作者: wangjiahao's avatar wangjiahao

Merge remote-tracking branch 'origin/main' into main

# Conflicts: # backend/src/main/resources/i18n/messages_en_US.properties # backend/src/main/resources/i18n/messages_zh_CN.properties # backend/src/main/resources/i18n/messages_zh_TW.properties # frontend/src/components/canvas/components/Toolbar.vue
...@@ -7,6 +7,8 @@ import io.dataease.base.mapper.ext.ExtDataSourceMapper; ...@@ -7,6 +7,8 @@ import io.dataease.base.mapper.ext.ExtDataSourceMapper;
import io.dataease.base.mapper.ext.query.GridExample; import io.dataease.base.mapper.ext.query.GridExample;
import io.dataease.commons.exception.DEException; import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.CommonThreadPool;
import io.dataease.commons.utils.LogUtil;
import io.dataease.controller.request.DatasourceUnionRequest; import io.dataease.controller.request.DatasourceUnionRequest;
import io.dataease.controller.sys.base.BaseGridRequest; import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.controller.sys.base.ConditionEntity; import io.dataease.controller.sys.base.ConditionEntity;
...@@ -40,6 +42,8 @@ public class DatasourceService { ...@@ -40,6 +42,8 @@ public class DatasourceService {
private DatasetTableMapper datasetTableMapper; private DatasetTableMapper datasetTableMapper;
@Resource @Resource
private DataSetGroupService dataSetGroupService; private DataSetGroupService dataSetGroupService;
@Resource
private CommonThreadPool commonThreadPool;
public Datasource addDatasource(Datasource datasource) { public Datasource addDatasource(Datasource datasource) {
DatasourceExample example = new DatasourceExample(); DatasourceExample example = new DatasourceExample();
...@@ -114,7 +118,6 @@ public class DatasourceService { ...@@ -114,7 +118,6 @@ public class DatasourceService {
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class); DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
if (StringUtils.equals(name, dataTableInfoDTO.getTable())) { if (StringUtils.equals(name, dataTableInfoDTO.getTable())) {
dbTableDTO.setEnableCheck(false); dbTableDTO.setEnableCheck(false);
List<DatasetGroup> parents = dataSetGroupService.getParents(datasetTable.getSceneId()); List<DatasetGroup> parents = dataSetGroupService.getParents(datasetTable.getSceneId());
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
parents.forEach(ele -> stringBuilder.append(ele.getName()).append("/")); parents.forEach(ele -> stringBuilder.append(ele.getName()).append("/"));
...@@ -131,4 +134,25 @@ public class DatasourceService { ...@@ -131,4 +134,25 @@ public class DatasourceService {
public Datasource get(String id) { public Datasource get(String id) {
return datasourceMapper.selectByPrimaryKey(id); return datasourceMapper.selectByPrimaryKey(id);
} }
public void initAllDataSourceConnectionPool(){
List<Datasource> datasources = datasourceMapper.selectByExampleWithBLOBs(new DatasourceExample());
datasources.forEach(datasource -> {
try {
commonThreadPool.addTask(() ->{
try {
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(datasource.getType());
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(datasource);
datasourceProvider.initDataSource(datasourceRequest);
LogUtil.error("Succsss to init datasource connection pool: " + datasource.getName());
}catch (Exception e){
LogUtil.error("Failed to init datasource connection pool: " + datasource.getName(), e);
}
});
}catch (Exception e){
e.printStackTrace();
}
});
}
} }
//package io.dataease.listener;
//
//import io.dataease.base.mapper.DatasetTableMapper;
//import io.dataease.commons.utils.CommonThreadPool;
//import io.dataease.service.dataset.DataSetTableFieldsService;
//import org.springframework.boot.context.event.ApplicationReadyEvent;
//import org.springframework.context.ApplicationListener;
//import org.springframework.core.annotation.Order;
//import org.springframework.core.env.Environment;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//
//@Component
//@Order(value = 2)
//public class AppStartReadHBaseListener implements ApplicationListener<ApplicationReadyEvent> {
// @Resource
// private CommonThreadPool commonThreadPool;
//// @Resource
//// private SparkCalc sparkCalc;
// @Resource
// private Environment env; // 保存了配置文件的信息
//
// @Resource
// private DatasetTableMapper datasetTableMapper;
// @Resource
// private DataSetTableFieldsService dataSetTableFieldsService;
//
// @Override
// public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
//// System.out.println("================= Read HBase start =================");
//// // 项目启动,从数据集中找到定时抽取的表,从HBase中读取放入缓存
//// DatasetTableExample datasetTableExample = new DatasetTableExample();
//// datasetTableExample.createCriteria().andModeEqualTo(1);
//// List<DatasetTable> datasetTables = datasetTableMapper.selectByExampleWithBLOBs(datasetTableExample);
//// for (DatasetTable table : datasetTables) {
////// commonThreadPool.addTask(() -> {
//// try {
//// List<DatasetTableField> fields = dataSetTableFieldsService.getFieldsByTableId(table.getId());
//// sparkCalc.getHBaseDataAndCache(table.getId(), fields);
//// } catch (Exception e) {
//// e.printStackTrace();
//// }
////// });
//// }
// }
//}
package io.dataease.listener;
import io.dataease.base.domain.DatasetTableTask;
import io.dataease.datasource.service.DatasourceService;
import io.dataease.service.ScheduleService;
import io.dataease.service.dataset.DataSetTableTaskService;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Component
@Order(value = 1)
public class DataSourceInitStartListener implements ApplicationListener<ApplicationReadyEvent> {
@Resource
private DatasourceService datasourceService;
@Override
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
datasourceService.initAllDataSourceConnectionPool();
}
}
...@@ -9,6 +9,7 @@ import io.dataease.commons.utils.TreeUtils; ...@@ -9,6 +9,7 @@ import io.dataease.commons.utils.TreeUtils;
import io.dataease.controller.request.chart.ChartGroupRequest; import io.dataease.controller.request.chart.ChartGroupRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest; import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.dto.chart.ChartGroupDTO; import io.dataease.dto.chart.ChartGroupDTO;
import io.dataease.i18n.Translator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -104,7 +105,7 @@ public class ChartGroupService { ...@@ -104,7 +105,7 @@ public class ChartGroupService {
} }
List<ChartGroup> list = chartGroupMapper.selectByExample(chartGroupExample); List<ChartGroup> list = chartGroupMapper.selectByExample(chartGroupExample);
if (list.size() > 0) { if (list.size() > 0) {
throw new RuntimeException("Name can't repeat in same group."); throw new RuntimeException(Translator.get("i18n_name_cant_repeat_same_group"));
} }
} }
} }
...@@ -20,6 +20,7 @@ import io.dataease.dto.chart.ChartViewDTO; ...@@ -20,6 +20,7 @@ import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.chart.ChartViewFieldDTO; import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.dto.chart.Series; import io.dataease.dto.chart.Series;
import io.dataease.dto.dataset.DataTableInfoDTO; import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.i18n.Translator;
import io.dataease.provider.QueryProvider; import io.dataease.provider.QueryProvider;
import io.dataease.service.dataset.DataSetTableFieldsService; import io.dataease.service.dataset.DataSetTableFieldsService;
import io.dataease.service.dataset.DataSetTableService; import io.dataease.service.dataset.DataSetTableService;
...@@ -226,7 +227,7 @@ public class ChartViewService { ...@@ -226,7 +227,7 @@ public class ChartViewService {
} }
List<ChartViewWithBLOBs> list = chartViewMapper.selectByExampleWithBLOBs(chartViewExample); List<ChartViewWithBLOBs> list = chartViewMapper.selectByExampleWithBLOBs(chartViewExample);
if (list.size() > 0) { if (list.size() > 0) {
throw new RuntimeException("Name can't repeat in same group."); throw new RuntimeException(Translator.get("i18n_name_cant_repeat_same_group"));
} }
} }
......
...@@ -12,8 +12,10 @@ import io.dataease.controller.request.dataset.DataSetGroupRequest; ...@@ -12,8 +12,10 @@ import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest; import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.dto.dataset.DataSetGroupDTO; import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.dto.dataset.DataSetTableDTO; import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.i18n.Translator;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -32,6 +34,7 @@ public class DataSetGroupService { ...@@ -32,6 +34,7 @@ public class DataSetGroupService {
@Resource @Resource
private DatasetGroupMapper datasetGroupMapper; private DatasetGroupMapper datasetGroupMapper;
@Resource @Resource
@Lazy
private DataSetTableService dataSetTableService; private DataSetTableService dataSetTableService;
@Resource @Resource
private ExtDataSetGroupMapper extDataSetGroupMapper; private ExtDataSetGroupMapper extDataSetGroupMapper;
...@@ -115,7 +118,7 @@ public class DataSetGroupService { ...@@ -115,7 +118,7 @@ public class DataSetGroupService {
} }
List<DatasetGroup> list = datasetGroupMapper.selectByExample(datasetGroupExample); List<DatasetGroup> list = datasetGroupMapper.selectByExample(datasetGroupExample);
if (list.size() > 0) { if (list.size() > 0) {
throw new RuntimeException("Name can't repeat in same group."); throw new RuntimeException(Translator.get("i18n_name_cant_repeat_same_group"));
} }
} }
......
...@@ -19,6 +19,7 @@ import io.dataease.dto.dataset.DataSetTableDTO; ...@@ -19,6 +19,7 @@ import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.DataSetTableUnionDTO; import io.dataease.dto.dataset.DataSetTableUnionDTO;
import io.dataease.dto.dataset.DataTableInfoCustomUnion; import io.dataease.dto.dataset.DataTableInfoCustomUnion;
import io.dataease.dto.dataset.DataTableInfoDTO; import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.i18n.Translator;
import io.dataease.provider.DDLProvider; import io.dataease.provider.DDLProvider;
import io.dataease.provider.QueryProvider; import io.dataease.provider.QueryProvider;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -34,6 +35,7 @@ import org.apache.poi.xssf.usermodel.XSSFSheet; ...@@ -34,6 +35,7 @@ import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -49,6 +51,7 @@ import java.util.stream.Collectors; ...@@ -49,6 +51,7 @@ import java.util.stream.Collectors;
* @Date 2021/2/23 2:54 下午 * @Date 2021/2/23 2:54 下午
*/ */
@Service @Service
@Transactional(rollbackFor = Exception.class)
public class DataSetTableService { public class DataSetTableService {
@Resource @Resource
private DatasetTableMapper datasetTableMapper; private DatasetTableMapper datasetTableMapper;
...@@ -177,7 +180,7 @@ public class DataSetTableService { ...@@ -177,7 +180,7 @@ public class DataSetTableService {
.id("count") .id("count")
.tableId(dataSetTableRequest.getId()) .tableId(dataSetTableRequest.getId())
.originName("*") .originName("*")
.name("记录数*") .name(Translator.get("i18n_chart_count"))
.dataeaseName("*") .dataeaseName("*")
.type("INT") .type("INT")
.checked(true) .checked(true)
...@@ -500,7 +503,7 @@ public class DataSetTableService { ...@@ -500,7 +503,7 @@ public class DataSetTableService {
return; return;
} }
QueryProvider qp = null; QueryProvider qp = null;
if(!ObjectUtils.isEmpty(ds)) { if (!ObjectUtils.isEmpty(ds)) {
qp = ProviderFactory.getQueryProvider(ds.getType()); qp = ProviderFactory.getQueryProvider(ds.getType());
} }
if (CollectionUtils.isNotEmpty(fields)) { if (CollectionUtils.isNotEmpty(fields)) {
...@@ -611,7 +614,7 @@ public class DataSetTableService { ...@@ -611,7 +614,7 @@ public class DataSetTableService {
} }
List<DatasetTable> list = datasetTableMapper.selectByExample(datasetTableExample); List<DatasetTable> list = datasetTableMapper.selectByExample(datasetTableExample);
if (list.size() > 0) { if (list.size() > 0) {
throw new RuntimeException("Name can't repeat in same group."); throw new RuntimeException(Translator.get("i18n_name_cant_repeat_same_group"));
} }
} }
...@@ -647,11 +650,11 @@ public class DataSetTableService { ...@@ -647,11 +650,11 @@ public class DataSetTableService {
if (StringUtils.equalsIgnoreCase(suffix, "xls")) { if (StringUtils.equalsIgnoreCase(suffix, "xls")) {
HSSFWorkbook workbook = new HSSFWorkbook(inputStream); HSSFWorkbook workbook = new HSSFWorkbook(inputStream);
HSSFSheet sheet0 = workbook.getSheetAt(0); HSSFSheet sheet0 = workbook.getSheetAt(0);
for (int i=0;i<workbook.getNumberOfSheets();i++){ for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
sheets.add(workbook.getSheetAt(i).getSheetName()); sheets.add(workbook.getSheetAt(i).getSheetName());
} }
if (sheet0.getNumMergedRegions() > 0) { if (sheet0.getNumMergedRegions() > 0) {
throw new RuntimeException("Sheet have merged regions."); throw new RuntimeException(Translator.get("i18n_excel_have_merge_region"));
} }
int rows; int rows;
if (isPreview) { if (isPreview) {
...@@ -668,7 +671,7 @@ public class DataSetTableService { ...@@ -668,7 +671,7 @@ public class DataSetTableService {
tableFiled.setFieldType("TEXT"); tableFiled.setFieldType("TEXT");
tableFiled.setFieldSize(1024); tableFiled.setFieldSize(1024);
String columnName = readCell(row.getCell(j)); String columnName = readCell(row.getCell(j));
if(StringUtils.isEmpty(columnName)){ if (StringUtils.isEmpty(columnName)) {
columnName = "NONE_" + String.valueOf(j); columnName = "NONE_" + String.valueOf(j);
} }
tableFiled.setFieldName(columnName); tableFiled.setFieldName(columnName);
...@@ -686,11 +689,11 @@ public class DataSetTableService { ...@@ -686,11 +689,11 @@ public class DataSetTableService {
} else if (StringUtils.equalsIgnoreCase(suffix, "xlsx")) { } else if (StringUtils.equalsIgnoreCase(suffix, "xlsx")) {
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(inputStream); XSSFWorkbook xssfWorkbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet0 = xssfWorkbook.getSheetAt(0); XSSFSheet sheet0 = xssfWorkbook.getSheetAt(0);
for (int i=0;i<xssfWorkbook.getNumberOfSheets();i++){ for (int i = 0; i < xssfWorkbook.getNumberOfSheets(); i++) {
sheets.add(xssfWorkbook.getSheetAt(i).getSheetName()); sheets.add(xssfWorkbook.getSheetAt(i).getSheetName());
} }
if (sheet0.getNumMergedRegions() > 0) { if (sheet0.getNumMergedRegions() > 0) {
throw new RuntimeException("Sheet have merged regions."); throw new RuntimeException(Translator.get("i18n_excel_have_merge_region"));
} }
int rows; int rows;
if (isPreview) { if (isPreview) {
...@@ -707,7 +710,7 @@ public class DataSetTableService { ...@@ -707,7 +710,7 @@ public class DataSetTableService {
tableFiled.setFieldType("TEXT"); tableFiled.setFieldType("TEXT");
tableFiled.setFieldSize(1024); tableFiled.setFieldSize(1024);
String columnName = readCell(row.getCell(j)); String columnName = readCell(row.getCell(j));
if(StringUtils.isEmpty(columnName)){ if (StringUtils.isEmpty(columnName)) {
columnName = "NONE_" + String.valueOf(j); columnName = "NONE_" + String.valueOf(j);
} }
tableFiled.setFieldName(columnName); tableFiled.setFieldName(columnName);
......
...@@ -3,6 +3,7 @@ package io.dataease.service.dataset; ...@@ -3,6 +3,7 @@ package io.dataease.service.dataset;
import io.dataease.base.domain.DatasetTableTask; import io.dataease.base.domain.DatasetTableTask;
import io.dataease.base.domain.DatasetTableTaskExample; import io.dataease.base.domain.DatasetTableTaskExample;
import io.dataease.base.mapper.DatasetTableTaskMapper; import io.dataease.base.mapper.DatasetTableTaskMapper;
import io.dataease.i18n.Translator;
import io.dataease.service.ScheduleService; import io.dataease.service.ScheduleService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.quartz.CronExpression; import org.quartz.CronExpression;
...@@ -31,7 +32,7 @@ public class DataSetTableTaskService { ...@@ -31,7 +32,7 @@ public class DataSetTableTaskService {
// check // check
if (StringUtils.isNotEmpty(datasetTableTask.getCron())) { if (StringUtils.isNotEmpty(datasetTableTask.getCron())) {
if (!CronExpression.isValidExpression(datasetTableTask.getCron())) { if (!CronExpression.isValidExpression(datasetTableTask.getCron())) {
throw new RuntimeException("cron expression error."); throw new RuntimeException(Translator.get("i18n_cron_expression_error"));
} }
} }
if (StringUtils.isEmpty(datasetTableTask.getId())) { if (StringUtils.isEmpty(datasetTableTask.getId())) {
......
...@@ -63,6 +63,7 @@ import org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassDef; ...@@ -63,6 +63,7 @@ import org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassDef;
import org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassMeta; import org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassMeta;
import org.pentaho.di.www.SlaveServerJobStatus; import org.pentaho.di.www.SlaveServerJobStatus;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -82,6 +83,7 @@ import java.util.stream.Collectors; ...@@ -82,6 +83,7 @@ import java.util.stream.Collectors;
public class ExtractDataService { public class ExtractDataService {
@Resource @Resource
@Lazy
private DataSetTableService dataSetTableService; private DataSetTableService dataSetTableService;
@Resource @Resource
private DataSetTableFieldsService dataSetTableFieldsService; private DataSetTableFieldsService dataSetTableFieldsService;
...@@ -91,7 +93,6 @@ public class ExtractDataService { ...@@ -91,7 +93,6 @@ public class ExtractDataService {
private DataSetTableTaskService dataSetTableTaskService; private DataSetTableTaskService dataSetTableTaskService;
@Resource @Resource
private DatasourceMapper datasourceMapper; private DatasourceMapper datasourceMapper;
private static ExecutorService pool = Executors.newScheduledThreadPool(50); //设置连接池
private static String lastUpdateTime = "${__last_update_time__}"; private static String lastUpdateTime = "${__last_update_time__}";
private static String currentUpdateTime = "${__current_update_time__}"; private static String currentUpdateTime = "${__current_update_time__}";
...@@ -113,7 +114,6 @@ public class ExtractDataService { ...@@ -113,7 +114,6 @@ public class ExtractDataService {
"UNIQUE KEY(dataease_uuid)\n" + "UNIQUE KEY(dataease_uuid)\n" +
"DISTRIBUTED BY HASH(dataease_uuid) BUCKETS 10\n" + "DISTRIBUTED BY HASH(dataease_uuid) BUCKETS 10\n" +
"PROPERTIES(\"replication_num\" = \"1\");"; "PROPERTIES(\"replication_num\" = \"1\");";
private static String shellScript = "curl --location-trusted -u %s:%s -H \"label:%s\" -H \"column_separator:%s\" -H \"columns:%s\" -H \"merge_type: %s\" -T %s -XPUT http://%s:%s/api/%s/%s/_stream_load\n" + private static String shellScript = "curl --location-trusted -u %s:%s -H \"label:%s\" -H \"column_separator:%s\" -H \"columns:%s\" -H \"merge_type: %s\" -T %s -XPUT http://%s:%s/api/%s/%s/_stream_load\n" +
"rm -rf %s\n"; "rm -rf %s\n";
...@@ -448,6 +448,7 @@ public class ExtractDataService { ...@@ -448,6 +448,7 @@ public class ExtractDataService {
selectSQL = qp.createQuerySQL(tableName, datasetTableFields); selectSQL = qp.createQuerySQL(tableName, datasetTableFields);
} }
inputStep = inputStep(transMeta, selectSQL); inputStep = inputStep(transMeta, selectSQL);
udjcStep = udjc(datasetTableFields, false);
break; break;
case sqlServer: case sqlServer:
SqlServerConfigration sqlServerConfigration = new Gson().fromJson(datasource.getConfiguration(), SqlServerConfigration.class); SqlServerConfigration sqlServerConfigration = new Gson().fromJson(datasource.getConfiguration(), SqlServerConfigration.class);
...@@ -459,10 +460,12 @@ public class ExtractDataService { ...@@ -459,10 +460,12 @@ public class ExtractDataService {
selectSQL = qp.createQuerySQL(tableName, datasetTableFields); selectSQL = qp.createQuerySQL(tableName, datasetTableFields);
} }
inputStep = inputStep(transMeta, selectSQL); inputStep = inputStep(transMeta, selectSQL);
udjcStep = udjc(datasetTableFields, false);
break; break;
case excel: case excel:
String filePath = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getData(); String filePath = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getData();
inputStep = excelInputStep(filePath, datasetTableFields); inputStep = excelInputStep(filePath, datasetTableFields);
udjcStep = udjc(datasetTableFields, true);
default: default:
break; break;
} }
...@@ -487,7 +490,7 @@ public class ExtractDataService { ...@@ -487,7 +490,7 @@ public class ExtractDataService {
break; break;
} }
udjcStep = udjc(datasetTableFields);
outputStep = outputStep(dorisOutputTable); outputStep = outputStep(dorisOutputTable);
hi1 = new TransHopMeta(inputStep, udjcStep); hi1 = new TransHopMeta(inputStep, udjcStep);
hi2 = new TransHopMeta(udjcStep, outputStep); hi2 = new TransHopMeta(udjcStep, outputStep);
...@@ -569,11 +572,11 @@ public class ExtractDataService { ...@@ -569,11 +572,11 @@ public class ExtractDataService {
return outputStep; return outputStep;
} }
private StepMeta udjc(List<DatasetTableField> datasetTableFields) { private StepMeta udjc(List<DatasetTableField> datasetTableFields, boolean isExcel) {
String needToChangeolumnType = ""; String needToChangeColumnType = "";
for (DatasetTableField datasetTableField : datasetTableFields) { for (DatasetTableField datasetTableField : datasetTableFields) {
if (datasetTableField.getDeExtractType() != null && datasetTableField.getDeExtractType() == 4) { if (datasetTableField.getDeExtractType() != null && datasetTableField.getDeExtractType() == 4) {
needToChangeolumnType = needToChangeolumnType + alterColumnTypeCode.replace("FILED", datasetTableField.getOriginName()); needToChangeColumnType = needToChangeColumnType + alterColumnTypeCode.replace("FILED", datasetTableField.getOriginName());
} }
} }
...@@ -583,8 +586,13 @@ public class ExtractDataService { ...@@ -583,8 +586,13 @@ public class ExtractDataService {
fields.add(fieldInfo); fields.add(fieldInfo);
userDefinedJavaClassMeta.setFieldInfo(fields); userDefinedJavaClassMeta.setFieldInfo(fields);
List<UserDefinedJavaClassDef> definitions = new ArrayList<UserDefinedJavaClassDef>(); List<UserDefinedJavaClassDef> definitions = new ArrayList<UserDefinedJavaClassDef>();
UserDefinedJavaClassDef userDefinedJavaClassDef = new UserDefinedJavaClassDef(UserDefinedJavaClassDef.ClassType.TRANSFORM_CLASS, "Processor", String tmp_code = code.replace("alterColumnTypeCode", needToChangeColumnType).replace("Column_Fields", String.join(",", datasetTableFields.stream().map(DatasetTableField::getOriginName).collect(Collectors.toList())));
code.replace("alterColumnTypeCode", needToChangeolumnType).replace("Column_Fields", String.join(",", datasetTableFields.stream().map(DatasetTableField::getOriginName).collect(Collectors.toList())))); if(isExcel){
tmp_code = tmp_code.replace("handleExcelIntColumn", handleExcelIntColumn);
}else {
tmp_code = tmp_code.replace("handleExcelIntColumn", "");
}
UserDefinedJavaClassDef userDefinedJavaClassDef = new UserDefinedJavaClassDef(UserDefinedJavaClassDef.ClassType.TRANSFORM_CLASS, "Processor", tmp_code);
userDefinedJavaClassDef.setActive(true); userDefinedJavaClassDef.setActive(true);
definitions.add(userDefinedJavaClassDef); definitions.add(userDefinedJavaClassDef);
...@@ -629,6 +637,14 @@ public class ExtractDataService { ...@@ -629,6 +637,14 @@ public class ExtractDataService {
" }\n" + " }\n" +
" }\n"; " }\n";
private static String handleExcelIntColumn = " \t\tif(tmp != null && tmp.endsWith(\".0\")){\n" +
" try {\n" +
" Integer.valueOf(tmp.substring(0, tmp.length()-2));\n" +
" get(Fields.Out, filed).setValue(r, tmp.substring(0, tmp.length()-2));\n" +
" get(Fields.Out, filed).getValueMeta().setType(2);\n" +
" }catch (Exception e){}\n" +
" }";
private static String code = "import org.pentaho.di.core.row.ValueMetaInterface;\n" + private static String code = "import org.pentaho.di.core.row.ValueMetaInterface;\n" +
"import java.util.List;\n" + "import java.util.List;\n" +
"import java.io.File;\n" + "import java.io.File;\n" +
...@@ -659,6 +675,7 @@ public class ExtractDataService { ...@@ -659,6 +675,7 @@ public class ExtractDataService {
" for (String filed : fileds) {\n" + " for (String filed : fileds) {\n" +
" String tmp = get(Fields.In, filed).getString(r);\n" + " String tmp = get(Fields.In, filed).getString(r);\n" +
"alterColumnTypeCode \n" + "alterColumnTypeCode \n" +
"handleExcelIntColumn \n" +
" str = str + tmp;\n" + " str = str + tmp;\n" +
" }\n" + " }\n" +
"\n" + "\n" +
......
...@@ -228,6 +228,10 @@ i18n_auth_export=Export ...@@ -228,6 +228,10 @@ i18n_auth_export=Export
i18n_auth_manage=Manage i18n_auth_manage=Manage
i18n_template_system=System Template i18n_template_system=System Template
i18n_template_self=Self Template i18n_template_self=Self Template
i18n_name_cant_repeat_same_group=Name is already exists in the same group
i18n_chart_count=Count*
i18n_excel_have_merge_region=Excel has merged region
i18n_cron_expression_error=Cron expression error
i18n_same_folder_can_not_repeat=Same Folder Can Not Repeat i18n_same_folder_can_not_repeat=Same Folder Can Not Repeat
i18n_default_panel=Default Panel i18n_default_panel=Default Panel
i18n_panel_list=Panel List i18n_panel_list=Panel List
...@@ -229,6 +229,10 @@ i18n_auth_export=导出 ...@@ -229,6 +229,10 @@ i18n_auth_export=导出
i18n_auth_manage=管理 i18n_auth_manage=管理
i18n_template_system=系统模板 i18n_template_system=系统模板
i18n_template_self=用户模板 i18n_template_self=用户模板
i18n_name_cant_repeat_same_group=同一分组下名称不能重复
i18n_chart_count=记录数*
i18n_excel_have_merge_region=Excel存在合并单元格
i18n_cron_expression_error=Cron表达式校验错误
i18n_same_folder_can_not_repeat=相同的目录下名称不能重复 i18n_same_folder_can_not_repeat=相同的目录下名称不能重复
i18n_default_panel=默认仪表盘 i18n_default_panel=默认仪表盘
i18n_panel_list=仪表盘列表 i18n_panel_list=仪表盘列表
...@@ -229,6 +229,10 @@ i18n_auth_export=導出 ...@@ -229,6 +229,10 @@ i18n_auth_export=導出
i18n_auth_manage=管理 i18n_auth_manage=管理
i18n_template_system=系統模板 i18n_template_system=系統模板
i18n_template_self=用戶模板 i18n_template_self=用戶模板
i18n_name_cant_repeat_same_group=同一分組下名稱不能重復
i18n_chart_count=記錄數*
i18n_excel_have_merge_region=Excel存在合並單元格
i18n_cron_expression_error=Cron表達式校驗錯誤
i18n_same_folder_can_not_repeat=相同的目录下名称不能重复 i18n_same_folder_can_not_repeat=相同的目录下名称不能重复
i18n_default_panel=默认仪表盘 i18n_default_panel=默认仪表盘
i18n_panel_list=仪表盘列表 i18n_panel_list=仪表盘列表
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
"@babel/register": "7.0.0", "@babel/register": "7.0.0",
"@vue/cli-plugin-babel": "3.6.0", "@vue/cli-plugin-babel": "3.6.0",
"@vue/cli-plugin-eslint": "^3.9.1", "@vue/cli-plugin-eslint": "^3.9.1",
"@vue/cli-service": "3.6.0", "@vue/cli-service": "^3.3.1",
"babel-eslint": "10.0.1", "babel-eslint": "10.0.1",
"chalk": "2.4.2", "chalk": "2.4.2",
"connect": "3.6.6", "connect": "3.6.6",
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
"less": "^4.1.1", "less": "^4.1.1",
"less-loader": "^8.0.0", "less-loader": "^8.0.0",
"mockjs": "1.0.1-beta3", "mockjs": "1.0.1-beta3",
"runjs": "^4.3.2", "runjs": "^4.1.3",
"sass": "^1.32.5", "sass": "^1.32.5",
"sass-loader": "^10.1.1", "sass-loader": "^10.1.1",
"script-ext-html-webpack-plugin": "2.1.3", "script-ext-html-webpack-plugin": "2.1.3",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
{{ item.name }}<i class="el-icon-arrow-down el-icon--right" /> {{ item.name }}<i class="el-icon-arrow-down el-icon--right" />
</el-tag> </el-tag>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-delete" divided :command="beforeClickItem('remove')"> <el-dropdown-item icon="el-icon-delete" :command="beforeClickItem('remove')">
<span>{{ $t('chart.delete') }}</span> <span>{{ $t('chart.delete') }}</span>
</el-dropdown-item> </el-dropdown-item>
<slot /> <slot />
......
...@@ -79,8 +79,6 @@ export default { ...@@ -79,8 +79,6 @@ export default {
}, },
mounted() { mounted() {
const _this = this const _this = this
debugger
// 加载数据 // 加载数据
_this.restore() _this.restore()
const erd = elementResizeDetectorMaker() const erd = elementResizeDetectorMaker()
......
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
<el-button class="el-icon-document-delete" size="mini" circle @click="clearCanvas" /> <el-button class="el-icon-document-delete" size="mini" circle @click="clearCanvas" />
</el-tooltip> </el-tooltip>
<input id="input" ref="files" type="file" hidden @change="handleFileChange"> <input id="input" ref="files" type="file" hidden @change="handleFileChange">
<el-tooltip :content="$t('commons.save') ">
<el-button class="el-icon-circle-check" size="mini" circle @click="save" />
</el-tooltip>
<el-tooltip :content="$t('panel.preview')"> <el-tooltip :content="$t('panel.preview')">
<el-button class="el-icon-view" size="mini" circle @click="clickPreview" /> <el-button class="el-icon-view" size="mini" circle @click="clickPreview" />
</el-tooltip> </el-tooltip>
<span style="float: right;margin-left: 10px"> <span style="float: right;margin-left: 10px">
<el-button size="mini" @click="save">
{{ $t('commons.save') }}
</el-button>
<el-button size="mini" @click="closePanelEdit"> <el-button size="mini" @click="closePanelEdit">
{{ $t('commons.close') }} {{ $t('commons.close') }}
</el-button> </el-button>
...@@ -52,7 +52,7 @@ import { mapState } from 'vuex' ...@@ -52,7 +52,7 @@ import { mapState } from 'vuex'
import { commonStyle, commonAttr } from '@/components/canvas/custom-component/component-list' import { commonStyle, commonAttr } from '@/components/canvas/custom-component/component-list'
import eventBus from '@/components/canvas/utils/eventBus' import eventBus from '@/components/canvas/utils/eventBus'
import { deepCopy } from '@/components/canvas/utils/utils' import { deepCopy } from '@/components/canvas/utils/utils'
import { panelSave } from '@/api/panel/panel' import { post } from '@/api/panel/panel'
import bus from '@/utils/bus' import bus from '@/utils/bus'
export default { export default {
...@@ -208,13 +208,8 @@ export default { ...@@ -208,13 +208,8 @@ export default {
panelStyle: JSON.stringify(this.canvasStyleData), panelStyle: JSON.stringify(this.canvasStyleData),
panelData: JSON.stringify(this.componentData) panelData: JSON.stringify(this.componentData)
} }
panelSave(requestInfo).then(response => { post('panel/group/save', requestInfo, () => {})
this.$message({ this.$message.success('保存成功')
message: this.$t('commons.save_success'),
type: 'success',
showClose: true
})
})
}, },
clearCanvas() { clearCanvas() {
this.$store.commit('setComponentData', []) this.$store.commit('setComponentData', [])
......
function checkDataPermission(el, binding, vnode) { function checkDataPermission(el, binding, vnode) {
const dataPermission = vnode.privileges const dataPermission = vnode.privileges
debugger
const { value } = binding const { value } = binding
console.log('permission:' + value)
// // 数据授权采用并集的方式 部门 角色 用户 有一个有权限即可 // // 数据授权采用并集的方式 部门 角色 用户 有一个有权限即可
// if (value && value instanceof Array) { // if (value && value instanceof Array) {
// const needPermissions = value // const needPermissions = value
......
...@@ -815,6 +815,8 @@ export default { ...@@ -815,6 +815,8 @@ export default {
input_limit_0_50: '0-50 chars' input_limit_0_50: '0-50 chars'
}, },
panel: { panel: {
picture_limit: 'Only pictures can be inserted',
drag_here: 'Please drag the left field here',
copy_link_passwd: 'Copy link and password', copy_link_passwd: 'Copy link and password',
copy_link: 'Copy link', copy_link: 'Copy link',
passwd_protect: 'Password Protect', passwd_protect: 'Password Protect',
......
...@@ -814,6 +814,8 @@ export default { ...@@ -814,6 +814,8 @@ export default {
input_limit_0_50: '0-50字符' input_limit_0_50: '0-50字符'
}, },
panel: { panel: {
picture_limit: '只能插入圖片',
drag_here: '請將左側字段拖至此處',
copy_link_passwd: '複製鏈接及密碼', copy_link_passwd: '複製鏈接及密碼',
copy_link: '複製鏈接', copy_link: '複製鏈接',
passwd_protect: '密碼保護', passwd_protect: '密碼保護',
......
...@@ -816,6 +816,8 @@ export default { ...@@ -816,6 +816,8 @@ export default {
input_limit_0_50: '0-50字符' input_limit_0_50: '0-50字符'
}, },
panel: { panel: {
picture_limit: '只能插入图片',
drag_here: '请将左侧字段拖至此处',
copy_link_passwd: '复制链接及密码', copy_link_passwd: '复制链接及密码',
copy_link: '复制链接', copy_link: '复制链接',
passwd_protect: '密码保护', passwd_protect: '密码保护',
......
...@@ -125,20 +125,20 @@ ...@@ -125,20 +125,20 @@
</el-radio-group> </el-radio-group>
</div> </div>
</el-row> </el-row>
</div> <el-row style="color: #909399;">
<el-row style="padding: 4px 6px;color: #909399;"> <span>
<span> <span v-show="chart.type && (chart.type.includes('pie') || chart.type.includes('funnel'))">
<span v-show="chart.type && (chart.type.includes('pie') || chart.type.includes('funnel'))"> Tips: {{ $t('chart.only_one_quota') }}
Tips: {{ $t('chart.only_one_quota') }} </span>
</span> <span v-show="chart.type && (chart.type.includes('text'))">
<span v-show="chart.type && (chart.type.includes('text'))"> Tips: {{ $t('chart.only_one_result') }}
Tips: {{ $t('chart.only_one_result') }} </span>
</span> <span v-show="chart.type && chart.type.includes('gauge')">
<span v-show="chart.type && chart.type.includes('gauge')"> Tips: {{ $t('chart.only_one_quota') }},{{ $t('chart.only_one_result') }}
Tips: {{ $t('chart.only_one_quota') }},{{ $t('chart.only_one_result') }} </span>
</span> </span>
</span> </el-row>
</el-row> </div>
<div style="overflow:auto;border-top: 1px solid #e6e6e6" class="attr-style"> <div style="overflow:auto;border-top: 1px solid #e6e6e6" class="attr-style">
<el-row class="padding-lr"> <el-row class="padding-lr">
<span>{{ $t('chart.style_priority') }}</span> <span>{{ $t('chart.style_priority') }}</span>
...@@ -902,6 +902,8 @@ export default { ...@@ -902,6 +902,8 @@ export default {
/*background-color: rgba(35,46,64,.05);*/ /*background-color: rgba(35,46,64,.05);*/
background-color: white; background-color: white;
display: block; display: block;
word-break: break-all;
white-space: normal;
} }
.item-on-move { .item-on-move {
...@@ -977,7 +979,7 @@ export default { ...@@ -977,7 +979,7 @@ export default {
} }
.attr-style{ .attr-style{
height: calc(100vh - 56px - 25vh - 40px - 62px - 10px - 60px); height: calc(100vh - 56px - 25vh - 40px - 62px - 60px);
} }
.attr-selector{ .attr-selector{
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<el-col> <el-col>
<el-row> <el-row>
<el-col style="width: 200px;"> <el-col style="width: 200px;">
<el-form ref="form" :model="form" label-width="60px" size="mini" class="row-style"> <el-form ref="form" :model="form" label-width="100px" size="mini" class="row-style">
<el-form-item :label="$t('dataset.showRow')"> <el-form-item :label="$t('dataset.showRow')">
<el-input v-model="form.row"> <el-input v-model="form.row">
<el-button slot="append" icon="el-icon-search" @click="reSearch" /> <el-button slot="append" icon="el-icon-search" @click="reSearch" />
......
...@@ -135,8 +135,8 @@ ...@@ -135,8 +135,8 @@
</el-form-item> </el-form-item>
<el-form-item v-if="taskForm.rate === 'CRON'" label=""> <el-form-item v-if="taskForm.rate === 'CRON'" label="">
<el-popover v-model="cronEdit"> <el-popover v-model="cronEdit">
<cron @close="cronEdit = false" @change="cronChange" i18n="cn"/> <cron :i18n="lang" @close="cronEdit = false" @change="cronChange" />
<el-input v-model="taskForm.cron" size="mini" style="width: 50%" @click="cronEdit = true" slot="reference"/> <el-input slot="reference" v-model="taskForm.cron" size="mini" style="width: 50%" @click="cronEdit = true" />
</el-popover> </el-popover>
</el-form-item> </el-form-item>
<el-form-item :label="$t('dataset.end_time')" prop="end"> <el-form-item :label="$t('dataset.end_time')" prop="end">
...@@ -354,7 +354,8 @@ export default { ...@@ -354,7 +354,8 @@ export default {
incrementalUpdateType: 'incrementalAdd', incrementalUpdateType: 'incrementalAdd',
sql: '', sql: '',
incrementalConfig: {}, incrementalConfig: {},
cronEdit: false cronEdit: false,
lang: this.$store.getters.language === 'en_US' ? 'en' : 'cn'
} }
}, },
computed: { computed: {
......
...@@ -257,7 +257,7 @@ export default { ...@@ -257,7 +257,7 @@ export default {
this.$router.replace('/panel/index') this.$router.replace('/panel/index')
}, },
showPanel(type) { showPanel(type) {
debugger
if (this.showIndex === -1 || this.showIndex === type) { if (this.showIndex === -1 || this.showIndex === type) {
this.$nextTick(() => (this.show = !this.show)) this.$nextTick(() => (this.show = !this.show))
} }
...@@ -272,7 +272,6 @@ export default { ...@@ -272,7 +272,6 @@ export default {
// 点击样式按钮 排除 // 点击样式按钮 排除
const stick = evt.target.closest('.el-icon-magic-stick') const stick = evt.target.closest('.el-icon-magic-stick')
if (!parent && !self && !stick) { if (!parent && !self && !stick) {
debugger
this.show = false this.show = false
window.removeEventListener('click', this.closeSidebar) window.removeEventListener('click', this.closeSidebar)
this.showIndex = -1 this.showIndex = -1
...@@ -388,7 +387,6 @@ export default { ...@@ -388,7 +387,6 @@ export default {
this.openFilterDiolog() this.openFilterDiolog()
}, },
closeLeftPanel() { closeLeftPanel() {
debugger
this.show = false this.show = false
// this.beforeDestroy() // this.beforeDestroy()
}, },
......
...@@ -120,8 +120,7 @@ ...@@ -120,8 +120,7 @@
<div class="filter-field"> <div class="filter-field">
<div class="field-content"> <div class="field-content">
<div class="field-content-left"> <div class="field-content-left">
<!-- <div class="field-content-text">{{ $t('panel.field') }} </div> --> <div class="field-content-text">{{ $t('panel.field') }} </div>
<div class="field-content-text">字段</div>
</div> </div>
<div class="field-content-right"> <div class="field-content-right">
...@@ -133,8 +132,8 @@ ...@@ -133,8 +132,8 @@
:move="onMove" :move="onMove"
style="width:100%;height: 100%;margin:0 10px;border-radius: 4px;overflow-x: auto;display: flex;align-items: center;background-color: white;" style="width:100%;height: 100%;margin:0 10px;border-radius: 4px;overflow-x: auto;display: flex;align-items: center;background-color: white;"
@end="end2" @end="end2"
> >
<transition-group class="draggable-group"> <transition-group class="list-group" :data-value="$t('panel.drag_here')">
<drag-item v-for="(item,index) in selectField" :key="item.id" :item="item" :index="index" @closeItem="closeItem" /> <drag-item v-for="(item,index) in selectField" :key="item.id" :item="item" :index="index" @closeItem="closeItem" />
</transition-group> </transition-group>
</draggable> </draggable>
...@@ -309,7 +308,9 @@ export default { ...@@ -309,7 +308,9 @@ export default {
}, },
methods: { methods: {
attr(){
return 'aaa'
},
loadViews() { loadViews() {
const viewIds = this.componentData const viewIds = this.componentData
.filter(item => item.type === 'view' && item.propValue && item.propValue.viewId) .filter(item => item.type === 'view' && item.propValue && item.propValue.viewId)
...@@ -646,4 +647,16 @@ export default { ...@@ -646,4 +647,16 @@ export default {
} }
} }
.list-group:empty,
.list-group > div:empty {
display: inline-block;
width: 100%;
height: calc(100% - 13px);
}
.list-group:empty:before,
.list-group > div:empty:before {
content: attr(data-value);
}
</style> </style>
...@@ -127,7 +127,6 @@ export default { ...@@ -127,7 +127,6 @@ export default {
// 初始化授权模板 // 初始化授权模板
if (this.showExtent) { if (this.showExtent) {
authDetailsModel(this.dataInfo.authType).then(res => { authDetailsModel(this.dataInfo.authType).then(res => {
debugger
this.defaultAuthDetails = res.data this.defaultAuthDetails = res.data
}) })
this.loadAuth() this.loadAuth()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论