From 27b1341b8ed7db8341d44b335eff1ba63777bd5d Mon Sep 17 00:00:00 2001 From: LimHyunwoo <81962309+imenuuu@users.noreply.github.com> Date: Wed, 17 Jan 2024 19:33:24 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20:=20=EC=A0=84=EC=9B=94=20=EA=B8=B0?= =?UTF-8?q?=EB=B6=80=EA=B8=88=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/donation/service/AdminDonationService.java | 6 +++++- .../java/com/example/matchapi/donation/dto/DonationRes.java | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Match-Api/src/main/java/com/example/matchapi/admin/donation/service/AdminDonationService.java b/Match-Api/src/main/java/com/example/matchapi/admin/donation/service/AdminDonationService.java index 8e516b88..73c569b0 100644 --- a/Match-Api/src/main/java/com/example/matchapi/admin/donation/service/AdminDonationService.java +++ b/Match-Api/src/main/java/com/example/matchapi/admin/donation/service/AdminDonationService.java @@ -63,6 +63,7 @@ public DonationRes.DonationInfo getDonationInfo() { int weekendDonationAmount = 0; int monthlyDonationAmount = 0; int totalDonationAmount = 0; + int beforeMonthRegularAmount = 0; for (DonationUser donationUser : donationUsers) { if(donationUser.getCreatedAt().isAfter(LocalDateTime.parse(localDate+FIRST_TIME))&&donationUser.getCreatedAt().isBefore(LocalDateTime.parse(localDate+LAST_TIME))){ oneDayDonationAmount += donationUser.getPrice(); @@ -73,10 +74,13 @@ public DonationRes.DonationInfo getDonationInfo() { if(donationUser.getCreatedAt().isAfter(LocalDateTime.parse(localDate.with(TemporalAdjusters.firstDayOfMonth())+FIRST_TIME))&&donationUser.getCreatedAt().isBefore( LocalDateTime.parse(localDate.with(TemporalAdjusters.lastDayOfMonth())+LAST_TIME))){ monthlyDonationAmount += donationUser.getPrice(); } + if(donationUser.getCreatedAt().isAfter(LocalDateTime.parse(localDate.minusMonths(1)+FIRST_TIME))&&donationUser.getCreatedAt().isBefore(LocalDateTime.parse(localDate+LAST_TIME))){ + beforeMonthRegularAmount += donationUser.getPrice(); + } totalDonationAmount += donationUser.getPrice(); } - return new DonationRes.DonationInfo(donationHelper.parsePriceComma(oneDayDonationAmount),donationHelper.parsePriceComma(weekendDonationAmount),donationHelper.parsePriceComma(monthlyDonationAmount), donationHelper.parsePriceComma(totalDonationAmount)); + return new DonationRes.DonationInfo(donationHelper.parsePriceComma(oneDayDonationAmount),donationHelper.parsePriceComma(weekendDonationAmount),donationHelper.parsePriceComma(monthlyDonationAmount), donationHelper.parsePriceComma(totalDonationAmount), donationHelper.parsePriceComma(beforeMonthRegularAmount)); } public DonationRes.DonationDetail getDonationDetail(Long donationId) { diff --git a/Match-Api/src/main/java/com/example/matchapi/donation/dto/DonationRes.java b/Match-Api/src/main/java/com/example/matchapi/donation/dto/DonationRes.java index d59e3e37..c21b7bb8 100644 --- a/Match-Api/src/main/java/com/example/matchapi/donation/dto/DonationRes.java +++ b/Match-Api/src/main/java/com/example/matchapi/donation/dto/DonationRes.java @@ -79,6 +79,8 @@ public static class DonationInfo { private String monthDonation; private String totalDonation; + + private String beforeMonthDonation; } @Getter