liyong
38 分钟以前 8f5be003e52fdbf034d1955216143bd184ebbdb4
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
55
56
package cn.iocoder.yudao.module.im.enums;
 
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
 
import java.util.Arrays;
import java.util.Objects;
 
/**
 * IM 会话类型枚举
 *
 * @author 芋道源码
 */
@RequiredArgsConstructor
@Getter
public enum ImConversationTypeEnum implements ArrayValuable<Integer> {
 
    NONE(0, "无会话"), // 无会话
    PRIVATE(1, "私聊"), // 私聊
    GROUP(2, "群聊"), // 群聊
    CHANNEL(3, "频道"); // 频道 / 公众号
 
    public static final Integer[] ARRAYS = Arrays.stream(values()).map(ImConversationTypeEnum::getType).toArray(Integer[]::new);
 
    /**
     * 类型
     */
    private final Integer type;
    /**
     * 名字
     */
    private final String name;
 
    @Override
    public Integer[] array() {
        return ARRAYS;
    }
 
    public static boolean isNone(Integer type) {
        return Objects.equals(NONE.type, type);
    }
 
    public static boolean isPrivate(Integer type) {
        return Objects.equals(PRIVATE.type, type);
    }
 
    public static boolean isGroup(Integer type) {
        return Objects.equals(GROUP.type, type);
    }
 
    public static boolean isChannel(Integer type) {
        return Objects.equals(CHANNEL.type, type);
    }
 
}