-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ny endepunkt for å hente notat opplysninger og ainntekt lenke (#105)
- Loading branch information
Showing
29 changed files
with
912 additions
and
148 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,3 @@ jobs: | |
with: | ||
nais_variabler_filnavn: main.yaml | ||
maven_options: -B -q -fae -Pit | ||
|
||
|
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
65 changes: 65 additions & 0 deletions
65
src/main/kotlin/no/nav/bidrag/behandling/controller/v1/ArbeidOgInntektController.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,65 @@ | ||
package no.nav.bidrag.behandling.controller.v1 | ||
|
||
import mu.KotlinLogging | ||
import no.nav.bidrag.behandling.database.datamodell.Behandlingstype | ||
import no.nav.bidrag.behandling.service.BehandlingService | ||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.boot.web.client.RestTemplateBuilder | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.client.RestTemplate | ||
import org.springframework.web.client.getForEntity | ||
|
||
private val log = KotlinLogging.logger {} | ||
|
||
data class ArbeidOgInntektLenkeRequest( | ||
val behandlingId: Long, | ||
val ident: String, | ||
) | ||
|
||
@BehandlingRestControllerV1 | ||
class ArbeidOgInntektController( | ||
@Value("\${ARBEID_OG_INNTEKT_URL}") private val ainntektUrl: String, | ||
private val behandlingService: BehandlingService, | ||
) { | ||
@PostMapping("/arbeidOgInntekt/ainntekt") | ||
fun ainntektLenke( | ||
@RequestBody request: ArbeidOgInntektLenkeRequest, | ||
): String { | ||
return hentAinntektLenke(request) | ||
} | ||
|
||
@PostMapping("/arbeidOgInntekt/arbeidsforhold") | ||
fun arbeidsforholdLenke( | ||
@RequestBody request: ArbeidOgInntektLenkeRequest, | ||
): String { | ||
return hentArbeidsforholdLenke(request) | ||
} | ||
|
||
private fun hentAinntektLenke(request: ArbeidOgInntektLenkeRequest): String { | ||
val behandling = behandlingService.hentBehandlingById(request.behandlingId) | ||
val kodeverkContext = | ||
"$ainntektUrl/redirect/sok/a-inntekt" | ||
val restTemplate: RestTemplate = | ||
RestTemplateBuilder() | ||
.defaultHeader( | ||
"Nav-A-inntekt-Filter", | ||
if (behandling.behandlingstype == Behandlingstype.FORSKUDD) "BidragsforskuddA-Inntekt" else "BidragA-Inntekt", | ||
) | ||
.defaultHeader("Nav-Enhet", behandling.behandlerEnhet) | ||
.defaultHeader("Nav-FagsakId", behandling.saksnummer) | ||
.defaultHeader("Nav-Personident", request.ident) | ||
.build() | ||
return restTemplate.getForEntity<String>(kodeverkContext).body!! | ||
} | ||
|
||
private fun hentArbeidsforholdLenke(request: ArbeidOgInntektLenkeRequest): String { | ||
val kodeverkContext = | ||
"$ainntektUrl/redirect/sok/arbeidstaker" | ||
val restTemplate: RestTemplate = | ||
RestTemplateBuilder() | ||
.defaultHeader("Nav-Personident", request.ident) | ||
.build() | ||
return restTemplate.getForEntity<String>(kodeverkContext).body!! | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/no/nav/bidrag/behandling/controller/v1/NotatOpplysningerController.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,18 @@ | ||
package no.nav.bidrag.behandling.controller.v1 | ||
|
||
import no.nav.bidrag.behandling.dto.notat.NotatDto | ||
import no.nav.bidrag.behandling.service.NotatOpplysningerService | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PathVariable | ||
|
||
@BehandlingRestControllerV1 | ||
class NotatOpplysningerController( | ||
private val notatOpplysningerService: NotatOpplysningerService, | ||
) { | ||
@GetMapping("/notat/{behandlingId}") | ||
fun hentNotatOpplysninger( | ||
@PathVariable behandlingId: Long, | ||
): NotatDto { | ||
return notatOpplysningerService.hentNotatOpplysninger(behandlingId) | ||
} | ||
} |
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
124 changes: 124 additions & 0 deletions
124
src/main/kotlin/no/nav/bidrag/behandling/dto/notat/NotatDto.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,124 @@ | ||
package no.nav.bidrag.behandling.dto.notat | ||
|
||
import no.nav.bidrag.domene.enums.inntekt.Inntektsrapportering | ||
import no.nav.bidrag.domene.enums.person.Bostatuskode | ||
import no.nav.bidrag.domene.enums.person.Sivilstandskode | ||
import no.nav.bidrag.domene.enums.rolle.Rolletype | ||
import no.nav.bidrag.domene.enums.rolle.SøktAvType | ||
import no.nav.bidrag.domene.ident.Personident | ||
import no.nav.bidrag.domene.tid.ÅrMånedsperiode | ||
import java.math.BigDecimal | ||
import java.time.LocalDate | ||
import java.time.YearMonth | ||
|
||
data class NotatDto( | ||
val saksnummer: String, | ||
val saksbehandlerNavn: String?, | ||
val virkningstidspunkt: Virkningstidspunkt, | ||
val boforhold: Boforhold, | ||
val parterISøknad: List<ParterISøknad>, | ||
val inntekter: Inntekter, | ||
val vedtak: List<Vedtak>, | ||
) | ||
|
||
data class Virkningstidspunkt( | ||
val søknadstype: String?, | ||
val søktAv: SøktAvType?, | ||
val mottattDato: YearMonth?, | ||
val søktFraDato: YearMonth?, | ||
val virkningstidspunkt: LocalDate?, | ||
val notat: Notat, | ||
) | ||
|
||
data class Notat( | ||
val medIVedtaket: String?, | ||
val intern: String?, | ||
) | ||
|
||
data class Boforhold( | ||
val barn: List<BoforholdBarn> = emptyList(), | ||
val sivilstand: SivilstandNotat, | ||
val notat: Notat, | ||
) | ||
|
||
data class SivilstandNotat( | ||
val opplysningerFraFolkeregisteret: List<OpplysningerFraFolkeregisteret<Sivilstandskode>> = emptyList(), | ||
val opplysningerBruktTilBeregning: List<OpplysningerBruktTilBeregning<Sivilstandskode>> = emptyList(), | ||
) | ||
|
||
data class BoforholdBarn( | ||
val navn: String, | ||
val fødselsdato: LocalDate?, | ||
val opplysningerFraFolkeregisteret: List<OpplysningerFraFolkeregisteret<Bostatuskode>> = emptyList(), | ||
val opplysningerBruktTilBeregning: List<OpplysningerBruktTilBeregning<Bostatuskode>> = emptyList(), | ||
) | ||
|
||
data class OpplysningerFraFolkeregisteret<T>( | ||
val periode: ÅrMånedsperiode, | ||
val status: T?, | ||
) | ||
|
||
data class OpplysningerBruktTilBeregning<T>( | ||
val periode: ÅrMånedsperiode, | ||
val status: T, | ||
val kilde: String, | ||
) | ||
|
||
data class ParterISøknad( | ||
val rolle: Rolletype, | ||
val navn: String?, | ||
val fødselsdato: LocalDate?, | ||
val personident: Personident?, | ||
) | ||
|
||
data class Inntekter( | ||
val inntekterPerRolle: List<InntekterPerRolle>, | ||
val notat: Notat, | ||
) | ||
|
||
data class InntekterPerRolle( | ||
val rolle: Rolletype, | ||
val arbeidsforhold: List<Arbeidsforhold>, | ||
val inntekterSomLeggesTilGrunn: List<InntekterSomLeggesTilGrunn>, | ||
val barnetillegg: List<Barnetillegg>, | ||
val utvidetBarnetrygd: List<UtvidetBarnetrygd>, | ||
) | ||
|
||
data class Arbeidsforhold( | ||
val periode: ÅrMånedsperiode, | ||
val arbeidsgiver: String, | ||
val stillingProsent: String?, | ||
val lønnsendringDato: LocalDate?, | ||
) | ||
|
||
data class InntekterSomLeggesTilGrunn( | ||
val inntektType: Inntektsrapportering?, | ||
val beskrivelse: String?, | ||
val periode: ÅrMånedsperiode?, | ||
val beløp: BigDecimal, | ||
) | ||
|
||
data class Barnetillegg( | ||
val periode: ÅrMånedsperiode, | ||
val beløp: BigDecimal, | ||
) | ||
|
||
data class UtvidetBarnetrygd( | ||
val periode: ÅrMånedsperiode, | ||
val beløp: BigDecimal, | ||
) | ||
|
||
data class Vedtak( | ||
val navn: String, | ||
val fødselsdato: LocalDate, | ||
val resultat: List<Resultat>, | ||
) | ||
|
||
data class Resultat( | ||
val type: String, | ||
val periode: ÅrMånedsperiode, | ||
val inntekt: BigDecimal, | ||
val sivilstand: String, | ||
val antallBarn: Int, | ||
val resultat: String, | ||
) |
Oops, something went wrong.