Skip to content

Commit

Permalink
♻️ : 전월 기부금 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
imenuuu committed Jan 17, 2024
1 parent d2caae3 commit 27b1341
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ public static class DonationInfo {
private String monthDonation;

private String totalDonation;

private String beforeMonthDonation;
}

@Getter
Expand Down

0 comments on commit 27b1341

Please sign in to comment.