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
c26037bc
Commit
c26037bc
authored
Sep 28, 2021
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计未读消息数量
parent
831d6451
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
1 deletions
+42
-1
common/src/main/java/com/wecloud/im/mapper/ImInboxMapper.java
+8
-0
common/src/main/java/com/wecloud/im/service/ImInboxService.java
+8
-0
common/src/main/java/com/wecloud/im/service/impl/ImInboxServiceImpl.java
+13
-0
common/src/main/java/com/wecloud/im/ws/sender/PushTask.java
+7
-1
common/src/main/resources/mapper/ImInboxMapper.xml
+6
-0
No files found.
common/src/main/java/com/wecloud/im/mapper/ImInboxMapper.java
View file @
c26037bc
...
@@ -42,4 +42,12 @@ public interface ImInboxMapper extends BaseMapper<ImInbox> {
...
@@ -42,4 +42,12 @@ public interface ImInboxMapper extends BaseMapper<ImInbox> {
Long
updateImMsgReceivedByIds
(
@Param
(
"clientId"
)
Long
clientId
,
@Param
(
"msgIds"
)
List
<
Long
>
msgIds
);
Long
updateImMsgReceivedByIds
(
@Param
(
"clientId"
)
Long
clientId
,
@Param
(
"msgIds"
)
List
<
Long
>
msgIds
);
Long
updateImMsgReadByIds
(
@Param
(
"clientId"
)
Long
clientId
,
@Param
(
"msgIds"
)
List
<
Long
>
msgIds
);
Long
updateImMsgReadByIds
(
@Param
(
"clientId"
)
Long
clientId
,
@Param
(
"msgIds"
)
List
<
Long
>
msgIds
);
/**
* 统计未读消息数量
*
* @param clientId
* @return
*/
Integer
countMyNotReadCount
(
@Param
(
"clientId"
)
Long
clientId
);
}
}
common/src/main/java/com/wecloud/im/service/ImInboxService.java
View file @
c26037bc
...
@@ -70,6 +70,14 @@ public interface ImInboxService extends BaseService<ImInbox> {
...
@@ -70,6 +70,14 @@ public interface ImInboxService extends BaseService<ImInbox> {
ApiResult
<
Boolean
>
updateImMsgReceived
(
ImMsgReceivedStatusUpdate
imMsgReceivedUpdate
);
ApiResult
<
Boolean
>
updateImMsgReceived
(
ImMsgReceivedStatusUpdate
imMsgReceivedUpdate
);
/**
/**
* 统计未读消息数量
*
* @param clientId
* @return
*/
Integer
countMyNotReadCount
(
Long
clientId
);
/**
* 消息修改为已读状态
* 消息修改为已读状态
*
*
* @return
* @return
...
...
common/src/main/java/com/wecloud/im/service/impl/ImInboxServiceImpl.java
View file @
c26037bc
...
@@ -116,6 +116,19 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
...
@@ -116,6 +116,19 @@ public class ImInboxServiceImpl extends BaseServiceImpl<ImInboxMapper, ImInbox>
return
ApiResult
.
ok
();
return
ApiResult
.
ok
();
}
}
/**
* 统计未读消息数量
*
* @param clientId
* @return
*/
@Override
public
Integer
countMyNotReadCount
(
Long
clientId
)
{
return
null
;
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ApiResult
<
Boolean
>
updateImMsgRead
(
ImMsgReadStatusUpdate
imMsgReadStatusUpdate
)
{
public
ApiResult
<
Boolean
>
updateImMsgRead
(
ImMsgReadStatusUpdate
imMsgReadStatusUpdate
)
{
...
...
common/src/main/java/com/wecloud/im/ws/sender/PushTask.java
View file @
c26037bc
...
@@ -7,6 +7,7 @@ import com.wecloud.im.entity.ImApplication;
...
@@ -7,6 +7,7 @@ import com.wecloud.im.entity.ImApplication;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImIosApns
;
import
com.wecloud.im.entity.ImIosApns
;
import
com.wecloud.im.push.PushUtils
;
import
com.wecloud.im.push.PushUtils
;
import
com.wecloud.im.service.ImInboxService
;
import
com.wecloud.im.service.ImIosApnsService
;
import
com.wecloud.im.service.ImIosApnsService
;
import
com.wecloud.im.ws.model.request.PushModel
;
import
com.wecloud.im.ws.model.request.PushModel
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -35,6 +36,10 @@ public class PushTask {
...
@@ -35,6 +36,10 @@ public class PushTask {
@Autowired
@Autowired
private
ImIosApnsService
imIosApnsService
;
private
ImIosApnsService
imIosApnsService
;
@Autowired
private
ImInboxService
imInboxService
;
/**
/**
* 谷歌推送地址
* 谷歌推送地址
*/
*/
...
@@ -207,7 +212,8 @@ public class PushTask {
...
@@ -207,7 +212,8 @@ public class PushTask {
String
deviceToken
=
imClientReceiver
.
getDeviceToken
();
String
deviceToken
=
imClientReceiver
.
getDeviceToken
();
String
alertTitle
=
pushModel
.
getTitle
();
String
alertTitle
=
pushModel
.
getTitle
();
String
alertBody
=
pushModel
.
getSubTitle
();
String
alertBody
=
pushModel
.
getSubTitle
();
int
badge
=
1
;
// 统计未读消息数量
int
badge
=
imInboxService
.
countMyNotReadCount
(
imClientReceiver
.
getId
());
String
topicBundleId
=
apns
.
getBundleId
();
String
topicBundleId
=
apns
.
getBundleId
();
String
certificatePassword
=
apns
.
getPwd
();
String
certificatePassword
=
apns
.
getPwd
();
boolean
contentAvailable
=
false
;
boolean
contentAvailable
=
false
;
...
...
common/src/main/resources/mapper/ImInboxMapper.xml
View file @
c26037bc
...
@@ -46,5 +46,11 @@
...
@@ -46,5 +46,11 @@
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from im_Inbox
from im_Inbox
</select>
</select>
<select
id=
"countMyNotReadCount"
resultType=
"java.lang.Integer"
>
SELECT COUNT(id)
FROM im_inbox
WHERE receiver = #{clientId}
AND read_msg_status = 0
</select>
</mapper>
</mapper>
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