xiangpei
2025-06-04 4e502853119c6d8e7ff686191e19bb0a19a4f875
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
package cn.lili.modules.im.entity.dos;
 
 
import cn.lili.common.utils.SnowFlake;
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.store.entity.dos.Store;
import cn.lili.mybatis.BaseTenantEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
 
import java.util.Date;
 
/**
 * @author Chopper
 */
@Data
@TableName("li_im_talk")
@ApiModel(value = "聊天")
@NoArgsConstructor
@AllArgsConstructor
public class ImTalk extends BaseTenantEntity {
 
    private static final long serialVersionUID = 1L;
 
    @ApiModelProperty("用户1 id")
    private String userId1;
 
    @ApiModelProperty("用户2 id")
    private String userId2;
 
    @ApiModelProperty("用户1置顶")
    private Boolean top1;
 
    @ApiModelProperty("用户2置顶")
    private Boolean top2;
 
    @ApiModelProperty("用户1 不可见")
    private Boolean disable1;
 
    @ApiModelProperty("用户2 不可见")
    private Boolean disable2;
 
    @ApiModelProperty("用户1名字")
    private String name1;
 
    @ApiModelProperty("用户2名字")
    private String name2;
 
    @ApiModelProperty("用户1头像")
    private String face1;
 
    @ApiModelProperty("用户2头像")
    private String face2;
 
    @ApiModelProperty("用户1的店铺标识")
    private Boolean storeFlag1;
 
    @ApiModelProperty("用户2的店铺标识")
    private Boolean storeFlag2;
 
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "最后聊天时间", hidden = true)
    private Date lastTalkTime;
 
    @ApiModelProperty(value = "最后聊天内容")
    private String lastTalkMessage;
 
    @ApiModelProperty(value = "最后发送消息类型")
    private String lastMessageType;
 
    @ApiModelProperty(value = "坐席Id")
    private String tenantId;
 
    @ApiModelProperty(value = "坐席名称")
    private String tenantName;
 
 
    public ImTalk(String userId1, String userId2,
                  String face1, String face2,
                  String name1, String name2
    ) {
        this.userId1 = userId1;
        this.userId2 = userId2;
        this.top1 = false;
        this.top2 = false;
        this.disable1 = false;
        this.disable2 = false;
        this.storeFlag1 = false;
        this.storeFlag2 = false;
        this.setId(SnowFlake.getIdStr());
        this.lastTalkTime = new Date();
        this.face1 = face1;
        this.face2 = face2;
        this.name1 = name1;
        this.name2 = name2;
    }
 
    public ImTalk(Member member1,Member member2){
        if(Long.parseLong(member1.getId()) > Long.parseLong(member2.getId())){
            this.userId1 = member2.getId();
            this.userId2 = member1.getId();
            this.top1 = false;
            this.top2 = false;
            this.disable1 = false;
            this.disable2 = false;
            this.storeFlag1 = false;
            this.storeFlag2 = false;
            this.setId(SnowFlake.getIdStr());
            this.lastTalkTime = new Date();
            this.face1 = member2.getFace();
            this.face2 = member1.getFace();
            this.name1 = member2.getNickName();
            this.name2 = member1.getNickName();
        }else{
            this.userId1 = member1.getId();
            this.userId2 = member2.getId();
            this.top1 = false;
            this.top2 = false;
            this.disable1 = false;
            this.disable2 = false;
            this.storeFlag1 = false;
            this.storeFlag2 = false;
            this.setId(SnowFlake.getIdStr());
            this.lastTalkTime = new Date();
            this.face1 = member1.getFace();
            this.face2 = member2.getFace();
            this.name1 = member1.getNickName();
            this.name2 = member2.getNickName();
        }
    }
    public ImTalk(Member member, Store store){
        if(Long.parseLong(member.getId()) > Long.parseLong(store.getId())){
            this.userId1 = store.getId();
            this.userId2 = member.getId();
            this.top1 = false;
            this.top2 = false;
            this.disable1 = false;
            this.disable2 = false;
            this.storeFlag1 = true;
            this.storeFlag2 = false;
            this.setId(SnowFlake.getIdStr());
            this.lastTalkTime = new Date();
            this.face1 = store.getStoreLogo();
            this.face2 = member.getFace();
            this.name1 = store.getStoreName();
            this.name2 = member.getNickName();
        }else{
            this.userId1 = member.getId();
            this.userId2 = store.getId();
            this.top1 = false;
            this.top2 = false;
            this.disable1 = false;
            this.disable2 = false;
            this.storeFlag1 = false;
            this.storeFlag2 = true;
            this.setId(SnowFlake.getIdStr());
            this.lastTalkTime = new Date();
            this.face1 = member.getFace();
            this.face2 = store.getStoreLogo();
            this.name1 = member.getNickName();
            this.name2 = store.getStoreName();
        }
    }
}