Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SiEn
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
SiEn
Commits
bd5a21ea
Commit
bd5a21ea
authored
Nov 05, 2020
by
zhangjw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1:新增USER_DEVICE_PUSH_TOKEN 保存用户对应的Push信息 减少每次发送查询token
parent
bedaafbd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
+10
-8
customer-service/src/main/java/com/ym/im/entity/UserSocketInfo.java
+0
-2
customer-service/src/main/java/com/ym/im/handler/ChannelGroupHandler.java
+6
-0
customer-service/src/main/java/com/ym/im/service/impl/StaffSingleChatServiceImpl.java
+3
-5
customer-service/src/main/java/com/ym/im/service/impl/UserSingleChatServiceImpl.java
+1
-1
No files found.
customer-service/src/main/java/com/ym/im/entity/UserSocketInfo.java
View file @
bd5a21ea
...
...
@@ -24,8 +24,6 @@ public class UserSocketInfo extends BaseSocketInfo {
private
Set
<
Long
>
sessionList
;
private
DeviceTokenParam
deviceTokenParam
;
private
Map
<
Long
,
Long
>
staffIds
=
new
HashMap
<>();
public
Long
getStaffId
(
Long
merchantId
)
{
...
...
customer-service/src/main/java/com/ym/im/handler/ChannelGroupHandler.java
View file @
bd5a21ea
package
com
.
ym
.
im
.
handler
;
import
com.ym.im.entity.DeviceTokenParam
;
import
com.ym.im.entity.StaffSocketInfo
;
import
com.ym.im.entity.UserSocketInfo
;
import
org.springframework.stereotype.Component
;
...
...
@@ -25,6 +26,11 @@ public class ChannelGroupHandler {
*/
public
final
Map
<
Long
,
Map
<
Long
,
StaffSocketInfo
>>
STAFF_GROUP
=
new
ConcurrentHashMap
<>();
/**
* 用户推送tokenGroup
*/
public
final
Map
<
Long
,
DeviceTokenParam
>
USER_DEVICE_PUSH_TOKEN
=
new
ConcurrentHashMap
<>();
/**
* 新增商户 客服
...
...
customer-service/src/main/java/com/ym/im/service/impl/StaffSingleChatServiceImpl.java
View file @
bd5a21ea
...
...
@@ -181,11 +181,9 @@ public class StaffSingleChatServiceImpl implements ChatService {
*/
@SneakyThrows
private
void
pushNotifications
(
Long
userId
)
{
final
UserSocketInfo
userSocketInfo
=
channelGroup
.
USER_GROUP
.
get
(
userId
);
if
(
userSocketInfo
!=
null
)
{
final
DeviceTokenParam
deviceTokenParam
=
userSocketInfo
.
getDeviceTokenParam
();
pushFactory
.
getService
(
deviceTokenParam
.
getDeviceType
()).
unicast
(
deviceTokenParam
.
getDeviceToken
());
}
final
DeviceTokenParam
deviceTokenParam
=
channelGroup
.
USER_DEVICE_PUSH_TOKEN
.
get
(
userId
);
pushFactory
.
getService
(
deviceTokenParam
.
getDeviceType
()).
unicast
(
deviceTokenParam
.
getDeviceToken
());
}
...
...
customer-service/src/main/java/com/ym/im/service/impl/UserSingleChatServiceImpl.java
View file @
bd5a21ea
...
...
@@ -76,8 +76,8 @@ public class UserSingleChatServiceImpl implements ChatService {
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
headers
.
put
(
"token"
,
token
);
final
AppUser
appUser
=
JsonUtils
.
json2Obj
(
HttpClientUtils
.
doGet
(
USER_INFO_URL
,
null
,
headers
),
AppUser
.
class
);
//获取deviceToken
userSocketInfo
.
setDeviceTokenParam
(
new
DeviceTokenParam
().
setDeviceToken
(
appUser
.
getDeviceToken
()).
setDeviceType
(
appUser
.
getDeviceType
()));
channelGroup
.
USER_GROUP
.
put
(
userId
,
userSocketInfo
);
channelGroup
.
USER_DEVICE_PUSH_TOKEN
.
put
(
userId
,
new
DeviceTokenParam
().
setDeviceToken
(
appUser
.
getDeviceToken
()).
setDeviceType
(
appUser
.
getDeviceType
()));
this
.
restoreBindingRelationship
(
userId
);
//恢复历史绑定关系
this
.
broadcastUserOnline
(
userId
);
//通知客服 用户上线
log
.
info
(
"用户: "
+
userId
+
" 上线"
);
...
...
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