Merge branch 'main' of https://dd3skj.picp.vip/zhaoxinyu/v4
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
package com.budwk.app.zhgh.dayofficework.message.example;
|
||||
|
||||
import com.budwk.app.zhgh.dayofficework.message.service.GlobalMessageSendService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 全局消息发送使用示例
|
||||
* 展示如何使用简化的API发送消息
|
||||
*/
|
||||
@IocBean
|
||||
@Slf4j
|
||||
public class MessageSendExample {
|
||||
|
||||
@Inject
|
||||
private GlobalMessageSendService globalMessageSendService;
|
||||
|
||||
/**
|
||||
* 示例1:发送简单的系统通知(自动发送到所有启用的渠道)
|
||||
*/
|
||||
public void sendSimpleNotification() {
|
||||
String title = "系统维护通知";
|
||||
String content = "系统将于今晚22:00-24:00进行维护,请提前保存工作内容。";
|
||||
List<String> receiverIds = Arrays.asList("user1", "user2", "user3");
|
||||
|
||||
// 最简单的调用方式,自动发送到所有启用的渠道
|
||||
globalMessageSendService.sendMessage(title, content, receiverIds);
|
||||
|
||||
log.info("简单系统通知发送完成");
|
||||
}
|
||||
|
||||
/**
|
||||
* 示例2:发送待办通知(自动发送到所有启用的渠道)
|
||||
*/
|
||||
public void sendTodoNotification() {
|
||||
String title = "审批待办";
|
||||
String content = "您有一个新的审批任务需要处理,请及时登录系统查看。";
|
||||
List<String> receiverIds = Arrays.asList("manager1", "manager2");
|
||||
|
||||
// 自动发送到所有启用的渠道
|
||||
globalMessageSendService.sendMessage(title, content, 2, receiverIds, null);
|
||||
|
||||
log.info("待办通知发送完成");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user