Skip to content

Commit

Permalink
Hvis automatisk omregning stoppes etter fattet skal EY fjernes fra op…
Browse files Browse the repository at this point in the history
…pgave (#6537)

* Hvis automatisk omregning stoppes etter fattet skal EY fjernes fra oppgave

* Legge til oppgaveservice i instansiering
  • Loading branch information
Bjodn authored Dec 3, 2024
1 parent 5bab546 commit c08ee36
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import no.nav.etterlatte.libs.common.sak.SakId
import no.nav.etterlatte.libs.ktor.token.BrukerTokenInfo
import no.nav.etterlatte.libs.ktor.token.HardkodaSystembruker
import no.nav.etterlatte.logger
import no.nav.etterlatte.oppgave.OppgaveService

class OmregningService(
private val behandlingService: BehandlingService,
private val omregningDao: OmregningDao,
private val oppgaveService: OppgaveService,
) {
fun hentSakerTilOmregning(
kjoering: String,
Expand Down Expand Up @@ -49,6 +51,12 @@ class OmregningService(
if (!listOf(KjoeringStatus.FERDIGSTILT, KjoeringStatus.FERDIGSTILT_FATTET).contains(request.status)) {
throw IllegalStateException("Prøver å lagre at kjøring er fullført, men status er ikke ferdigstilt.")
}
if (request.status == KjoeringStatus.FERDIGSTILT_FATTET) {
request.behandling?.let {
val oppgave = oppgaveService.hentOppgaverForReferanse(it.toString()).single()
oppgaveService.fjernSaksbehandler(oppgave.id)
}
}
omregningDao.lagreKjoering(request)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ internal class ApplicationContext(
OmregningService(
behandlingService = behandlingService,
omregningDao = omregningDao,
oppgaveService = oppgaveService,
)

val tilgangService = TilgangServiceImpl(sakTilgangDao)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class OmregningServiceTest(
OmregningService(
behandlingService = mockk(),
omregningDao = OmregningDao(connection),
oppgaveService = mockk(),
)

val request =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ internal class VedtakAttestertRiver(
}
validate { it.requireKey(OmregningDataPacket.KEY) }
validate { it.requireKey(OmregningDataPacket.SAK_ID) }
validate { it.requireKey(OmregningDataPacket.BEHANDLING_ID) }
validate { it.requireKey(OmregningDataPacket.KJOERING) }
validate { it.requireKey(OmregningDataPacket.REV_AARSAK) }
validate { it.interestedIn(BEREGNING_BELOEP_FOER) }
Expand Down Expand Up @@ -86,6 +87,7 @@ internal class VedtakAttestertRiver(
false -> KjoeringStatus.FERDIGSTILT
},
sakId = sakId,
behandling = packet.omregningData.hentBehandlingId(),
beregningBeloepFoer = bigDecimal(packet, BEREGNING_BELOEP_FOER),
beregningBeloepEtter = bigDecimal(packet, BEREGNING_BELOEP_ETTER),
beregningGFoer = bigDecimal(packet, BEREGNING_G_FOER),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.etterlatte.libs.common.sak

import java.math.BigDecimal
import java.util.UUID

data class KjoeringRequest(
val kjoering: String,
Expand All @@ -21,6 +22,7 @@ data class LagreKjoeringRequest(
val kjoering: String,
val status: KjoeringStatus,
val sakId: SakId,
val behandling: UUID? = null,
val beregningBeloepFoer: BigDecimal?,
val beregningBeloepEtter: BigDecimal?,
val beregningGFoer: BigDecimal?,
Expand Down

0 comments on commit c08ee36

Please sign in to comment.