|
|
@@ -18,11 +18,11 @@ public class CouponService {
|
|
|
private CouponRepo couponRepo;
|
|
|
private MerchantService merchantService;
|
|
|
|
|
|
- public List<Coupon> my(Long userId,Boolean isAll) {
|
|
|
+ public List<Coupon> my(Long userId, Boolean isAll) {
|
|
|
Long merchantId = merchantService.findMerchantId(userId);
|
|
|
List<Coupon> coupons = couponRepo.findAllByMerchantIdAndEnabledTrue(merchantId);
|
|
|
if (isAll) {
|
|
|
- return coupons;
|
|
|
+ return coupons.stream().filter(c -> !c.getStartDate().isBefore(LocalDate.now())).collect(Collectors.toList());
|
|
|
}
|
|
|
return coupons.stream().filter(c -> !c.getEndDate().isBefore(LocalDate.now())).collect(Collectors.toList());
|
|
|
}
|