From 8fd38f9ee24beffa1184995957bea79df0a015a4 Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Sat, 6 Jun 2026 10:43:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=85=E9=81=93bug#1629=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cf/imes/module/system/enums/ErrorCodeConstants.java | 1 + .../system/service/notify/NotifySendServiceImpl.java | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java index 5426ed698..f855475ed 100644 --- a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java +++ b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java @@ -183,6 +183,7 @@ public class ErrorCodeConstants { // ========== 站内信模版 1-002-026-000 ========== public static final ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_026_000, "notify.template.not.exists"); public static final ErrorCode NOTIFY_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_026_001, "notify.template.code.duplicate"); + public static final ErrorCode NOTIFY_TEMPLATE_CLOSED = new ErrorCode(1_002_026_002, "当前模版已经关闭,请开启后再次尝试发送消息"); // ========== 站内信模版 1-002-027-000 ========== diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifySendServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifySendServiceImpl.java index 00cb082c7..df0b70905 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifySendServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifySendServiceImpl.java @@ -14,6 +14,8 @@ import jakarta.annotation.Resource; import java.util.Map; import java.util.Objects; +import static com.cf.imes.module.system.enums.ErrorCodeConstants.NOTIFY_TEMPLATE_CLOSED; + /** * 站内信发送 Service 实现类 * @@ -39,8 +41,7 @@ public class NotifySendServiceImpl implements NotifySendService { // 校验模版 NotifyTemplateDO template = validateNotifyTemplate(templateCode); if (Objects.equals(template.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { - log.info("[sendSingleNotify][模版({})已经关闭,无法给用户({}/{})发送]", templateCode, userId, userType); - return null; + throw new ServiceException(NOTIFY_TEMPLATE_CLOSED); } // 校验参数 validateTemplateParams(template, templateParams); @@ -60,8 +61,7 @@ public class NotifySendServiceImpl implements NotifySendService { // 校验模版 NotifyTemplateDO template = validateNotifyTemplate(templateCode); if (Objects.equals(template.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { - log.info("[sendSingleNotify][模版({})已经关闭,无法给用户({}/{})发送]", templateCode, userId, userType); - return null; + throw new ServiceException(NOTIFY_TEMPLATE_CLOSED); } // 校验参数 validateTemplateParams(template, templateParams);