From 24e550a2d1d637543f762b9e885c494483a9039d Mon Sep 17 00:00:00 2001 From: ohu-star Date: Sun, 4 Aug 2024 00:13:36 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[FEAT]=20=ED=95=9C=20=EC=A3=BC=20=EC=98=88?= =?UTF-8?q?=EC=82=B0=20=EA=B8=88=EC=95=A1=20=EC=A1=B0=ED=9A=8C=20API=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../converter/MonthBudgetConverter.java | 6 ++++ .../haruchi/service/MonthBudgetService.java | 33 +++++++++++++++++++ .../web/controller/MonthBudgetController.java | 9 +++++ .../web/dto/MonthBudgetResponseDTO.java | 8 +++++ 4 files changed, 56 insertions(+) diff --git a/src/main/java/umc/haruchi/converter/MonthBudgetConverter.java b/src/main/java/umc/haruchi/converter/MonthBudgetConverter.java index e07f42f..f94f8d9 100644 --- a/src/main/java/umc/haruchi/converter/MonthBudgetConverter.java +++ b/src/main/java/umc/haruchi/converter/MonthBudgetConverter.java @@ -39,4 +39,10 @@ public static MonthBudgetResponseDTO.GetMonthUsedPercentResultDTO toGetMonthUsed .monthUsedPercent(percent) .build(); } + + public static MonthBudgetResponseDTO.GetWeekBudgetResultDTO toGetWeekBudgetResultDTO(Integer budget) { + return MonthBudgetResponseDTO.GetWeekBudgetResultDTO.builder() + .weekBudget(budget) + .build(); + } } \ No newline at end of file diff --git a/src/main/java/umc/haruchi/service/MonthBudgetService.java b/src/main/java/umc/haruchi/service/MonthBudgetService.java index eb560d8..199779a 100644 --- a/src/main/java/umc/haruchi/service/MonthBudgetService.java +++ b/src/main/java/umc/haruchi/service/MonthBudgetService.java @@ -19,12 +19,15 @@ import umc.haruchi.web.dto.MonthBudgetRequestDTO; import umc.haruchi.web.dto.MonthBudgetResponseDTO; +import java.time.DayOfWeek; import java.time.LocalDate; import java.time.YearMonth; import java.util.ArrayList; import java.util.List; import java.util.Optional; +import static umc.haruchi.apiPayload.code.status.ErrorStatus.NOT_SOME_DAY_BUDGET; + @Service @RequiredArgsConstructor @Transactional(readOnly = true) @@ -145,6 +148,36 @@ public double getMonthUsedPercent(Long memberId) { //소수점 6번째자리에서 반올림해서 리턴 return Math.round(monthUsedAmountPercent*1000000)/1000000.0; } + + public Integer getWeekBudget(Long memberId) { + LocalDate today = LocalDate.now(); + + //member가 존재하는 지 확인 + Member member = memberRepository.findById(memberId) + .orElseThrow(() -> new MonthBudgetHandler(ErrorStatus.NO_MEMBER_EXIST)); + + //member와 year, month 기반으로 해당하는 monthBudget 찾기 + MonthBudget monthBudget = monthBudgetRepository.findByMemberIdAndYearAndMonth(memberId, today.getYear(), today.getMonthValue()) + .orElseThrow(() -> new MonthBudgetHandler(ErrorStatus.MONTH_BUDGET_NOT_FOUND)); + + //이번 주 일요일까지 남은 일수 계산 + int remainDays = DayOfWeek.SUNDAY.getValue() - today.getDayOfWeek().getValue(); + + //남은 일수의 dayBudget 구하기 + List dayBudgets = new ArrayList<>(); + + for(int i=0; i<= remainDays; i++){ + DayBudget dayBudget = dayBudgetRepository.findByMonthBudgetAndDay(monthBudget, today.getDayOfMonth()+i) + .orElseThrow(() -> new DayBudgetHandler(NOT_SOME_DAY_BUDGET)); + dayBudgets.add(dayBudget.getDayBudget()); + } + + //남은 일수의 dayBudget 합 리턴 + return dayBudgets.stream() + .mapToInt(Integer::intValue) + .sum(); + } + private long roundDownToNearestHundred(long amount) { return (amount / 100) * 100; } diff --git a/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java b/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java index 4e38c69..5f9b97e 100644 --- a/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java +++ b/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java @@ -8,6 +8,7 @@ import umc.haruchi.apiPayload.ApiResponse; import umc.haruchi.config.login.auth.MemberDetail; import umc.haruchi.converter.MonthBudgetConverter; +import umc.haruchi.domain.Member; import umc.haruchi.domain.MonthBudget; import umc.haruchi.service.MonthBudgetService; import umc.haruchi.web.dto.MonthBudgetRequestDTO; @@ -44,4 +45,12 @@ public ApiResponse getMonth double monthBudgetPercent = monthBudgetService.getMonthUsedPercent(memberDetail.getMember().getId()); return ApiResponse.onSuccess(MonthBudgetConverter.toGetMonthUsedPercentResultDTO(monthBudgetPercent)); } + + //한 주 예산 금액 조회 + @Operation(summary = "한 주 예산 금액 조회 API", description = "본인의 한 주 예산 금액을 조회하는 API 입니다.") + @GetMapping("/week") + public ApiResponse getWeekBudget(@AuthenticationPrincipal MemberDetail memberDetail) { + Integer weekBudget = monthBudgetService.getWeekBudget(memberDetail.getMember().getId()); + return ApiResponse.onSuccess(MonthBudgetConverter.toGetWeekBudgetResultDTO(weekBudget)); + } } diff --git a/src/main/java/umc/haruchi/web/dto/MonthBudgetResponseDTO.java b/src/main/java/umc/haruchi/web/dto/MonthBudgetResponseDTO.java index aff3847..c7e769d 100644 --- a/src/main/java/umc/haruchi/web/dto/MonthBudgetResponseDTO.java +++ b/src/main/java/umc/haruchi/web/dto/MonthBudgetResponseDTO.java @@ -44,4 +44,12 @@ public static class GetMonthResultDTO { public static class GetMonthUsedPercentResultDTO { double monthUsedPercent; } + + @Builder + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static class GetWeekBudgetResultDTO { + Integer weekBudget; + } } From 954306b30c5f39dc4e409b7bbf8a8ed549982e14 Mon Sep 17 00:00:00 2001 From: ohu-star Date: Sun, 4 Aug 2024 23:44:31 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[FIX]=20=ED=95=9C=20=EC=A3=BC=20=EC=98=88?= =?UTF-8?q?=EC=82=B0=20=EA=B8=88=EC=95=A1=20=EC=A1=B0=ED=9A=8C=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../converter/MonthBudgetConverter.java | 28 +++- .../java/umc/haruchi/domain/MonthBudget.java | 9 +- .../umc/haruchi/service/MemberService.java | 4 +- .../haruchi/service/MonthBudgetService.java | 147 ++++++++++++++++-- .../web/controller/MonthBudgetController.java | 9 +- .../web/dto/MonthBudgetResponseDTO.java | 17 +- 6 files changed, 189 insertions(+), 25 deletions(-) diff --git a/src/main/java/umc/haruchi/converter/MonthBudgetConverter.java b/src/main/java/umc/haruchi/converter/MonthBudgetConverter.java index f94f8d9..225d010 100644 --- a/src/main/java/umc/haruchi/converter/MonthBudgetConverter.java +++ b/src/main/java/umc/haruchi/converter/MonthBudgetConverter.java @@ -1,10 +1,13 @@ package umc.haruchi.converter; +import umc.haruchi.domain.DayBudget; import umc.haruchi.domain.MonthBudget; import umc.haruchi.web.dto.MonthBudgetRequestDTO; import umc.haruchi.web.dto.MonthBudgetResponseDTO; import java.time.LocalDate; +import java.util.List; +import java.util.stream.Collectors; public class MonthBudgetConverter { public static MonthBudgetResponseDTO.CreateMonthResultDTO toCreateMonthResultDTO(MonthBudget monthBudget) { @@ -26,6 +29,14 @@ public static MonthBudget toMonthBudget(Long monthBudget) { .build(); } + public static MonthBudget toMonthBudgetWithMonth(Long monthBudget, Integer year, Integer month) { + return MonthBudget.builder() + .monthBudget(monthBudget) + .year(year) + .month(month) + .build(); + } + public static MonthBudgetResponseDTO.GetMonthResultDTO toGetMonthResultDTO(MonthBudget monthBudget) { return MonthBudgetResponseDTO.GetMonthResultDTO.builder() .monthBudget(monthBudget.getMonthBudget()) @@ -40,9 +51,22 @@ public static MonthBudgetResponseDTO.GetMonthUsedPercentResultDTO toGetMonthUsed .build(); } - public static MonthBudgetResponseDTO.GetWeekBudgetResultDTO toGetWeekBudgetResultDTO(Integer budget) { + public static MonthBudgetResponseDTO.GetWeekBudgetResultDTO toGetWeekBudgetResultDTO(DayBudget dayBudget) { return MonthBudgetResponseDTO.GetWeekBudgetResultDTO.builder() - .weekBudget(budget) + .day(dayBudget.getDay()) + .dayBudget(dayBudget.getDayBudget()) + .status(dayBudget.getDayBudgetStatus()) + .build(); + } + + public static MonthBudgetResponseDTO.GetWeekBudgetResultListDTO toGetWeekBudgetResultListDTO(List budgets, Integer month, Integer week) { + List weekBudgetDTOList = budgets.stream() + .map(MonthBudgetConverter::toGetWeekBudgetResultDTO).collect(Collectors.toList()); + + return MonthBudgetResponseDTO.GetWeekBudgetResultListDTO.builder() + .month(month) + .week(week) + .weekBudget(weekBudgetDTOList) .build(); } } \ No newline at end of file diff --git a/src/main/java/umc/haruchi/domain/MonthBudget.java b/src/main/java/umc/haruchi/domain/MonthBudget.java index 0025132..f14509e 100644 --- a/src/main/java/umc/haruchi/domain/MonthBudget.java +++ b/src/main/java/umc/haruchi/domain/MonthBudget.java @@ -43,7 +43,7 @@ public class MonthBudget extends BaseEntity { @Builder.Default private List dayBudgetList = new ArrayList<>(); - @PrePersist + //@PrePersist public void prePersist() { LocalDate now = LocalDate.now(); this.year = now.getYear(); @@ -57,10 +57,9 @@ public void setMember(Member member) { member.getMonthBudgetList().add(this); } - public void updateMonthBudget(Long monthBudget) { - LocalDate now = LocalDate.now(); - this.year = now.getYear(); - this.month = now.getMonthValue(); + public void updateMonthBudget(Long monthBudget, Integer year, Integer month) { + this.year = year; + this.month = month; this.monthBudget = monthBudget; } diff --git a/src/main/java/umc/haruchi/service/MemberService.java b/src/main/java/umc/haruchi/service/MemberService.java index b0093fb..7eda504 100644 --- a/src/main/java/umc/haruchi/service/MemberService.java +++ b/src/main/java/umc/haruchi/service/MemberService.java @@ -26,6 +26,7 @@ import umc.haruchi.web.dto.MemberRequestDTO; import umc.haruchi.web.dto.MemberResponseDTO; +import java.time.LocalDate; import java.util.List; import java.util.Optional; import java.util.concurrent.TimeUnit; @@ -51,12 +52,13 @@ public class MemberService { // 회원가입 @Transactional public Member joinMember(MemberRequestDTO.MemberJoinDTO request) throws Exception { + LocalDate today = LocalDate.now(); Member newMember = MemberConverter.toMember(request); newMember.encodePassword(passwordEncoder.encode(request.getPassword())); //회원가입 시 monthBudget 생성 - MonthBudget monthBudget = MonthBudgetConverter.toMonthBudget(request.getMonthBudget()); + MonthBudget monthBudget = MonthBudgetConverter.toMonthBudgetWithMonth(request.getMonthBudget(), today.getYear(), today.getMonthValue()); monthBudget.setMember(newMember); monthBudgetRepository.save(monthBudget); diff --git a/src/main/java/umc/haruchi/service/MonthBudgetService.java b/src/main/java/umc/haruchi/service/MonthBudgetService.java index 199779a..7b1c305 100644 --- a/src/main/java/umc/haruchi/service/MonthBudgetService.java +++ b/src/main/java/umc/haruchi/service/MonthBudgetService.java @@ -8,6 +8,7 @@ import umc.haruchi.apiPayload.exception.handler.DayBudgetHandler; import umc.haruchi.apiPayload.exception.handler.MonthBudgetHandler; import umc.haruchi.converter.DayBudgetConverter; +import umc.haruchi.converter.MonthBudgetConverter; import umc.haruchi.domain.DayBudget; import umc.haruchi.domain.Member; import umc.haruchi.domain.MonthBudget; @@ -23,6 +24,7 @@ import java.time.LocalDate; import java.time.YearMonth; import java.util.ArrayList; +import java.util.Calendar; import java.util.List; import java.util.Optional; @@ -36,6 +38,21 @@ public class MonthBudgetService { private final MemberRepository memberRepository; private final DayBudgetRepository dayBudgetRepository; + @Transactional + public MonthBudget createMonthBudget(Long memberId, Integer year, Integer month, Long budget) { + //member가 존재하는 지 확인 + Member member = memberRepository.findById(memberId) + .orElseThrow(() -> new MonthBudgetHandler(ErrorStatus.NO_MEMBER_EXIST)); + + MonthBudget monthBudget = monthBudgetRepository.findByMemberIdAndYearAndMonth(memberId, year, month) + .orElseGet(() -> MonthBudgetConverter.toMonthBudgetWithMonth(budget, year, month)); + + //지정된 날짜의 MonthBudget 생성 + monthBudget.setMember(member); + + return monthBudgetRepository.save(monthBudget); + } + @Transactional public MonthBudget updateMonthBudget(Long memberId, MonthBudgetRequestDTO.UpdateMonthDTO request) { LocalDate today = LocalDate.now(); @@ -48,7 +65,7 @@ public MonthBudget updateMonthBudget(Long memberId, MonthBudgetRequestDTO.Update MonthBudget monthBudget = monthBudgetRepository.findByMemberIdAndYearAndMonth(memberId, today.getYear(), today.getMonthValue()) .orElseThrow(() -> new MonthBudgetHandler(ErrorStatus.MONTH_BUDGET_NOT_FOUND)); - monthBudget.updateMonthBudget(request.getMonthBudget()); + monthBudget.updateMonthBudget(request.getMonthBudget(), today.getYear(), today.getMonthValue()); //하루 예산 재분배하여 저장 List dayBudgets = distributeDayBudgets(memberId); @@ -117,6 +134,38 @@ public List distributeDayBudgets(Long memberId) { return dayBudgets; } + //저번 달의 dayBudget 생성에만 사용(우선 지난 달 dayBudget이 없을 때 생성용) + @Transactional + public List createDayBudgetsWithMonth(Long memberId, Integer year, Integer month, Long budget) { + Member member = memberRepository.findById(memberId) + .orElseThrow(() -> new MonthBudgetHandler(ErrorStatus.NO_MEMBER_EXIST)); + + MonthBudget monthBudget = createMonthBudget(memberId, year, month, budget); + + //지정된 달의 일 수 + int dayInMonth = YearMonth.of(year, month).lengthOfMonth(); + + List dayBudgets = new ArrayList<>(); + + for(int day = 1; day <= dayInMonth; day++) { + final int currentDay = day; + //이전 달의 dayBudget을 모두 INACTIVE로 생성 + DayBudgetStatus status = DayBudgetStatus.INACTIVE; + int nowDistributedAmount = 0; + + //dayBudget 생성 혹은 업뎃 + DayBudget dayBudget = dayBudgetRepository.findByMonthBudgetAndDay(monthBudget, day) + .orElseGet(() -> DayBudgetConverter.toDayBudget(nowDistributedAmount, currentDay, status, monthBudget)); + + dayBudget.setStatus(status); + dayBudget.setDayBudget(nowDistributedAmount); + + dayBudgets.add(dayBudget); + } + + return dayBudgetRepository.saveAll(dayBudgets); + } + public MonthBudget getMonthBudget(Long memberId) { LocalDate today = LocalDate.now(); @@ -149,7 +198,9 @@ public double getMonthUsedPercent(Long memberId) { return Math.round(monthUsedAmountPercent*1000000)/1000000.0; } - public Integer getWeekBudget(Long memberId) { + //저번 달의 monthBudget이 없다면 생성해야해서 Transactional + @Transactional + public List getWeekBudget(Long memberId) { LocalDate today = LocalDate.now(); //member가 존재하는 지 확인 @@ -160,22 +211,92 @@ public Integer getWeekBudget(Long memberId) { MonthBudget monthBudget = monthBudgetRepository.findByMemberIdAndYearAndMonth(memberId, today.getYear(), today.getMonthValue()) .orElseThrow(() -> new MonthBudgetHandler(ErrorStatus.MONTH_BUDGET_NOT_FOUND)); - //이번 주 일요일까지 남은 일수 계산 - int remainDays = DayOfWeek.SUNDAY.getValue() - today.getDayOfWeek().getValue(); + //상대날짜 구하기 + int dayInWeek = today.getDayOfWeek().getValue() - DayOfWeek.MONDAY.getValue(); + //이번 주 월요일 구하기 + int firstDayOfWeek = today.getDayOfMonth() - dayInWeek; + System.out.println("시작 날짜: " + firstDayOfWeek); //남은 일수의 dayBudget 구하기 - List dayBudgets = new ArrayList<>(); + List dayBudgets = new ArrayList<>(); - for(int i=0; i<= remainDays; i++){ - DayBudget dayBudget = dayBudgetRepository.findByMonthBudgetAndDay(monthBudget, today.getDayOfMonth()+i) - .orElseThrow(() -> new DayBudgetHandler(NOT_SOME_DAY_BUDGET)); - dayBudgets.add(dayBudget.getDayBudget()); + //이번주에 저번달이 포함되어 있다면 저번 달의 monthBudget 생성. + //더 좋은 로직이 있는 지 고민.. + Integer daysInLastMonth = 0; + Integer newYear = 0; + Integer newMonth = 0; + + if(firstDayOfWeek < 1) { + //헌재 1월이라면 작년 12월의 monthBudget 생성 + if(monthBudget.getMonth() == 1) { + createDayBudgetsWithMonth(memberId, today.getYear()-1, 12, 0L); + daysInLastMonth = YearMonth.of(today.getYear()-1, 12).lengthOfMonth(); + newYear = today.getYear() - 1; + newMonth = 12; + } + //아니라면 저번달의 monthBudget 생성 + else { + createDayBudgetsWithMonth(memberId, today.getYear(), monthBudget.getMonth()-1, 0L); + daysInLastMonth = YearMonth.of(today.getYear(), monthBudget.getMonth()-1).lengthOfMonth(); + newYear = today.getYear(); + newMonth = monthBudget.getMonth()-1; + } + + //지난달 monthBudget 찾기 + MonthBudget lastMonthBudget = monthBudgetRepository.findByMemberIdAndYearAndMonth(memberId, newYear, newMonth) + .orElseThrow(() -> new MonthBudgetHandler(ErrorStatus.MONTH_BUDGET_NOT_FOUND)); + + //dayBudget 찾기 + for(int i=0; i< 7; i++){ + int plusDay = i; + //저번달 날짜라면 저번달 monthBudget에서 찾기 + if(firstDayOfWeek + i < 1) { + plusDay += daysInLastMonth; + DayBudget dayBudget = dayBudgetRepository.findByMonthBudgetAndDay(lastMonthBudget, firstDayOfWeek + plusDay) + .orElseThrow(() -> new DayBudgetHandler(NOT_SOME_DAY_BUDGET)); + dayBudgets.add(dayBudget); + } + //이번달 날짜라면 이번달 monthBudget에서 찾기 + else { + DayBudget dayBudget = dayBudgetRepository.findByMonthBudgetAndDay(monthBudget, firstDayOfWeek + plusDay) + .orElseThrow(() -> new DayBudgetHandler(NOT_SOME_DAY_BUDGET)); + dayBudgets.add(dayBudget); + } + } + } + else { + for(int i=0; i< 7; i++){ + DayBudget dayBudget = dayBudgetRepository.findByMonthBudgetAndDay(monthBudget, firstDayOfWeek+i) + .orElseThrow(() -> new DayBudgetHandler(NOT_SOME_DAY_BUDGET)); + dayBudgets.add(dayBudget); + } } - //남은 일수의 dayBudget 합 리턴 - return dayBudgets.stream() - .mapToInt(Integer::intValue) - .sum(); + //이번 주의 dayBudget 리턴 + return dayBudgets; + } + + public List getMonthAndWeek(Long memberId) { + LocalDate today = LocalDate.now(); + + //member가 존재하는 지 확인 + Member member = memberRepository.findById(memberId) + .orElseThrow(() -> new MonthBudgetHandler(ErrorStatus.NO_MEMBER_EXIST)); + + //member와 year, month 기반으로 해당하는 monthBudget 찾기 + MonthBudget monthBudget = monthBudgetRepository.findByMemberIdAndYearAndMonth(memberId, today.getYear(), today.getMonthValue()) + .orElseThrow(() -> new MonthBudgetHandler(ErrorStatus.MONTH_BUDGET_NOT_FOUND)); + + List currentWeek = new ArrayList<>(); + + Calendar calendar = Calendar.getInstance(); + Integer week = Integer.valueOf(calendar.get(Calendar.WEEK_OF_MONTH)); + + //현재 달 + currentWeek.add(monthBudget.getMonth()); + currentWeek.add(week); + + return currentWeek; } private long roundDownToNearestHundred(long amount) { diff --git a/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java b/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java index 5f9b97e..58cd689 100644 --- a/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java +++ b/src/main/java/umc/haruchi/web/controller/MonthBudgetController.java @@ -8,6 +8,7 @@ import umc.haruchi.apiPayload.ApiResponse; import umc.haruchi.config.login.auth.MemberDetail; import umc.haruchi.converter.MonthBudgetConverter; +import umc.haruchi.domain.DayBudget; import umc.haruchi.domain.Member; import umc.haruchi.domain.MonthBudget; import umc.haruchi.service.MonthBudgetService; @@ -15,6 +16,7 @@ import umc.haruchi.web.dto.MonthBudgetResponseDTO; import java.time.LocalDateTime; +import java.util.List; @RestController @RequiredArgsConstructor @@ -49,8 +51,9 @@ public ApiResponse getMonth //한 주 예산 금액 조회 @Operation(summary = "한 주 예산 금액 조회 API", description = "본인의 한 주 예산 금액을 조회하는 API 입니다.") @GetMapping("/week") - public ApiResponse getWeekBudget(@AuthenticationPrincipal MemberDetail memberDetail) { - Integer weekBudget = monthBudgetService.getWeekBudget(memberDetail.getMember().getId()); - return ApiResponse.onSuccess(MonthBudgetConverter.toGetWeekBudgetResultDTO(weekBudget)); + public ApiResponse getWeekBudget(@AuthenticationPrincipal MemberDetail memberDetail) { + List weekBudget = monthBudgetService.getWeekBudget(memberDetail.getMember().getId()); + List currentWeek = monthBudgetService.getMonthAndWeek(memberDetail.getMember().getId()); + return ApiResponse.onSuccess(MonthBudgetConverter.toGetWeekBudgetResultListDTO(weekBudget, currentWeek.get(0), currentWeek.get(1))); } } diff --git a/src/main/java/umc/haruchi/web/dto/MonthBudgetResponseDTO.java b/src/main/java/umc/haruchi/web/dto/MonthBudgetResponseDTO.java index c7e769d..2c65d65 100644 --- a/src/main/java/umc/haruchi/web/dto/MonthBudgetResponseDTO.java +++ b/src/main/java/umc/haruchi/web/dto/MonthBudgetResponseDTO.java @@ -4,9 +4,12 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +import umc.haruchi.domain.DayBudget; +import umc.haruchi.domain.enums.DayBudgetStatus; import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.List; public class MonthBudgetResponseDTO { @Builder @@ -50,6 +53,18 @@ public static class GetMonthUsedPercentResultDTO { @NoArgsConstructor @AllArgsConstructor public static class GetWeekBudgetResultDTO { - Integer weekBudget; + Long day; + Integer dayBudget; + DayBudgetStatus status; + } + + @Builder + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static class GetWeekBudgetResultListDTO { + List weekBudget; + Integer month; + Integer week; } }