-
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.
- Loading branch information
Showing
21 changed files
with
435 additions
and
150 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
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
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
32 changes: 32 additions & 0 deletions
32
src/main/kotlin/no/nav/familie/ef/personhendelse/inntekt/FeilutbetalingBeregningUtil.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,32 @@ | ||
package no.nav.familie.ef.personhendelse.inntekt | ||
|
||
import java.math.BigDecimal | ||
import java.math.RoundingMode | ||
|
||
private val grunnbeløp = 118_620 | ||
private val halvtGrunnbeløp = 59_310 | ||
private val reduksjonsfaktor = BigDecimal(0.45) | ||
|
||
fun beregnFeilutbetalingForMåned(forventetInntekt: Int, samletInntekt: Int): Int { | ||
return beregnUtbetaling(forventetInntekt) - beregnUtbetaling(samletInntekt) | ||
} | ||
|
||
private fun beregnUtbetaling(inntekt: Int): Int { | ||
val avkortning = beregnAvkortning(inntekt).setScale(0, RoundingMode.HALF_DOWN) | ||
|
||
val fullOvergangsstønad = | ||
BigDecimal(grunnbeløp).multiply(BigDecimal(2.25)).setScale(0, RoundingMode.HALF_EVEN) | ||
|
||
val utbetaling = fullOvergangsstønad.subtract(avkortning).setScale(0, RoundingMode.HALF_UP).toInt() | ||
|
||
return if (utbetaling <= 0) 0 else utbetaling / 12 | ||
} | ||
|
||
private fun beregnAvkortning(inntekt: Int): BigDecimal { | ||
val inntektOverHalveGrunnbeløpÅrlig = BigDecimal(inntekt).multiply(BigDecimal(12)).subtract(BigDecimal(halvtGrunnbeløp)) | ||
return if (inntektOverHalveGrunnbeløpÅrlig > BigDecimal.ZERO) { | ||
inntektOverHalveGrunnbeløpÅrlig.multiply(reduksjonsfaktor).setScale(5, RoundingMode.HALF_DOWN) | ||
} else { | ||
BigDecimal.ZERO | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/no/nav/familie/ef/personhendelse/inntekt/InntektsendringerScheduler.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,17 @@ | ||
package no.nav.familie.ef.personhendelse.inntekt | ||
|
||
import no.nav.familie.leader.LeaderClient | ||
import org.springframework.scheduling.annotation.Scheduled | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class InntektsendringerScheduler(val vedtakendringerService: VedtakendringerService) { | ||
|
||
@Scheduled(cron = "0 0 4 6 * *") // kl 04:00 den 6. hver måned | ||
fun inntektskontroll() { | ||
if (LeaderClient.isLeader() == true) { | ||
vedtakendringerService.beregnInntektsendringerOgLagreIDb() | ||
vedtakendringerService.opprettOppgaverForInntektsendringer(true) | ||
} | ||
} | ||
} |
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.