道具券列表改造
This commit is contained in:
parent
cbf67d93b3
commit
61392d8810
@ -41,7 +41,7 @@ public class PropCouponRestController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的道具券列表
|
||||
* 查询我的有效道具券列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public PageResult<PropCouponCO> queryMyCoupons(@RequestBody @Validated PropCouponQueryCmd cmd) {
|
||||
|
||||
@ -42,10 +42,7 @@ public class PropCouponListQryExe {
|
||||
couponType = PropCouponType.getByCode(cmd.getCouponType());
|
||||
}
|
||||
|
||||
PropCouponStatus status = null;
|
||||
if (cmd.getStatus() != null) {
|
||||
status = PropCouponStatus.getByCode(cmd.getStatus());
|
||||
}
|
||||
PropCouponStatus status = PropCouponStatus.UNUSED;
|
||||
|
||||
// 3. 查询券列表(分页)
|
||||
List<PropCoupon> propCoupons = propCouponGateway.selectByUserId(
|
||||
@ -55,14 +52,6 @@ public class PropCouponListQryExe {
|
||||
cmd.getCurrent().intValue(),
|
||||
cmd.getSize().intValue()
|
||||
);
|
||||
|
||||
// 过期未使用的券
|
||||
propCoupons.forEach(coupon -> {
|
||||
if (coupon.getStatus() == PropCouponStatus.UNUSED && coupon.getExpireTime().isBefore(LocalDateTime.now())) {
|
||||
coupon.setStatus(PropCouponStatus.EXPIRED);
|
||||
}
|
||||
});
|
||||
|
||||
// 4. 统计总数
|
||||
Long total = propCouponGateway.countByUserId(userId, couponType, status);
|
||||
|
||||
|
||||
@ -85,6 +85,7 @@ public class PropCouponGatewayImpl implements PropCouponGateway {
|
||||
if (status != null) {
|
||||
wrapper.eq(PropCouponDO::getStatus, status.getCode());
|
||||
}
|
||||
wrapper.lt(PropCouponDO::getExpireTime, LocalDateTime.now());
|
||||
wrapper.orderByDesc(PropCouponDO::getCreateTime);
|
||||
|
||||
Page<PropCouponDO> page = new Page<>(pageNo, pageSize);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user