增加构建通知
This commit is contained in:
parent
71e20202da
commit
1af85b2940
@ -28,12 +28,10 @@ public interface TeamEnvironmentNotificationConfigConverter
|
||||
*/
|
||||
@Mapping(target = "notificationChannelName",
|
||||
expression = "java(getChannelName(config.getNotificationChannelId(), channelMap))")
|
||||
@Mapping(target = "deployNotificationTemplateName",
|
||||
expression = "java(getTemplateName(config.getDeployNotificationTemplateId(), templateMap))")
|
||||
@Mapping(target = "preApprovalNotificationTemplateName",
|
||||
expression = "java(getTemplateName(config.getPreApprovalNotificationTemplateId(), templateMap))")
|
||||
@Mapping(target = "buildNotificationTemplateName",
|
||||
expression = "java(getTemplateName(config.getBuildNotificationTemplateId(), templateMap))")
|
||||
@Mapping(target = "buildFailureNotificationTemplateName",
|
||||
expression = "java(getTemplateName(config.getBuildFailureNotificationTemplateId(), templateMap))")
|
||||
UserTeamEnvironmentNotificationConfigDTO toUserDTO(
|
||||
TeamEnvironmentNotificationConfig config,
|
||||
@Context Map<Long, NotificationChannel> channelMap,
|
||||
|
||||
@ -116,11 +116,11 @@ public class DeployExecuteRequest {
|
||||
@Schema(description = "通知渠道ID")
|
||||
private Long notificationChannelId;
|
||||
|
||||
@Schema(description = "是否启用部署通知")
|
||||
private Boolean deployNotificationEnabled;
|
||||
@Schema(description = "是否启用审批前提醒")
|
||||
private Boolean preApprovalNotificationEnabled;
|
||||
|
||||
@Schema(description = "部署通知模板ID")
|
||||
private Long deployNotificationTemplateId;
|
||||
@Schema(description = "审批前提醒模板ID")
|
||||
private Long preApprovalNotificationTemplateId;
|
||||
|
||||
@Schema(description = "是否启用构建通知")
|
||||
private Boolean buildNotificationEnabled;
|
||||
@ -128,11 +128,8 @@ public class DeployExecuteRequest {
|
||||
@Schema(description = "构建通知模板ID")
|
||||
private Long buildNotificationTemplateId;
|
||||
|
||||
@Schema(description = "构建失败时是否发送日志文件到企业微信")
|
||||
@Schema(description = "构建失败时是否发送日志文件")
|
||||
private Boolean buildFailureFileEnabled;
|
||||
|
||||
@Schema(description = "构建失败通知模板ID")
|
||||
private Long buildFailureNotificationTemplateId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,14 +30,14 @@ public class TeamEnvironmentNotificationConfigDTO extends BaseDTO {
|
||||
private Long notificationChannelId;
|
||||
|
||||
/**
|
||||
* 是否启用部署通知
|
||||
* 是否启用审批前提醒
|
||||
*/
|
||||
private Boolean deployNotificationEnabled;
|
||||
private Boolean preApprovalNotificationEnabled;
|
||||
|
||||
/**
|
||||
* 部署通知模板ID
|
||||
* 审批前提醒模板ID
|
||||
*/
|
||||
private Long deployNotificationTemplateId;
|
||||
private Long preApprovalNotificationTemplateId;
|
||||
|
||||
/**
|
||||
* 是否启用构建通知
|
||||
@ -50,15 +50,10 @@ public class TeamEnvironmentNotificationConfigDTO extends BaseDTO {
|
||||
private Long buildNotificationTemplateId;
|
||||
|
||||
/**
|
||||
* 构建失败时是否发送日志文件到企业微信
|
||||
* 构建失败时是否发送日志文件
|
||||
*/
|
||||
private Boolean buildFailureFileEnabled;
|
||||
|
||||
/**
|
||||
* 构建失败通知模板ID
|
||||
*/
|
||||
private Long buildFailureNotificationTemplateId;
|
||||
|
||||
// ===== 扩展字段(非数据库字段) =====
|
||||
|
||||
/**
|
||||
@ -67,17 +62,12 @@ public class TeamEnvironmentNotificationConfigDTO extends BaseDTO {
|
||||
private String notificationChannelName;
|
||||
|
||||
/**
|
||||
* 部署通知模板名称(扩展字段,非数据库字段)
|
||||
* 审批前提醒模板名称(扩展字段,非数据库字段)
|
||||
*/
|
||||
private String deployNotificationTemplateName;
|
||||
private String preApprovalNotificationTemplateName;
|
||||
|
||||
/**
|
||||
* 构建通知模板名称(扩展字段,非数据库字段)
|
||||
*/
|
||||
private String buildNotificationTemplateName;
|
||||
|
||||
/**
|
||||
* 构建失败通知模板名称(扩展字段,非数据库字段)
|
||||
*/
|
||||
private String buildFailureNotificationTemplateName;
|
||||
}
|
||||
|
||||
@ -20,16 +20,16 @@ public class UserTeamEnvironmentNotificationConfigDTO {
|
||||
private Long notificationChannelId;
|
||||
|
||||
/**
|
||||
* 是否启用部署通知
|
||||
* 是否启用审批前提醒
|
||||
*/
|
||||
@Schema(description = "是否启用部署通知")
|
||||
private Boolean deployNotificationEnabled;
|
||||
@Schema(description = "是否启用审批前提醒")
|
||||
private Boolean preApprovalNotificationEnabled;
|
||||
|
||||
/**
|
||||
* 部署通知模板ID
|
||||
* 审批前提醒模板ID
|
||||
*/
|
||||
@Schema(description = "部署通知模板ID")
|
||||
private Long deployNotificationTemplateId;
|
||||
@Schema(description = "审批前提醒模板ID")
|
||||
private Long preApprovalNotificationTemplateId;
|
||||
|
||||
/**
|
||||
* 是否启用构建通知
|
||||
@ -44,17 +44,11 @@ public class UserTeamEnvironmentNotificationConfigDTO {
|
||||
private Long buildNotificationTemplateId;
|
||||
|
||||
/**
|
||||
* 构建失败时是否发送日志文件到企业微信
|
||||
* 构建失败时是否发送日志文件
|
||||
*/
|
||||
@Schema(description = "构建失败时是否发送日志文件到企业微信")
|
||||
@Schema(description = "构建失败时是否发送日志文件")
|
||||
private Boolean buildFailureFileEnabled;
|
||||
|
||||
/**
|
||||
* 构建失败通知模板ID
|
||||
*/
|
||||
@Schema(description = "构建失败通知模板ID")
|
||||
private Long buildFailureNotificationTemplateId;
|
||||
|
||||
// ===== 扩展字段(非数据库字段) =====
|
||||
|
||||
/**
|
||||
@ -64,20 +58,14 @@ public class UserTeamEnvironmentNotificationConfigDTO {
|
||||
private String notificationChannelName;
|
||||
|
||||
/**
|
||||
* 部署通知模板名称(扩展字段,非数据库字段)
|
||||
* 审批前提醒模板名称(扩展字段,非数据库字段)
|
||||
*/
|
||||
@Schema(description = "部署通知模板名称(扩展字段,非数据库字段)")
|
||||
private String deployNotificationTemplateName;
|
||||
@Schema(description = "审批前提醒模板名称(扩展字段,非数据库字段)")
|
||||
private String preApprovalNotificationTemplateName;
|
||||
|
||||
/**
|
||||
* 构建通知模板名称(扩展字段,非数据库字段)
|
||||
*/
|
||||
@Schema(description = "构建通知模板名称(扩展字段,非数据库字段)")
|
||||
private String buildNotificationTemplateName;
|
||||
|
||||
/**
|
||||
* 构建失败通知模板名称(扩展字段,非数据库字段)
|
||||
*/
|
||||
@Schema(description = "构建失败通知模板名称(扩展字段,非数据库字段)")
|
||||
private String buildFailureNotificationTemplateName;
|
||||
}
|
||||
|
||||
@ -46,16 +46,16 @@ public class TeamEnvironmentNotificationConfig extends Entity<Long> {
|
||||
private Long notificationChannelId;
|
||||
|
||||
/**
|
||||
* 是否启用部署通知
|
||||
* 是否启用审批前提醒
|
||||
*/
|
||||
@Column(name = "deploy_notification_enabled", nullable = false, columnDefinition = "BIT DEFAULT 1")
|
||||
private Boolean deployNotificationEnabled = true;
|
||||
@Column(name = "pre_approval_notification_enabled", nullable = false)
|
||||
private Boolean preApprovalNotificationEnabled = false;
|
||||
|
||||
/**
|
||||
* 部署通知模板ID(关联sys_notification_template)
|
||||
* 审批前提醒模板ID(关联sys_notification_template)
|
||||
*/
|
||||
@Column(name = "deploy_notification_template_id")
|
||||
private Long deployNotificationTemplateId;
|
||||
@Column(name = "pre_approval_notification_template_id")
|
||||
private Long preApprovalNotificationTemplateId;
|
||||
|
||||
/**
|
||||
* 是否启用构建通知
|
||||
@ -74,10 +74,4 @@ public class TeamEnvironmentNotificationConfig extends Entity<Long> {
|
||||
*/
|
||||
@Column(name = "build_failure_file_enabled", nullable = false)
|
||||
private Boolean buildFailureFileEnabled = false;
|
||||
|
||||
/**
|
||||
* 构建失败通知模板ID(关联sys_notification_template)
|
||||
*/
|
||||
@Column(name = "build_failure_notification_template_id")
|
||||
private Long buildFailureNotificationTemplateId;
|
||||
}
|
||||
|
||||
@ -275,9 +275,8 @@ public class DeployServiceImpl implements IDeployService {
|
||||
// 16. 批量查询通知模板信息
|
||||
Set<Long> templateIds = notificationConfigMap.values().stream()
|
||||
.flatMap(config -> Stream.of(
|
||||
config.getDeployNotificationTemplateId(),
|
||||
config.getBuildNotificationTemplateId(),
|
||||
config.getBuildFailureNotificationTemplateId()
|
||||
config.getPreApprovalNotificationTemplateId(),
|
||||
config.getBuildNotificationTemplateId()
|
||||
))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
@ -280,15 +280,12 @@ public class TeamEnvironmentConfigServiceImpl
|
||||
// 5. 批量查询通知模板信息
|
||||
Set<Long> templateIds = new HashSet<>();
|
||||
notificationConfigMap.values().forEach(nc -> {
|
||||
if (nc.getDeployNotificationTemplateId() != null) {
|
||||
templateIds.add(nc.getDeployNotificationTemplateId());
|
||||
if (nc.getPreApprovalNotificationTemplateId() != null) {
|
||||
templateIds.add(nc.getPreApprovalNotificationTemplateId());
|
||||
}
|
||||
if (nc.getBuildNotificationTemplateId() != null) {
|
||||
templateIds.add(nc.getBuildNotificationTemplateId());
|
||||
}
|
||||
if (nc.getBuildFailureNotificationTemplateId() != null) {
|
||||
templateIds.add(nc.getBuildFailureNotificationTemplateId());
|
||||
}
|
||||
});
|
||||
|
||||
Map<Long, NotificationTemplate> templateMap = new HashMap<>();
|
||||
@ -325,11 +322,11 @@ public class TeamEnvironmentConfigServiceImpl
|
||||
}
|
||||
}
|
||||
|
||||
// 填充部署通知模板名称
|
||||
if (notificationConfig.getDeployNotificationTemplateId() != null) {
|
||||
NotificationTemplate template = templateMap.get(notificationConfig.getDeployNotificationTemplateId());
|
||||
// 填充审批前提醒模板名称
|
||||
if (notificationConfig.getPreApprovalNotificationTemplateId() != null) {
|
||||
NotificationTemplate template = templateMap.get(notificationConfig.getPreApprovalNotificationTemplateId());
|
||||
if (template != null) {
|
||||
notificationConfigDTO.setDeployNotificationTemplateName(template.getName());
|
||||
notificationConfigDTO.setPreApprovalNotificationTemplateName(template.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,14 +338,6 @@ public class TeamEnvironmentConfigServiceImpl
|
||||
}
|
||||
}
|
||||
|
||||
// 填充构建失败通知模板名称
|
||||
if (notificationConfig.getBuildFailureNotificationTemplateId() != null) {
|
||||
NotificationTemplate template = templateMap.get(notificationConfig.getBuildFailureNotificationTemplateId());
|
||||
if (template != null) {
|
||||
notificationConfigDTO.setBuildFailureNotificationTemplateName(template.getName());
|
||||
}
|
||||
}
|
||||
|
||||
config.setNotificationConfig(notificationConfigDTO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -873,12 +873,11 @@ CREATE TABLE deploy_team_environment_notification_config
|
||||
environment_id BIGINT NOT NULL COMMENT '环境ID',
|
||||
|
||||
notification_channel_id BIGINT NULL COMMENT '通知渠道ID(关联sys_notification_channel)',
|
||||
deploy_notification_enabled BIT NOT NULL DEFAULT 1 COMMENT '是否启用部署通知',
|
||||
deploy_notification_template_id BIGINT NULL COMMENT '部署通知模板ID(关联sys_notification_template)',
|
||||
pre_approval_notification_enabled BIT NOT NULL DEFAULT 0 COMMENT '是否启用审批前提醒',
|
||||
pre_approval_notification_template_id BIGINT NULL COMMENT '审批前提醒模板ID(关联sys_notification_template)',
|
||||
build_notification_enabled BIT NOT NULL DEFAULT 0 COMMENT '是否启用构建通知',
|
||||
build_notification_template_id BIGINT NULL COMMENT '构建通知模板ID(关联sys_notification_template)',
|
||||
build_failure_log_enabled BIT NOT NULL DEFAULT 0 COMMENT '构建失败时是否附加错误日志到通知(0:不附加,1:附加)',
|
||||
build_failure_notification_template_id BIGINT NULL COMMENT '构建失败通知模板ID(关联sys_notification_template)',
|
||||
build_failure_file_enabled BIT NOT NULL DEFAULT 0 COMMENT '构建失败时是否发送日志文件(0:不发送,1:发送)',
|
||||
|
||||
UNIQUE INDEX uk_team_env (team_id, environment_id),
|
||||
INDEX idx_team (team_id),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user