-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PEK-715 hent SPK tjenestepensjon-simulering
- Loading branch information
1 parent
8a73130
commit 980a7ba
Showing
24 changed files
with
981 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...in/no/nav/tjenestepensjon/simulering/v2025/tjenestepensjon/v1/domain/Maanedsutbetaling.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package no.nav.tjenestepensjon.simulering.v2025.tjenestepensjon.v1.domain | ||
|
||
import no.nav.tjenestepensjon.simulering.model.domain.pen.Alder | ||
import java.time.LocalDate | ||
|
||
data class Maanedsutbetaling( | ||
val fraOgMedDato: LocalDate, | ||
val fraOgMedAlder: Alder, | ||
var maanedsBeloep: Int, | ||
) |
12 changes: 10 additions & 2 deletions
12
...nav/tjenestepensjon/simulering/v2025/tjenestepensjon/v1/domain/SimulertTjenestepensjon.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
package no.nav.tjenestepensjon.simulering.v2025.tjenestepensjon.v1.domain | ||
|
||
data class SimulertTjenestepensjon( | ||
open class SimulertTjenestepensjon( | ||
val tpLeverandoer: String, | ||
var ordningsListe: List<Ordning> = emptyList(), | ||
var utbetalingsperioder: List<Utbetalingsperiode> = emptyList(), | ||
var aarsakIngenUtbetaling: List<String> = emptyList(), | ||
) | ||
|
||
data class Ordning(val tpNummer: String) | ||
data class Ordning(val tpNummer: String) | ||
|
||
open class SimulertTjenestepensjonMedMaanedsUtbetalinger( | ||
val tpLeverandoer: String, | ||
var ordningsListe: List<Ordning> = emptyList(), | ||
var utbetalingsperioder: List<Maanedsutbetaling> = emptyList(), | ||
var aarsakIngenUtbetaling: List<String> = emptyList(), | ||
) |
41 changes: 41 additions & 0 deletions
41
.../tjenestepensjon/simulering/v2025/tjenestepensjon/v1/dto/Tjenestepensjon2025Aggregator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package no.nav.tjenestepensjon.simulering.v2025.tjenestepensjon.v1.dto | ||
|
||
import no.nav.tjenestepensjon.simulering.v2025.tjenestepensjon.v1.domain.Maanedsutbetaling | ||
import no.nav.tjenestepensjon.simulering.v2025.tjenestepensjon.v1.domain.SimulertTjenestepensjonMedMaanedsUtbetalinger | ||
import no.nav.tjenestepensjon.simulering.v2025.tjenestepensjon.v1.dto.response.* | ||
|
||
object Tjenestepensjon2025Aggregator { | ||
|
||
fun aggregerRespons(simulertTjenestepensjon: SimulertTjenestepensjonMedMaanedsUtbetalinger) = | ||
SimulerTjenestepensjonResponseDto( | ||
simuleringsResultatStatus = SimuleringsResultatStatusDto(ResultatTypeDto.SUCCESS), | ||
simuleringsResultat = SimuleringsResultatDto( | ||
tpLeverandoer = simulertTjenestepensjon.tpLeverandoer, | ||
utbetalingsperioder = aggregerTilAarligePerioder(simulertTjenestepensjon.utbetalingsperioder), | ||
) | ||
) | ||
|
||
fun aggregerTilAarligePerioder(maanedsutbetalinger: List<Maanedsutbetaling>): List<UtbetalingPerAar> { | ||
val aarligeUtbetalinger = mutableMapOf<Int, MutableMap<Int, Int>>() //år -> månedsnummer(1-12) -> beløp for måneden | ||
|
||
maanedsutbetalinger.forEach { maanedsutbetaling -> | ||
val (startAar, startMaaned) = maanedsutbetaling.fraOgMedAlder.let { it.aar to it.maaneder + 1 } | ||
|
||
// Bruk beløp for start år-måned og fremtidige år | ||
(startAar..SISTE_UTBETALINGSAAR).forEach { aar -> | ||
val maanedFra = if (aar == startAar) startMaaned else 1 | ||
aarligeUtbetalinger | ||
.getOrPut(aar) { mutableMapOf() } | ||
.putAll((maanedFra..MAANEDER_I_AAR).associateWith { maanedsutbetaling.maanedsBeloep }) | ||
} | ||
} | ||
|
||
// Summer beløp per år | ||
return aarligeUtbetalinger | ||
.map { (aar, maanedToBeloep) -> UtbetalingPerAar(aar, maanedToBeloep.values.sum()) } | ||
.sortedBy { it.aar } | ||
} | ||
|
||
const val MAANEDER_I_AAR = 12 | ||
const val SISTE_UTBETALINGSAAR = 85 | ||
} |
16 changes: 0 additions & 16 deletions
16
.../nav/tjenestepensjon/simulering/v2025/tjenestepensjon/v1/dto/Tjenestepensjon2025Mapper.kt
This file was deleted.
Oops, something went wrong.
10 changes: 7 additions & 3 deletions
10
...nsjon/simulering/v2025/tjenestepensjon/v1/dto/request/SimulerTjenestepensjonRequestDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
package no.nav.tjenestepensjon.simulering.v2025.tjenestepensjon.v1.dto.request | ||
|
||
import java.time.LocalDate | ||
|
||
data class SimulerTjenestepensjonRequestDto( | ||
val fnr: String, | ||
val uttaksListe: List<UttakDto>, | ||
val fremtidigInntektListe: List<FremtidigInntektDto>, | ||
val pid: String, | ||
val foedselsdato: LocalDate, | ||
val uttaksdato: LocalDate, | ||
val sisteInntekt: Int, | ||
val aarIUtlandetEtter16: Int, | ||
val brukerBaOmAfp: Boolean, | ||
val epsPensjon: Boolean, | ||
val eps2G: Boolean, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
...tjenestepensjon/simulering/v2025/tjenestepensjon/v1/dto/response/UtbetalingsperiodeDto.kt
This file was deleted.
Oops, something went wrong.
20 changes: 12 additions & 8 deletions
20
...jenestepensjon/simulering/v2025/tjenestepensjon/v1/service/TjenestepensjonV2025Service.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...nestepensjon/simulering/v2025/tjenestepensjon/v1/service/klp/KLPTjenestepensjonService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package no.nav.tjenestepensjon.simulering.v2025.tjenestepensjon.v1.service.klp | ||
|
||
import no.nav.tjenestepensjon.simulering.ping.Pingable | ||
import no.nav.tjenestepensjon.simulering.v2025.tjenestepensjon.v1.domain.SimulertTjenestepensjonMedMaanedsUtbetalinger | ||
import no.nav.tjenestepensjon.simulering.v2025.tjenestepensjon.v1.dto.request.SimulerTjenestepensjonRequestDto | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class KLPTjenestepensjonService(private val client: KLPTjenestepensjonClient) : Pingable { | ||
|
||
fun simuler(request: SimulerTjenestepensjonRequestDto): Result<SimulertTjenestepensjonMedMaanedsUtbetalinger> { | ||
return Result.failure(RuntimeException("Aggregation is not implemented for KLP")) | ||
} | ||
|
||
override fun ping() = client.ping() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.