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
d3dd2ecf
Commit
d3dd2ecf
authored
Mar 03, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
3a2861b7
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
6 deletions
+25
-6
core/src/main/java/com/wecloud/im/controller/ImConversationController.java
+9
-0
core/src/main/java/com/wecloud/im/param/ImHistoryMessagePageParam.java
+2
-0
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
+4
-4
core/src/main/java/com/wecloud/im/vo/OfflineMsgDto.java
+8
-1
core/src/main/resources/mapper/ImMessageMapper.xml
+2
-1
No files found.
core/src/main/java/com/wecloud/im/controller/ImConversationController.java
View file @
d3dd2ecf
package
com
.
wecloud
.
im
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.wecloud.im.param.ImConversationQueryParam
;
import
com.wecloud.im.param.MutedGroupParam
;
import
com.wecloud.im.param.SetAdminsParam
;
...
...
@@ -71,6 +72,7 @@ public class ImConversationController extends BaseController {
@PostMapping
(
"/leave"
)
@ApiOperation
(
value
=
"client退出会话"
,
notes
=
"若是创建者退出,[创建者]权限将会转移给按加入会话时间排序的下一个client"
)
public
ApiResult
<
Boolean
>
leaveConversation
(
@RequestBody
ImClientLeaveConversation
imClientToConversation
)
throws
Exception
{
log
.
info
(
"client退出会话入参 {}"
,
JSON
.
toJSONString
(
imClientToConversation
));
return
imConversationService
.
leaveConversation
(
imClientToConversation
);
}
...
...
@@ -81,6 +83,7 @@ public class ImConversationController extends BaseController {
@PostMapping
(
"/delClient"
)
@ApiOperation
(
value
=
"将client从会话移除"
,
notes
=
"权限:目前只有创建者有权限操作"
)
public
ApiResult
<
Boolean
>
delClientToConversation
(
@RequestBody
ImClientToConversation
imClientToConversation
)
throws
Exception
{
log
.
info
(
"将client从会话移除入参 {}"
,
JSON
.
toJSONString
(
imClientToConversation
));
return
imConversationService
.
delClientToConversation
(
imClientToConversation
);
}
...
...
@@ -91,6 +94,7 @@ public class ImConversationController extends BaseController {
@PostMapping
(
"/addClient"
)
@ApiOperation
(
value
=
"将用户添加进会话"
,
notes
=
"权限:会话中所有client都有权限操作"
)
public
ApiResult
<
Boolean
>
addClientToConversation
(
@RequestBody
ImClientToConversation
imClientToConversation
)
throws
Exception
{
log
.
info
(
"将用户添加进会话入参 {}"
,
JSON
.
toJSONString
(
imClientToConversation
));
return
imConversationService
.
addClientToConversation
(
imClientToConversation
);
}
...
...
@@ -100,6 +104,7 @@ public class ImConversationController extends BaseController {
@PostMapping
(
"/create"
)
@ApiOperation
(
value
=
"创建会话"
,
notes
=
"后台可配置:两个客户端如果已经创建过会话,是否重复创建会话"
)
public
ApiResult
<
ImConversationCreateVo
>
createImConversation
(
@RequestBody
ImConversationCreate
imConversationCreate
)
throws
Exception
{
log
.
info
(
"创建会话入参 {}"
,
JSON
.
toJSONString
(
imConversationCreate
));
return
imConversationService
.
createImConversation
(
imConversationCreate
);
}
...
...
@@ -109,6 +114,7 @@ public class ImConversationController extends BaseController {
@PostMapping
(
"/transferOwner"
)
@ApiOperation
(
value
=
"群主转让"
,
notes
=
"权限:目前只有群主有权限操作"
)
public
ApiResult
<
Boolean
>
transferOwner
(
@RequestBody
TransferOwnerParam
param
)
{
log
.
info
(
"群主转让入参 {}"
,
JSON
.
toJSONString
(
param
));
Boolean
result
=
imConversationService
.
transferOwner
(
param
);
return
ApiResult
.
ok
(
result
);
}
...
...
@@ -119,6 +125,7 @@ public class ImConversationController extends BaseController {
@PostMapping
(
"/setAdmins"
)
@ApiOperation
(
value
=
"设置群管理员"
,
notes
=
"权限:目前只有群主有权限操作"
)
public
ApiResult
<
Boolean
>
setAdmins
(
@RequestBody
@Validated
SetAdminsParam
param
)
{
log
.
info
(
"设置群管理员入参 {}"
,
JSON
.
toJSONString
(
param
));
if
(
CollectionUtils
.
isEmpty
(
param
.
getClientIds
()))
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
...
...
@@ -132,6 +139,7 @@ public class ImConversationController extends BaseController {
@PostMapping
(
"/mutedGroup"
)
@ApiOperation
(
value
=
"群禁言、取消群禁言"
,
notes
=
"权限:群主和管理员有权限操作"
)
public
ApiResult
<
Boolean
>
mutedGroup
(
@RequestBody
@Validated
MutedGroupParam
param
)
{
log
.
info
(
"群禁言、取消群禁言入参 {}"
,
JSON
.
toJSONString
(
param
));
Boolean
result
=
imConversationService
.
mutedGroup
(
param
);
return
ApiResult
.
ok
(
result
);
}
...
...
@@ -142,6 +150,7 @@ public class ImConversationController extends BaseController {
@PostMapping
(
"/mutedGroupMember"
)
@ApiOperation
(
value
=
"选择禁言"
,
notes
=
"权限:群主和管理员有权限操作"
)
public
ApiResult
<
Boolean
>
mutedGroupMember
(
@RequestBody
@Validated
MutedGroupParam
param
)
{
log
.
info
(
"选择禁言入参 {}"
,
JSON
.
toJSONString
(
param
));
if
(
CollectionUtils
.
isEmpty
(
param
.
getClientIds
()))
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
...
...
core/src/main/java/com/wecloud/im/param/ImHistoryMessagePageParam.java
View file @
d3dd2ecf
...
...
@@ -28,10 +28,12 @@ public class ImHistoryMessagePageParam extends BasePageOrderParam {
/**
* 消息id最小值
*/
@ApiModelProperty
(
"消息id最小值"
)
private
Long
msgIdStart
;
/**
* 消息id最大值
*/
@ApiModelProperty
(
"消息id最大值"
)
private
Long
msgIdEnd
;
}
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
View file @
d3dd2ecf
...
...
@@ -249,7 +249,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
imMessage
.
setSendStatus
(
2
);
imMessage
.
setFkConversationId
(
imConversation
.
getId
());
imMessageService
.
save
(
imMessage
);
sendEventMsgToMember
(
imApplication
,
client2
.
getId
(),
imMessage
,
createClient
,
client2
);
sendEventMsgToMember
(
imApplication
,
client2
.
getId
(),
imMessage
,
createClient
);
}
}
ImConversationCreateVo
imConversationCreateVo
=
new
ImConversationCreateVo
();
...
...
@@ -343,10 +343,10 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
// 遍历发送给已在群内的成员
for
(
ImConversationMembers
conversationMember
:
membersList
)
{
sendEventMsgToMember
(
imApplication
,
conversationMember
.
getFkClientId
(),
imMessage
,
imClientSender
,
clientToConversation
);
sendEventMsgToMember
(
imApplication
,
conversationMember
.
getFkClientId
(),
imMessage
,
imClientSender
);
}
// 发送给刚被拉入群的成员
sendEventMsgToMember
(
imApplication
,
clientToConversation
.
getId
(),
imMessage
,
imClientSender
,
clientToConversation
);
sendEventMsgToMember
(
imApplication
,
clientToConversation
.
getId
(),
imMessage
,
imClientSender
);
}
// 将群成员数量减
...
...
@@ -362,7 +362,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
}
private
void
sendEventMsgToMember
(
ImApplication
imApplication
,
Long
conversationMemberClientId
,
ImMessage
imMessage
,
ImClient
clientSender
,
ImClient
clientToConversation
)
{
ImClient
clientSender
)
{
// 查询接收方
ImClient
imClientReceiver
=
imClientService
.
getOne
(
new
QueryWrapper
<
ImClient
>().
lambda
()
.
eq
(
ImClient:
:
getFkAppid
,
imApplication
.
getId
())
...
...
core/src/main/java/com/wecloud/im/vo/OfflineMsgDto.java
View file @
d3dd2ecf
...
...
@@ -9,13 +9,20 @@ import java.io.Serializable;
import
java.util.Date
;
/**
* 离线消息内容实体
* @Author wenzhida
* @Date 2022/3/3 11:19
* @Description 离线消息内容实体
*/
@Data
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"OfflineMsgDto"
)
public
class
OfflineMsgDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7073389493201687249L
;
@ApiModelProperty
(
"会话id"
)
private
Long
conversationId
;
@ApiModelProperty
(
"消息类型"
)
private
Integer
type
;
...
...
core/src/main/resources/mapper/ImMessageMapper.xml
View file @
d3dd2ecf
...
...
@@ -63,7 +63,8 @@
im_message.system_flag,
im_message.`at`,
im_message.send_status,
im_message.`msg_type` AS 'type', im_message.fk_conversation_id,
im_message.`msg_type` AS 'type',
im_message.fk_conversation_id as conversationId,
(SELECT COUNT(id) FROM im_inbox WHERE fk_msg_id = msgId AND read_msg_status = 0) AS not_read_count,
(SELECT COUNT(id)
FROM im_inbox
...
...
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