Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
51b6c63c
Commit
51b6c63c
authored
Aug 30, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点赞评论消息通知
parent
250e1051
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
NotifyQueryReq.java
.../community/api/beans/req/notification/NotifyQueryReq.java
+1
-2
NotificationService.java
...java/com/tanpu/community/service/NotificationService.java
+7
-3
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/req/notification/NotifyQueryReq.java
View file @
51b6c63c
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
notification
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
...
...
@@ -14,7 +13,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public
class
NotifyQueryReq
{
@ApiModelProperty
(
value
=
"1:转发 2:点赞 3:评论 4:关注 0:全部"
)
@ApiModelProperty
(
value
=
"1:转发 2:点赞
(主题点赞+评论点赞)
3:评论 4:关注 0:全部"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"最后一条通知"
)
...
...
community-service/src/main/java/com/tanpu/community/service/NotificationService.java
View file @
51b6c63c
...
...
@@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.util.Arrays
;
import
java.util.List
;
@Service
...
...
@@ -164,8 +165,12 @@ public class NotificationService {
.
eq
(
NotificationEntity:
:
getNotificationId
,
lastId
));
queryWrapper
.
lt
(
NotificationEntity:
:
getUpdateTime
,
lastOne
.
getCreateTime
());
}
if
(!
NotificationTypeEnum
.
ALL
.
getCode
().
equals
(
type
))
{
if
(!
NotificationTypeEnum
.
ALL
.
getCode
().
equals
(
type
)
&&
!
NotificationTypeEnum
.
LIKE
.
getCode
().
equals
(
type
)
)
{
queryWrapper
.
eq
(
NotificationEntity:
:
getMessageType
,
type
);
}
else
if
(
NotificationTypeEnum
.
LIKE
.
getCode
().
equals
(
type
))
{
// 类型2点赞返回评论点赞和主题点赞
queryWrapper
.
in
(
NotificationEntity:
:
getMessageType
,
Arrays
.
asList
(
NotificationTypeEnum
.
LIKE
.
getCode
(),
NotificationTypeEnum
.
COMMENT_LIKE
.
getCode
()));
}
return
notificationMapper
.
selectList
(
queryWrapper
);
}
...
...
@@ -213,7 +218,7 @@ public class NotificationService {
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
,
TimeUtils
.
format
(
LocalDateTime
.
now
()),
60
*
60
*
24
*
30
);
if
(
NotificationTypeEnum
.
COMMENT_LIKE
.
equals
(
type
))
{
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_MSG
+
notifyUserId
,
userInfo
.
getNickName
()
+
"点赞了你的评论"
,
60
*
60
*
24
*
30
);
}
else
if
(
NotificationTypeEnum
.
FOLLOW
.
equals
(
type
))
{
}
else
if
(
NotificationTypeEnum
.
FOLLOW
.
equals
(
type
))
{
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_MSG
+
notifyUserId
,
userInfo
.
getNickName
()
+
"关注了你"
,
60
*
60
*
24
*
30
);
}
else
{
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_MSG
+
notifyUserId
,
userInfo
.
getNickName
()
+
type
.
getType
()
+
"了你的内容"
,
60
*
60
*
24
*
30
);
...
...
@@ -221,7 +226,6 @@ public class NotificationService {
}
// 删除评论及缓存
public
void
deleteCommentNotify
(
String
notifyUserId
,
String
operatorId
,
String
commentId
,
LocalDateTime
commentTime
)
{
// 物理删除
...
...
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