/
niki02
/
Practice_SBER
Обзор
Документация
Войти
/
niki02
/
Practice_SBER
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/main/java/com/example/creditcalculator/api/ScheduleEntryDto.java
49 строк
2 KB
nikgilae
final commit
23 июн 2026, 12:08
23 июн 2026, 12:08
9a5fbe1
Код
Авторство
О чём код?
package com.example.creditcalculator.api; import com.example.creditcalculator.domain.OperationType; import com.example.creditcalculator.infrastructure.persistence.LoanOperationEntity; import com.example.creditcalculator.service.ScheduleEntry; import java.math.BigDecimal; import java.time.LocalDate; public record ScheduleEntryDto( String kind, // "PAST" | "PLANNED" Integer periodNumber, // only for PLANNED LocalDate paymentDate, BigDecimal paymentAmount, BigDecimal interestPaid, BigDecimal principalPaid, BigDecimal overdueInterestPaid, BigDecimal overduePrincipalPaid, BigDecimal remainingPrincipal, OperationType operationType // only for PAST ) { public static ScheduleEntryDto past(LoanOperationEntity op, BigDecimal remainingPrincipal) { return new ScheduleEntryDto( "PAST", null, op.getOperationDate(), op.getAmount(), op.getInterestPaid(), op.getPrincipalPaid(), op.getOverdueInterestPaid(), op.getOverduePrincipalPaid(), remainingPrincipal, op.getOperationType()); } public static ScheduleEntryDto planned(ScheduleEntry e) { return new ScheduleEntryDto( "PLANNED", e.periodNumber(), e.paymentDate(), e.paymentAmount(), e.interestPaid(), e.principalPaid(), null, null, e.remainingPrincipal(), null); } }