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
4204b3c8
Commit
4204b3c8
authored
Aug 16, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息通知 fix
parent
a095d0f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
22 deletions
+16
-22
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+1
-8
HomePageManager.java
...ain/java/com/tanpu/community/manager/HomePageManager.java
+15
-14
No files found.
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
4204b3c8
...
@@ -92,7 +92,7 @@ public class CommentManager {
...
@@ -92,7 +92,7 @@ public class CommentManager {
// 消息通知
// 消息通知
ThemeEntity
themeEntity
=
themeService
.
queryByThemeId
(
req
.
getThemeId
());
ThemeEntity
themeEntity
=
themeService
.
queryByThemeId
(
req
.
getThemeId
());
notificationService
.
insert
(
userId
,
themeEntity
.
getAuthorId
(),
NotificationTypeEnum
.
COMMENT
,
req
.
getThemeId
(),
req
.
getComment
());
notificationService
.
insert
(
userId
,
themeEntity
.
getAuthorId
(),
NotificationTypeEnum
.
COMMENT
,
req
.
getThemeId
(),
req
.
getComment
());
messageNotify
(
themeEntity
.
getAuthorId
(),
userId
,
NotificationTypeEnum
.
COMMENT
);
notificationService
.
putNotifyCache
(
themeEntity
.
getAuthorId
(),
userId
,
NotificationTypeEnum
.
COMMENT
);
return
commentQo
;
return
commentQo
;
}
}
...
@@ -173,11 +173,4 @@ public class CommentManager {
...
@@ -173,11 +173,4 @@ public class CommentManager {
commentService
.
delete
(
commentId
,
userId
);
commentService
.
delete
(
commentId
,
userId
);
}
}
// 消息通知队列缓存
private
void
messageNotify
(
String
notifyUserId
,
String
operatorId
,
NotificationTypeEnum
type
){
UserInfoResp
userInfo
=
getUserInfo
(
operatorId
);
redisCache
.
incr
(
RedisKeyConstant
.
MESSAGE_NOTIFY_COUNT
+
notifyUserId
);
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_MSG
+
notifyUserId
,
userInfo
.
getNickName
()+
type
.
getType
()+
"了你的内容"
,
60
*
60
*
24
*
30
);
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
,
TimeUtils
.
format
(
LocalDateTime
.
now
()),
60
*
60
*
24
*
30
);
}
}
}
community-service/src/main/java/com/tanpu/community/manager/HomePageManager.java
View file @
4204b3c8
...
@@ -17,8 +17,12 @@ import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNewChief;
...
@@ -17,8 +17,12 @@ import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNewChief;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoOrg
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoOrg
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO
;
import
com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO
;
import
com.tanpu.community.api.constants.RedisKeyConstant
;
import
com.tanpu.community.api.enums.FundCompanyTypeEnum
;
import
com.tanpu.community.api.enums.*
;
import
com.tanpu.community.api.enums.NotificationTypeEnum
;
import
com.tanpu.community.api.enums.OperationTypeEnum
;
import
com.tanpu.community.api.enums.PersonalCenterTypeEnum
;
import
com.tanpu.community.api.enums.QueryFollowTypeEnum
;
import
com.tanpu.community.api.enums.ShowFollowStatusEnum
;
import
com.tanpu.community.cache.RedisCache
;
import
com.tanpu.community.cache.RedisCache
;
import
com.tanpu.community.dao.entity.community.FollowRelEntity
;
import
com.tanpu.community.dao.entity.community.FollowRelEntity
;
import
com.tanpu.community.dao.mapper.community.FollowRelMapper
;
import
com.tanpu.community.dao.mapper.community.FollowRelMapper
;
...
@@ -31,7 +35,6 @@ import com.tanpu.community.service.FollowRelService;
...
@@ -31,7 +35,6 @@ import com.tanpu.community.service.FollowRelService;
import
com.tanpu.community.service.NotificationService
;
import
com.tanpu.community.service.NotificationService
;
import
com.tanpu.community.util.ConvertUtil
;
import
com.tanpu.community.util.ConvertUtil
;
import
com.tanpu.community.util.PageUtils
;
import
com.tanpu.community.util.PageUtils
;
import
com.tanpu.community.util.TimeUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -39,8 +42,14 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -39,8 +42,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -238,21 +247,13 @@ public class HomePageManager {
...
@@ -238,21 +247,13 @@ public class HomePageManager {
// 第一次关注才有消息通知
// 第一次关注才有消息通知
if
(
followRelService
.
addFollowRel
(
req
.
getFollowUserId
(),
followerId
))
{
if
(
followRelService
.
addFollowRel
(
req
.
getFollowUserId
(),
followerId
))
{
notificationService
.
insert
(
followerId
,
req
.
getFollowUserId
(),
NotificationTypeEnum
.
FOLLOW
,
req
.
getFollowUserId
(),
null
);
notificationService
.
insert
(
followerId
,
req
.
getFollowUserId
(),
NotificationTypeEnum
.
FOLLOW
,
req
.
getFollowUserId
(),
null
);
messageFollowNotify
(
req
.
getFollowUserId
(),
followerId
);
notificationService
.
putNotifyCacheFollow
(
req
.
getFollowUserId
(),
followerId
);
}
}
}
else
if
(
OperationTypeEnum
.
CANCEL
.
getCode
().
equals
(
req
.
getType
()))
{
}
else
if
(
OperationTypeEnum
.
CANCEL
.
getCode
().
equals
(
req
.
getType
()))
{
followRelService
.
deleteFollowRel
(
req
.
getFollowUserId
(),
followerId
);
followRelService
.
deleteFollowRel
(
req
.
getFollowUserId
(),
followerId
);
}
}
}
}
// 消息通知队列缓存-关注
private
void
messageFollowNotify
(
String
notifyUserId
,
String
operatorId
)
{
UserInfoResp
userInfo
=
getUserInfo
(
operatorId
);
redisCache
.
incr
(
RedisKeyConstant
.
MESSAGE_NOTIFY_COUNT
+
notifyUserId
);
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_MSG
+
notifyUserId
,
userInfo
.
getNickName
()
+
"关注了你"
,
60
*
60
*
24
*
30
);
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
,
TimeUtils
.
format
(
LocalDateTime
.
now
()),
60
*
60
*
24
*
30
);
}
private
UserInfoResp
getUserInfo
(
String
authorId
)
{
private
UserInfoResp
getUserInfo
(
String
authorId
)
{
CommonResp
<
UserInfoResp
>
userInfoNewCommonResp
=
feignClientForFatools
.
queryUserInfoNew
(
authorId
);
CommonResp
<
UserInfoResp
>
userInfoNewCommonResp
=
feignClientForFatools
.
queryUserInfoNew
(
authorId
);
if
(
userInfoNewCommonResp
.
isNotSuccess
())
{
if
(
userInfoNewCommonResp
.
isNotSuccess
())
{
...
...
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