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

This commit is contained in:
junjun 2022-11-02 17:43:03 +08:00
commit 6908992db8
8 changed files with 93 additions and 68 deletions

View File

@ -67,7 +67,12 @@ public class DataSetTableTaskController {
@PostMapping("list/{goPage}/{pageSize}") @PostMapping("list/{goPage}/{pageSize}")
public Pager<List<DataSetTaskDTO>> list(@RequestBody DatasetTableTask datasetTableTask, @PathVariable int goPage, @PathVariable int pageSize) { public Pager<List<DataSetTaskDTO>> list(@RequestBody DatasetTableTask datasetTableTask, @PathVariable int goPage, @PathVariable int pageSize) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, dataSetTableTaskService.list(datasetTableTask)); Pager<List<DataSetTaskDTO>> listPager = PageUtils.setPageInfo(page, dataSetTableTaskService.list(datasetTableTask));
List<DataSetTaskDTO> listObject = listPager.getListObject();
for (DataSetTaskDTO dto : listObject) {
dataSetTableTaskLogService.lastExecStatus(dto);
}
return listPager;
} }
@ApiOperation("分页查询") @ApiOperation("分页查询")

View File

@ -34,6 +34,8 @@ import java.util.stream.Collectors;
@Service("apiProvider") @Service("apiProvider")
public class ApiProvider extends Provider { public class ApiProvider extends Provider {
private static String path = "['%s']";
@Resource @Resource
private SystemParameterService systemParameterService; private SystemParameterService systemParameterService;
@ -198,10 +200,10 @@ public class ApiProvider extends Provider {
handleStr(apiDefinition, response, fields, rootPath); handleStr(apiDefinition, response, fields, rootPath);
} }
for (JSONObject field : fields) { for (JSONObject field : fields) {
if(field.containsKey("children") && CollectionUtils.isNotEmpty(field.getJSONArray("children"))){ if (field.containsKey("children") && CollectionUtils.isNotEmpty(field.getJSONArray("children"))) {
field.put("disabled", false); field.put("disabled", false);
} }
if(field.containsKey("children") && CollectionUtils.isEmpty(field.getJSONArray("children"))){ if (field.containsKey("children") && CollectionUtils.isEmpty(field.getJSONArray("children"))) {
field.put("disabled", true); field.put("disabled", true);
} }
} }
@ -238,14 +240,14 @@ public class ApiProvider extends Provider {
array.add(StringUtils.isNotEmpty(jsonObject.getString(s)) ? jsonObject.getString(s) : ""); array.add(StringUtils.isNotEmpty(jsonObject.getString(s)) ? jsonObject.getString(s) : "");
o.put("value", array); o.put("value", array);
} }
o.put("jsonPath", rootPath + "." + s); o.put("jsonPath", rootPath + "." + String.format(path, s));
setProperty(apiDefinition, o, s); setProperty(apiDefinition, o, s);
if (!hasItem(apiDefinition, fields, o)) { if (!hasItem(apiDefinition, fields, o)) {
fields.add(o); fields.add(o);
} }
} else if (StringUtils.isNotEmpty(value) && value.startsWith("{")) { } else if (StringUtils.isNotEmpty(value) && value.startsWith("{")) {
List<JSONObject> children = new ArrayList<>(); List<JSONObject> children = new ArrayList<>();
handleStr(apiDefinition, jsonObject.getString(s), children, rootPath + "." + s); handleStr(apiDefinition, jsonObject.getString(s), children, rootPath + "." + String.format(path, s));
JSONObject o = new JSONObject(); JSONObject o = new JSONObject();
o.put("children", children); o.put("children", children);
o.put("childrenDataType", "OBJECT"); o.put("childrenDataType", "OBJECT");
@ -256,7 +258,7 @@ public class ApiProvider extends Provider {
} }
} else { } else {
JSONObject o = new JSONObject(); JSONObject o = new JSONObject();
o.put("jsonPath", rootPath + "." + s); o.put("jsonPath", rootPath + "." + String.format(path, s));
setProperty(apiDefinition, o, s); setProperty(apiDefinition, o, s);
JSONArray array = new JSONArray(); JSONArray array = new JSONArray();
array.add(StringUtils.isNotEmpty(jsonObject.getString(s)) ? jsonObject.getString(s) : ""); array.add(StringUtils.isNotEmpty(jsonObject.getString(s)) ? jsonObject.getString(s) : "");

View File

@ -89,8 +89,8 @@ public class JdbcProvider extends DefaultJdbcProvider {
} }
DatabaseMetaData databaseMetaData = connection.getMetaData(); DatabaseMetaData databaseMetaData = connection.getMetaData();
String tableNamePattern = datasourceRequest.getTable(); String tableNamePattern = datasourceRequest.getTable();
if(datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.mysql.name())){ if (datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.mysql.name())) {
if(databaseMetaData.getDriverMajorVersion() < 8){ if (databaseMetaData.getDriverMajorVersion() < 8) {
tableNamePattern = String.format(MySQLConstants.KEYWORD_TABLE, tableNamePattern); tableNamePattern = String.format(MySQLConstants.KEYWORD_TABLE, tableNamePattern);
} }
} }
@ -98,29 +98,36 @@ public class JdbcProvider extends DefaultJdbcProvider {
while (resultSet.next()) { while (resultSet.next()) {
String tableName = resultSet.getString("TABLE_NAME"); String tableName = resultSet.getString("TABLE_NAME");
String database; String database;
if (datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.pg.name()) ||datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.ck.name()) || datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.impala.name())) { String schema = resultSet.getString("TABLE_SCHEM");
if (datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.pg.name()) || datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.ck.name())
|| datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.impala.name())) {
database = resultSet.getString("TABLE_SCHEM"); database = resultSet.getString("TABLE_SCHEM");
} else { } else {
database = resultSet.getString("TABLE_CAT"); database = resultSet.getString("TABLE_CAT");
} }
if(datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.pg.name())){ if (datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.pg.name())) {
if (tableName.equals(datasourceRequest.getTable()) && database.equalsIgnoreCase(getDsSchema(datasourceRequest))) { if (tableName.equals(datasourceRequest.getTable()) && database.equalsIgnoreCase(getDsSchema(datasourceRequest))) {
TableField tableField = getTableFiled(resultSet, datasourceRequest); TableField tableField = getTableFiled(resultSet, datasourceRequest);
list.add(tableField); list.add(tableField);
} }
}else { } else if (datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.sqlServer.name())) {
if (database != null) { if (tableName.equals(datasourceRequest.getTable()) && database.equalsIgnoreCase(getDatabase(datasourceRequest)) && schema.equalsIgnoreCase(getDsSchema(datasourceRequest))) {
if (tableName.equals(datasourceRequest.getTable()) && database.equalsIgnoreCase(getDatabase(datasourceRequest))) { TableField tableField = getTableFiled(resultSet, datasourceRequest);
TableField tableField = getTableFiled(resultSet, datasourceRequest); list.add(tableField);
list.add(tableField); }
} } else {
} else { if (database != null) {
if (tableName.equals(datasourceRequest.getTable())) { if (tableName.equals(datasourceRequest.getTable()) && database.equalsIgnoreCase(getDatabase(datasourceRequest))) {
TableField tableField = getTableFiled(resultSet, datasourceRequest); TableField tableField = getTableFiled(resultSet, datasourceRequest);
list.add(tableField); list.add(tableField);
} }
} } else {
} if (tableName.equals(datasourceRequest.getTable())) {
TableField tableField = getTableFiled(resultSet, datasourceRequest);
list.add(tableField);
}
}
}
} }
resultSet.close(); resultSet.close();
@ -165,9 +172,9 @@ public class JdbcProvider extends DefaultJdbcProvider {
} else { } else {
String size = resultSet.getString("COLUMN_SIZE"); String size = resultSet.getString("COLUMN_SIZE");
if (size == null) { if (size == null) {
if(dbType.equals("JSON") && datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.mysql.name())){ if (dbType.equals("JSON") && datasourceRequest.getDatasource().getType().equalsIgnoreCase(DatasourceTypes.mysql.name())) {
tableField.setFieldSize(65535); tableField.setFieldSize(65535);
}else { } else {
tableField.setFieldSize(1); tableField.setFieldSize(1);
} }
@ -176,7 +183,7 @@ public class JdbcProvider extends DefaultJdbcProvider {
} }
} }
} }
if(StringUtils.isNotEmpty(tableField.getFieldType()) && tableField.getFieldType().equalsIgnoreCase("DECIMAL")){ if (StringUtils.isNotEmpty(tableField.getFieldType()) && tableField.getFieldType().equalsIgnoreCase("DECIMAL")) {
tableField.setAccuracy(Integer.valueOf(resultSet.getString("DECIMAL_DIGITS"))); tableField.setAccuracy(Integer.valueOf(resultSet.getString("DECIMAL_DIGITS")));
} }
return tableField; return tableField;
@ -746,16 +753,16 @@ public class JdbcProvider extends DefaultJdbcProvider {
} }
@Override @Override
public void checkConfiguration(Datasource datasource)throws Exception{ public void checkConfiguration(Datasource datasource) throws Exception {
if (StringUtils.isEmpty(datasource.getConfiguration())){ if (StringUtils.isEmpty(datasource.getConfiguration())) {
throw new Exception("Datasource configuration is empty"); throw new Exception("Datasource configuration is empty");
} }
try { try {
JdbcConfiguration jdbcConfiguration = new Gson().fromJson(datasource.getConfiguration(), JdbcConfiguration.class); JdbcConfiguration jdbcConfiguration = new Gson().fromJson(datasource.getConfiguration(), JdbcConfiguration.class);
if(jdbcConfiguration.getQueryTimeout() < 0){ if (jdbcConfiguration.getQueryTimeout() < 0) {
throw new Exception("Querytimeout cannot be less than zero." ); throw new Exception("Querytimeout cannot be less than zero.");
} }
}catch (Exception e){ } catch (Exception e) {
throw new Exception("Invalid configuration: " + e.getMessage()); throw new Exception("Invalid configuration: " + e.getMessage());
} }

View File

@ -170,7 +170,7 @@ public class DataSetTableService {
datasetTableTask.setTableId(datasetTable.getId()); datasetTableTask.setTableId(datasetTable.getId());
datasetTableTask.setRate(ScheduleType.SIMPLE.toString()); datasetTableTask.setRate(ScheduleType.SIMPLE.toString());
datasetTableTask.setType("all_scope"); datasetTableTask.setType("all_scope");
datasetTableTask.setName(datasetTable.getName() + " 更新设置"); datasetTableTask.setName(datasetTable.getName() + " 更新设置-" + System.currentTimeMillis());
datasetTableTask.setEnd("0"); datasetTableTask.setEnd("0");
datasetTableTask.setStatus(TaskStatus.Underway.name()); datasetTableTask.setStatus(TaskStatus.Underway.name());
datasetTableTask.setStartTime(System.currentTimeMillis()); datasetTableTask.setStartTime(System.currentTimeMillis());

View File

@ -81,11 +81,13 @@ public class PanelAppTemplateService {
if (StringUtils.isEmpty(requestTemplate.getNodeType())) { if (StringUtils.isEmpty(requestTemplate.getNodeType())) {
requestTemplate.setNodeType("template"); requestTemplate.setNodeType("template");
} }
//Store static resource into the server if(StringUtils.isNotEmpty(request.getSnapshot())){
String snapshotName = "app-template-" + request.getId() + ".jpeg"; //Store static resource into the server
staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", "")); String snapshotName = "app-template-" + request.getId() + ".jpeg";
requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName); staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", ""));
panelAppTemplateMapper.insertSelective(requestTemplate); requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName);
panelAppTemplateMapper.insertSelective(requestTemplate);
}
} }
@ -96,9 +98,11 @@ public class PanelAppTemplateService {
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs(); PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
BeanUtils.copyBean(requestTemplate, request); BeanUtils.copyBean(requestTemplate, request);
//Store static resource into the server //Store static resource into the server
String snapshotName = "app-template-" + request.getId() + ".jpeg"; if(StringUtils.isNotEmpty(request.getSnapshot())){
staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", "")); String snapshotName = "app-template-" + request.getId() + ".jpeg";
requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName); staticResourceService.saveSingleFileToServe(snapshotName, request.getSnapshot().replace("data:image/jpeg;base64,", ""));
requestTemplate.setSnapshot("/" + UPLOAD_URL_PREFIX + '/' + snapshotName);
}
panelAppTemplateMapper.updateByPrimaryKeySelective(requestTemplate); panelAppTemplateMapper.updateByPrimaryKeySelective(requestTemplate);
} }

View File

@ -136,7 +136,7 @@ INSERT INTO `sys_auth` (`id`, `auth_source`, `auth_source_type`, `auth_target`,
DROP FUNCTION IF EXISTS `GET_V_AUTH_MODEL_WITH_CHILDREN`; DROP FUNCTION IF EXISTS `GET_V_AUTH_MODEL_WITH_CHILDREN`;
delimiter ;; delimiter ;;
CREATE FUNCTION `GET_V_AUTH_MODEL_WITH_CHILDREN`(parentId longtext,modelType varchar(255)) CREATE FUNCTION `GET_V_AUTH_MODEL_WITH_CHILDREN`(parentId longtext,modelType varchar(255))
RETURNS longtext CHARSET utf8mb4 RETURNS longtext CHARSET utf8mb4 COLLATE utf8mb4_general_ci
READS SQL DATA READS SQL DATA
BEGIN BEGIN
@ -176,7 +176,7 @@ delimiter ;
DROP FUNCTION IF EXISTS `GET_V_AUTH_MODEL_WITH_PARENT`; DROP FUNCTION IF EXISTS `GET_V_AUTH_MODEL_WITH_PARENT`;
delimiter ;; delimiter ;;
CREATE FUNCTION `GET_V_AUTH_MODEL_WITH_PARENT`(childrenId longtext,modelType varchar(255)) CREATE FUNCTION `GET_V_AUTH_MODEL_WITH_PARENT`(childrenId longtext,modelType varchar(255))
RETURNS longtext CHARSET utf8mb4 RETURNS longtext CHARSET utf8mb4 COLLATE utf8mb4_general_ci
READS SQL DATA READS SQL DATA
BEGIN BEGIN

View File

@ -211,16 +211,16 @@
/> />
</span> </span>
</span> </span>
<el-input <!-- <el-input-->
v-if="scope.row.deType === 1" <!-- v-if="scope.row.deType === 1"-->
v-model="scope.row.dateFormat" <!-- v-model="scope.row.dateFormat"-->
:placeholder="$t('dataset.date_format')" <!-- :placeholder="$t('dataset.date_format')"-->
size="small" <!-- size="small"-->
class="input-type" <!-- class="input-type"-->
:disabled="!hasDataPermission('manage', param.privileges)" <!-- :disabled="!hasDataPermission('manage', param.privileges)"-->
@blur="saveEdit(scope.row)" <!-- @blur="saveEdit(scope.row)"-->
@keyup.enter.native="saveEdit(scope.row)" <!-- @keyup.enter.native="saveEdit(scope.row)"-->
/> <!-- />-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -548,16 +548,16 @@
/> />
</span> </span>
</span> </span>
<el-input <!-- <el-input-->
v-if="scope.row.deType === 1" <!-- v-if="scope.row.deType === 1"-->
v-model="scope.row.dateFormat" <!-- v-model="scope.row.dateFormat"-->
:placeholder="$t('dataset.date_format')" <!-- :placeholder="$t('dataset.date_format')"-->
size="small" <!-- size="small"-->
class="input-type" <!-- class="input-type"-->
:disabled="!hasDataPermission('manage', param.privileges)" <!-- :disabled="!hasDataPermission('manage', param.privileges)"-->
@blur="saveEdit(scope.row)" <!-- @blur="saveEdit(scope.row)"-->
@keyup.enter.native="saveEdit(scope.row)" <!-- @keyup.enter.native="saveEdit(scope.row)"-->
/> <!-- />-->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column

View File

@ -68,8 +68,15 @@
v-if="scope.row.lastExecStatus" v-if="scope.row.lastExecStatus"
:class="[`de-${scope.row.lastExecStatus}-pre`, 'de-status']" :class="[`de-${scope.row.lastExecStatus}-pre`, 'de-status']"
>{{ >{{
$t(`dataset.${scope.row.lastExecStatus.toLocaleLowerCase()}`) $t(`dataset.${scope.row.lastExecStatus.toLocaleLowerCase()}`)
}} }}
<svg-icon
v-if="scope.row.lastExecStatus === 'Error'"
style="cursor: pointer;"
icon-class="icon-maybe"
class="field-icon-location"
@click="showErrorMassage(scope.row.msg)"
/>
</span> </span>
<span v-else>-</span> <span v-else>-</span>
</template> </template>