shikeyin
2024-01-11 65da8373531677b1c37a98f53eaa30c892f35e5a
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.iplatform.chat;
 
import java.io.Serializable;
 
/**
 * 聊天会话定义。
 * <p>该对象维护一个聊天过程,包括:发起人与接收人。</p>
 * <pre>
 *     1) promoter 发起人只能是用户(终端业务用户)发起会话
 *     2) customerService 指客服人员,或者聊天对方,目前场景为客服
 *     3)
 * </pre>
 * @date 2023-07-11
 */
public class ChatSession implements Serializable {
 
    public long getPromoter() {
        return promoter;
    }
 
    public void setPromoter(long promoter) {
        this.promoter = promoter;
    }
 
    public long getCustomerService() {
        return customerService;
    }
 
    public void setCustomerService(long customerService) {
        this.customerService = customerService;
    }
 
    public String getBizId() {
        return bizId;
    }
 
    public void setBizId(String bizId) {
        this.bizId = bizId;
    }
 
    public void setId(long id) {
        this.id = id;
    }
 
    public long getEndTime() {
        return endTime;
    }
 
    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }
 
    private long endTime = 0;
    private long promoter;    // 发起人
    private long customerService; // 对方,客服人员
    private boolean robotRequire = false;   // 是否需要机器人响应
    private String bizId = Constants.DEFAULT_BUSINESS_ID;  // 业务编号
    private long id;
 
    /**
     * 构建聊天会话对象
     * @param promoter 发起人,必填
     * @param customerService 客服人员,可选
     * @param robotRequire 是否需要机器人响应,默认:false
     */
    public ChatSession(long chatDialogId, long promoter, long customerService, boolean robotRequire){
        if(promoter <= 0){
            throw new IllegalArgumentException("创建ChatSession错误:发起人必须存在!");
        }
        this.promoter = promoter;
        this.customerService = customerService;
        this.robotRequire = robotRequire;
        this.id = chatDialogId;
    }
 
    /**
     * 返回聊天会话ID,当用户发出第一个消息后,即创建会话,后续界面需要传递该参数。
     * @return
     */
    public long getId(){
        return this.id;
    }
}