-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1855 from navikt/dev
Prodsette #1853
- Loading branch information
Showing
29 changed files
with
569 additions
and
132 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
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
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
2 changes: 1 addition & 1 deletion
2
...e14aVedtak/Avvik14aStatistikkMetrikk.java → ...k14aVedtak/Avvik14aStatistikkMetrikk.java
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
2 changes: 1 addition & 1 deletion
2
...efolje/siste14aVedtak/Avvik14aVedtak.java → ...tak14a/avvik14aVedtak/Avvik14aVedtak.java
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
84 changes: 84 additions & 0 deletions
84
...to/veilarbportefolje/oppfolgingsvedtak14a/gjeldende14aVedtak/Gjeldende14aVedtakService.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,84 @@ | ||
package no.nav.pto.veilarbportefolje.oppfolgingsvedtak14a.gjeldende14aVedtak | ||
|
||
import no.nav.common.types.identer.AktorId | ||
import no.nav.pto.veilarbportefolje.oppfolging.OppfolgingRepositoryV2 | ||
import no.nav.pto.veilarbportefolje.oppfolgingsvedtak14a.siste14aVedtak.Siste14aVedtakForBruker | ||
import no.nav.pto.veilarbportefolje.oppfolgingsvedtak14a.siste14aVedtak.Siste14aVedtakRepository | ||
import no.nav.pto.veilarbportefolje.vedtakstotte.Hovedmal | ||
import no.nav.pto.veilarbportefolje.vedtakstotte.Innsatsgruppe | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.stereotype.Service | ||
import java.time.ZoneId | ||
import java.time.ZonedDateTime | ||
import java.util.* | ||
|
||
@Service | ||
class Gjeldende14aVedtakService( | ||
@Autowired val siste14aVedtakRepository: Siste14aVedtakRepository, | ||
@Autowired val oppfolgingRepositoryV2: OppfolgingRepositoryV2 | ||
) { | ||
fun hentGjeldende14aVedtak(brukerIdenter: Set<AktorId>): Map<AktorId, Optional<Gjeldende14aVedtak>> { | ||
val aktorIdSiste14aVedtakMap: Map<AktorId, Optional<Siste14aVedtakForBruker>> = | ||
siste14aVedtakRepository.hentSiste14aVedtakForBrukere(brukerIdenter) | ||
.mapValues { Optional.ofNullable(it.value) } | ||
val aktorIdStartDatoOppfolgingMap: Map<AktorId, Optional<ZonedDateTime>> = | ||
oppfolgingRepositoryV2.hentStartDatoForOppfolging(brukerIdenter) | ||
|
||
return brukerIdenter.associate { brukerIdent -> | ||
val maybeSiste14aVedtak: Optional<Siste14aVedtakForBruker> = | ||
aktorIdSiste14aVedtakMap[brukerIdent] ?: Optional.empty() | ||
val maybeStartDatoOppfolging: Optional<ZonedDateTime> = | ||
aktorIdStartDatoOppfolgingMap[brukerIdent] ?: Optional.empty() | ||
|
||
if (maybeSiste14aVedtak.isEmpty || maybeStartDatoOppfolging.isEmpty) { | ||
return@associate brukerIdent to Optional.empty<Gjeldende14aVedtak>() | ||
} | ||
|
||
if (!sjekkOmVedtakErGjeldende(maybeSiste14aVedtak.get(), maybeStartDatoOppfolging.get())) { | ||
return@associate brukerIdent to Optional.empty<Gjeldende14aVedtak>() | ||
} | ||
|
||
return@associate brukerIdent to maybeSiste14aVedtak.get().let { | ||
Optional.of( | ||
Gjeldende14aVedtak( | ||
aktorId = it.aktorId, | ||
innsatsgruppe = it.innsatsgruppe, | ||
hovedmal = it.hovedmal, | ||
fattetDato = it.fattetDato | ||
) | ||
) | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
@JvmField | ||
val LANSERINGSDATO_VEILARBOPPFOLGING_OPPFOLGINGSPERIODE: ZonedDateTime = | ||
ZonedDateTime.of(2017, 12, 4, 0, 0, 0, 0, ZoneId.systemDefault()) | ||
|
||
@JvmStatic | ||
fun sjekkOmVedtakErGjeldende( | ||
siste14aVedtakForBruker: Siste14aVedtakForBruker, | ||
startDatoInnevarendeOppfolgingsperiode: ZonedDateTime | ||
): Boolean { | ||
val erVedtaketFattetIInnevarendeOppfolgingsperiode = | ||
siste14aVedtakForBruker.fattetDato.isAfter(startDatoInnevarendeOppfolgingsperiode) | ||
val erVedtaketFattetForLanseringsdatoForVeilarboppfolging = siste14aVedtakForBruker.fattetDato | ||
.isBefore(LANSERINGSDATO_VEILARBOPPFOLGING_OPPFOLGINGSPERIODE) | ||
val erStartdatoForOppfolgingsperiodeLikLanseringsdatoForVeilarboppfolging = | ||
!startDatoInnevarendeOppfolgingsperiode | ||
.isAfter(LANSERINGSDATO_VEILARBOPPFOLGING_OPPFOLGINGSPERIODE) | ||
|
||
return erVedtaketFattetIInnevarendeOppfolgingsperiode || | ||
(erVedtaketFattetForLanseringsdatoForVeilarboppfolging | ||
&& erStartdatoForOppfolgingsperiodeLikLanseringsdatoForVeilarboppfolging) | ||
} | ||
} | ||
} | ||
|
||
data class Gjeldende14aVedtak( | ||
val aktorId: AktorId, | ||
val innsatsgruppe: Innsatsgruppe, | ||
val hovedmal: Hovedmal?, | ||
val fattetDato: ZonedDateTime | ||
) |
2 changes: 1 addition & 1 deletion
2
...je/siste14aVedtak/GjeldendeVedtak14a.java → ...jeldende14aVedtak/GjeldendeVedtak14a.java
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
2 changes: 1 addition & 1 deletion
2
.../siste14aVedtak/Siste14aVedtakApiDto.java → .../siste14aVedtak/Siste14aVedtakApiDto.java
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
2 changes: 1 addition & 1 deletion
2
...iste14aVedtak/Siste14aVedtakKafkaDto.java → ...iste14aVedtak/Siste14aVedtakKafkaDto.java
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
2 changes: 1 addition & 1 deletion
2
...te14aVedtak/Siste14aVedtakRepository.java → ...te14aVedtak/Siste14aVedtakRepository.java
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
3 changes: 2 additions & 1 deletion
3
...siste14aVedtak/Siste14aVedtakService.java → ...siste14aVedtak/Siste14aVedtakService.java
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
Oops, something went wrong.