增加构建通知

This commit is contained in:
dengqichen 2025-11-14 14:35:46 +08:00
parent 566425869d
commit 3a7492ac91
4 changed files with 99 additions and 102 deletions

View File

@ -6,6 +6,7 @@ import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -65,8 +66,11 @@ public class DeployExecuteRequest {
@Valid @Valid
private NotificationConfig notification; private NotificationConfig notification;
@Schema(description = "执行时间", required = true)
private Date deployDate = new Date();
@Schema(description = "部署备注") @Schema(description = "部署备注")
private String remark; private String deployRemark;
/** /**
* Jenkins配置 * Jenkins配置

View File

@ -756,7 +756,7 @@ public class DeployServiceImpl implements IDeployService {
*/ */
private void createDeployRecord(DeployExecuteRequest request, WorkflowInstanceDTO workflowInstance, String businessKey) { private void createDeployRecord(DeployExecuteRequest request, WorkflowInstanceDTO workflowInstance, String businessKey) {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
deployRecordService.createDeployRecord(workflowInstance.getId(), businessKey, request.getTeamApplicationId(), request.getTeamId(), request.getApplicationId(), request.getEnvironmentId(), currentUsername, request.getRemark()); deployRecordService.createDeployRecord(workflowInstance.getId(), businessKey, request.getTeamApplicationId(), request.getTeamId(), request.getApplicationId(), request.getEnvironmentId(), currentUsername, request.getDeployRemark());
log.info("部署记录已创建: businessKey={}, workflowInstanceId={}", businessKey, workflowInstance.getId()); log.info("部署记录已创建: businessKey={}, workflowInstanceId={}", businessKey, workflowInstance.getId());
} }
@ -874,7 +874,7 @@ public class DeployServiceImpl implements IDeployService {
// 4. 查询部署记录 // 4. 查询部署记录
DeployRecord deployRecord = deployRecordRepository.findByBusinessKeyAndDeletedFalse(businessKey) DeployRecord deployRecord = deployRecordRepository.findByBusinessKeyAndDeletedFalse(businessKey)
.orElseThrow(() -> new BusinessException(ResponseCode.DEPLOY_RECORD_NOT_FOUND, .orElseThrow(() -> new BusinessException(ResponseCode.DEPLOY_RECORD_NOT_FOUND,
new Object[]{businessKey})); new Object[] {businessKey}));
// 5. 构建 DTO // 5. 构建 DTO
DeployApprovalTaskDTO dto = new DeployApprovalTaskDTO(); DeployApprovalTaskDTO dto = new DeployApprovalTaskDTO();

View File

@ -91,8 +91,7 @@ public class JenkinsBuildDelegate extends BaseNodeDelegate<JenkinsBuildInputMapp
JenkinsBuildResponse buildDetails = jenkinsServiceIntegration.getBuildDetails(externalSystem, jobName, buildInfo.getBuildNumber()); JenkinsBuildResponse buildDetails = jenkinsServiceIntegration.getBuildDetails(externalSystem, jobName, buildInfo.getBuildNumber());
// 打印调试信息 // 打印调试信息
log.info("Build details - changeSets: {}, artifacts: {}", log.info("Build details - changeSets: {}, artifacts: {}", buildDetails.getChangeSets(), buildDetails.getArtifacts());
buildDetails.getChangeSets(), buildDetails.getArtifacts());
// 6. 设置输出结果执行到这里说明构建成功 // 6. 设置输出结果执行到这里说明构建成功
// 直接修改预初始化的 output 对象 // 直接修改预初始化的 output 对象

View File

@ -48,7 +48,6 @@ public class NotificationNodeDelegate extends BaseNodeDelegate<NotificationInput
logWarn(String.format("Notification delegate parameter verification failed - channelId: %s, templateId: %s", input.getChannelId(), input.getNotificationTemplateId())); logWarn(String.format("Notification delegate parameter verification failed - channelId: %s, templateId: %s", input.getChannelId(), input.getNotificationTemplateId()));
return; return;
} }
try {
// 2. 查询渠道和模板信息 // 2. 查询渠道和模板信息
NotificationChannel channel = notificationChannelRepository.findById(input.getChannelId()).orElseThrow(() -> new RuntimeException("通知渠道不存在: " + input.getChannelId())); NotificationChannel channel = notificationChannelRepository.findById(input.getChannelId()).orElseThrow(() -> new RuntimeException("通知渠道不存在: " + input.getChannelId()));
NotificationTemplate template = notificationTemplateRepository.findById(input.getNotificationTemplateId()).orElseThrow(() -> new RuntimeException("通知模板不存在: " + input.getNotificationTemplateId())); NotificationTemplate template = notificationTemplateRepository.findById(input.getNotificationTemplateId()).orElseThrow(() -> new RuntimeException("通知模板不存在: " + input.getNotificationTemplateId()));
@ -81,12 +80,7 @@ public class NotificationNodeDelegate extends BaseNodeDelegate<NotificationInput
// 5. 发送通知NotificationService会处理模板渲染和详细配置 // 5. 发送通知NotificationService会处理模板渲染和详细配置
notificationService.send(request); notificationService.send(request);
log.info("工作流通知发送成功 - 渠道ID: {}, 模板ID: {}", log.info("工作流通知发送成功 - 渠道ID: {}, 模板ID: {}", input.getChannelId(), input.getNotificationTemplateId());
input.getChannelId(), input.getNotificationTemplateId());
} catch (Exception e) {
logError("工作流通知发送失败: " + e.getMessage());
throw new RuntimeException("通知发送失败", e);
}
} }
/** /**