Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/gradle/all-dependencies-3e3d9ebd3a
Browse files Browse the repository at this point in the history
  • Loading branch information
flexable777 authored Oct 30, 2024
2 parents d33e8a7 + efa4056 commit e2ce14f
Show file tree
Hide file tree
Showing 22 changed files with 672 additions and 117 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ val testContainersVersion = "1.20.2"
val mockkVersion = "1.13.13"
val apachePoiVersion = "5.3.0"
val springDocVersion = "2.6.0"

val shedlockVersion = "5.16.0"
val klageKodeverkVersion = "1.8.50"
val klageKodeverkVersion = "1.8.56"
val ehcacheVersion = "3.10.8"
val otelVersion = "1.43.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,16 @@ class AddRandomDataController(
mottattVedtaksinstans = mottattVedtaksinstans,
mottattKlageinstans = mottattKA,
avsluttetAvSaksbehandler = avsluttetAvSaksbehandler.atStartOfDay(),
source = Source.values().random(),
source = Source.entries.toTypedArray().random(),

kvalitetsvurderingReference = KvalitetsvurderingReference(
id = kvalitetsvurderingId,
version = kakaVersion,
),

created = mottattKA.atStartOfDay(),
modified = avsluttetAvSaksbehandler.atStartOfDay()
modified = avsluttetAvSaksbehandler.atStartOfDay(),
tilbakekreving = Random.nextBoolean(),
)
}

Expand Down
6 changes: 6 additions & 0 deletions src/main/kotlin/no/nav/klage/kaka/api/AdminController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ class AdminController(
adminService.logV1HjemlerInV2()
}

@GetMapping("/migrateTilbakekreving")
fun migrateTilbakekreving() {
krevAdminTilgang()
adminService.migrateTilbakekreving()
}

private fun krevAdminTilgang() {
val roller = rolleMapper.toRoles(tokenUtil.getGroups())
if (!roller.contains(Role.KAKA_ADMIN)) {
Expand Down
24 changes: 11 additions & 13 deletions src/main/kotlin/no/nav/klage/kaka/api/KALederController.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.klage.kaka.api

import io.swagger.v3.oas.annotations.tags.Tag
import no.nav.klage.kaka.api.view.ExcelQueryParams
import no.nav.klage.kaka.api.view.ManagerResponseV1
import no.nav.klage.kaka.api.view.ManagerResponseV2
import no.nav.klage.kaka.api.view.Saksbehandler
Expand All @@ -24,7 +25,6 @@ import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import java.io.FileInputStream
import java.time.Year
import java.time.YearMonth

@RestController
Expand All @@ -45,18 +45,17 @@ class KALederController(

@GetMapping("/export/v{version}/excel", "/export/v{version}/excel-med-fritekst")
fun getAsExcelMedFritekst(
@RequestParam(required = false) year: Int?,
@PathVariable("version", required = false) version: Int?,
@PathVariable("version", required = true) version: Int,
queryParams: ExcelQueryParams,
): ResponseEntity<Resource> {
logger.debug("getAsExcelMedFritekst() called. Year param = $year, version = $version")
logger.debug("getAsExcelMedFritekst() called. Query params = {}", queryParams)

validateHasExcelMedFritekst()

val yearToUse = if (year != null) Year.of(year) else Year.now()
val file = if (version == 2) {
exportServiceV2.getAsExcel(year = yearToUse, includeFritekst = true)
exportServiceV2.getAsExcel(includeFritekst = true, queryParams = queryParams)
} else {
exportServiceV1.getAsExcel(year = yearToUse, includeFritekst = true)
exportServiceV1.getAsExcel(includeFritekst = true, queryParams = queryParams)
}

val responseHeaders = HttpHeaders()
Expand All @@ -79,18 +78,17 @@ class KALederController(

@GetMapping("/export/v{version}/excel-uten-fritekst")
fun getAsExcelUtenFritekst(
@RequestParam(required = false) year: Int?,
@PathVariable("version", required = false) version: Int?,
@PathVariable("version", required = true) version: Int,
queryParams: ExcelQueryParams,
): ResponseEntity<Resource> {
logger.debug("getAsExcelUtenFritekst() called. Year param = $year, version = $version")
logger.debug("getAsExcelUtenFritekst() called. Query params = {}", queryParams)

validateHasExcelUtenFritekst()

val yearToUse = if (year != null) Year.of(year) else Year.now()
val file = if (version == 2) {
exportServiceV2.getAsExcel(year = yearToUse, includeFritekst = false)
exportServiceV2.getAsExcel(includeFritekst = false, queryParams = queryParams)
} else {
exportServiceV1.getAsExcel(year = yearToUse, includeFritekst = false)
exportServiceV1.getAsExcel(includeFritekst = false, queryParams = queryParams)
}

val responseHeaders = HttpHeaders()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class KabalKvalitetsvurderingV2Controller(
utfoerendeSaksbehandler = input.utfoerendeSaksbehandler,
tilknyttetEnhet = input.tilknyttetEnhet,
source = Source.KABAL,
tilbakekreving = input.tilbakekreving ?: false,
).id
)
}
Expand Down
20 changes: 20 additions & 0 deletions src/main/kotlin/no/nav/klage/kaka/api/SaksdataController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,26 @@ class SaksdataController(
return saksdataService.setUtfall(saksdataId, Utfall.of(input.value), innloggetSaksbehandler).toSaksdataView()
}

@PutMapping("/{id}/tilbakekreving")
fun setTilbakekreving(
@PathVariable("id") saksdataId: UUID,
@RequestBody input: BooleanInput
): SaksdataView {
val innloggetSaksbehandler = tokenUtil.getIdent()
logSaksdataMethodDetails(
::setTilbakekreving.name,
innloggetSaksbehandler,
saksdataId,
logger
)

return saksdataService.setTilbakekreving(
saksdataId = saksdataId,
tilbakekreving = input.value,
innloggetSaksbehandler = innloggetSaksbehandler
).toSaksdataView()
}

@PutMapping("/{id}/hjemmelidlist")
fun setHjemmelIdList(
@PathVariable("id") saksdataId: UUID,
Expand Down
16 changes: 16 additions & 0 deletions src/main/kotlin/no/nav/klage/kaka/api/view/ExcelQueryParams.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package no.nav.klage.kaka.api.view

import java.time.LocalDate

data class ExcelQueryParams(
val fromDate: LocalDate,
val toDate: LocalDate,
val tilbakekreving: String,
val klageenheter: List<String>?,
val vedtaksinstansgrupper: List<Int>?,
val enheter: List<String>?,
val types: List<String>?,
val ytelser: List<String>?,
val utfall: List<String>?,
val hjemler: List<String>?,
)
2 changes: 2 additions & 0 deletions src/main/kotlin/no/nav/klage/kaka/api/view/KabalView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ data class KabalSaksdataInput(
val kvalitetsvurderingId: UUID,
val avsluttetAvSaksbehandler: LocalDateTime,
val tilknyttetEnhet: String,
//TODO: Remove nullable after kabal-api update
val tilbakekreving: Boolean?,
)

data class ValidationErrors(
Expand Down
26 changes: 2 additions & 24 deletions src/main/kotlin/no/nav/klage/kaka/api/view/RawDataExportV2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ data class AnonymizedFinishedVurderingV2(
val vedtaksinstansEnhet: String,
val vedtaksinstansgruppe: Int,
val mottattKlageinstans: Date,
val tilbakekreving: Boolean,

var klageforberedelsenSakensDokumenter: Boolean,
var klageforberedelsenSakensDokumenterRelevanteOpplysningerFraAndreFagsystemerErIkkeJournalfoert: Boolean,
Expand Down Expand Up @@ -82,6 +83,7 @@ data class AnonymizedFinishedVurderingWithoutEnheterV2(
val sakstypeId: String,
val mottattVedtaksinstans: Date?,
val mottattKlageinstans: Date,
val tilbakekreving: Boolean,

var klageforberedelsenSakensDokumenter: Boolean,
var klageforberedelsenSakensDokumenterRelevanteOpplysningerFraAndreFagsystemerErIkkeJournalfoert: Boolean,
Expand Down Expand Up @@ -167,27 +169,3 @@ data class VedtaksinstanslederResponseV2(
val mine: List<AnonymizedFinishedVurderingWithoutEnheterV2>,
val rest: List<AnonymizedFinishedVurderingWithoutEnheterV2>,
)

enum class Vedtaksinstansgruppe(val id: Int) {
AKERSHUS(0),
OSLO(1),
VESTLAND(2),
ROGALAND(3),
TROENDELAG(4),
INNLANDET(5),
AGDER(6),
OESTFOLD(7),
MOERE_OG_ROMSDAL(8),
BUSKERUD(9),
VESTFOLD(10),
NORDLAND(11),
TELEMARK(12),
TROMS(13),
FINNMARK(14),
NAV_OEKONOMI_STOENAD(15),
NAV_ARBEID_OG_YTELSER(16),
NAV_KONTROLL_FORVALTNING(17),
NAV_HJELPEMIDDELSENTRAL(18),
NAV_FAMILIE_OG_PENSJONSYTELSER(19),
UNKNOWN(999),
}
6 changes: 4 additions & 2 deletions src/main/kotlin/no/nav/klage/kaka/api/view/SaksdataView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ data class SaksdataView(
val avsluttetAvSaksbehandler: LocalDateTime?,
val sourceId: String,
val created: LocalDateTime,
val modified: LocalDateTime
val modified: LocalDateTime,
val tilbakekreving: Boolean,
) {
data class KvalitetsvurderingReference(
val id: UUID,
Expand Down Expand Up @@ -56,7 +57,8 @@ fun Saksdata.toSaksdataView(): SaksdataView {
avsluttetAvSaksbehandler = avsluttetAvSaksbehandler,
sourceId = source.id,
created = created,
modified = modified
modified = modified,
tilbakekreving = tilbakekreving,
)
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/kotlin/no/nav/klage/kaka/domain/Saksdata.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ class Saksdata(
@Column(name = "created")
val created: LocalDateTime = LocalDateTime.now(),
@Column(name = "modified")
var modified: LocalDateTime = LocalDateTime.now()
var modified: LocalDateTime = LocalDateTime.now(),
@Column(name = "tilbakekreving")
var tilbakekreving: Boolean = false,
) {

override fun toString(): String {
Expand Down Expand Up @@ -281,5 +283,4 @@ class Saksdata(
}

val noRegistringshjemmelNeeded = listOf(Utfall.TRUKKET, Utfall.RETUR)
val noKvalitetsvurderingNeeded = listOf(Utfall.TRUKKET, Utfall.RETUR, Utfall.UGUNST)

val noKvalitetsvurderingNeeded = listOf(Utfall.TRUKKET, Utfall.RETUR, Utfall.UGUNST)
60 changes: 60 additions & 0 deletions src/main/kotlin/no/nav/klage/kaka/domain/Vedtaksinstansgruppe.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package no.nav.klage.kaka.domain

enum class Vedtaksinstansgruppe(val id: Int) {
AKERSHUS(0),
OSLO(1),
VESTLAND(2),
ROGALAND(3),
TROENDELAG(4),
INNLANDET(5),
AGDER(6),
OESTFOLD(7),
MOERE_OG_ROMSDAL(8),
BUSKERUD(9),
VESTFOLD(10),
NORDLAND(11),
TELEMARK(12),
TROMS(13),
FINNMARK(14),
NAV_OEKONOMI_STOENAD(15),
NAV_ARBEID_OG_YTELSER(16),
NAV_KONTROLL_FORVALTNING(17),
NAV_HJELPEMIDDELSENTRAL(18),
NAV_FAMILIE_OG_PENSJONSYTELSER(19),
UNKNOWN(999),
}

val vedtaksinstansgruppeMap = mapOf(
"02" to Vedtaksinstansgruppe.AKERSHUS,
"03" to Vedtaksinstansgruppe.OSLO,
"46" to Vedtaksinstansgruppe.VESTLAND,
"12" to Vedtaksinstansgruppe.VESTLAND,
"14" to Vedtaksinstansgruppe.VESTLAND,
"13" to Vedtaksinstansgruppe.VESTLAND,
"11" to Vedtaksinstansgruppe.ROGALAND,
"50" to Vedtaksinstansgruppe.TROENDELAG,
"16" to Vedtaksinstansgruppe.TROENDELAG,
"17" to Vedtaksinstansgruppe.TROENDELAG,
"57" to Vedtaksinstansgruppe.TROENDELAG,
"34" to Vedtaksinstansgruppe.INNLANDET,
"04" to Vedtaksinstansgruppe.INNLANDET,
"05" to Vedtaksinstansgruppe.INNLANDET,
"09" to Vedtaksinstansgruppe.AGDER,
"10" to Vedtaksinstansgruppe.AGDER,
"01" to Vedtaksinstansgruppe.OESTFOLD,
"15" to Vedtaksinstansgruppe.MOERE_OG_ROMSDAL,
"06" to Vedtaksinstansgruppe.BUSKERUD,
"07" to Vedtaksinstansgruppe.VESTFOLD,
"53" to Vedtaksinstansgruppe.VESTFOLD,
"18" to Vedtaksinstansgruppe.NORDLAND,
"08" to Vedtaksinstansgruppe.TELEMARK,
"19" to Vedtaksinstansgruppe.TROMS,
"20" to Vedtaksinstansgruppe.FINNMARK,
"41" to Vedtaksinstansgruppe.NAV_OEKONOMI_STOENAD,
"44" to Vedtaksinstansgruppe.NAV_ARBEID_OG_YTELSER,
"45" to Vedtaksinstansgruppe.NAV_KONTROLL_FORVALTNING,
"47" to Vedtaksinstansgruppe.NAV_HJELPEMIDDELSENTRAL,
"48" to Vedtaksinstansgruppe.NAV_FAMILIE_OG_PENSJONSYTELSER,
"42" to Vedtaksinstansgruppe.UNKNOWN,
"00" to Vedtaksinstansgruppe.UNKNOWN,
)
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ interface SaksdataRepository : JpaRepository<Saksdata, UUID>, SaksdataRepository

fun findOneByKvalitetsvurderingReferenceId(kvalitetsvurderingId: UUID): Saksdata?

fun findByTilbakekrevingIsFalse(): List<Saksdata>
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package no.nav.klage.kaka.repositories

import java.time.LocalDate
import java.time.LocalDateTime

interface SaksdataRepositoryCustom {
Expand Down Expand Up @@ -42,6 +43,32 @@ interface SaksdataRepositoryCustom {
toDateTime: LocalDateTime
): Set<SaksdataRepositoryCustomImpl.QueryResultV2>

fun findByQueryParamsV1(
fromDate: LocalDate,
toDate: LocalDate,
tilbakekreving: String,
klageenheter: List<String>?,
vedtaksinstansgrupper: List<Int>?,
enheter: List<String>?,
types: List<String>?,
ytelser: List<String>?,
utfall: List<String>?,
hjemler: List<String>?,
): Set<SaksdataRepositoryCustomImpl.QueryResultV1>

fun findByQueryParamsV2(
fromDate: LocalDate,
toDate: LocalDate,
tilbakekreving: String,
klageenheter: List<String>?,
vedtaksinstansgrupper: List<Int>?,
enheter: List<String>?,
types: List<String>?,
ytelser: List<String>?,
utfall: List<String>?,
hjemler: List<String>?,
): Set<SaksdataRepositoryCustomImpl.QueryResultV2>

fun findByTilknyttetEnhetAndAvsluttetAvSaksbehandlerBetweenOrderByCreatedV1(
enhet: String,
fromDateTime: LocalDateTime,
Expand Down
Loading

0 comments on commit e2ce14f

Please sign in to comment.