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
0363ebf8
Commit
0363ebf8
authored
Mar 02, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方法名称修改
parent
f2f02b3f
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
69 additions
and
84 deletions
+69
-84
core/src/main/java/com/wecloud/im/friend/controller/ImFriendController.java
+9
-9
core/src/main/java/com/wecloud/im/service/ImClientService.java
+1
-2
core/src/main/java/com/wecloud/im/service/impl/ImClientBlacklistServiceImpl.java
+3
-3
core/src/main/java/com/wecloud/im/service/impl/ImClientServiceImpl.java
+10
-12
core/src/main/java/com/wecloud/im/service/impl/ImConversationMembersServiceImpl.java
+2
-2
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
+22
-30
core/src/main/java/com/wecloud/im/service/impl/ImInboxServiceImpl.java
+3
-3
core/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
+4
-5
core/src/main/java/com/wecloud/im/thousandchat/service/ThousandChatService.java
+3
-3
core/src/main/java/com/wecloud/im/user/controller/FriendController.java
+0
-3
core/src/main/java/com/wecloud/im/user/service/FriendService.java
+3
-3
core/src/main/java/com/wecloud/im/user/service/UserService.java
+3
-3
core/src/main/java/com/wecloud/rtc/service/impl/RtcServiceImpl.java
+6
-6
No files found.
core/src/main/java/com/wecloud/im/friend/controller/ImFriendController.java
View file @
0363ebf8
...
...
@@ -58,7 +58,7 @@ public class ImFriendController extends BaseController {
if
(
param
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
...
...
@@ -79,7 +79,7 @@ public class ImFriendController extends BaseController {
if
(
param
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
...
...
@@ -100,7 +100,7 @@ public class ImFriendController extends BaseController {
@PostMapping
(
"/unsureFriends"
)
@ApiOperation
(
value
=
"待接受的好友请求列表,最多只返回1000个"
)
public
ApiResult
<
List
<
ImFriendApplyDto
>>
getUnsureFriends
()
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
...
...
@@ -117,7 +117,7 @@ public class ImFriendController extends BaseController {
if
(
param
==
null
||
param
.
getAgree
()
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
...
...
@@ -137,7 +137,7 @@ public class ImFriendController extends BaseController {
@PostMapping
(
"/batchDelete"
)
@ApiOperation
(
value
=
"删除好友"
)
public
ApiResult
<
Boolean
>
batchDeleteFriend
(
@RequestBody
ImDeleteFriendParam
param
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
...
...
@@ -153,7 +153,7 @@ public class ImFriendController extends BaseController {
@OperationLog
(
name
=
"好友分页列表"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"好友分页列表"
)
public
ApiResult
<
Paging
<
ImFriendBaseDto
>>
getImFriendPageList
(
@RequestBody
ImFriendPageParam
pageParam
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
...
...
@@ -169,7 +169,7 @@ public class ImFriendController extends BaseController {
@OperationLog
(
name
=
"批量创建好友推荐"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"批量创建好友推荐"
)
public
ApiResult
<
Boolean
>
batchCreateRecommend
(
@RequestBody
ImCreateRecommendParam
param
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
...
...
@@ -192,7 +192,7 @@ public class ImFriendController extends BaseController {
@OperationLog
(
name
=
"好友推荐分页列表"
,
type
=
OperationLogType
.
PAGE
)
@ApiOperation
(
value
=
"好友推荐分页列表"
)
public
ApiResult
<
Paging
<
ImFriendRecommendDto
>>
getImFriendRecommendPageList
(
@RequestBody
ImFriendPageParam
pageParam
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
...
...
@@ -207,7 +207,7 @@ public class ImFriendController extends BaseController {
@PostMapping
(
"/recommend/batchDelete"
)
@ApiOperation
(
value
=
"删除好友推荐"
)
public
ApiResult
<
Boolean
>
batchDeleteRecommend
(
@RequestBody
ImDeleteRecommendParam
param
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
...
...
core/src/main/java/com/wecloud/im/service/ImClientService.java
View file @
0363ebf8
...
...
@@ -17,7 +17,6 @@ import com.wecloud.im.vo.MyInfoVo;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.service.BaseService
;
import
io.geekidea.springbootplus.framework.core.pagination.Paging
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
java.util.List
;
...
...
@@ -133,7 +132,7 @@ public interface ImClientService extends BaseService<ImClient> {
*
* @return
*/
ImClient
getCurentClient
();
ImClient
getCur
r
entClient
();
ImClient
getCacheImClient
(
Long
applicationId
,
String
clientId
);
...
...
core/src/main/java/com/wecloud/im/service/impl/ImClientBlacklistServiceImpl.java
View file @
0363ebf8
...
...
@@ -52,7 +52,7 @@ public class ImClientBlacklistServiceImpl extends BaseServiceImpl<ImClientBlackl
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ApiResult
<
Boolean
>
addImClientBlacklist
(
ImClientBlacklistUpdate
imClientBlacklistUpdate
)
throws
Exception
{
ImClient
client
=
imClientService
.
getCurentClient
();
ImClient
client
=
imClientService
.
getCur
r
entClient
();
if
(
client
==
null
)
{
throw
new
BusinessException
(
"当前用户登录信息失效"
);
}
...
...
@@ -77,7 +77,7 @@ public class ImClientBlacklistServiceImpl extends BaseServiceImpl<ImClientBlackl
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ApiResult
<
Boolean
>
removeImClientBlacklist
(
ImClientBlacklistUpdate
imClientBlacklistUpdate
)
throws
Exception
{
// 操作者
ImClient
client
=
imClientService
.
getCurentClient
();
ImClient
client
=
imClientService
.
getCur
r
entClient
();
if
(
client
==
null
)
{
throw
new
BusinessException
(
"当前用户登录信息失效"
);
}
...
...
@@ -100,7 +100,7 @@ public class ImClientBlacklistServiceImpl extends BaseServiceImpl<ImClientBlackl
Page
<
ImClientBlacklistQueryVo
>
page
=
new
PageInfo
<>(
imClientBlacklistPageParam
);
ImClient
client
=
imClientService
.
getCurentClient
();
ImClient
client
=
imClientService
.
getCur
r
entClient
();
IPage
<
ImClientBlacklistQueryVo
>
imClientBlacklistPageList
=
imClientBlacklistMapper
.
getImClientBlacklistPageList
(
page
,
client
.
getClientId
());
...
...
core/src/main/java/com/wecloud/im/service/impl/ImClientServiceImpl.java
View file @
0363ebf8
...
...
@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.google.common.collect.Lists
;
import
com.wecloud.im.entity.ImApplication
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImClientBlacklist
;
import
com.wecloud.im.enums.FriendStateEnum
;
import
com.wecloud.im.enums.RelationEnum
;
import
com.wecloud.im.friend.entity.ImFriend
;
...
...
@@ -47,7 +46,6 @@ import org.springframework.cache.annotation.Cacheable;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
...
...
@@ -76,7 +74,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
@Override
public
MyInfoVo
getMyInfo
()
{
ImClient
currentClient
=
this
.
getCurentClient
();
ImClient
currentClient
=
this
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
throw
new
BusinessException
(
"当前用户登录信息失效"
);
}
...
...
@@ -88,7 +86,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
updateHeadPortrait
(
ImClientHeadPortraitAdd
imClientHeadPortraitAdd
)
{
ImClient
curentClient
=
getCurentClient
();
ImClient
curentClient
=
getCur
r
entClient
();
curentClient
.
setHeadPortrait
(
imClientHeadPortraitAdd
.
getHeadPortrait
());
imClientMapper
.
updateById
(
curentClient
);
...
...
@@ -100,7 +98,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
@Override
public
boolean
updateNickname
(
ImClientNicknameUpdate
imClientNicknameUpdate
)
{
ImClient
curentClient
=
getCurentClient
();
ImClient
curentClient
=
getCur
r
entClient
();
curentClient
.
setNickname
(
imClientNicknameUpdate
.
getNickname
());
imClientMapper
.
updateById
(
curentClient
);
...
...
@@ -112,7 +110,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
@Override
public
boolean
updateHeadAndNickname
(
ImClientHeadPortraitAndNicknameUpdate
imClientHeadPortraitAndNicknameUpdate
)
{
ImClient
curentClient
=
getCurentClient
();
ImClient
curentClient
=
getCur
r
entClient
();
curentClient
.
setHeadPortrait
(
imClientHeadPortraitAndNicknameUpdate
.
getHeadPortrait
());
curentClient
.
setNickname
(
imClientHeadPortraitAndNicknameUpdate
.
getNickname
());
imClientMapper
.
updateById
(
curentClient
);
...
...
@@ -125,7 +123,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
@Override
public
ApiResult
<
List
<
GetInfoListVo
>>
getInfoList
(
GetClientInfoParam
getClientInfoParam
)
throws
Exception
{
ImClient
curentClient
=
getCurentClient
();
ImClient
curentClient
=
getCur
r
entClient
();
if
(
getClientInfoParam
.
getClientIds
()
==
null
||
getClientInfoParam
.
getClientIds
().
isEmpty
())
{
throw
new
BusinessException
(
"getClientInfoParam.getClientIds() == null"
);
...
...
@@ -154,7 +152,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
@Override
public
ClientInfoVo
getClientInfo
(
ClientInfoParam
param
)
{
ImClient
currentClient
=
this
.
getCurentClient
();
ImClient
currentClient
=
this
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
throw
new
BusinessException
(
"当前用户登录信息失效"
);
}
...
...
@@ -186,7 +184,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
updateNickname
(
ImClientNicknameAdd
imClientNicknameAdd
)
throws
Exception
{
ImClient
curentClient
=
getCurentClient
();
ImClient
curentClient
=
getCur
r
entClient
();
// shiro线程中获取当前token
JwtToken
curentJwtToken
=
JwtUtil
.
getCurentJwtToken
();
...
...
@@ -228,7 +226,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
this
.
removeOldToken
(
imApplication
.
getId
(),
curentJwtToken
.
getToken
());
}
ImClient
client
=
getCurentClient
();
ImClient
client
=
getCur
r
entClient
();
ImClient
clientNew
=
new
ImClient
();
BeanUtils
.
copyProperties
(
imClientDevice
,
clientNew
);
clientNew
.
setId
(
client
.
getId
());
...
...
@@ -243,7 +241,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
@Override
public
boolean
logout
()
{
ImClient
curentClient
=
getCurentClient
();
ImClient
curentClient
=
getCur
r
entClient
();
// 清除设备token
boolean
update
=
this
.
update
(
new
UpdateWrapper
<
ImClient
>().
lambda
()
...
...
@@ -285,7 +283,7 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
}
@Override
public
ImClient
getCurentClient
()
{
public
ImClient
getCur
r
entClient
()
{
// shiro线程中获取当前token
JwtToken
curentJwtToken
=
JwtUtil
.
getCurentJwtToken
();
...
...
core/src/main/java/com/wecloud/im/service/impl/ImConversationMembersServiceImpl.java
View file @
0363ebf8
...
...
@@ -88,7 +88,7 @@ public class ImConversationMembersServiceImpl extends BaseServiceImpl<ImConversa
// 根据appKey查询application
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
curentJwtToken
.
getAppKey
());
ImClient
imClientSender
=
imClientService
.
getCurentClient
();
ImClient
imClientSender
=
imClientService
.
getCur
r
entClient
();
// 查询该成员
ImConversationMembers
imConversationMember
=
imConversationMembersService
.
getOne
(
...
...
@@ -142,7 +142,7 @@ public class ImConversationMembersServiceImpl extends BaseServiceImpl<ImConversa
// 根据appKey查询application
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
curentJwtToken
.
getAppKey
());
ImClient
imClientSender
=
imClientService
.
getCurentClient
();
ImClient
imClientSender
=
imClientService
.
getCur
r
entClient
();
// 查询该成员
ImConversationMembers
imConversationMember
=
imConversationMembersService
.
getOne
(
...
...
core/src/main/java/com/wecloud/im/service/impl/ImConversationServiceImpl.java
View file @
0363ebf8
...
...
@@ -14,7 +14,6 @@ import com.wecloud.im.entity.ImMessage;
import
com.wecloud.im.entity.ImMessageOnlineSend
;
import
com.wecloud.im.enums.ChatTypeEnum
;
import
com.wecloud.im.enums.GroupRoleEnum
;
import
com.wecloud.im.enums.MutedEnum
;
import
com.wecloud.im.mapper.ImConversationMapper
;
import
com.wecloud.im.param.ImClientSimpleDto
;
import
com.wecloud.im.param.ListConversationMembersParam
;
...
...
@@ -59,7 +58,6 @@ import org.apache.commons.collections4.CollectionUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -111,7 +109,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ApiResult
<
ImConversationCreateVo
>
createImConversation
(
ImConversationCreate
imConversationCreate
)
{
ImClient
createClient
=
imClientService
.
getCurentClient
();
ImClient
createClient
=
imClientService
.
getCur
r
entClient
();
if
(
CollectionUtils
.
isEmpty
(
imConversationCreate
.
getClientIds
()))
{
log
.
info
(
"未找到群成员信息"
);
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
...
...
@@ -267,7 +265,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
// 根据appKey查询application
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
curentJwtToken
.
getAppKey
());
ImClient
imClientSender
=
imClientService
.
getCurentClient
();
ImClient
imClientSender
=
imClientService
.
getCur
r
entClient
();
// 查询该会话所有成员
List
<
ImConversationMembers
>
membersList
=
imConversationMembersService
.
list
(
...
...
@@ -402,7 +400,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
// 根据appKey查询application
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
curentJwtToken
.
getAppKey
());
ImClient
imClientSender
=
imClientService
.
getCurentClient
();
ImClient
imClientSender
=
imClientService
.
getCur
r
entClient
();
// 判断是否为群主
ImConversationMembers
conversationMember
=
imConversationMembersService
.
getOne
(
...
...
@@ -515,13 +513,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ApiResult
<
Boolean
>
leaveConversation
(
ImClientLeaveConversation
imClientToConversation
)
throws
Exception
{
// shiro线程中获取当前token
JwtToken
curentJwtToken
=
JwtUtil
.
getCurentJwtToken
();
// 根据appKey查询application
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
curentJwtToken
.
getAppKey
());
ImClient
imClientSender
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCurrentClient
();
ImConversation
imConversationById
=
imConversationService
.
getById
(
imClientToConversation
.
getConversationId
());
if
(
imConversationById
==
null
)
{
...
...
@@ -533,7 +525,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
new
QueryWrapper
<
ImConversationMembers
>().
lambda
()
.
eq
(
ImConversationMembers:
:
getFkConversationId
,
imClientToConversation
.
getConversationId
())
.
orderByAsc
(
ImConversationMembers:
:
getCreateTime
)
.
notIn
(
ImConversationMembers:
:
getFkClientId
,
imClientSender
.
getId
())
.
notIn
(
ImConversationMembers:
:
getFkClientId
,
currentClient
.
getId
())
);
if
(
membersList
.
isEmpty
())
{
...
...
@@ -543,9 +535,9 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
// 判断用户是否在该会话
ImConversationMembers
members
=
imConversationMembersService
.
getOne
(
new
QueryWrapper
<
ImConversationMembers
>().
lambda
()
.
eq
(
ImConversationMembers:
:
getFkAppid
,
imApplication
.
getI
d
())
.
eq
(
ImConversationMembers:
:
getFkAppid
,
currentClient
.
getFkAppi
d
())
.
eq
(
ImConversationMembers:
:
getFkConversationId
,
imClientToConversation
.
getConversationId
())
.
eq
(
ImConversationMembers:
:
getFkClientId
,
imClientSender
.
getId
())
.
eq
(
ImConversationMembers:
:
getFkClientId
,
currentClient
.
getId
())
);
// 将client从会话移除
...
...
@@ -555,7 +547,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
}
// 将群成员数量减1
imConversationMapper
.
addMemberCount
(
imApplication
.
getI
d
(),
imClientToConversation
.
getConversationId
(),
-
1
);
imConversationMapper
.
addMemberCount
(
currentClient
.
getFkAppi
d
(),
imClientToConversation
.
getConversationId
(),
-
1
);
// ws 退出事件通知给群内其他人 ----------
...
...
@@ -568,8 +560,8 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
imMessage
.
setId
(
messageId
);
imMessage
.
setMsgType
(
MsgTypeEnum
.
LEAVE_CONVERSATION
.
getUriCode
());
imMessage
.
setCreateTime
(
new
Date
());
imMessage
.
setFkAppid
(
imApplication
.
getI
d
());
imMessage
.
setSender
(
imClientSender
.
getId
());
imMessage
.
setFkAppid
(
currentClient
.
getFkAppi
d
());
imMessage
.
setSender
(
currentClient
.
getId
());
imMessage
.
setWithdraw
(
false
);
imMessage
.
setEvent
(
true
);
imMessage
.
setSystemFlag
(
false
);
...
...
@@ -585,7 +577,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
// 查询接收方
ImClient
imClientReceiver
=
imClientService
.
getOne
(
new
QueryWrapper
<
ImClient
>().
lambda
()
.
eq
(
ImClient:
:
getFkAppid
,
imApplication
.
getI
d
())
.
eq
(
ImClient:
:
getFkAppid
,
currentClient
.
getFkAppi
d
())
.
eq
(
ImClient:
:
getId
,
conversationMembers
.
getFkClientId
()));
if
(
imClientReceiver
==
null
)
{
continue
;
...
...
@@ -597,7 +589,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
imMessageOnlineSend
.
setMsgId
(
messageId
);
imMessageOnlineSend
.
setCreateTime
(
new
Date
());
imMessageOnlineSend
.
setType
(
MsgTypeEnum
.
LEAVE_CONVERSATION
.
getUriCode
());
imMessageOnlineSend
.
setSender
(
imClientSender
.
getClientId
());
imMessageOnlineSend
.
setSender
(
currentClient
.
getClientId
());
imMessageOnlineSend
.
setConversationId
(
conversationMembers
.
getFkConversationId
());
imMessageOnlineSend
.
setWithdraw
(
Boolean
.
FALSE
);
imMessageOnlineSend
.
setEvent
(
Boolean
.
TRUE
);
...
...
@@ -637,7 +629,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
JwtToken
curentJwtToken
=
JwtUtil
.
getCurentJwtToken
();
// 根据appKey查询application
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
curentJwtToken
.
getAppKey
());
ImClient
imClientSender
=
imClientService
.
getCurentClient
();
ImClient
imClientSender
=
imClientService
.
getCur
r
entClient
();
// 判断操作人是否为群主
ImConversationMembers
currentMember
=
imConversationMembersService
.
getOne
(
...
...
@@ -670,7 +662,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
*/
@Override
public
Boolean
setAdmins
(
SetAdminsParam
param
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
// 判断操作人是否为群主
ImConversationMembers
currentMember
=
imConversationMembersService
.
getOne
(
new
QueryWrapper
<
ImConversationMembers
>().
lambda
()
...
...
@@ -698,7 +690,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
*/
@Override
public
Boolean
mutedGroup
(
MutedGroupParam
param
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(!
imConversationService
.
isBelongToRole
(
currentClient
.
getClientId
(),
param
.
getConversationId
(),
Lists
.
newArrayList
(
GroupRoleEnum
.
OWNER
.
getCode
(),
GroupRoleEnum
.
ADMIN
.
getCode
())))
{
// 当前操作人不属于群主或管理人员
...
...
@@ -715,7 +707,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
@Override
public
Boolean
mutedGroupMember
(
MutedGroupParam
param
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(!
imConversationService
.
isBelongToRole
(
currentClient
.
getClientId
(),
param
.
getConversationId
(),
Lists
.
newArrayList
(
GroupRoleEnum
.
OWNER
.
getCode
(),
GroupRoleEnum
.
ADMIN
.
getCode
())))
{
// 当前操作人不属于群主或管理人员
...
...
@@ -771,7 +763,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
// 根据appKey查询application
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
curentJwtToken
.
getAppKey
());
ImClient
imClientSender
=
imClientService
.
getCurentClient
();
ImClient
imClientSender
=
imClientService
.
getCur
r
entClient
();
ImConversation
imConversationById
=
imConversationService
.
getById
(
imConversationNameUpdate
.
getConversationId
());
...
...
@@ -854,7 +846,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
// 根据appKey查询application
ImApplication
imApplication
=
imApplicationService
.
getCacheAppByAppKey
(
curentJwtToken
.
getAppKey
());
ImClient
imClientSender
=
imClientService
.
getCurentClient
();
ImClient
imClientSender
=
imClientService
.
getCur
r
entClient
();
ImConversation
imConversationById
=
imConversationService
.
getById
(
imConversationAttrUpdate
.
getConversationId
());
// 判断是否为群主
...
...
@@ -947,7 +939,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
updateDisplayConversation
(
ImConversationDisplayUpdate
imConversationDisplayUpdate
)
{
ImClient
curentClient
=
imClientService
.
getCurentClient
();
ImClient
curentClient
=
imClientService
.
getCur
r
entClient
();
for
(
Long
id
:
imConversationDisplayUpdate
.
getConversationIds
())
{
// 修改为删除隐藏状态
boolean
update
=
imConversationMembersService
.
update
(
new
UpdateWrapper
<
ImConversationMembers
>()
...
...
@@ -981,7 +973,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
@Override
public
List
<
ConversationVo
>
getMyImConversationListAndMsgCount
()
throws
Exception
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
// 查询用户加入的所有会话 与每个会话的未读条数 成员
List
<
ConversationVo
>
myImConversationListAndMsgCount
=
imConversationMapper
.
getMyImConversationListAndMsgCount
(
currentClient
.
getId
(),
null
);
...
...
@@ -1007,7 +999,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
@Override
public
ConversationVo
infoImConversationAndMsgCount
(
ImConversationQueryParam
param
)
throws
Exception
{
ImClient
client
=
imClientService
.
getCurentClient
();
ImClient
client
=
imClientService
.
getCur
r
entClient
();
// 查询用户加入的所有会话 与每个会话的未读条数 成员
List
<
ConversationVo
>
conversationList
=
imConversationMapper
.
getMyImConversationListAndMsgCount
(
client
.
getId
(),
param
.
getId
());
if
(
CollectionUtils
.
isEmpty
(
conversationList
))
{
...
...
@@ -1025,7 +1017,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
@Override
public
List
<
ImConversation
>
getMyImConversationList
()
throws
Exception
{
ImClient
client
=
imClientService
.
getCurentClient
();
ImClient
client
=
imClientService
.
getCur
r
entClient
();
return
imConversationMapper
.
getMyImConversationList
(
client
.
getId
());
}
...
...
core/src/main/java/com/wecloud/im/service/impl/ImInboxServiceImpl.java
View file @
0363ebf8
...
...
@@ -95,7 +95,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ApiResult
<
Boolean
>
updateImMsgReceived
(
ImMsgReceivedStatusUpdate
imMsgReceivedUpdate
)
{
ImClient
curentClient
=
imClientService
.
getCurentClient
();
ImClient
curentClient
=
imClientService
.
getCur
r
entClient
();
// 修改已接收状态
Long
aLong
=
imInboxMapper
.
updateImMsgReceivedByIds
(
curentClient
.
getId
(),
imMsgReceivedUpdate
.
getMsgIds
());
...
...
@@ -136,7 +136,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ApiResult
<
Boolean
>
updateImMsgRead
(
MsgReadStatusUpdateParam
msgReadStatusUpdateParam
)
{
ImClient
curentClient
=
imClientService
.
getCurentClient
();
ImClient
curentClient
=
imClientService
.
getCur
r
entClient
();
// 修改已读状态
Long
aLong
=
imInboxMapper
.
updateImMsgReadByIds
(
curentClient
.
getId
(),
msgReadStatusUpdateParam
.
getMsgIds
());
...
...
@@ -155,7 +155,7 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
@Override
public
Boolean
updateMsgReadStatusByConversation
(
MsgReadStatusUpdateParam
msgReadStatusUpdateParam
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
// 获取该用户该会话所有未读消息 msgId 列表
List
<
ImInbox
>
imInboxList
=
this
.
list
(
new
QueryWrapper
<
ImInbox
>().
lambda
()
.
eq
(
ImInbox:
:
getFkConversationId
,
msgReadStatusUpdateParam
.
getConversationId
())
...
...
core/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
View file @
0363ebf8
...
...
@@ -58,7 +58,6 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -208,7 +207,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
imClientSender
=
imClientService
.
getCacheImClient
(
request
.
getSenderClientId
());
imApplication
=
imApplicationService
.
getCacheById
(
imClientSender
.
getFkAppid
());
}
else
{
imClientSender
=
imClientService
.
getCurentClient
();
imClientSender
=
imClientService
.
getCur
r
entClient
();
// 查询imApplication
imApplication
=
imApplicationService
.
getCacheById
(
imClientSender
.
getFkAppid
());
}
...
...
@@ -319,7 +318,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
imClientSender
=
imClientService
.
getCacheImClient
(
request
.
getSenderClientId
());
imApplication
=
imApplicationService
.
getCacheById
(
imClientSender
.
getFkAppid
());
}
else
{
imClientSender
=
imClientService
.
getCurentClient
();
imClientSender
=
imClientService
.
getCur
r
entClient
();
// 查询imApplication
imApplication
=
imApplicationService
.
getCacheById
(
imClientSender
.
getFkAppid
());
}
...
...
@@ -461,7 +460,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
if
(
request
!=
null
)
{
imClientSender
=
imClientService
.
getCacheImClient
(
request
.
getSenderClientId
());
}
else
{
imClientSender
=
imClientService
.
getCurentClient
();
imClientSender
=
imClientService
.
getCur
r
entClient
();
}
if
(
imClientSender
==
null
)
{
throw
new
BusinessException
(
"查无发送用户信息"
);
...
...
@@ -507,7 +506,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
// 返回数据
List
<
ImMessageOfflineListVo
>
imMessageOfflineListVoList
=
new
ArrayList
<>();
ImClient
client
=
imClientService
.
getCurentClient
();
ImClient
client
=
imClientService
.
getCur
r
entClient
();
// 获取加入的所有会话
List
<
ImConversation
>
myImConversationList
=
imConversationService
.
getMyImConversationList
();
...
...
core/src/main/java/com/wecloud/im/thousandchat/service/ThousandChatService.java
View file @
0363ebf8
...
...
@@ -65,7 +65,7 @@ public class ThousandChatService extends BaseServiceImpl<ImMsgReadLastestMapper,
* @return
*/
public
ApiResult
<
Boolean
>
updateImMsgReceived
(
LastestReceivedMsg
lastestReceivedMsg
)
{
ImClient
curentClient
=
imClientService
.
getCurentClient
();
ImClient
curentClient
=
imClientService
.
getCur
r
entClient
();
ImMessage
lastestMsg
=
imMessageService
.
getById
(
lastestReceivedMsg
.
getLastestMsgId
());
...
...
@@ -105,7 +105,7 @@ public class ThousandChatService extends BaseServiceImpl<ImMsgReadLastestMapper,
* @return
*/
public
ApiResult
<
Boolean
>
updateImMsgRead
(
Long
lastestMsgId
)
{
ImClient
curentClient
=
imClientService
.
getCurentClient
();
ImClient
curentClient
=
imClientService
.
getCur
r
entClient
();
ImMessage
lastestMsg
=
imMessageService
.
getById
(
lastestMsgId
);
...
...
@@ -139,7 +139,7 @@ public class ThousandChatService extends BaseServiceImpl<ImMsgReadLastestMapper,
return
new
ArrayList
<>();
}
ImClient
curentClient
=
imClientService
.
getCurentClient
();
ImClient
curentClient
=
imClientService
.
getCur
r
entClient
();
List
<
ConversationLastestReadMsg
>
lastestReadMsgs
=
imMsgReadLastestMapper
.
findLastestReadMsgs
(
curentClient
.
getId
());
Map
<
Long
,
ConversationLastestReadMsg
>
conversationMsgMap
=
lastestReadMsgs
.
stream
().
collect
(
Collectors
.
toMap
(
ConversationLastestReadMsg:
:
getConversationId
,
v
->
v
,(
a
,
b
)->
a
));
...
...
core/src/main/java/com/wecloud/im/user/controller/FriendController.java
View file @
0363ebf8
package
com
.
wecloud
.
im
.
user
.
controller
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.friend.param.ImFriendApplyDto
;
import
com.wecloud.im.friend.param.ImFriendBaseParam
;
import
com.wecloud.im.friend.service.ImFriendService
;
import
com.wecloud.im.service.ImClientService
;
import
com.wecloud.im.user.param.FriendDto
;
import
com.wecloud.im.user.service.FriendService
;
...
...
core/src/main/java/com/wecloud/im/user/service/FriendService.java
View file @
0363ebf8
...
...
@@ -44,7 +44,7 @@ public class FriendService extends BaseServiceImpl<UserMapper, User> {
public
FriendDto
getFriendInfo
(
ImFriendBaseParam
param
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
throw
new
BusinessException
(
"当前登录用户未找到"
);
}
...
...
@@ -74,7 +74,7 @@ public class FriendService extends BaseServiceImpl<UserMapper, User> {
* 全量获取好友列表
*/
public
List
<
FriendDto
>
getFriends
()
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
throw
new
BusinessException
(
"当前登录用户未找到"
);
}
...
...
@@ -116,7 +116,7 @@ public class FriendService extends BaseServiceImpl<UserMapper, User> {
* 获取好友列表申请
*/
public
List
<
FriendDto
>
getApplyFriends
()
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
if
(
currentClient
==
null
)
{
throw
new
BusinessException
(
"当前登录用户未找到"
);
}
...
...
core/src/main/java/com/wecloud/im/user/service/UserService.java
View file @
0363ebf8
...
...
@@ -194,7 +194,7 @@ public class UserService extends BaseServiceImpl<UserMapper, User> {
* 查找本人信息
*/
public
UserBaseDto
myInfo
()
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
User
user
=
this
.
getOne
(
new
QueryWrapper
<
User
>().
lambda
()
.
eq
(
User:
:
getId
,
currentClient
.
getClientId
()));
if
(
user
==
null
)
{
...
...
@@ -224,7 +224,7 @@ public class UserService extends BaseServiceImpl<UserMapper, User> {
userBaseDto
.
setRelation
(
RelationEnum
.
STRANGER
.
getCode
());
// 查询该好友与自己关系: 陌生人、好友、被拉黑名单
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
ImFriend
imFriend
=
imFriendService
.
getByKey
(
currentClient
.
getClientId
(),
user
.
getId
().
toString
());
if
(
imFriend
!=
null
&&
FriendStateEnum
.
CONFORM
.
getCode
().
equals
(
imFriend
.
getState
()))
{
userBaseDto
.
setRelation
(
RelationEnum
.
FRIEND
.
getCode
());
...
...
@@ -252,7 +252,7 @@ public class UserService extends BaseServiceImpl<UserMapper, User> {
userBaseDto
.
setUserId
(
user
.
getId
().
toString
());
userBaseDto
.
setRelation
(
RelationEnum
.
STRANGER
.
getCode
());
// 查询该好友与自己关系: 陌生人、好友、被拉黑名单
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
ImFriend
imFriend
=
imFriendService
.
getByKey
(
currentClient
.
getClientId
(),
user
.
getId
().
toString
());
if
(
imFriend
!=
null
&&
FriendStateEnum
.
CONFORM
.
getCode
().
equals
(
imFriend
.
getState
()))
{
userBaseDto
.
setRelation
(
RelationEnum
.
FRIEND
.
getCode
());
...
...
core/src/main/java/com/wecloud/rtc/service/impl/RtcServiceImpl.java
View file @
0363ebf8
...
...
@@ -78,7 +78,7 @@ public class RtcServiceImpl extends UserStateListener implements RtcService {
@Override
public
ApiResult
<
CreateRtcChannelResult
>
createAndCall
(
CreateRtcChannelParam
createRtcChannelParam
)
throws
JsonProcessingException
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
Long
rtcChannelId
=
SnowflakeUtil
.
getId
();
// 判断发起方必须在线
boolean
onlineStatus
=
userStateCacheManager
.
isOnline
(
currentClient
.
getId
());
...
...
@@ -116,7 +116,7 @@ public class RtcServiceImpl extends UserStateListener implements RtcService {
@Override
public
ApiResult
<
Boolean
>
join
(
JoinRtcChannelParam
joinRtcChannelParam
)
{
ImClient
client
=
imClientService
.
getCurentClient
();
ImClient
client
=
imClientService
.
getCur
r
entClient
();
// 修改缓存
mangerRtcCacheService
.
join
(
client
.
getId
(),
joinRtcChannelParam
.
getChannelId
());
...
...
@@ -142,7 +142,7 @@ public class RtcServiceImpl extends UserStateListener implements RtcService {
@Override
public
ApiResult
<
Boolean
>
reject
(
RejectRtcChannelParam
rejectRtcChannelParam
)
{
ImClient
client
=
imClientService
.
getCurentClient
();
ImClient
client
=
imClientService
.
getCur
r
entClient
();
// 修改缓存
mangerRtcCacheService
.
leave
(
client
.
getId
(),
rejectRtcChannelParam
.
getChannelId
());
//获取频道内所有client
...
...
@@ -172,7 +172,7 @@ public class RtcServiceImpl extends UserStateListener implements RtcService {
@Override
public
ApiResult
<
Boolean
>
leave
(
LeaveRtcChannelParam
leaveRtcChannelParam
)
{
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCur
r
entClient
();
this
.
leave
(
leaveRtcChannelParam
,
currentClient
);
return
ApiResult
.
ok
(
true
);
...
...
@@ -209,7 +209,7 @@ public class RtcServiceImpl extends UserStateListener implements RtcService {
@Override
public
ApiResult
<
Boolean
>
sdpForward
(
SdpForwardParam
sdpForwardParam
)
{
ImClient
client
=
imClientService
.
getCurentClient
();
ImClient
client
=
imClientService
.
getCur
r
entClient
();
Long
rtcChannelId
=
SnowflakeUtil
.
getId
();
// 根据appKey查询appid
...
...
@@ -250,7 +250,7 @@ public class RtcServiceImpl extends UserStateListener implements RtcService {
@Override
public
ApiResult
<
Boolean
>
candidateForward
(
CandidateForwardParam
candidateForwardParam
)
{
ImClient
client
=
imClientService
.
getCurentClient
();
ImClient
client
=
imClientService
.
getCur
r
entClient
();
Long
rtcChannelId
=
SnowflakeUtil
.
getId
();
// 根据appKey查询appid
...
...
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