Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
88b3b5b1
Commit
88b3b5b1
authored
Jan 13, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coupon expired task dev;
user coupon opt;
parent
caae8b82
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
17 deletions
+33
-17
SConsumerCouponController.java
...hare/web/controller/system/SConsumerCouponController.java
+1
-7
CouponRetryTask.java
...artz/src/main/java/share/quartz/task/CouponRetryTask.java
+14
-2
ISConsumerCouponService.java
...in/java/share/system/service/ISConsumerCouponService.java
+7
-0
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+11
-8
No files found.
share-front/src/main/java/share/web/controller/system/SConsumerCouponController.java
View file @
88b3b5b1
...
...
@@ -38,14 +38,8 @@ public class SConsumerCouponController extends BaseController {
// @PreAuthorize("@ss.hasPermi('system:coupon:list')")
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
String
useStatus
)
{
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
if
(
StringUtils
.
isNotBlank
(
useStatus
)){
sConsumerCoupon
.
setUseStatus
(
Integer
.
valueOf
(
useStatus
));
}
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
startPage
();
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
listByUseStatus
(
Integer
.
valueOf
(
useStatus
)
);
return
getDataTable
(
list
);
}
...
...
share-quartz/src/main/java/share/quartz/task/CouponRetryTask.java
View file @
88b3b5b1
...
...
@@ -19,8 +19,7 @@ import share.system.service.ISStoreService;
import
share.system.service.QPService
;
import
share.system.service.impl.QPServiceImpl
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Component
(
"couponRetryTask"
)
...
...
@@ -78,5 +77,18 @@ public class CouponRetryTask {
sConsumerCouponService
.
updateById
(
sConsumerCoupon
);
}
});
LambdaQueryWrapper
<
SConsumerCoupon
>
consumerCouponWrapper
=
new
LambdaQueryWrapper
<>();
consumerCouponWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
UserStatusEnum
.
UNUSED
.
getCode
());
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponService
.
list
(
consumerCouponWrapper
);
List
<
SConsumerCoupon
>
expiredSConsumerCounpons
=
Optional
.
ofNullable
(
sConsumerCoupons
).
orElse
(
new
ArrayList
<>()).
stream
().
filter
(
item
->
{
if
(
item
.
getEndDate
().
compareTo
(
new
Date
())
<
0
){
item
.
setUseStatus
(
UserStatusEnum
.
EXPIRED
.
getCode
());
return
true
;
}
return
false
;
}).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
expiredSConsumerCounpons
)){
sConsumerCouponService
.
updateBatchById
(
expiredSConsumerCounpons
);
}
}
}
share-system/src/main/java/share/system/service/ISConsumerCouponService.java
View file @
88b3b5b1
...
...
@@ -28,6 +28,13 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
* @return 优惠券领取记录集合
*/
public
List
<
SConsumerCoupon
>
selectSConsumerCouponList
(
SConsumerCoupon
sConsumerCoupon
);
/**
* 查询优惠券领取记录列表
*
* @param useStatus 优惠券领取记录
* @return 优惠券领取记录集合
*/
public
List
<
SConsumerCoupon
>
listByUseStatus
(
Integer
useStatus
);
/**
* 新增优惠券领取记录
...
...
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
88b3b5b1
...
...
@@ -2,9 +2,7 @@ package share.system.service.impl;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.stream.Collectors
;
...
...
@@ -73,12 +71,6 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
List
<
SConsumerCoupon
>
sConsumerCoupons
=
baseMapper
.
selectSConsumerCouponList
(
sConsumerCoupon
);
sConsumerCoupons
.
forEach
(
item
->
{
if
(
item
.
getUseStatus
().
equals
(
UserStatusEnum
.
UNUSED
.
getCode
()))
{
if
(
item
.
getEndDate
().
compareTo
(
new
Date
())
<
0
)
{
item
.
setUseStatus
(
UserStatusEnum
.
EXPIRED
.
getCode
());
baseMapper
.
updateSConsumerCoupon
(
item
);
}
}
List
<
SConsumer
>
list
=
sConsumerService
.
list
();
if
(
list
.
stream
().
filter
(
obj
->
obj
.
getId
().
equals
(
item
.
getConsumerId
())).
findFirst
().
isPresent
())
{
item
.
setPhone
(
list
.
stream
().
filter
(
obj
->
obj
.
getId
().
equals
(
item
.
getConsumerId
())).
findFirst
().
get
().
getPhone
());
...
...
@@ -91,6 +83,17 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
return
sConsumerCoupons
;
}
@Override
public
List
<
SConsumerCoupon
>
listByUseStatus
(
Integer
useStatus
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<
SConsumerCoupon
>();
queryWrapper
.
eq
(
SConsumerCoupon:
:
getConsumerId
,
user
.
getId
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
useStatus
);
queryWrapper
.
orderByDesc
(
SConsumerCoupon:
:
getCreateTime
);
List
<
SConsumerCoupon
>
sConsumerCoupons
=
baseMapper
.
selectList
(
queryWrapper
);
return
sConsumerCoupons
;
}
/**
* 新增优惠券领取记录
*
...
...
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