Skip to content

Commit

Permalink
optimization some code (#2379)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyongtian authored Oct 12, 2023
1 parent 96ce025 commit e9762b0
Show file tree
Hide file tree
Showing 33 changed files with 720 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result;
import org.dinky.service.AlertGroupService;
import org.dinky.service.AlertHistoryService;

import java.util.List;

Expand Down Expand Up @@ -59,7 +58,6 @@
public class AlertGroupController {

private final AlertGroupService alertGroupService;
private final AlertHistoryService alertHistoryService;

/**
* save or update alert Group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result;
import org.dinky.service.ClusterInstanceService;
import org.dinky.service.JobInstanceService;

import java.util.List;

Expand Down Expand Up @@ -60,7 +59,6 @@
public class ClusterInstanceController {

private final ClusterInstanceService clusterInstanceService;
private final JobInstanceService jobInstanceService;

/**
* added or updated cluster instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.dinky.explainer.lineage.LineageResult;
import org.dinky.job.BuildConfiguration;
import org.dinky.service.JobInstanceService;
import org.dinky.service.TaskService;

import java.util.HashSet;
import java.util.Set;
Expand Down Expand Up @@ -66,9 +65,7 @@
@RequestMapping("/api/jobInstance")
@RequiredArgsConstructor
public class JobInstanceController {

private final JobInstanceService jobInstanceService;
private final TaskService taskService;

/**
* 动态查询列表
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ public class RoleMenuController {
/**
* assign menus to role
*
* @param roleId
* @param menus
* @param assignMenuToRoleDto
* @return {@link Result} with {@link Void}
* @throws Exception {@link Exception}
*/
@PostMapping("assignMenuToRole")
@Log(title = "Assign Menus to Role ", businessType = BusinessType.GRANT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public Result<Map<String, List<Configuration<?>>>> getAll() {
example = "sys")
public Result<List<Configuration<?>>> getOneTypeByKey(@RequestParam("type") String type) {
Map<String, List<Configuration<?>>> all = sysConfigService.getAll();
// 过滤出 以 type 开头的配置 返回 list
// Filter out configurations starting with type and return a list
List<Configuration<?>> configList = all.entrySet().stream()
.filter(entry -> entry.getKey().startsWith(type))
.map(Map.Entry::getValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public interface AlertGroupService extends ISuperService<AlertGroup> {
* alert group enable or disable by id
*
* @param id
* @return
* @return {@link Boolean}
*/
Boolean modifyAlertGroupStatus(Integer id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ public interface AlertHistoryService extends ISuperService<AlertHistory> {
* @param alertGroupId {@link Integer}
* @return {@link Boolean}
*/
@Deprecated
Boolean deleteByAlertGroupId(Integer alertGroupId);

/**
* Query alert history records by job instance ID.
*
* @param jobInstanceId The ID of the job instance for which to query alert history records.
* @return A list of {@link AlertHistory} objects representing the alert history records for the specified job instance.
*/
List<AlertHistory> queryAlertHistoryRecordByJobInstanceId(Integer jobInstanceId);
}
75 changes: 75 additions & 0 deletions dinky-admin/src/main/java/org/dinky/service/CatalogueService.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,102 @@
*/
public interface CatalogueService extends ISuperService<Catalogue> {

/**
* Get the catalogue tree
*
* @return A list of {@link Catalogue} objects representing the catalogue tree.
*/
List<Catalogue> getCatalogueTree();

/**
* Find a catalogue by its parent ID and name.
*
* @param parentId The ID of the parent catalogue to find the child catalogue for.
* @param name The name of the catalogue to find.
* @return A {@link Catalogue} object representing the found catalogue.
*/
Catalogue findByParentIdAndName(Integer parentId, String name);

/**
* Save or update a catalogue and its tasks.
*
* @param catalogueTaskDTO A {@link CatalogueTaskDTO} object representing the updated catalogue and tasks.
* @return A {@link Catalogue} object representing the saved or updated catalogue.
*/
Catalogue saveOrUpdateCatalogueAndTask(CatalogueTaskDTO catalogueTaskDTO);

/**
* Create a catalogue and file task based on the given catalogue task DTO.
*
* @param catalogueTaskDTO A {@link CatalogueTaskDTO} object representing the catalogue task to create.
* @param ment The name of the catalogue to create.
* @return A boolean value indicating whether the catalogue was created successfully.
*/
Catalogue createCatalogAndFileTask(CatalogueTaskDTO catalogueTaskDTO, String ment);

/**
* Check if the given catalogue needs to be renamed.
*
* @param catalogue A {@link Catalogue} object representing the catalogue to check.
* @return A boolean value indicating whether the catalogue needs to be renamed.
*/
boolean toRename(Catalogue catalogue);

/**
* Move the given catalogue from one parent ID to another.
*
* @param originCatalogueId The ID of the catalogue to move.
* @param targetParentId The ID of the new parent for the catalogue.
* @return A boolean value indicating whether the catalogue was moved successfully.
*/
boolean moveCatalogue(Integer originCatalogueId, Integer targetParentId);

/**
* Copy a task from the given catalogue.
*
* @param catalogue A {@link Catalogue} object representing the catalogue to copy the task from.
* @return A boolean value indicating whether the task was copied successfully.
*/
boolean copyTask(Catalogue catalogue);

/**
* Add dependent catalogues for the given catalogue names.
*
* @param catalogueNames An array of strings representing the names of the catalogues to add as dependents.
* @return An integer representing the ID of the added catalogue.
*/
Integer addDependCatalogue(String[] catalogueNames);

/**
* Traverse the file system based on the given source path and catalogue.
*
* @param sourcePath The path of the source directory to traverse.
* @param catalog A {@link Catalogue} object representing the catalogue to use for filtering files.
*/
void traverseFile(String sourcePath, Catalogue catalog);

/**
* Get the catalogue with the given parent ID and name.
*
* @param parentId The ID of the parent catalogue to find the child catalogue for.
* @param name The name of the catalogue to find.
* @return A {@link Catalogue} object representing the found catalogue.
*/
Catalogue getCatalogue(Integer parentId, String name);

/**
* Delete a catalogue by its ID.
*
* @param catalogueId The ID of the catalogue to delete.
* @return A {@link Result<Void>} object representing the result of the deletion operation.
*/
Result<Void> deleteCatalogueById(Integer catalogueId);

/**
* Save, update, or rename a catalogue based on the given parameters.
*
* @param catalogue A {@link Catalogue} object representing the catalogue to save, update, or rename.
* @return A boolean value indicating whether the operation was successful.
*/
Boolean saveOrUpdateOrRename(Catalogue catalogue);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,42 @@
*/
public interface ClusterConfigurationService extends ISuperService<ClusterConfiguration> {

/**
* Get the cluster configuration with the given ID.
*
* @param id The ID of the cluster configuration to get.
* @return A {@link ClusterConfiguration} object representing the found cluster configuration.
*/
ClusterConfiguration getClusterConfigById(Integer id);

/**
* List all enabled cluster configurations.
*
* @return A list of {@link ClusterConfiguration} objects representing all enabled cluster configurations.
*/
List<ClusterConfiguration> listEnabledAllClusterConfig();

/**
* Get the Flink cluster configuration with the given ID.
*
* @param id The ID of the Flink cluster configuration to get.
* @return A {@link FlinkClusterConfig} object representing the found Flink cluster configuration.
*/
FlinkClusterConfig getFlinkClusterCfg(Integer id);

TestResult testGateway(ClusterConfigurationDTO clusterConfiguration);
/**
* Test the given cluster configuration.
*
* @param clusterConfigurationDTO A {@link ClusterConfigurationDTO} object representing the cluster configuration to test.
* @return A {@link TestResult} object representing the test results.
*/
TestResult testGateway(ClusterConfigurationDTO clusterConfigurationDTO);

/**
* Modify the status of a cluster configuration based on its ID.
*
* @param id The ID of the cluster configuration to modify.
* @return A boolean value indicating whether the modification was successful.
*/
Boolean modifyClusterConfigStatus(Integer id);
}
49 changes: 49 additions & 0 deletions dinky-admin/src/main/java/org/dinky/service/DataBaseService.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,37 @@ public interface DataBaseService extends ISuperService<DataBase> {
*/
List<Column> listColumns(Integer id, String schemaName, String tableName);

/**
* Get the Flink table SQL for the given ID, schema name, and table name.
*
* @param id The ID of the Flink table to get the SQL for.
* @param schemaName The name of the schema for the Flink table.
* @param tableName The name of the table for the Flink table.
* @return A string representing the Flink table SQL.
*/
@Deprecated
String getFlinkTableSql(Integer id, String schemaName, String tableName);

/**
* Get the SQL select statement for the given ID, schema name, and table name.
*
* @param id The ID of the table to get the SQL select statement for.
* @param schemaName The name of the schema for the table.
* @param tableName The name of the table for the SQL select statement.
* @return A string representing the SQL select statement.
*/
@Deprecated
String getSqlSelect(Integer id, String schemaName, String tableName);

/**
* Get the SQL create statement for the given ID, schema name, and table name.
*
* @param id The ID of the table to get the SQL create statement for.
* @param schemaName The name of the schema for the table.
* @param tableName The name of the table for the SQL create statement.
* @return A string representing the SQL create statement.
*/
@Deprecated
String getSqlCreate(Integer id, String schemaName, String tableName);

/**
Expand Down Expand Up @@ -129,8 +156,18 @@ public interface DataBaseService extends ISuperService<DataBase> {
*/
SqlGeneration getSqlGeneration(Integer id, String schemaName, String tableName);

/**
* List all enabled Flink with statements.
*
* @return A list of strings representing all enabled Flink with statements.
*/
List<String> listEnabledFlinkWith();

/**
* Get the SQL for enabling Flink with statements.
*
* @return A string representing the SQL for enabling Flink with statements.
*/
String getEnabledFlinkWithSql();

/**
Expand All @@ -141,7 +178,19 @@ public interface DataBaseService extends ISuperService<DataBase> {
*/
Boolean copyDatabase(DataBase database);

/**
* Explain common SQL statements for the given task.
*
* @param task A {@link TaskDTO} object representing the task to explain.
* @return A list of {@link SqlExplainResult} objects representing the explanation results of common SQL statements.
*/
List<SqlExplainResult> explainCommonSql(TaskDTO task);

/**
* Execute the given SQL DTO and return the job result.
*
* @param sqlDTO A {@link SqlDTO} object representing the SQL statement to execute.
* @return A {@link JobResult} object representing the execution result of the SQL statement.
*/
JobResult executeCommonSql(SqlDTO sqlDTO);
}
14 changes: 10 additions & 4 deletions dinky-admin/src/main/java/org/dinky/service/GitProjectService.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
*/
public interface GitProjectService extends ISuperService<GitProject> {
/**
* 保存或更新
* Save or update the given Git project.
*
* @param gitProjectDTO gitProjectDTO
* @param gitProjectDTO A {@link GitProjectDTO} object representing the Git project to save or update.
*/
void saveOrUpdate(GitProjectDTO gitProjectDTO);

Expand All @@ -55,12 +55,18 @@ public interface GitProjectService extends ISuperService<GitProject> {
*/
Boolean dragendSortJar(GitProjectSortJarParams gitProjectSortJarParams);

/**
* Get the Git pool as a map of strings.
*
* @return A map of strings representing the Git pool.
*/
Map<String, String> getGitPool();

/**
* 更新状态
* Modify the status of a Git project based on its ID.
*
* @param id id
* @param id The ID of the Git project to modify the status for.
* @return A boolean value indicating whether the modification was successful.
*/
Boolean modifyGitProjectStatus(Integer id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,12 @@
*/
public interface HistoryService extends ISuperService<History> {

/**
* Remove the history of a Git project based on its ID.
*
* @param id The ID of the Git project to remove the history for.
* @return A boolean value indicating whether the removal was successful.
*/
@Deprecated
boolean removeHistoryById(Integer id);
}
5 changes: 5 additions & 0 deletions dinky-admin/src/main/java/org/dinky/service/JarService.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@
*/
public interface JarService extends ISuperService<Jar> {

/**
* List all enabled jar files.
*
* @return A list of {@link Jar} objects representing all enabled jar files.
*/
List<Jar> listEnabledAll();
}
Loading

0 comments on commit e9762b0

Please sign in to comment.