Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
641176d2
Commit
641176d2
authored
Nov 15, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志添加
parent
c5d683e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletions
+13
-1
core/src/main/java/com/wecloud/im/action/NormalChatAction.java
+13
-1
No files found.
core/src/main/java/com/wecloud/im/action/NormalChatAction.java
View file @
641176d2
...
@@ -113,7 +113,9 @@ public class NormalChatAction {
...
@@ -113,7 +113,9 @@ public class NormalChatAction {
// 给所有人(在线+离线)遍历发送
// 给所有人(在线+离线)遍历发送
// 先查询该会话所有成员
// 先查询该会话所有成员
long
time1
=
System
.
currentTimeMillis
();
List
<
ImConversationMembers
>
membersList
=
ehcacheService
.
getEhCacheMember
(
"member"
+
conversation
.
getId
(),
conversation
.
getId
());
List
<
ImConversationMembers
>
membersList
=
ehcacheService
.
getEhCacheMember
(
"member"
+
conversation
.
getId
(),
conversation
.
getId
());
log
.
info
(
"会话id{} 获取群成员列表耗时 {}"
,
conversation
.
getId
(),
System
.
currentTimeMillis
()-
time1
);
if
(
membersList
.
isEmpty
())
{
if
(
membersList
.
isEmpty
())
{
log
.
info
(
"查询会话所有成员返回空,会话ID: {}"
,
data
.
getToConversation
());
log
.
info
(
"查询会话所有成员返回空,会话ID: {}"
,
data
.
getToConversation
());
WsResponse
<
HashMap
<
String
,
Long
>>
responseModel
=
new
WsResponse
<>();
WsResponse
<
HashMap
<
String
,
Long
>>
responseModel
=
new
WsResponse
<>();
...
@@ -138,6 +140,7 @@ public class NormalChatAction {
...
@@ -138,6 +140,7 @@ public class NormalChatAction {
return
;
return
;
}
}
}
}
long
time2
=
System
.
currentTimeMillis
();
if
(
ChatTypeEnum
.
NORMAL_GROUP
.
getCode
().
equals
(
conversation
.
getChatType
()))
{
if
(
ChatTypeEnum
.
NORMAL_GROUP
.
getCode
().
equals
(
conversation
.
getChatType
()))
{
if
(
beKickOut
(
reqId
,
imClientSender
,
membersList
,
request
.
getSenderChannel
()))
{
if
(
beKickOut
(
reqId
,
imClientSender
,
membersList
,
request
.
getSenderChannel
()))
{
return
;
return
;
...
@@ -153,10 +156,15 @@ public class NormalChatAction {
...
@@ -153,10 +156,15 @@ public class NormalChatAction {
if
(!
checkMsg
(
imClientSender
,
conversation
,
reqId
,
data
,
request
.
getSenderChannel
(),
memberMap
))
{
if
(!
checkMsg
(
imClientSender
,
conversation
,
reqId
,
data
,
request
.
getSenderChannel
(),
memberMap
))
{
return
;
return
;
}
}
log
.
info
(
"会话id{} 校验耗时 {}"
,
conversation
.
getId
(),
System
.
currentTimeMillis
()-
time2
);
long
time3
=
System
.
currentTimeMillis
();
ImMessageOnlineSend
imMessageOnlineSend
=
assembleImMessageOnlineSend
(
data
,
imClientSender
,
imApplication
.
getId
());
ImMessageOnlineSend
imMessageOnlineSend
=
assembleImMessageOnlineSend
(
data
,
imClientSender
,
imApplication
.
getId
());
log
.
info
(
"会话id{} 构造消息耗时 {}"
,
conversation
.
getId
(),
System
.
currentTimeMillis
()-
time3
);
// 入库 保存收件箱
// 入库 保存收件箱
long
time4
=
System
.
currentTimeMillis
();
batchSaveInbox
(
imApplication
,
imClientSender
,
conversation
,
imMessageOnlineSend
.
getMsgId
(),
membersList
);
batchSaveInbox
(
imApplication
,
imClientSender
,
conversation
,
imMessageOnlineSend
.
getMsgId
(),
membersList
);
log
.
info
(
"会话id{} 保存inbox耗时 {}"
,
conversation
.
getId
(),
System
.
currentTimeMillis
()-
time4
);
// 入库成功后 判断是否是临时会话 如果是,双方会话display状态是否是1(显示),如果不是,需要修改为是
// 入库成功后 判断是否是临时会话 如果是,双方会话display状态是否是1(显示),如果不是,需要修改为是
if
(
ChatTypeEnum
.
TEMP
.
getCode
().
equals
(
conversation
.
getChatType
()))
{
if
(
ChatTypeEnum
.
TEMP
.
getCode
().
equals
(
conversation
.
getChatType
()))
{
// 木有只有私聊一种临时会话类型
// 木有只有私聊一种临时会话类型
...
@@ -174,6 +182,7 @@ public class NormalChatAction {
...
@@ -174,6 +182,7 @@ public class NormalChatAction {
// final Boolean isPush = ehcacheService.getIsPush("push" + conversation.getId());
// final Boolean isPush = ehcacheService.getIsPush("push" + conversation.getId());
final
Boolean
isPush
=
Boolean
.
TRUE
;
final
Boolean
isPush
=
Boolean
.
TRUE
;
// 多线程处理消息下发
// 多线程处理消息下发
long
time5
=
System
.
currentTimeMillis
();
for
(
ImConversationMembers
member
:
membersList
)
{
for
(
ImConversationMembers
member
:
membersList
)
{
if
(
member
.
getFkClientId
().
equals
(
imClientSender
.
getId
()))
{
if
(
member
.
getFkClientId
().
equals
(
imClientSender
.
getId
()))
{
// 不给自己发
// 不给自己发
...
@@ -184,14 +193,17 @@ public class NormalChatAction {
...
@@ -184,14 +193,17 @@ public class NormalChatAction {
});
});
}
}
log
.
info
(
"会话id {} 多线程发消息耗时 {}"
,
conversation
.
getId
(),
System
.
currentTimeMillis
()-
time5
);
// 响应发送方消息id等信息
// 响应发送方消息id等信息
long
time6
=
System
.
currentTimeMillis
();
response
(
reqId
,
imMessageOnlineSend
,
request
.
getSenderChannel
());
response
(
reqId
,
imMessageOnlineSend
,
request
.
getSenderChannel
());
log
.
info
(
"会话id {} 构造响应耗时 {}"
,
conversation
.
getId
(),
System
.
currentTimeMillis
()-
time6
);
}
}
private
void
sendMsgToMember
(
ImApplication
imApplication
,
ImConversationMembers
member
,
ImMessageOnlineSend
imMessageOnlineSend
,
PushVO
push
,
Boolean
isPush
)
{
private
void
sendMsgToMember
(
ImApplication
imApplication
,
ImConversationMembers
member
,
ImMessageOnlineSend
imMessageOnlineSend
,
PushVO
push
,
Boolean
isPush
)
{
// 在线用户直接发消息
// 在线用户直接发消息
Boolean
sendSuccess
=
sendMsgForOnline
(
member
.
getFkClientId
(),
imMessageOnlineSend
);
sendMsgForOnline
(
member
.
getFkClientId
(),
imMessageOnlineSend
);
if
(
isPush
&&
!
member
.
getDoNotDisturb
())
{
if
(
isPush
&&
!
member
.
getDoNotDisturb
())
{
try
{
try
{
// 异步推送系统通知消息 5分钟内推一次消息
// 异步推送系统通知消息 5分钟内推一次消息
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment