diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/converter/TeamEnvironmentNotificationConfigConverter.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/converter/TeamEnvironmentNotificationConfigConverter.java index 19597a10..d6b5d3a7 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/converter/TeamEnvironmentNotificationConfigConverter.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/converter/TeamEnvironmentNotificationConfigConverter.java @@ -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 channelMap, diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/DeployExecuteRequest.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/DeployExecuteRequest.java index 5513f4cc..ff6e3fc3 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/DeployExecuteRequest.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/DeployExecuteRequest.java @@ -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; } } diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/TeamEnvironmentNotificationConfigDTO.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/TeamEnvironmentNotificationConfigDTO.java index 87537ab1..69a8e476 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/TeamEnvironmentNotificationConfigDTO.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/TeamEnvironmentNotificationConfigDTO.java @@ -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; } diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/UserTeamEnvironmentNotificationConfigDTO.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/UserTeamEnvironmentNotificationConfigDTO.java index 767e01d1..e0978147 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/UserTeamEnvironmentNotificationConfigDTO.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/dto/UserTeamEnvironmentNotificationConfigDTO.java @@ -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; } diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentNotificationConfig.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentNotificationConfig.java index 1b6fe0fc..66697d79 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentNotificationConfig.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/entity/TeamEnvironmentNotificationConfig.java @@ -46,16 +46,16 @@ public class TeamEnvironmentNotificationConfig extends Entity { 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 { */ @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; } diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/service/impl/DeployServiceImpl.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/service/impl/DeployServiceImpl.java index 86a89abc..7edbd699 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/service/impl/DeployServiceImpl.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/service/impl/DeployServiceImpl.java @@ -275,9 +275,8 @@ public class DeployServiceImpl implements IDeployService { // 16. 批量查询通知模板信息 Set templateIds = notificationConfigMap.values().stream() .flatMap(config -> Stream.of( - config.getDeployNotificationTemplateId(), - config.getBuildNotificationTemplateId(), - config.getBuildFailureNotificationTemplateId() + config.getPreApprovalNotificationTemplateId(), + config.getBuildNotificationTemplateId() )) .filter(Objects::nonNull) .collect(Collectors.toSet()); diff --git a/backend/src/main/java/com/qqchen/deploy/backend/deploy/service/impl/TeamEnvironmentConfigServiceImpl.java b/backend/src/main/java/com/qqchen/deploy/backend/deploy/service/impl/TeamEnvironmentConfigServiceImpl.java index 0edc403a..58c76660 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/deploy/service/impl/TeamEnvironmentConfigServiceImpl.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/deploy/service/impl/TeamEnvironmentConfigServiceImpl.java @@ -280,15 +280,12 @@ public class TeamEnvironmentConfigServiceImpl // 5. 批量查询通知模板信息 Set 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 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); } } diff --git a/backend/src/main/resources/db/changelog/changes/v1.0.0-schema.sql b/backend/src/main/resources/db/changelog/changes/v1.0.0-schema.sql index 06bd4b3a..c93281a1 100644 --- a/backend/src/main/resources/db/changelog/changes/v1.0.0-schema.sql +++ b/backend/src/main/resources/db/changelog/changes/v1.0.0-schema.sql @@ -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),