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
c36bd527
Commit
c36bd527
authored
May 16, 2022
by
罗长华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复发送单聊消息报错
parent
e3cc857f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
16 deletions
+14
-16
core/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
+9
-8
core/src/main/resources/mapper/ImConversationMapper.xml
+0
-1
docs/db/wecloud_im.sql
+0
-2
docs/对接文档/内部/wecloud-im前端Websocket对接文档.md
+5
-5
No files found.
core/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
View file @
c36bd527
...
...
@@ -786,11 +786,18 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
throw
new
BusinessException
(
"收件人列表为空"
);
}
// 查找conversation列表
Long
senderImClientId
=
sender
.
getId
();
Set
<
Long
>
receiverImClientIds
=
receiverList
.
stream
().
map
(
ImClient:
:
getId
).
collect
(
Collectors
.
toSet
());
List
<
ImConversation
>
conversationList
=
imConversationService
.
getConversationBySenderAndReceivers
(
senderImClientId
,
receiverImClientIds
);
// 根据收件人imClientId对会话/会话成员进行分组
Set
<
Long
>
notExistConversationReceiverClientIds
=
new
HashSet
<>(
receiverImClientIds
);
if
(!
conversationList
.
isEmpty
())
{
conversationMapGroupById
.
putAll
(
conversationList
.
stream
().
collect
(
Collectors
.
toMap
(
ImConversation:
:
getId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
)));
...
...
@@ -799,20 +806,14 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
List
<
ImConversationMembers
>
conversationMembersList
=
imConversationMembersService
.
list
(
Wrappers
.<
ImConversationMembers
>
lambdaQuery
().
in
(
ImConversationMembers:
:
getFkConversationId
,
conversationIdList
));
conMembersMapGroupByConId
.
putAll
(
conversationMembersList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ImConversationMembers:
:
getFkConversationId
)));
if
(
conversationMapGroupById
.
size
()
==
receiverList
.
size
())
{
// 如果会话数量和收件人数量一致,后面的逻辑就不需要走了
return
;
}
Set
<
Long
>
hasExistConversationReceiverImClientIds
=
conversationMembersList
.
stream
()
.
map
(
ImConversationMembers:
:
getFkClientId
)
.
filter
(
fkClientId
->
!
fkClientId
.
equals
(
senderImClientId
)).
collect
(
Collectors
.
toSet
());
// 根据收件人imClientId对会话/会话成员进行分组
Set
<
Long
>
notExistConversationReceiverClientIds
=
new
HashSet
<>(
receiverImClientIds
);
notExistConversationReceiverClientIds
.
removeAll
(
hasExistConversationReceiverImClientIds
);
}
// 不存在会话的先创建会话
for
(
Long
receiverImClientId
:
notExistConversationReceiverClientIds
)
{
...
...
core/src/main/resources/mapper/ImConversationMapper.xml
View file @
c36bd527
...
...
@@ -134,7 +134,6 @@
c.system_flag,
c.muted,
c.is_forbid_add_friend as forbid_add_friend,
c.is_forbid_send_red_packets as forbid_send_red_packets,
c.is_forbid_send_pic as forbid_send_pic,
c.is_forbid_send_link as forbid_send_link
FROM
...
...
docs/db/wecloud_im.sql
View file @
c36bd527
...
...
@@ -235,8 +235,6 @@ alter table `im_conversation_members`
alter
table
`im_conversation`
add
column
`is_forbid_add_friend`
tinyint
(
1
)
unsigned
default
0
comment
'是否禁止群里互加好友0否1是'
;
alter
table
`im_conversation`
add
column
`is_forbid_send_red_packets`
tinyint
(
1
)
unsigned
default
0
comment
'是否禁止发红包0否1是'
;
alter
table
`im_conversation`
add
column
`is_forbid_send_pic`
tinyint
(
1
)
unsigned
default
0
comment
'是否禁止发图片0否1是'
;
alter
table
`im_conversation`
add
column
`is_forbid_send_link`
tinyint
(
1
)
unsigned
default
0
comment
'是否禁止发链接0否1是'
;
docs/对接文档/内部/wecloud-im前端Websocket对接文档.md
View file @
c36bd527
# wec
loud-im 前端Websocket对接文档
# wec
loud-im 前端Websocket对接文档
...
...
@@ -289,14 +289,14 @@ websocket是异步的 有可能你很快速的发送了几条消息,服务器响
"subTitle"
:
"点击查看"
},
"diyAbcd"
:
"aaaa自已定义字段的值"
,
"toConversation"
:
1402147846261706752
,
"type"
:
-1
,
"text"
:
"你好,这是一123个纯文本消息"
,
"toConversation"
:
1402147846261706752
,
"type"
:
-1
,
"text"
:
"你好,这是一123个纯文本消息"
,
"attrs"
:{
"a"
:
"用户自定义的一些键值对"
,
"b"
:
"用户自定义的一些键值对"
}
}
}
}
```
**参数描述**
...
...
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