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
8efa7d41
Commit
8efa7d41
authored
Aug 13, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
圈子消息通知-fix
parent
67529872
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
NotificationController.java
...om/tanpu/community/controller/NotificationController.java
+3
-2
NotificationService.java
...java/com/tanpu/community/service/NotificationService.java
+8
-4
No files found.
community-service/src/main/java/com/tanpu/community/controller/NotificationController.java
View file @
8efa7d41
...
...
@@ -10,6 +10,7 @@ import com.tanpu.community.manager.NotificationManager;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -21,7 +22,7 @@ import java.util.List;
*/
@Slf4j
@RestController
@RequestMapping
(
"/notification"
)
@RequestMapping
(
"/
api/
notification"
)
public
class
NotificationController
{
@Autowired
...
...
@@ -32,7 +33,7 @@ public class NotificationController {
@AuthLogin
@PostMapping
(
"/query"
)
@ResponseBody
public
CommonResp
<
List
<
ThemeNotifyQo
>>
query
(
NotifyQueryReq
req
){
public
CommonResp
<
List
<
ThemeNotifyQo
>>
query
(
@RequestBody
NotifyQueryReq
req
){
List
<
ThemeNotifyQo
>
query
=
notificationManager
.
queryList
(
req
,
userHolder
.
getUserId
());
return
CommonResp
.
success
(
query
);
...
...
community-service/src/main/java/com/tanpu/community/service/NotificationService.java
View file @
8efa7d41
...
...
@@ -8,6 +8,7 @@ import com.tanpu.community.dao.entity.NotificationForwardDO;
import
com.tanpu.community.dao.entity.NotificationLikeDO
;
import
com.tanpu.community.dao.entity.community.NotificationEntity
;
import
com.tanpu.community.dao.mapper.community.NotificationMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -56,6 +57,7 @@ public class NotificationService {
public
void
insertLike
(
String
operatorId
,
String
notifierId
,
String
targetId
){
NotificationEntity
entity
=
notificationMapper
.
selectOne
(
new
LambdaQueryWrapper
<
NotificationEntity
>()
.
eq
(
NotificationEntity:
:
getMessageType
,
NotificationTypeEnum
.
LIKE
.
getCode
())
.
eq
(
NotificationEntity:
:
getTargetId
,
targetId
)
.
eq
(
NotificationEntity:
:
getNotifiedUserId
,
notifierId
));
if
(
entity
!=
null
){
NotificationLikeDO
notificationLikeDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationLikeDO
.
class
);
...
...
@@ -92,14 +94,16 @@ public class NotificationService {
public
List
<
NotificationEntity
>
query
(
String
userId
,
Integer
type
,
String
lastId
,
Integer
pageSize
){
NotificationEntity
lastOne
=
notificationMapper
.
selectOne
(
new
LambdaQueryWrapper
<
NotificationEntity
>()
.
eq
(
NotificationEntity:
:
getNotificationId
,
lastId
));
LambdaQueryWrapper
<
NotificationEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
NotificationEntity
>()
.
eq
(
NotificationEntity:
:
getNotifiedUserId
,
userId
)
.
lt
(
NotificationEntity:
:
getUpdateTime
,
lastOne
.
getCreateTime
())
.
last
(
"limit "
+
pageSize
);
if
(
StringUtils
.
isNotBlank
(
lastId
)){
NotificationEntity
lastOne
=
notificationMapper
.
selectOne
(
new
LambdaQueryWrapper
<
NotificationEntity
>()
.
eq
(
NotificationEntity:
:
getNotificationId
,
lastId
));
queryWrapper
.
lt
(
NotificationEntity:
:
getUpdateTime
,
lastOne
.
getCreateTime
());
}
if
(!
NotificationTypeEnum
.
ALL
.
getCode
().
equals
(
type
)){
queryWrapper
.
eq
(
NotificationEntity:
:
getMessageType
,
type
);
}
...
...
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