Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hvis automatisk omregning stoppes etter fattet skal EY fjernes fra oppgave #6537

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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