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
c291af82
Commit
c291af82
authored
Apr 08, 2022
by
罗长华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、调整ws请求的WsResponse返回值为对象类型
parent
45ba90b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
14 deletions
+38
-14
core/src/main/java/com/wecloud/im/action/ConversationAction.java
+31
-12
core/src/main/java/com/wecloud/im/action/InboxAction.java
+7
-2
No files found.
core/src/main/java/com/wecloud/im/action/ConversationAction.java
View file @
c291af82
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.Api;
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -85,12 +86,16 @@ public class ConversationAction {
...
@@ -85,12 +86,16 @@ public class ConversationAction {
/**
/**
* 将client从会话移除
* 将client从会话移除
* @return
*/
*/
@ActionMapping
(
"/delClient"
)
@ActionMapping
(
"/delClient"
)
@ApiOperation
(
value
=
"将client从会话移除"
,
notes
=
"权限:目前只有群主有权限操作"
)
@ApiOperation
(
value
=
"将client从会话移除"
,
notes
=
"权限:目前只有群主有权限操作"
)
public
WsResponse
<
Boolean
>
delClientToConversation
(
ImClientToConversation
data
)
throws
Exception
{
public
WsResponse
<
Map
<
String
,
Boolean
>
>
delClientToConversation
(
ImClientToConversation
data
)
throws
Exception
{
log
.
info
(
"将client从会话移除入参 {}"
,
JSON
.
toJSONString
(
data
));
log
.
info
(
"将client从会话移除入参 {}"
,
JSON
.
toJSONString
(
data
));
return
WsResponse
.
ok
(
imConversationService
.
delClientToConversation
(
data
));
boolean
r
=
imConversationService
.
delClientToConversation
(
data
);
Map
<
String
,
Boolean
>
result
=
new
HashMap
<>();
result
.
put
(
"result"
,
r
);
return
WsResponse
.
ok
(
result
);
}
}
/**
/**
...
@@ -129,37 +134,46 @@ public class ConversationAction {
...
@@ -129,37 +134,46 @@ public class ConversationAction {
/**
/**
* 群主转让
* 群主转让
* @return
*/
*/
@ActionMapping
(
"/transferOwner"
)
@ActionMapping
(
"/transferOwner"
)
@ApiOperation
(
value
=
"群主转让"
,
notes
=
"权限:目前只有群主有权限操作"
)
@ApiOperation
(
value
=
"群主转让"
,
notes
=
"权限:目前只有群主有权限操作"
)
public
WsResponse
<
Boolean
>
transferOwner
(
TransferOwnerParam
data
)
{
public
WsResponse
<
Map
<
String
,
Boolean
>
>
transferOwner
(
TransferOwnerParam
data
)
{
log
.
info
(
"群主转让入参 {}"
,
JSON
.
toJSONString
(
data
));
log
.
info
(
"群主转让入参 {}"
,
JSON
.
toJSONString
(
data
));
Boolean
result
=
imConversationService
.
transferOwner
(
data
);
Boolean
r
=
imConversationService
.
transferOwner
(
data
);
Map
<
String
,
Boolean
>
result
=
new
HashMap
<>();
result
.
put
(
"result"
,
r
);
return
WsResponse
.
ok
(
result
);
return
WsResponse
.
ok
(
result
);
}
}
/**
/**
* 设置群管理员
* 设置群管理员
* @return
*/
*/
@ActionMapping
(
"/setAdmins"
)
@ActionMapping
(
"/setAdmins"
)
@ApiOperation
(
value
=
"设置群管理员"
,
notes
=
"权限:目前只有群主有权限操作"
)
@ApiOperation
(
value
=
"设置群管理员"
,
notes
=
"权限:目前只有群主有权限操作"
)
public
WsResponse
<
Boolean
>
setAdmins
(
@Validated
SetAdminsParam
data
)
{
public
WsResponse
<
Map
<
String
,
Boolean
>
>
setAdmins
(
@Validated
SetAdminsParam
data
)
{
log
.
info
(
"设置群管理员入参 {}"
,
JSON
.
toJSONString
(
data
));
log
.
info
(
"设置群管理员入参 {}"
,
JSON
.
toJSONString
(
data
));
if
(
CollectionUtils
.
isEmpty
(
data
.
getClientIds
()))
{
if
(
CollectionUtils
.
isEmpty
(
data
.
getClientIds
()))
{
return
WsResponse
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
return
WsResponse
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
}
Boolean
result
=
imConversationService
.
setAdmins
(
data
);
Boolean
r
=
imConversationService
.
setAdmins
(
data
);
Map
<
String
,
Boolean
>
result
=
new
HashMap
<>();
result
.
put
(
"result"
,
r
);
return
WsResponse
.
ok
(
result
);
return
WsResponse
.
ok
(
result
);
}
}
/**
/**
* 群禁言、取消群禁言
* 群禁言、取消群禁言
* @return
*/
*/
@ActionMapping
(
"/mutedGroup"
)
@ActionMapping
(
"/mutedGroup"
)
@ApiOperation
(
value
=
"群禁言、取消群禁言"
,
notes
=
"权限:群主和管理员有权限操作"
)
@ApiOperation
(
value
=
"群禁言、取消群禁言"
,
notes
=
"权限:群主和管理员有权限操作"
)
public
WsResponse
<
Boolean
>
mutedGroup
(
@Validated
MutedGroupParam
data
)
{
public
WsResponse
<
Map
<
String
,
Boolean
>
>
mutedGroup
(
@Validated
MutedGroupParam
data
)
{
log
.
info
(
"群禁言、取消群禁言入参 {}"
,
JSON
.
toJSONString
(
data
));
log
.
info
(
"群禁言、取消群禁言入参 {}"
,
JSON
.
toJSONString
(
data
));
Boolean
result
=
imConversationService
.
mutedGroup
(
data
);
Boolean
r
=
imConversationService
.
mutedGroup
(
data
);
Map
<
String
,
Boolean
>
result
=
new
HashMap
<>();
result
.
put
(
"result"
,
r
);
return
WsResponse
.
ok
(
result
);
return
WsResponse
.
ok
(
result
);
}
}
...
@@ -168,23 +182,28 @@ public class ConversationAction {
...
@@ -168,23 +182,28 @@ public class ConversationAction {
*/
*/
@ActionMapping
(
"/mutedGroupMember"
)
@ActionMapping
(
"/mutedGroupMember"
)
@ApiOperation
(
value
=
"选择禁言"
,
notes
=
"权限:群主和管理员有权限操作"
)
@ApiOperation
(
value
=
"选择禁言"
,
notes
=
"权限:群主和管理员有权限操作"
)
public
WsResponse
<
Boolean
>
mutedGroupMember
(
@Validated
MutedGroupMemberParam
data
)
{
public
WsResponse
<
Map
<
String
,
Boolean
>
>
mutedGroupMember
(
@Validated
MutedGroupMemberParam
data
)
{
log
.
info
(
"选择禁言入参 {}"
,
JSON
.
toJSONString
(
data
));
log
.
info
(
"选择禁言入参 {}"
,
JSON
.
toJSONString
(
data
));
if
(
CollectionUtils
.
isEmpty
(
data
.
getClientIds
()))
{
if
(
CollectionUtils
.
isEmpty
(
data
.
getClientIds
()))
{
return
WsResponse
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
return
WsResponse
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
}
Boolean
result
=
imConversationService
.
mutedGroupMember
(
data
);
Boolean
r
=
imConversationService
.
mutedGroupMember
(
data
);
Map
<
String
,
Boolean
>
result
=
new
HashMap
<>();
result
.
put
(
"result"
,
r
);
return
WsResponse
.
ok
(
result
);
return
WsResponse
.
ok
(
result
);
}
}
/**
/**
* 查询用户加入的所有会话 与每个会话的未读条数 成员
* 查询用户加入的所有会话 与每个会话的未读条数 成员
* @return
*/
*/
@ActionMapping
(
"/getList"
)
@ActionMapping
(
"/getList"
)
@ApiOperation
(
value
=
"查询加入的会话列表"
,
notes
=
"查询用户加入的非隐藏状态的会话列表 与每个会话的未读条数 成员"
)
@ApiOperation
(
value
=
"查询加入的会话列表"
,
notes
=
"查询用户加入的非隐藏状态的会话列表 与每个会话的未读条数 成员"
)
public
WsResponse
<
List
<
ConversationVo
>>
getMyImConversationListAndMsgCount
()
{
public
WsResponse
<
Map
<
String
,
List
<
ConversationVo
>
>>
getMyImConversationListAndMsgCount
()
{
List
<
ConversationVo
>
conversationList
=
imConversationService
.
getMyImConversationListAndMsgCount
();
List
<
ConversationVo
>
conversationList
=
imConversationService
.
getMyImConversationListAndMsgCount
();
return
WsResponse
.
ok
(
conversationList
);
Map
<
String
,
List
<
ConversationVo
>>
result
=
new
HashMap
<>();
result
.
put
(
"result"
,
conversationList
);
return
WsResponse
.
ok
(
result
);
}
}
/**
/**
...
...
core/src/main/java/com/wecloud/im/action/InboxAction.java
View file @
c291af82
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.Api;
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -58,13 +59,17 @@ public class InboxAction {
...
@@ -58,13 +59,17 @@ public class InboxAction {
/**
/**
* 会话消息修改为已读状态
* 会话消息修改为已读状态
* @return
*/
*/
@ActionMapping
(
"/updateMsgReadStatusByConversation"
)
@ActionMapping
(
"/updateMsgReadStatusByConversation"
)
@ApiOperation
(
value
=
"会话消息修改为已读状态"
)
@ApiOperation
(
value
=
"会话消息修改为已读状态"
)
public
WsResponse
<
Boolean
>
updateMsgReadStatusByConversation
(
UpdateMsgReadStatusByConversationParam
data
)
throws
Exception
{
public
WsResponse
<
Map
<
String
,
Boolean
>
>
updateMsgReadStatusByConversation
(
UpdateMsgReadStatusByConversationParam
data
)
throws
Exception
{
if
(
data
.
getConversationId
()
==
null
)
{
if
(
data
.
getConversationId
()
==
null
)
{
return
WsResponse
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
);
return
WsResponse
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
);
}
}
return
WsResponse
.
ok
(
imInboxService
.
updateMsgReadStatusByConversation
(
data
));
boolean
r
=
imInboxService
.
updateMsgReadStatusByConversation
(
data
);
Map
<
String
,
Boolean
>
result
=
new
HashMap
<>();
result
.
put
(
"result"
,
r
);
return
WsResponse
.
ok
(
result
);
}
}
}
}
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