Skip to content

Commit

Permalink
Merge branch 'main' into innsyn
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvind-wedoe committed Dec 10, 2024
2 parents 78dca2e + 724ca23 commit eb9c0b0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ val jacksonJsonschemaVersion = "1.0.39"
val pdfboxVersion = "3.0.3"
val tikaVersion = "3.0.0"
val verapdfVersion = "1.26.1"
val klageKodeverkVersion = "1.8.60"
val klageKodeverkVersion = "1.8.61"
val commonsFileupload2JakartaVersion = "2.0.0-M1"
val otelVersion = "1.44.1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CreateBehandlingFromMottak(
detaljer = BehandlingDetaljer(
ankebehandlingOpprettet =
AnkebehandlingOpprettetDetaljer(
mottattKlageinstans = ankebehandling.created
mottattKlageinstans = ankebehandling.mottattKlageinstans
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ExternalMottakFacade(
val behandling = mottakService.createMottakForKlageAnkeV3(oversendtKlageAnke)

if (oversendtKlageAnke.saksbehandlerIdent != null) {
setSaksbehandler(behandling = behandling, saksbehandlerIdent = oversendtKlageAnke.saksbehandlerIdent)
tryToSetSaksbehandler(behandling = behandling, saksbehandlerIdent = oversendtKlageAnke.saksbehandlerIdent)
}

tryToSendSvarbrev(behandling, hindreAutomatiskSvarbrev = oversendtKlageAnke.hindreAutomatiskSvarbrev == true)
Expand All @@ -49,7 +49,7 @@ class ExternalMottakFacade(
val behandling = mottakService.createMottakForKlageAnkeV3(oversendtKlageAnke)

if (oversendtKlageAnke.saksbehandlerIdent != null) {
setSaksbehandler(behandling = behandling, saksbehandlerIdent = oversendtKlageAnke.saksbehandlerIdent)
tryToSetSaksbehandler(behandling = behandling, saksbehandlerIdent = oversendtKlageAnke.saksbehandlerIdent)
}

tryToSendSvarbrev(behandling, hindreAutomatiskSvarbrev = oversendtKlageAnke.hindreAutomatiskSvarbrev == true)
Expand All @@ -74,6 +74,23 @@ class ExternalMottakFacade(
}
}

private fun tryToSetSaksbehandler(
behandling: Behandling,
saksbehandlerIdent: String
) {
try {
setSaksbehandler(
behandling = behandling,
saksbehandlerIdent = saksbehandlerIdent,
)
} catch (e: Exception) {
mottakService.createTaskForMerkantil(
behandlingId = behandling.id,
reason = "Klarte ikke å tildele behandling ${behandling.id} til saksbehandlerIdent $saksbehandlerIdent. Feilmelding: ${e.message}"
)
}
}

private fun setSaksbehandler(behandling: Behandling, saksbehandlerIdent: String) {
logger.debug("Preparing to set saksbehandler. Getting enhet for saksbehandler $saksbehandlerIdent")
val enhetForSaksbehandler = try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import no.nav.klage.kodeverk.Ytelse
import no.nav.klage.oppgave.clients.kabalinnstillinger.KabalInnstillingerClient
import no.nav.klage.oppgave.clients.kabalinnstillinger.model.*
import no.nav.klage.oppgave.domain.klage.Behandling
import org.springframework.retry.annotation.Retryable
import org.springframework.stereotype.Service

@Service
class KabalInnstillingerService(
private val kabalInnstillingerClient: KabalInnstillingerClient,
) {
@Retryable
fun getPotentialSaksbehandlere(behandling: Behandling): Saksbehandlere {
return kabalInnstillingerClient.searchSaksbehandlere(
SaksbehandlerSearchInput(
Expand All @@ -19,6 +21,7 @@ class KabalInnstillingerService(
)
}

@Retryable
fun getPotentialMedunderskrivere(behandling: Behandling): Medunderskrivere {
if (behandling.tildeling == null) {
return Medunderskrivere(medunderskrivere = emptyList())
Expand All @@ -33,6 +36,7 @@ class KabalInnstillingerService(
)
}

@Retryable
fun getPotentialROL(behandling: Behandling): Saksbehandlere {
return kabalInnstillingerClient.searchROL(
ROLSearchInput(
Expand All @@ -42,12 +46,14 @@ class KabalInnstillingerService(
}

//TODO: Bør vi ha et cache her? Kan være et problem om leder gir nye tilganger, kanskje et kortere cache?
@Retryable
fun getTildelteYtelserForSaksbehandler(navIdent: String): List<Ytelse> {
return kabalInnstillingerClient.getSaksbehandlersTildelteYtelser(navIdent).ytelseIdList.map {
Ytelse.of(it)
}
}

@Retryable
fun getTildelteYtelserForEnhet(enhet: String): Set<Ytelse> {
return kabalInnstillingerClient.getTildelteYtelserForEnhet(enhet).ytelseIdList.map {
Ytelse.of(it)
Expand Down

0 comments on commit eb9c0b0

Please sign in to comment.