Skip to content

Commit

Permalink
optimize-same-web-code (DataLinkDC#2393)
Browse files Browse the repository at this point in the history
  • Loading branch information
zackyoungh authored Oct 17, 2023
1 parent dc81815 commit cd7470a
Show file tree
Hide file tree
Showing 11 changed files with 711 additions and 673 deletions.
27 changes: 15 additions & 12 deletions dinky-admin/src/main/java/org/dinky/data/dto/JobDataDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import com.fasterxml.jackson.databind.JsonNode;

import cn.hutool.core.lang.Opt;
import cn.hutool.json.JSONUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
Expand Down Expand Up @@ -115,17 +116,19 @@ public JobHistory toJobHistory() {
}

public static JobDataDto fromJobHistory(JobHistory jobHistory) {
return JobDataDto.builder()
.id(jobHistory.getId())
.tenantId(jobHistory.getTenantId())
.job(jobHistory.getJobJson())
.exceptions(jobHistory.getExceptionsJson())
.checkpoints(jobHistory.getCheckpointsJson())
.checkpointsConfig(jobHistory.getCheckpointsConfigJson())
.config(jobHistory.getConfigJson())
.jar(JsonUtils.parseToJsonNode(jobHistory.getJarJson()))
.cluster(jobHistory.getClusterJson())
.clusterConfiguration(jobHistory.getClusterConfigurationJson())
.build();
return Opt.ofNullable(jobHistory)
.map(x -> JobDataDto.builder()
.id(jobHistory.getId())
.tenantId(jobHistory.getTenantId())
.job(jobHistory.getJobJson())
.exceptions(jobHistory.getExceptionsJson())
.checkpoints(jobHistory.getCheckpointsJson())
.checkpointsConfig(jobHistory.getCheckpointsConfigJson())
.config(jobHistory.getConfigJson())
.jar(JsonUtils.parseToJsonNode(jobHistory.getJarJson()))
.cluster(jobHistory.getClusterJson())
.clusterConfiguration(jobHistory.getClusterConfigurationJson())
.build())
.orElse(null);
}
}
Loading

0 comments on commit cd7470a

Please sign in to comment.