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
595bc14d
Commit
595bc14d
authored
Feb 08, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
content中type字段拆出
parent
ee40a6e2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
30 deletions
+39
-30
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
+15
-3
core/src/main/java/com/wecloud/im/service/impl/ImInboxServiceImpl.java
+11
-13
core/src/main/java/com/wecloud/im/thousandchat/service/ThousandChatService.java
+10
-11
docs/db/feature-cluster增量.sql
+3
-3
No files found.
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
View file @
595bc14d
...
...
@@ -325,8 +325,14 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
ImMessageOnlineSend
imMessageOnlineSend
=
new
ImMessageOnlineSend
();
imMessageOnlineSend
.
setMsgId
(
messageId
);
imMessageOnlineSend
.
setType
(
MsgTypeEnum
.
INVITE_CLIENT_JOIN_CONVERSATION
.
getUriCode
());
imMessageOnlineSend
.
setSender
(
imClientSender
.
getClientId
());
imMessageOnlineSend
.
setContent
((
HashMap
)
content
);
Map
<
String
,
String
>
contentMap
=
new
HashMap
<>();
// 操作的client ID
contentMap
.
put
(
"operator"
,
imClientSender
.
getClientId
());
// 被操作的client ID
contentMap
.
put
(
"passivityOperator"
,
client2
.
getClientId
());
imMessageOnlineSend
.
setContent
(
contentMap
);
imMessageOnlineSend
.
setConversationId
(
conversationMembers
.
getFkConversationId
());
imMessageOnlineSend
.
setWithdraw
(
Boolean
.
FALSE
);
imMessageOnlineSend
.
setEvent
(
Boolean
.
TRUE
);
...
...
@@ -448,8 +454,14 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
ImMessageOnlineSend
imMessageOnlineSend
=
new
ImMessageOnlineSend
();
imMessageOnlineSend
.
setMsgId
(
messageId
);
imMessageOnlineSend
.
setType
(
MsgTypeEnum
.
REMOVE_CLIENT_CONVERSATION
.
getUriCode
());
imMessageOnlineSend
.
setSender
(
imClientSender
.
getClientId
());
imMessageOnlineSend
.
setContent
((
HashMap
)
content
);
Map
<
String
,
Object
>
contentMap
=
new
HashMap
<>();
// 操作的client ID
contentMap
.
put
(
"operator"
,
imClientSender
.
getClientId
());
// 被操作的client ID
contentMap
.
put
(
"passivityOperator"
,
client2
.
getClientId
());
imMessageOnlineSend
.
setContent
(
contentMap
);
imMessageOnlineSend
.
setConversationId
(
conversationMembers
.
getFkConversationId
());
imMessageOnlineSend
.
setWithdraw
(
Boolean
.
FALSE
);
imMessageOnlineSend
.
setEvent
(
Boolean
.
TRUE
);
...
...
@@ -562,8 +574,8 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
ImMessageOnlineSend
imMessageOnlineSend
=
new
ImMessageOnlineSend
();
imMessageOnlineSend
.
setMsgId
(
messageId
);
imMessageOnlineSend
.
setType
(
MsgTypeEnum
.
LEAVE_CONVERSATION
.
getUriCode
());
imMessageOnlineSend
.
setSender
(
imClientSender
.
getClientId
());
imMessageOnlineSend
.
setContent
((
HashMap
)
content
);
imMessageOnlineSend
.
setConversationId
(
conversationMembers
.
getFkConversationId
());
imMessageOnlineSend
.
setWithdraw
(
Boolean
.
FALSE
);
imMessageOnlineSend
.
setEvent
(
Boolean
.
TRUE
);
...
...
core/src/main/java/com/wecloud/im/service/impl/ImInboxServiceImpl.java
View file @
595bc14d
...
...
@@ -101,12 +101,10 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
ImApplication
application
=
imApplicationService
.
getCacheById
(
curentClient
.
getFkAppid
());
// 内容
HashMap
<
String
,
String
>
stringStringHashMap
=
new
HashMap
<>();
stringStringHashMap
.
put
(
"type"
,
MsgTypeEnum
.
CLIENT_RECEIVED_MSG
.
getUriCode
()
+
""
);
stringStringHashMap
.
put
(
"receiverId"
,
curentClient
.
getClientId
());
HashMap
<
String
,
String
>
contentMap
=
new
HashMap
<>();
contentMap
.
put
(
"receiverId"
,
curentClient
.
getClientId
());
// 推送给接收方
sendMsgStatus
(
curentClient
,
application
,
stringStringHash
Map
,
imMsgReceivedUpdate
.
getMsgIds
());
sendMsgStatus
(
curentClient
,
MsgTypeEnum
.
CLIENT_RECEIVED_MSG
,
content
Map
,
imMsgReceivedUpdate
.
getMsgIds
());
// 是否同时修改为已读状态
if
(
imMsgReceivedUpdate
.
getReadStatus
())
{
...
...
@@ -144,10 +142,9 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
ImApplication
application
=
imApplicationService
.
getCacheById
(
curentClient
.
getFkAppid
());
// 内容
HashMap
<
String
,
String
>
stringStringHashMap
=
new
HashMap
<>();
stringStringHashMap
.
put
(
"type"
,
MsgTypeEnum
.
CLIENT_READ_MSG
+
""
);
stringStringHashMap
.
put
(
"receiverId"
,
curentClient
.
getClientId
());
sendMsgStatus
(
curentClient
,
application
,
stringStringHashMap
,
imMsgReadStatusUpdate
.
getMsgIds
());
HashMap
<
String
,
String
>
contentMap
=
new
HashMap
<>();
contentMap
.
put
(
"receiverId"
,
curentClient
.
getClientId
());
sendMsgStatus
(
curentClient
,
MsgTypeEnum
.
CLIENT_READ_MSG
,
contentMap
,
imMsgReadStatusUpdate
.
getMsgIds
());
return
ApiResult
.
ok
();
...
...
@@ -157,11 +154,11 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
* 下发状态类型消息
*
* @param curentClient 当前客户端
* @param
application 当前应用
* @param
stringStringHashMap
消息content内容
* @param
msgTypeEnum 消息类型枚举
* @param
contentMap
消息content内容
* @param msgIds 消息id集合
*/
private
void
sendMsgStatus
(
ImClient
curentClient
,
ImApplication
application
,
HashMap
<
String
,
String
>
stringStringHash
Map
,
List
<
Long
>
msgIds
)
{
private
void
sendMsgStatus
(
ImClient
curentClient
,
MsgTypeEnum
msgTypeEnum
,
HashMap
<
String
,
String
>
content
Map
,
List
<
Long
>
msgIds
)
{
// 遍历消息id集合
for
(
Long
msgId
:
msgIds
)
{
...
...
@@ -194,9 +191,10 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
// 封装响应的实体
ImMessageOnlineSend
imMessageOnlineSend
=
new
ImMessageOnlineSend
();
BeanUtils
.
copyProperties
(
imMessage
,
imMessageOnlineSend
);
imMessageOnlineSend
.
setType
(
msgTypeEnum
.
getUriCode
());
imMessageOnlineSend
.
setMsgId
(
imMessage
.
getId
());
imMessageOnlineSend
.
setSender
(
curentClient
.
getClientId
());
imMessageOnlineSend
.
setContent
(
stringStringHash
Map
);
imMessageOnlineSend
.
setContent
(
content
Map
);
imMessageOnlineSend
.
setConversationId
(
conversationMember
.
getFkConversationId
());
// 查询接收方
ImClient
imClientReceiver
=
imClientService
.
getOne
(
new
QueryWrapper
<
ImClient
>().
lambda
()
...
...
core/src/main/java/com/wecloud/im/thousandchat/service/ThousandChatService.java
View file @
595bc14d
...
...
@@ -89,12 +89,11 @@ public class ThousandChatService extends BaseServiceImpl<ImMsgReadLastestMapper,
imMsgReadLastestMapper
.
upsertImMsgReceive
(
lastest
);
// 内容
HashMap
<
String
,
String
>
stringStringHashMap
=
new
HashMap
<>();
stringStringHashMap
.
put
(
"type"
,
MsgTypeEnum
.
CLIENT_RECEIVED_MSG
.
getUriCode
()
+
""
);
stringStringHashMap
.
put
(
"receiverId"
,
curentClient
.
getClientId
());
HashMap
<
String
,
String
>
contentMap
=
new
HashMap
<>();
contentMap
.
put
(
"receiverId"
,
curentClient
.
getClientId
());
// 推送给接收方
sendMsgStatus
(
curentClient
,
stringStringHash
Map
,
lastestMsg
);
sendMsgStatus
(
curentClient
,
MsgTypeEnum
.
CLIENT_RECEIVED_MSG
,
content
Map
,
lastestMsg
);
return
ApiResult
.
ok
();
}
...
...
@@ -127,10 +126,9 @@ public class ThousandChatService extends BaseServiceImpl<ImMsgReadLastestMapper,
imMsgReadLastestMapper
.
upsertImMsgRead
(
lastest
);
// 内容
HashMap
<
String
,
String
>
stringStringHashMap
=
new
HashMap
<>();
stringStringHashMap
.
put
(
"type"
,
MsgTypeEnum
.
CLIENT_READ_MSG
+
""
);
stringStringHashMap
.
put
(
"receiverId"
,
curentClient
.
getClientId
());
sendMsgStatus
(
curentClient
,
stringStringHashMap
,
lastestMsg
);
HashMap
<
String
,
String
>
contentMap
=
new
HashMap
<>();
contentMap
.
put
(
"receiverId"
,
curentClient
.
getClientId
());
sendMsgStatus
(
curentClient
,
MsgTypeEnum
.
CLIENT_READ_MSG
,
contentMap
,
lastestMsg
);
return
ApiResult
.
ok
();
...
...
@@ -182,10 +180,10 @@ public class ThousandChatService extends BaseServiceImpl<ImMsgReadLastestMapper,
* 下发状态类型消息
*
* @param curentClient 当前客户端
* @param
stringStringHashMap
消息content内容
* @param
contentMap
消息content内容
* @param lastestMsg 最新一条待处理消息
*/
private
void
sendMsgStatus
(
ImClient
curentClient
,
HashMap
<
String
,
String
>
stringStringHash
Map
,
ImMessage
lastestMsg
)
{
private
void
sendMsgStatus
(
ImClient
curentClient
,
MsgTypeEnum
msgTypeEnum
,
HashMap
<
String
,
String
>
content
Map
,
ImMessage
lastestMsg
)
{
Map
<
String
/** ip **/
,
List
<
String
/** client的主键ID:platform **/
>>
onlineIpClientMap
=
thousandChatCacheManager
.
findOnlineHostsByThousandGroupId
(
lastestMsg
.
getFkConversationId
());
...
...
@@ -193,8 +191,9 @@ public class ThousandChatService extends BaseServiceImpl<ImMsgReadLastestMapper,
// 封装响应的实体
ImMessageOnlineSend
imMessageOnlineSend
=
new
ImMessageOnlineSend
();
imMessageOnlineSend
.
setMsgId
(
lastestMsg
.
getId
());
imMessageOnlineSend
.
setType
(
msgTypeEnum
.
getUriCode
());
imMessageOnlineSend
.
setSender
(
curentClient
.
getClientId
());
imMessageOnlineSend
.
setContent
(
stringStringHash
Map
);
imMessageOnlineSend
.
setContent
(
content
Map
);
imMessageOnlineSend
.
setConversationId
(
lastestMsg
.
getFkConversationId
());
imMessageOnlineSend
.
setCreateTime
(
new
Date
());
imMessageOnlineSend
.
setWithdraw
(
false
);
...
...
docs/db/feature-cluster增量.sql
View file @
595bc14d
-- 在f
eature-cluster 2021年12月22日之后,需要执行的的sql增量脚本
-- 在f
eature-cluster 2021年12月22日之后,需要执行的的sql增量脚本
-- 在feature-cluster 2021年12月22日之后,需要执行的的sql增量脚本
ALTER
TABLE
`im_conversation`
CHANGE
COLUMN
`system
``
system_flag`
tinyint
(
1
)
NULL
DEFAULT
NULL
COMMENT
'可选 对话类型标志,是否是系统对话,后面会说明。'
AFTER
`attributes`
;
ALTER
TABLE
`im_message`
CHANGE
COLUMN
`system
``
system_flag`
tinyint
(
1
)
NULL
DEFAULT
0
COMMENT
'0非系统通知; 1为系统通知'
AFTER
`event`
;
ALTER
TABLE
`im_conversation`
CHANGE
COLUMN
`system`
`system_flag`
tinyint
(
1
)
NULL
DEFAULT
NULL
COMMENT
'可选 对话类型标志,是否是系统对话,后面会说明。'
AFTER
`attributes`
;
ALTER
TABLE
`im_message`
CHANGE
COLUMN
`system`
`system_flag`
tinyint
(
1
)
NULL
DEFAULT
0
COMMENT
'0非系统通知; 1为系统通知'
AFTER
`event`
;
-- 在feature-cluster 2022年1月4日之后,需要执行的sql增量脚本
ALTER
TABLE
im_conversation
ADD
COLUMN
`member_count`
int
NULL
COMMENT
'群成员数'
AFTER
`last_message`
;
...
...
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