Skip to content

Commit

Permalink
Bruke samme datokey som regulering (#6343)
Browse files Browse the repository at this point in the history
* Bruke samme datokey som regulering

* Fjerner dato fra melding da den alltid er det samme
  • Loading branch information
Bjodn authored Nov 15, 2024
1 parent 1b13604 commit 516a183
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import no.nav.etterlatte.rapidsandrivers.ListenerMedLogging
import no.nav.etterlatte.rapidsandrivers.RapidEvents.ANTALL
import no.nav.etterlatte.rapidsandrivers.RapidEvents.EKSKLUDERTE_SAKER
import no.nav.etterlatte.rapidsandrivers.RapidEvents.KJOERING
import no.nav.etterlatte.rapidsandrivers.RapidEvents.LOEPENDE_FOM
import no.nav.etterlatte.rapidsandrivers.RapidEvents.SPESIFIKKE_SAKER
import no.nav.etterlatte.rapidsandrivers.antall
import no.nav.etterlatte.rapidsandrivers.ekskluderteSaker
import no.nav.etterlatte.rapidsandrivers.kjoering
import no.nav.etterlatte.rapidsandrivers.loependeFom
import no.nav.etterlatte.rapidsandrivers.saker
import no.nav.etterlatte.regulering.kjoerIBatch
import no.nav.helse.rapids_rivers.JsonMessage
Expand All @@ -34,7 +32,6 @@ internal class InntektsjusteringJobbRiver(
initialiserRiver(rapidsConnection, InntektsjusteringHendelseType.START_INNTEKTSJUSTERING_JOBB) {
validate { it.requireKey(KJOERING) }
validate { it.requireKey(ANTALL) }
validate { it.requireKey(LOEPENDE_FOM) }
validate { it.interestedIn(SPESIFIKKE_SAKER) }
validate { it.interestedIn(EKSKLUDERTE_SAKER) }
}
Expand All @@ -54,7 +51,7 @@ internal class InntektsjusteringJobbRiver(

val antall = packet.antall
val sakType = SakType.OMSTILLINGSSTOENAD
val loependeFom = packet.loependeFom
val loependeFom = AarligInntektsjusteringRequest.utledLoependeFom()

kjoerIBatch(
logger = logger,
Expand All @@ -75,7 +72,6 @@ internal class InntektsjusteringJobbRiver(
val request =
AarligInntektsjusteringRequest(
kjoering = kjoering,
loependeFom = loependeFom,
saker = sakerSomSkalInformeres.saker.map { it.id },
)
behandlingService.startAarligInntektsjustering(request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import no.nav.etterlatte.libs.common.behandling.BehandlingStatus
import no.nav.etterlatte.libs.common.behandling.Revurderingaarsak
import no.nav.etterlatte.libs.common.behandling.SakType
import no.nav.etterlatte.libs.common.behandling.Virkningstidspunkt
import no.nav.etterlatte.libs.common.inntektsjustering.AarligInntektsjusteringRequest
import no.nav.etterlatte.libs.common.rapidsandrivers.lagParMedEventNameKey
import no.nav.etterlatte.libs.common.sak.Sak
import no.nav.etterlatte.libs.common.sak.SakId
Expand All @@ -19,7 +20,6 @@ import no.nav.etterlatte.rapidsandrivers.InntektsjusteringHendelseType
import no.nav.etterlatte.rapidsandrivers.RapidEvents.ANTALL
import no.nav.etterlatte.rapidsandrivers.RapidEvents.EKSKLUDERTE_SAKER
import no.nav.etterlatte.rapidsandrivers.RapidEvents.KJOERING
import no.nav.etterlatte.rapidsandrivers.RapidEvents.LOEPENDE_FOM
import no.nav.etterlatte.rapidsandrivers.RapidEvents.SPESIFIKKE_SAKER
import no.nav.helse.rapids_rivers.JsonMessage
import no.nav.helse.rapids_rivers.testsupport.TestRapid
Expand All @@ -28,7 +28,7 @@ import java.time.YearMonth

class InntektsjusteringJobbRiverTest {
private val kjoering = "inntektsjustering-jobb-2024"
private val loependeFom = YearMonth.of(2024, 1)
private val loependeFom = AarligInntektsjusteringRequest.utledLoependeFom()

@Test
fun `teste start inntektsjustering jobb aktivert`() {
Expand Down Expand Up @@ -112,7 +112,6 @@ class InntektsjusteringJobbRiverTest {
ANTALL to 12000,
SPESIFIKKE_SAKER to listOf<SakId>(),
EKSKLUDERTE_SAKER to listOf<SakId>(),
LOEPENDE_FOM to loependeFom.atDay(1),
),
).toJson()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
document.getElementById('json').value = '{"@event_name":"OMREGNING:KLAR_FOR_OMREGNING","hendelse_data":{"sakId":"","fradato":"2024-01-01","revurderingaarsak":""}}'
prettify()
} else if( hendelseType == 'inntektsjusteringjobb') {
document.getElementById('json').value = '{"@event_name": "INNTEKTSJUSTERING:START_INNTEKTSJUSTERING_JOBB","kjoering": "asdf","antall": 1,"loepende_fom": "2024-01-01","spesifikke_saker": "","ekskluderte_saker": ""}'
document.getElementById('json').value = '{"@event_name": "INNTEKTSJUSTERING:START_INNTEKTSJUSTERING_JOBB","kjoering": "asdf","antall": 1, "spesifikke_saker": "","ekskluderte_saker": ""}'
prettify()
} else {
document.getElementById('json').value = ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import no.nav.etterlatte.libs.common.inntektsjustering.AarligInntektsjusteringRe
import no.nav.etterlatte.libs.common.rapidsandrivers.lagParMedEventNameKey
import no.nav.etterlatte.rapidsandrivers.InntektsjusteringHendelseType
import no.nav.etterlatte.rapidsandrivers.RapidEvents
import no.nav.etterlatte.rapidsandrivers.ReguleringEvents
import no.nav.etterlatte.rapidsandrivers.tilSeparertString
import no.nav.etterlatte.tidshendelser.HendelserJobb
import no.nav.etterlatte.tidshendelser.regulering.ReguleringDao
Expand Down Expand Up @@ -42,7 +41,6 @@ fun createRecord(konfigurasjon: Reguleringskonfigurasjon) =
.newMessage(
mapOf(
InntektsjusteringHendelseType.START_INNTEKTSJUSTERING_JOBB.lagParMedEventNameKey(),
ReguleringEvents.DATO to AarligInntektsjusteringRequest.utledLoependeFom(),
RapidEvents.KJOERING to AarligInntektsjusteringRequest.utledKjoering(),
RapidEvents.ANTALL to konfigurasjon.antall,
RapidEvents.SPESIFIKKE_SAKER to konfigurasjon.spesifikkeSaker.tilSeparertString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import java.time.YearMonth

data class AarligInntektsjusteringRequest(
val kjoering: String,
val loependeFom: YearMonth,
val loependeFom: YearMonth = utledLoependeFom(),
val saker: List<SakId>,
) {
companion object {
fun utledKjoering() = "INNTEKTSJUSTERING_JOBB_${Year.now().value}"

fun utledLoependeFom() = YearMonth.of(Year.now().value, 1)
fun utledLoependeFom() = YearMonth.of(Year.now().value, 1).plusYears(1)
}
}

0 comments on commit 516a183

Please sign in to comment.