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
755ec6ea
Commit
755ec6ea
authored
Apr 26, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改会话属性接口调整
parent
79aed1f7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
20 deletions
+9
-20
core/src/main/java/com/wecloud/im/action/ConversationAction.java
+3
-1
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
+6
-19
No files found.
core/src/main/java/com/wecloud/im/action/ConversationAction.java
View file @
755ec6ea
...
...
@@ -67,6 +67,7 @@ public class ConversationAction {
@ActionMapping
(
"/saveOrUpdateAttr"
)
@ApiOperation
(
value
=
"添加或修改会话拓展字段"
,
notes
=
"权限:所有client都权限操作"
)
public
WsResponse
<
Map
<
String
,
Boolean
>>
saveOrUpdateAttr
(
ImConversationAttrUpdate
data
)
{
log
.
info
(
"添加或修改会话拓展字段 {}"
,
JSON
.
toJSONString
(
data
));
imConversationService
.
saveOrUpdateAttr
(
data
);
return
WsResponse
.
ok
();
}
...
...
@@ -212,6 +213,7 @@ public class ConversationAction {
@ActionMapping
(
"/info"
)
@ApiOperation
(
value
=
"根据会话id查询指定会话信息"
,
notes
=
"根据会话id查询指定会话信息 与每个会话的未读条数"
)
public
WsResponse
<
ConversationVo
>
info
(
@Validated
ImConversationQueryParam
data
)
throws
Exception
{
log
.
info
(
"根据会话id查询指定会话信息 {}"
,
JSON
.
toJSONString
(
data
));
ConversationVo
conversationVo
=
imConversationService
.
infoImConversationAndMsgCount
(
data
);
return
WsResponse
.
ok
(
conversationVo
);
}
...
...
@@ -222,7 +224,7 @@ public class ConversationAction {
@ActionMapping
(
"/displayUpdate"
)
@ApiOperation
(
value
=
"批量修改单向隐藏或显示会话"
,
notes
=
"拉取会话列表不展示已隐藏状态的会话,云端聊天记录不删除;假设有A和B两个用户,A删会话,B还能发; 如果B发了消息,A这边要重新把会话显示出来,并能显示之前的聊天记录"
)
public
WsResponse
<
Map
<
String
,
Boolean
>>
updateDisplayConversation
(
ImConversationDisplayUpdate
data
)
throws
Exception
{
log
.
info
(
"批量修改单向隐藏或显示会话 {}"
,
JSON
.
toJSONString
(
data
));
imConversationService
.
updateDisplayConversation
(
data
);
return
WsResponse
.
ok
();
}
...
...
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
View file @
755ec6ea
...
...
@@ -973,13 +973,10 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveOrUpdateAttr
(
ImConversationAttrUpdate
imConversationAttrUpdate
)
{
// shiro线程中获取当前token
JwtToken
curentJwtToken
=
JwtUtil
.
getCurrentJwtToken
();
// 根据appKey查询application
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
curentJwtToken
.
getAppKey
());
ImClient
imClientSender
=
imClientService
.
getCurrentClient
();
// 获取当前client
ImClient
currentClient
=
contextService
.
getImClientIfNotNullOrThrow
();
// 根据appId查询application
ImApplication
imApplication
=
contextService
.
getImApplicationIfNotNullOrThrow
(
currentClient
.
getFkAppid
());
ImConversation
imConversationById
=
imConversationService
.
getById
(
imConversationAttrUpdate
.
getConversationId
());
// 判断是否为群主
...
...
@@ -992,30 +989,22 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
new
QueryWrapper
<
ImConversationMembers
>().
lambda
()
.
eq
(
ImConversationMembers:
:
getFkAppid
,
imApplication
.
getId
())
.
eq
(
ImConversationMembers:
:
getFkConversationId
,
imConversationAttrUpdate
.
getConversationId
())
.
ne
(
ImConversationMembers:
:
getFkClientId
,
imClientSender
.
getId
())
.
ne
(
ImConversationMembers:
:
getFkClientId
,
currentClient
.
getId
())
);
String
attributes
=
JsonUtils
.
encodeJson
(
imConversationAttrUpdate
.
getAttributes
());
imConversationById
.
setAttributes
(
attributes
);
boolean
b
=
imConversationService
.
updateById
(
imConversationById
);
// 删除redis中该会话的缓存
deleteCacheImConversationById
(
imConversationAttrUpdate
.
getConversationId
());
if
(
b
)
{
// ws下发拓展字段变动事件
// 内容
HashMap
<
String
,
String
>
content
=
new
HashMap
<>();
HashMap
<
String
,
String
>
content
=
Maps
.
newHashMap
();
content
.
put
(
"attributes"
,
imConversationById
.
getAttributes
());
// 遍历发送
for
(
ImConversationMembers
conversationMembers
:
membersList
)
{
// 查询接收方
ImClient
imClientReceiver
=
imClientService
.
getOne
(
new
QueryWrapper
<
ImClient
>().
lambda
()
.
eq
(
ImClient:
:
getFkAppid
,
imApplication
.
getId
())
...
...
@@ -1023,7 +1012,6 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
if
(
imClientReceiver
==
null
)
{
continue
;
}
// 封装响应的实体
ImMessageOnlineSend
imMessageOnlineSend
=
new
ImMessageOnlineSend
();
...
...
@@ -1045,7 +1033,6 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
responseModel
.
setData
(
imMessageOnlineSend
);
responseModel
.
setReqId
(
null
);
channelSender
.
sendMsg
(
responseModel
,
imClientReceiver
.
getId
());
}
}
else
{
...
...
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