增加生成后端服务代码。
This commit is contained in:
parent
1c166c2559
commit
5d375b7783
@ -28,6 +28,7 @@ import jakarta.annotation.Resource;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@ -75,7 +76,7 @@ public class JenkinsBuildServiceImpl extends BaseServiceImpl<JenkinsBuild, Jenki
|
|||||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional
|
||||||
public Integer syncAllBuilds(Long externalSystemId) {
|
public Integer syncAllBuilds(Long externalSystemId) {
|
||||||
// 1. 创建同步历史记录
|
// 1. 创建同步历史记录
|
||||||
JenkinsSyncHistoryDTO syncHistory = new JenkinsSyncHistoryDTO();
|
JenkinsSyncHistoryDTO syncHistory = new JenkinsSyncHistoryDTO();
|
||||||
@ -175,7 +176,7 @@ public class JenkinsBuildServiceImpl extends BaseServiceImpl<JenkinsBuild, Jenki
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||||
public Integer syncBuilds(ExternalSystem externalSystem, JenkinsJob job) {
|
public Integer syncBuilds(ExternalSystem externalSystem, JenkinsJob job) {
|
||||||
JenkinsJobResponse queryJob = jenkinsServiceIntegration.job(externalSystem, job.getJobName());
|
JenkinsJobResponse queryJob = jenkinsServiceIntegration.job(externalSystem, job.getJobName());
|
||||||
if (queryJob == null || queryJob.getLastBuild() == null) {
|
if (queryJob == null || queryJob.getLastBuild() == null) {
|
||||||
|
|||||||
@ -11,51 +11,56 @@ import lombok.EqualsAndHashCode;
|
|||||||
public class DeployNodeFormVariables extends BaseNodeFormVariables {
|
public class DeployNodeFormVariables extends BaseNodeFormVariables {
|
||||||
|
|
||||||
@SchemaProperty(
|
@SchemaProperty(
|
||||||
title = "项目",
|
title = "绑定三方Jenkins系统",
|
||||||
description = "选择项目",
|
description = "请选择三方Jenkins系统",
|
||||||
required = true,
|
required = true,
|
||||||
dataSource = @SchemaPropertyDataSource(
|
dataSource = @SchemaPropertyDataSource(
|
||||||
type = "api",
|
type = "api",
|
||||||
url = "/api/v1/projects",
|
url = "/api/v1/external-system/list?type=JENKINS",
|
||||||
valueField = "id",
|
valueField = "id",
|
||||||
labelField = "name"
|
labelField = "name"
|
||||||
|
),
|
||||||
|
order = 1
|
||||||
)
|
)
|
||||||
)
|
private String externalSystemId;
|
||||||
private String projectId;
|
|
||||||
|
|
||||||
@SchemaProperty(
|
@SchemaProperty(
|
||||||
title = "Jenkins视图",
|
title = "绑定Jenkins视图",
|
||||||
description = "Jenkins视图名称",
|
description = "Jenkins视图",
|
||||||
required = true,
|
required = true,
|
||||||
dataSource = @SchemaPropertyDataSource(
|
dataSource = @SchemaPropertyDataSource(
|
||||||
type = "api",
|
type = "api",
|
||||||
url = "/api/v1/jenkins/views",
|
url = "/api/v1/jenkins-view/list",
|
||||||
valueField = "name",
|
valueField = "id",
|
||||||
labelField = "name",
|
labelField = "viewName",
|
||||||
dependsOn = {"projectId"},
|
dependsOn = {"externalSystemId"},
|
||||||
params = {
|
params = {
|
||||||
@SchemaPropertyDataSourceParam(name = "projectId", value = "${projectId}")
|
@SchemaPropertyDataSourceParam(name = "externalSystemId", value = "${externalSystemId}")
|
||||||
}
|
}
|
||||||
|
),
|
||||||
|
order = 2
|
||||||
)
|
)
|
||||||
)
|
private String viewId;
|
||||||
private String view;
|
|
||||||
|
|
||||||
@SchemaProperty(
|
@SchemaProperty(
|
||||||
title = "Jenkins任务",
|
title = "绑定Jenkins任务",
|
||||||
description = "Jenkins任务名称",
|
description = "Jenkins任务",
|
||||||
required = true,
|
required = true,
|
||||||
dataSource = @SchemaPropertyDataSource(
|
dataSource = @SchemaPropertyDataSource(
|
||||||
type = "api",
|
type = "api",
|
||||||
url = "/api/v1/jenkins/jobs",
|
url = "/api/v1/jenkins-job/list",
|
||||||
valueField = "name",
|
valueField = "id",
|
||||||
labelField = "name",
|
labelField = "jobName",
|
||||||
dependsOn = {"projectId", "view"},
|
dependsOn = {"externalSystemId", "viewId"},
|
||||||
params = {
|
params = {
|
||||||
@SchemaPropertyDataSourceParam(name = "projectId", value = "${projectId}"),
|
@SchemaPropertyDataSourceParam(name = "externalSystemId", value = "${externalSystemId}"),
|
||||||
@SchemaPropertyDataSourceParam(name = "view", value = "${view}")
|
@SchemaPropertyDataSourceParam(name = "viewId", value = "${viewId}")
|
||||||
}
|
}
|
||||||
|
),
|
||||||
|
order = 3
|
||||||
)
|
)
|
||||||
)
|
private String jobId;
|
||||||
private String job;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user