refactor(web): 增加一个查询表详情的接口
This commit is contained in:
@@ -14,6 +14,7 @@ import com.lanyuanxiaoyao.service.configuration.entity.PageResponse;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
|
||||
import com.lanyuanxiaoyao.service.forest.service.InfoService;
|
||||
import com.lanyuanxiaoyao.service.forest.service.ZookeeperService;
|
||||
import com.lanyuanxiaoyao.service.web.entity.FlinkJobVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.SyncStateVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.TableVO;
|
||||
import java.util.List;
|
||||
@@ -144,4 +145,17 @@ public class TableController extends BaseController {
|
||||
}
|
||||
return responseCrudData(infoService.tableMetaList(flinkJobId).collect(meta -> new TableVO(null, meta, null, null, null, null, null)));
|
||||
}
|
||||
|
||||
@GetMapping("detail")
|
||||
public AmisResponse getMeta(@RequestParam("flink_job_id") Long flinkJobId, @RequestParam("alias") String alias) throws Exception {
|
||||
if (ObjectUtil.isNull(flinkJobId) || ObjectUtil.isNull(alias)) {
|
||||
throw new Exception("flink job id or alias is null");
|
||||
}
|
||||
CompletableFuture<FlinkJob> flinkJobFuture = CompletableFuture.supplyAsync(() -> infoService.flinkJobDetail(flinkJobId), ExecutorProvider.EXECUTORS);
|
||||
CompletableFuture<TableMeta> tableMetaFuture = CompletableFuture.supplyAsync(() -> infoService.tableMetaDetail(flinkJobId, alias), ExecutorProvider.EXECUTORS);
|
||||
CompletableFuture.allOf(flinkJobFuture, tableMetaFuture).get();
|
||||
return responseData()
|
||||
.withData("flinkJob", new FlinkJobVO(flinkJobFuture.get()))
|
||||
.withData("tableMeta", tableMetaFuture.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.lanyuanxiaoyao.service.web.entity;
|
||||
|
||||
import com.eshore.odcp.hudi.connector.entity.FlinkJob;
|
||||
import com.eshore.odcp.hudi.connector.entity.TableMeta;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* 避免前段不支持java long类型的精度
|
||||
*
|
||||
* @author lanyuanxiaoyao
|
||||
* @date 2023-06-13
|
||||
*/
|
||||
public class FlinkJobVO {
|
||||
@JsonIgnore
|
||||
private final FlinkJob flinkJob;
|
||||
|
||||
public FlinkJobVO(FlinkJob flinkJob) {
|
||||
this.flinkJob = flinkJob;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return flinkJob.getId().toString();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return flinkJob.getName();
|
||||
}
|
||||
|
||||
public FlinkJob.RunMode getRunMode() {
|
||||
return flinkJob.getRunMode();
|
||||
}
|
||||
|
||||
public TableMeta.YarnMeta getOneInOneSyncYarn() {
|
||||
return flinkJob.getOneInOneSyncYarn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FlinkJobVO{" +
|
||||
"flinkJob=" + flinkJob +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user