liyong
6 小时以前 7a23c450f3ac85de7dca1b908de273ff636ce218
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package cn.iocoder.yudao.module.im.service.websocket.notification.message;
 
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.im.dal.dataobject.message.ImChannelMessageDO;
import lombok.Data;
import lombok.experimental.Accessors;
 
import java.time.LocalDateTime;
 
/**
 * IM 频道消息 WebSocket 推送通知
 * <p>
 * 单向:服务端运营推送 → C 端用户;C 端不能向频道发消息。
 * 字段分层:顶层是消息元数据 + 检索维度,content 是 MaterialMessage payload 的 JSON 串。
 *
 * @author 芋道源码
 */
@Data
@Accessors(chain = true)
public class ImChannelMessageNotification {
 
    /**
     * 消息编号
     */
    private Long id;
    /**
     * 频道编号
     */
    private Long channelId;
    /**
     * 关联素材编号
     */
    private Long materialId;
    /**
     * 消息类型
     */
    private Integer type;
    /**
     * 消息内容;payload JSON 串
     */
    private String content;
    /**
     * 发送时间
     */
    private LocalDateTime sendTime;
 
    /**
     * 由频道消息 DO 构建推送通知
     */
    public static ImChannelMessageNotification ofSend(ImChannelMessageDO message) {
        return BeanUtils.toBean(message, ImChannelMessageNotification.class);
    }
 
}