Skip to content

Commit ffac402

Browse files
committed
hotfix: payroll summary null 에러 해결
1 parent cebc046 commit ffac402

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

app/src/main/java/com/mangoboss/app/api/facade/payroll/BossPayrollFacade.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public TransferSummaryResponse getPayrollSummary(final Long storeId, final Long
164164
LocalDate today = LocalDate.now(clock);
165165
List<PayrollEntity> payrolls = payrollService.getPayrolls(storeId, targetMonth);
166166
if (payrolls.isEmpty()) {
167-
return TransferSummaryResponse.of(TransferSummaryStateForResponse.NOT_YET, today.withDayOfMonth(payrollSetting.getTransferDate()));
167+
return TransferSummaryResponse.of(TransferSummaryStateForResponse.NOT_YET, payrollSetting.getTransferDate(),today);
168168
}
169169
boolean allPending = payrolls.stream().allMatch(p ->
170170
p.getTransferState().equals(TransferState.PENDING)

app/src/main/java/com/mangoboss/app/dto/payroll/response/TransferSummaryResponse.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ public record TransferSummaryResponse(
99
LocalDate transferDate,
1010
TransferSummaryStateForResponse isTransferred
1111
) {
12+
public static TransferSummaryResponse of(final TransferSummaryStateForResponse state, final Integer transferDate, final LocalDate today) {
13+
if( transferDate == null) {
14+
return TransferSummaryResponse.builder()
15+
.transferDate(null)
16+
.isTransferred(state)
17+
.build();
18+
}
19+
return TransferSummaryResponse.builder()
20+
.transferDate(today.withDayOfMonth(transferDate))
21+
.isTransferred(state)
22+
.build();
23+
}
24+
1225
public static TransferSummaryResponse of(final TransferSummaryStateForResponse state, final LocalDate transferDate) {
1326
return TransferSummaryResponse.builder()
1427
.transferDate(transferDate)

0 commit comments

Comments
 (0)