Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✏️ 가게사장의 쿠폰확인 시 발급수량도 함께 전달 #64

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,19 @@ public void downloadAllCoupons(@PathVariable Long storeId,
@GetMapping("/{storeId}/coupons/product")
public CommonResponse<CouponsForUserResponse> storeCouponsForUser(@PathVariable Long storeId,
@RequestHeader(value = "userId", required = false) Long userId) {
LocalDate now = LocalDate.now();
return CommonResponse.success(couponFacade.getAllStoreCouponsForUser(userId, storeId, now));
return CommonResponse.success(couponFacade.getAllStoreCouponsForUser(userId, storeId));
}

@PostMapping("/{storeId}/coupons/payment")
public CommonResponse<CouponsForUserResponse> couponsInPaymentStep(@PathVariable Long storeId,
@RequestHeader(value = "userId") Long userId,
@RequestBody TotalAmountRequest totalAmountRequest) {
LocalDate now = LocalDate.now();
return CommonResponse.success(couponFacade.getAvailableCouponsInPayment(totalAmountRequest, userId, storeId, now));
return CommonResponse.success(couponFacade.getAvailableCouponsInPayment(totalAmountRequest, userId, storeId));
}

@GetMapping("/coupons/my")
public CommonResponse<CouponsForUserResponse> myCoupons(@RequestHeader(value = "userId") Long userId) {
LocalDate now = LocalDate.now();
return CommonResponse.success(couponFacade.getMyValidCoupons(userId, now));
return CommonResponse.success(couponFacade.getMyValidCoupons(userId));
}

@GetMapping("/coupons/{couponId}/members")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ public class CouponForOwnerDto {
private String couponName;
private Long minPrice;
private Long discountPrice;
private Integer limitCount;
private Integer unusedCount;
private LocalDate startDate;
private LocalDate endDate;

@QueryProjection
public CouponForOwnerDto(Long key, String couponCode, String couponName, Long minPrice, Long discountPrice, Integer unusedCount, LocalDate startDate, LocalDate endDate) {
public CouponForOwnerDto(Long key, String couponCode, String couponName, Long minPrice, Long discountPrice, Integer limitCount, Integer unusedCount, LocalDate startDate, LocalDate endDate) {
this.key = key;
this.couponCode = couponCode;
this.couponName = couponName;
this.minPrice = minPrice;
this.discountPrice = discountPrice;
this.limitCount = limitCount;
this.unusedCount = unusedCount;
this.startDate = startDate;
this.endDate = endDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,19 @@ public void downloadAllCoupons(Long userId, Long storeId, String nickname, Strin
couponService.downloadAllCoupons(userId, storeId, nickname, phoneNumber, now);
}

public CouponsForUserResponse getAllStoreCouponsForUser(Long userId, Long storeId, LocalDate now) {
public CouponsForUserResponse getAllStoreCouponsForUser(Long userId, Long storeId) {
LocalDate now = LocalDate.now();
return CouponsForUserResponse.from(couponService.getAllStoreCouponsForUser(userId, storeId, now));
}

public CouponsForUserResponse getAvailableCouponsInPayment(TotalAmountRequest totalAmountRequest,
Long userId, Long storeId, LocalDate now) {
Long userId, Long storeId) {
LocalDate now = LocalDate.now();
return CouponsForUserResponse.from(couponService.getAvailableCouponsInPayment(totalAmountRequest, userId, storeId, now));
}

public CouponsForUserResponse getMyValidCoupons(Long userId, LocalDate now) {
public CouponsForUserResponse getMyValidCoupons(Long userId) {
LocalDate now = LocalDate.now();
return CouponsForUserResponse.from(couponService.getMyValidCoupons(userId, now));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ public interface CouponRepositoryCustom {
List<CouponWithIssueStatusDto> findStoreCouponsForUser(Long userId, Long storeId, LocalDate now);
List<CouponWithAvailabilityDto> findAvailableCoupons(Long totalAmount, Long userId, Long storeId, LocalDate now);
List<CouponDto> findMyValidCoupons(Long userId, LocalDate now);

Integer findMyValidCouponCount(Long userId, LocalDate now);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public List<CouponForOwnerDto> findAllDtoByStoreId(Long storeId, LocalDate now)
coupon.couponName,
coupon.minPrice,
coupon.discountPrice,
coupon.limitCount,
coupon.limitCount.subtract(
JPAExpressions
.select(issuedCoupon.count())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ public List<LikedStoreInfoResponse> simpleInfos(List<Long> storeIds){
return storeService.simpleInfos(storeIds).stream()
.map(kr.bb.store.domain.store.controller.response.LikedStoreInfoResponse::toCommonDto)
.collect(Collectors.toList());

}

public List<SettlementStoreInfoResponse> storeInfoForSettlement(List<Long> storeIds) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kr/bb/store/util/RedisCacheInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public class RedisCacheInitializer implements ApplicationRunner {
@CacheEvict(value = {"store-list-with-paging"}, allEntries = true)
@Override
public void run(ApplicationArguments args) throws Exception {
log.info("Some Cache Initialized");
log.info("store-list Cache Initialized");
}
}
Loading