-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
River som lytter på distribuert brev og lagrer i omregningskjøring (#…
- Loading branch information
Showing
9 changed files
with
198 additions
and
60 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
5 changes: 5 additions & 0 deletions
5
...ing/src/main/resources/db/migration/V185__omregning_kjoering_distribuert_og_iverksett.sql
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,5 @@ | ||
ALTER TABLE omregningskjoering | ||
ADD COLUMN iverkksatt_behandling BOOL; | ||
|
||
ALTER TABLE omregningskjoering | ||
ADD COLUMN distribuert_brev BOOL; |
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
57 changes: 0 additions & 57 deletions
57
...-behandling/src/main/kotlin/inntektsjustering/OppdaterInntektsjusteringBrevDistribuert.kt
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
...terlatte-oppdater-behandling/src/main/kotlin/regulering/OmregningBrevDistribusjonRiver.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,67 @@ | ||
package no.nav.etterlatte.regulering | ||
|
||
import no.nav.etterlatte.BehandlingService | ||
import no.nav.etterlatte.brev.BrevHendelseType | ||
import no.nav.etterlatte.brev.Brevkoder | ||
import no.nav.etterlatte.libs.common.feilhaandtering.InternfeilException | ||
import no.nav.etterlatte.libs.common.inntektsjustering.AarligInntektsjusteringRequest | ||
import no.nav.etterlatte.libs.common.sak.DisttribuertEllerIverksatt | ||
import no.nav.etterlatte.rapidsandrivers.BREV_KODE | ||
import no.nav.etterlatte.rapidsandrivers.Kontekst | ||
import no.nav.etterlatte.rapidsandrivers.ListenerMedLogging | ||
import no.nav.etterlatte.rapidsandrivers.SAK_ID_KEY | ||
import no.nav.etterlatte.rapidsandrivers.brevId | ||
import no.nav.etterlatte.rapidsandrivers.brevKode | ||
import no.nav.etterlatte.rapidsandrivers.sakId | ||
import no.nav.helse.rapids_rivers.JsonMessage | ||
import no.nav.helse.rapids_rivers.MessageContext | ||
import no.nav.helse.rapids_rivers.RapidsConnection | ||
import org.slf4j.LoggerFactory | ||
|
||
internal class OmregningBrevDistribusjonRiver( | ||
rapidsConnection: RapidsConnection, | ||
private val behandlingService: BehandlingService, | ||
) : ListenerMedLogging() { | ||
private val logger = LoggerFactory.getLogger(this::class.java) | ||
|
||
init { | ||
initialiserRiver(rapidsConnection, BrevHendelseType.DISTRIBUERT) { | ||
validate { it.requireKey(SAK_ID_KEY) } | ||
validate { it.requireKey(BREV_KODE) } | ||
validate { it.demandValue(BREV_KODE, Brevkoder.OMS_INNTEKTSJUSTERING_VEDTAK.name) } // TODO kan bli flere | ||
} | ||
} | ||
|
||
override fun kontekst() = Kontekst.OMREGNING | ||
|
||
override fun haandterPakke( | ||
packet: JsonMessage, | ||
context: MessageContext, | ||
) { | ||
logger.info("Setter status på brev til distribuert på omregning til sak=${packet.sakId}, brevid=${packet.brevId}") | ||
try { | ||
val brevkode = packet.brevKode | ||
when (brevkode) { | ||
Brevkoder.OMS_INNTEKTSJUSTERING_VEDTAK.name -> { | ||
val kjoering = AarligInntektsjusteringRequest.utledKjoering() | ||
behandlingService.lagreKjoeringBrevDistribuertEllerIverksatt( | ||
packet.sakId, | ||
kjoering, | ||
DisttribuertEllerIverksatt.DISTRIBUERT, | ||
) | ||
} | ||
|
||
else -> {} | ||
} | ||
} catch (e: Exception) { | ||
logger.error( | ||
"Kunne ikke oppdatere omregning sin status på brev distribusjon for sak ${packet.sakId} brevid: ${packet.brevId}", | ||
e, | ||
) | ||
throw InternfeilException( | ||
"Fikk ikke oppdatert kjøring med status på brev distribusjon for ${packet.sakId}", | ||
e, | ||
) | ||
} | ||
} | ||
} |
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