Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
usedCarAuction
/
aus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0d0fec04
authored
May 08, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:优惠券红点接口与获取弹窗通知保持一致
1 parent
2dcc8f46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
6 deletions
aus-core/src/main/java/com/glsx/usedcar/module/coupon/service/CouponAccountService.java
aus-core/src/main/java/com/glsx/usedcar/module/coupon/service/CouponAccountService.java
View file @
0d0fec0
...
...
@@ -288,7 +288,7 @@ public class CouponAccountService {
/**
* 检查用户是否有待通知的弹窗(红点状态)
* <p>
* 查询用户
是否有状态为待通知(0)且未过期的弹窗通知
* 查询用户
状态为待通知(0)且未过期的弹窗通知,并校验关联优惠券是否过期
*
* @param accountId 用户 ID
* @return 红点状态响应
...
...
@@ -296,13 +296,39 @@ public class CouponAccountService {
public
CouponRedDotRespVO
checkRedDotStatus
(
Integer
accountId
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
//
统计待通知且未过期的弹窗通知数量
L
ong
pendingCount
=
popupNotificationRepository
.
count
PendingNotifications
(
//
查询待通知且未过期的弹窗通知
L
ist
<
CouponPopupNotification
>
pendingNotifications
=
popupNotificationRepository
.
find
PendingNotifications
(
accountId
,
0
,
DeleteFlag
.
NOT_DELETED
.
getCode
(),
now
);
CouponRedDotRespVO
respVO
=
new
CouponRedDotRespVO
();
respVO
.
setHasRedDot
(
pendingCount
!=
null
&&
pendingCount
>
0
);
respVO
.
setPendingCount
(
pendingCount
!=
null
?
pendingCount
:
0L
);
if
(
pendingNotifications
.
isEmpty
())
{
respVO
.
setHasRedDot
(
false
);
respVO
.
setPendingCount
(
0L
);
return
respVO
;
}
// 提取所有优惠券 ID
List
<
String
>
couponIdList
=
new
ArrayList
<>();
for
(
CouponPopupNotification
notification
:
pendingNotifications
)
{
JSONArray
objects
=
JSON
.
parseArray
(
notification
.
getCouponIds
());
couponIdList
.
addAll
(
objects
.
toJavaList
(
String
.
class
));
}
if
(
couponIdList
.
isEmpty
())
{
respVO
.
setHasRedDot
(
false
);
respVO
.
setPendingCount
(
0L
);
return
respVO
;
}
// 查询优惠券并过滤掉已过期的
List
<
CouponAccount
>
validCoupons
=
couponAccountRepository
.
findByCouponIdInAndDeleteFlag
(
couponIdList
,
DeleteFlag
.
NOT_DELETED
.
getCode
())
.
stream
()
.
filter
(
c
->
c
.
getValidEndTime
()
!=
null
&&
c
.
getValidEndTime
().
isAfter
(
now
))
.
toList
();
long
pendingCount
=
validCoupons
.
size
();
respVO
.
setHasRedDot
(
pendingCount
>
0
);
respVO
.
setPendingCount
(
pendingCount
);
return
respVO
;
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment