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
401e90e4
Commit
401e90e4
authored
Oct 28, 2021
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复撤回自定义推送字段
parent
fac10f3a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
19 deletions
+35
-19
common/src/main/java/com/wecloud/im/param/add/ImMsgRecall.java
+2
-3
common/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
+6
-9
common/src/main/java/com/wecloud/im/ws/sender/PushTask.java
+27
-7
No files found.
common/src/main/java/com/wecloud/im/param/add/ImMsgRecall.java
View file @
401e90e4
package
com
.
wecloud
.
im
.
param
.
add
;
import
com.wecloud.im.ws.model.request.PushModel
;
import
io.geekidea.springbootplus.framework.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
@@ -7,8 +8,6 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.HashMap
;
/**
* 撤回消息
*
...
...
@@ -26,6 +25,6 @@ public class ImMsgRecall extends BaseEntity {
private
Long
msgId
;
@ApiModelProperty
(
"自定义推送字段"
)
private
HashMap
pushMap
;
private
PushModel
push
;
}
common/src/main/java/com/wecloud/im/service/impl/ImMessageServiceImpl.java
View file @
401e90e4
...
...
@@ -24,6 +24,7 @@ import com.wecloud.im.service.ImMessageService;
import
com.wecloud.im.vo.ImMessageOfflineListVo
;
import
com.wecloud.im.vo.OfflineMsgDto
;
import
com.wecloud.im.ws.model.ResponseModel
;
import
com.wecloud.im.ws.model.request.PushModel
;
import
com.wecloud.im.ws.sender.PushTask
;
import
com.wecloud.im.ws.service.WriteDataService
;
import
io.geekidea.springbootplus.framework.common.api.ApiCode
;
...
...
@@ -39,11 +40,8 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
static
com
.
wecloud
.
im
.
ws
.
strategy
.
concrete
.
ImConcreteReceiveStrategy
.
PUSH_KEY
;
/**
* 消息存储表 服务实现类
*
...
...
@@ -105,11 +103,7 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
boolean
saveOk
=
this
.
updateById
(
messageById
);
if
(
saveOk
)
{
// 获取自定义推送字段
HashMap
<
String
,
String
>
pushMap
=
null
;
if
(
imMsgRecall
.
getPushMap
().
get
(
PUSH_KEY
)
!=
null
)
{
pushMap
=
(
HashMap
<
String
,
String
>)
imMsgRecall
.
getPushMap
().
get
(
PUSH_KEY
);
}
// 查询该会话所有成员
List
<
ImConversationMembers
>
membersList
=
imConversationMembersService
.
list
(
...
...
@@ -165,8 +159,11 @@ public class ImMessageServiceImpl extends BaseServiceImpl<ImMessageMapper, ImMes
responseModel
.
setReqId
(
null
);
writeDataService
.
write
(
responseModel
,
imApplication
.
getAppKey
(),
imClientReceiver
.
getClientId
());
// 获取自定义推送字段
PushModel
pushModel
=
imMsgRecall
.
getPush
();
// 异步推送系统通知消息
pushTask
.
push
(
pushM
ap
,
imClientReceiver
,
imApplication
);
pushTask
.
push
(
pushM
odel
,
imClientReceiver
,
imApplication
);
}
return
ApiResult
.
ok
();
...
...
common/src/main/java/com/wecloud/im/ws/sender/PushTask.java
View file @
401e90e4
...
...
@@ -58,23 +58,19 @@ public class PushTask {
private
static
final
String
title
=
"title"
;
private
static
final
String
subTitle
=
"subTitle"
;
/**
* 异步系统推送
*
* @param imClientReceiver
*/
@Async
public
void
push
(
HashMap
<
String
,
String
>
pushMap
,
ImClient
imClientReceiver
,
ImApplication
imApplication
)
{
public
void
push
(
PushModel
pushModel
,
ImClient
imClientReceiver
,
ImApplication
imApplication
)
{
log
.
info
(
"push:"
+
imClientReceiver
.
getClientId
());
PushModel
pushModel
=
new
PushModel
();
if
(
pushMap
==
null
||
pushMap
.
isEmpty
())
{
if
(
pushModel
!=
null
)
{
pushModel
.
setTitle
(
PUSH_TITLE
);
pushModel
.
setSubTitle
(
PUSH_BODY
);
}
else
{
pushModel
.
setTitle
(
pushMap
.
get
(
title
));
pushModel
.
setSubTitle
(
pushMap
.
get
(
subTitle
));
}
// 校验参数
...
...
@@ -97,6 +93,30 @@ public class PushTask {
}
}
/**
* 异步系统推送
*
* @param imClientReceiver
*/
@Async
public
void
push
(
HashMap
<
String
,
String
>
pushMap
,
ImClient
imClientReceiver
,
ImApplication
imApplication
)
{
log
.
info
(
"push:"
+
imClientReceiver
.
getClientId
());
PushModel
pushModel
=
new
PushModel
();
if
(
pushMap
==
null
||
pushMap
.
isEmpty
())
{
pushModel
.
setTitle
(
PUSH_TITLE
);
pushModel
.
setSubTitle
(
PUSH_BODY
);
}
else
{
pushModel
.
setTitle
(
pushMap
.
get
(
title
));
pushModel
.
setSubTitle
(
pushMap
.
get
(
subTitle
));
}
this
.
push
(
pushModel
,
imClientReceiver
,
imApplication
);
}
private
void
android
(
PushModel
pushModel
,
ImClient
imClientReceiver
,
ImApplication
imApplication
)
{
// 安卓推送通道,友盟:1;firebase:2; 信鸽3
if
(
imApplication
.
getAndroidPushChannel
()
==
1
)
{
...
...
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