-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ vedtaksperiode reberegnet er historikkinnslag
* og knyttes til generasjon Co-authored-by: Christian Bülow Skovborg <[email protected]>
- Loading branch information
Showing
13 changed files
with
144 additions
and
126 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
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
33 changes: 8 additions & 25 deletions
33
.../src/main/kotlin/no/nav/helse/modell/kommando/VedtaksperiodeReberegnetPeriodehistorikk.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,36 +1,19 @@ | ||
package no.nav.helse.modell.kommando | ||
|
||
import no.nav.helse.db.HistorikkinnslagRepository | ||
import no.nav.helse.db.UtbetalingRepository | ||
import no.nav.helse.spesialist.api.periodehistorikk.PeriodehistorikkType | ||
import org.slf4j.LoggerFactory | ||
import java.util.UUID | ||
import no.nav.helse.modell.periodehistorikk.HistorikkinnslagDto | ||
import no.nav.helse.modell.vedtaksperiode.Vedtaksperiode | ||
|
||
internal class VedtaksperiodeReberegnetPeriodehistorikk( | ||
private val vedtaksperiodeId: UUID, | ||
private val utbetalingRepository: UtbetalingRepository, | ||
private val vedtaksperiode: Vedtaksperiode, | ||
private val historikkinnslagRepository: HistorikkinnslagRepository, | ||
) : Command { | ||
private val sikkerLogg = LoggerFactory.getLogger("tjenestekall") | ||
|
||
override fun execute(context: CommandContext): Boolean { | ||
val utbetalinger = utbetalingRepository.utbetalingerForVedtaksperiode(vedtaksperiodeId) | ||
val utbetalingId = utbetalinger.firstOrNull()?.utbetalingId | ||
|
||
if (utbetalingId != null) { | ||
sikkerLogg.info( | ||
"Vedtaksperiode reberegnet lagres som periodehistorikk på vedtaksperiode {} med utbetalingId {}", | ||
vedtaksperiodeId, | ||
utbetalingId, | ||
) | ||
historikkinnslagRepository.lagre(PeriodehistorikkType.VEDTAKSPERIODE_REBEREGNET, null, utbetalingId) | ||
} else { | ||
sikkerLogg.info( | ||
"Kunne ikke legge til periodehistorikk ved reberegnet vedtaksperiode. Finner ikke utbetalingId for vedtaksperiodeId {} ", | ||
vedtaksperiodeId, | ||
) | ||
} | ||
|
||
val innslag = HistorikkinnslagDto.vedtaksperiodeReberegnet() | ||
historikkinnslagRepository.lagre( | ||
historikkinnslag = innslag, | ||
generasjonId = vedtaksperiode.gjeldendeGenerasjonId, | ||
) | ||
return true | ||
} | ||
} |
Oops, something went wrong.