From 5a5f92d2e9e158665f99a46735c9aef532a7a065 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=BB=AE=E6=A2=A6?= <ls909275705@gmail.com>
Date: Mon, 25 Sep 2023 15:51:48 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=8B=E8=AF=95=E7=AB=99=E5=86=85?=
 =?UTF-8?q?=E4=BF=A1=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0Member=20=E7=94=A8?=
 =?UTF-8?q?=E6=88=B7=E7=B1=BB=E5=9E=8B=E7=9A=84=E6=94=AF=E6=8C=81=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../admin/notify/NotifyTemplateController.java        | 11 ++++++++---
 .../notify/vo/template/NotifyTemplateSendReqVO.java   |  4 ++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java
index 0299836d7..b5152e25b 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java
@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.system.controller.admin.notify;
 
+import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.*;
@@ -76,8 +77,12 @@ public class NotifyTemplateController {
     @Operation(summary = "发送站内信")
     @PreAuthorize("@ss.hasPermission('system:notify-template:send-notify')")
     public CommonResult<Long> sendNotify(@Valid @RequestBody NotifyTemplateSendReqVO sendReqVO) {
-        return success(notifySendService.sendSingleNotifyToAdmin(sendReqVO.getUserId(),
-                sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams()));
+        if (UserTypeEnum.MEMBER.getValue().equals(sendReqVO.getUserType())) {
+            return success(notifySendService.sendSingleNotifyToMember(sendReqVO.getUserId(),
+                    sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams()));
+        } else {
+            return success(notifySendService.sendSingleNotifyToAdmin(sendReqVO.getUserId(),
+                    sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams()));
+        }
     }
-
 }
diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateSendReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateSendReqVO.java
index d04c609f5..6a47e8ba9 100644
--- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateSendReqVO.java
+++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateSendReqVO.java
@@ -15,6 +15,10 @@ public class NotifyTemplateSendReqVO {
     @NotNull(message = "用户id不能为空")
     private Long userId;
 
+    @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @NotNull(message = "用户类型不能为空")
+    private Integer userType;
+
     @Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "01")
     @NotEmpty(message = "模板编码不能为空")
     private String templateCode;