增加生成后端服务代码。

This commit is contained in:
asp_ly 2024-12-30 21:53:02 +08:00
parent 1c166c2559
commit 5d375b7783
2 changed files with 38 additions and 32 deletions

View File

@ -28,6 +28,7 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
@ -75,7 +76,7 @@ public class JenkinsBuildServiceImpl extends BaseServiceImpl<JenkinsBuild, Jenki
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Override
@Transactional(rollbackFor = Exception.class)
@Transactional
public Integer syncAllBuilds(Long externalSystemId) {
// 1. 创建同步历史记录
JenkinsSyncHistoryDTO syncHistory = new JenkinsSyncHistoryDTO();
@ -175,7 +176,7 @@ public class JenkinsBuildServiceImpl extends BaseServiceImpl<JenkinsBuild, Jenki
}
@Override
@Transactional(rollbackFor = Exception.class)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public Integer syncBuilds(ExternalSystem externalSystem, JenkinsJob job) {
JenkinsJobResponse queryJob = jenkinsServiceIntegration.job(externalSystem, job.getJobName());
if (queryJob == null || queryJob.getLastBuild() == null) {

View File

@ -11,51 +11,56 @@ import lombok.EqualsAndHashCode;
public class DeployNodeFormVariables extends BaseNodeFormVariables {
@SchemaProperty(
title = "项目",
description = "选择项目",
title = "绑定三方Jenkins系统",
description = "请选择三方Jenkins系统",
required = true,
dataSource = @SchemaPropertyDataSource(
type = "api",
url = "/api/v1/projects",
url = "/api/v1/external-system/list?type=JENKINS",
valueField = "id",
labelField = "name"
),
order = 1
)
)
private String projectId;
private String externalSystemId;
@SchemaProperty(
title = "Jenkins视图",
description = "Jenkins视图名称",
title = "绑定Jenkins视图",
description = "Jenkins视图",
required = true,
dataSource = @SchemaPropertyDataSource(
type = "api",
url = "/api/v1/jenkins/views",
valueField = "name",
labelField = "name",
dependsOn = {"projectId"},
url = "/api/v1/jenkins-view/list",
valueField = "id",
labelField = "viewName",
dependsOn = {"externalSystemId"},
params = {
@SchemaPropertyDataSourceParam(name = "projectId", value = "${projectId}")
@SchemaPropertyDataSourceParam(name = "externalSystemId", value = "${externalSystemId}")
}
),
order = 2
)
)
private String view;
private String viewId;
@SchemaProperty(
title = "Jenkins任务",
description = "Jenkins任务名称",
title = "绑定Jenkins任务",
description = "Jenkins任务",
required = true,
dataSource = @SchemaPropertyDataSource(
type = "api",
url = "/api/v1/jenkins/jobs",
valueField = "name",
labelField = "name",
dependsOn = {"projectId", "view"},
url = "/api/v1/jenkins-job/list",
valueField = "id",
labelField = "jobName",
dependsOn = {"externalSystemId", "viewId"},
params = {
@SchemaPropertyDataSourceParam(name = "projectId", value = "${projectId}"),
@SchemaPropertyDataSourceParam(name = "view", value = "${view}")
@SchemaPropertyDataSourceParam(name = "externalSystemId", value = "${externalSystemId}"),
@SchemaPropertyDataSourceParam(name = "viewId", value = "${viewId}")
}
),
order = 3
)
)
private String job;
private String jobId;
}