Skip to content

Commit

Permalink
Legg til behandling og oppgrader felles versjon (#560)
Browse files Browse the repository at this point in the history
* Legg til behandling og oppgrader felles versjon

* Legg til behandling og oppgrader felles versjon
  • Loading branch information
ugur93 authored Apr 15, 2024
1 parent e012e70 commit 15cca6e
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 124 deletions.
3 changes: 3 additions & 0 deletions .nais/feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ azure:
- application: bidrag-dokument-forsendelse-feature
namespace: bidrag
cluster: dev-gcp
- application: bidrag-behandling-feature
namespace: bidrag
cluster: dev-gcp
ingresses:
- https://bidrag-dokument-feature.dev.adeo.no/
- https://bidrag-dokument-feature.dev.intern.nav.no/
Expand Down
3 changes: 3 additions & 0 deletions .nais/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ azure:
- application: bidrag-dokument-forsendelse
namespace: bidrag
cluster: dev-gcp
- application: bidrag-behandling
namespace: bidrag
cluster: dev-gcp
ingresses:
- https://bidrag-dokument.nais.preprod.local/
- https://bidrag-dokument.dev.adeo.no/
Expand Down
3 changes: 3 additions & 0 deletions .nais/prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ azure:
- application: bidrag-dokument-forsendelse
namespace: bidrag
cluster: prod-gcp
- application: bidrag-behandling
namespace: bidrag
cluster: prod-gcp
ingresses:
- https://bidrag-dokument.nais.adeo.no/
- https://bidrag-dokument.intern.nav.no/
Expand Down
16 changes: 7 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
<kotlin.version>1.9.22</kotlin.version>

<!-- dependent versions other than from spring-boot -->
<bidrag-commons.version>20231002151454_eab4a7b</bidrag-commons.version>
<bidrag-commons-test.version>1.20230504132526_a72fa41</bidrag-commons-test.version>
<bidrag-transport.version>20231010134706_52d8d27</bidrag-transport.version>
<bidrag-felles.version>2024.04.15.133925</bidrag-felles.version>
<logback.encoder.version>7.4</logback.encoder.version>
<springdoc-openapi-ui.version>2.3.0</springdoc-openapi-ui.version>
<springframework-cloud.version>4.1.0</springframework-cloud.version>
Expand Down Expand Up @@ -104,13 +102,13 @@

<dependency>
<groupId>no.nav.bidrag</groupId>
<artifactId>bidrag-commons</artifactId>
<version>${bidrag-commons.version}</version>
<artifactId>bidrag-commons-felles</artifactId>
<version>${bidrag-felles.version}</version>
</dependency>
<dependency>
<groupId>no.nav.bidrag</groupId>
<artifactId>bidrag-transport</artifactId>
<version>${bidrag-transport.version}</version>
<artifactId>bidrag-transport-felles</artifactId>
<version>${bidrag-felles.version}</version>
</dependency>
<!--Sikkerhet-->
<dependency>
Expand Down Expand Up @@ -232,8 +230,8 @@
</dependency>
<dependency>
<groupId>no.nav.bidrag</groupId>
<artifactId>bidrag-commons-test</artifactId>
<version>${bidrag-commons-test.version}</version>
<artifactId>bidrag-commons-test-felles</artifactId>
<version>${bidrag-felles.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ class BidragDokumentConsumer(
private val rootUri: String,
private val metricsRegistry: MeterRegistry,
) {
fun finnAvvik(saksnummer: String?, journalpostId: String?): HttpResponse<List<AvvikType>> {
val path: String = if (saksnummer != null) {
String.format(PATH_AVVIK_PA_JOURNALPOST_MED_SAK_PARAM, journalpostId, saksnummer)
} else {
String.format(PATH_AVVIK_PA_JOURNALPOST, journalpostId)
}
fun finnAvvik(
saksnummer: String?,
journalpostId: String?,
): HttpResponse<List<AvvikType>> {
val path: String =
if (saksnummer != null) {
String.format(PATH_AVVIK_PA_JOURNALPOST_MED_SAK_PARAM, journalpostId, saksnummer)
} else {
String.format(PATH_AVVIK_PA_JOURNALPOST, journalpostId)
}
val avviksResponse =
restTemplate.exchange(path, HttpMethod.GET, null, typereferansenErListeMedAvvikstyper())
return HttpResponse(avviksResponse)
Expand All @@ -51,22 +55,27 @@ class BidragDokumentConsumer(
avvikshendelse: Avvikshendelse?,
): HttpResponse<BehandleAvvikshendelseResponse> {
val path = String.format("$PATH_JOURNALPOST_UTEN_SAK/avvik", journalpostId)
val avviksResponse = restTemplate
.exchange(
path,
HttpMethod.POST,
HttpEntity(avvikshendelse, createEnhetHeader(enhetsnummer)),
BehandleAvvikshendelseResponse::class.java,
)
val avviksResponse =
restTemplate
.exchange(
path,
HttpMethod.POST,
HttpEntity(avvikshendelse, createEnhetHeader(enhetsnummer)),
BehandleAvvikshendelseResponse::class.java,
)
return HttpResponse(avviksResponse)
}

fun hentJournalpost(saksnummer: String?, id: String?): HttpResponse<JournalpostResponse> {
val url: String = if (saksnummer == null) {
String.format(PATH_JOURNALPOST, id)
} else {
String.format(PATH_JOURNALPOST_MED_SAKPARAM, id, saksnummer)
}
fun hentJournalpost(
saksnummer: String?,
id: String?,
): HttpResponse<JournalpostResponse> {
val url: String =
if (saksnummer == null) {
String.format(PATH_JOURNALPOST, id)
} else {
String.format(PATH_JOURNALPOST_MED_SAKPARAM, id, saksnummer)
}
val journalpostExchange =
restTemplate.exchange(url, HttpMethod.GET, null, JournalpostResponse::class.java)
return HttpResponse(journalpostExchange)
Expand All @@ -79,12 +88,14 @@ class BidragDokumentConsumer(
val uriBuilder = UriComponentsBuilder.fromPath(String.format(PATH_JOURNAL, saksnummer))
fagomrade.forEach { uriBuilder.queryParam(PARAM_FAGOMRADE, it) }
val uri = uriBuilder.toUriString()
log.info { "Henter journalposter for sak $saksnummer" }
val timer = metricsRegistry.timer("finnJournalposter", "service", name)
return try {
val journalposterFraArkiv = timer.recordCallable {
restTemplate
.exchange(uri, HttpMethod.GET, null, typereferansenErListeMedJournalposter())
}!!
val journalposterFraArkiv =
timer.recordCallable {
restTemplate
.exchange(uri, HttpMethod.GET, null, typereferansenErListeMedJournalposter())
}!!
journalposterFraArkiv.body ?: emptyList()
} catch (e: HttpStatusCodeException) {
log.error(e) {
Expand All @@ -107,24 +118,26 @@ class BidragDokumentConsumer(
endreJournalpostCommand: EndreJournalpostCommand,
): HttpResponse<Void> {
val path = String.format(PATH_JOURNALPOST_UTEN_SAK, endreJournalpostCommand.journalpostId)
val endretJournalpostResponse = restTemplate
.exchange(
path,
HttpMethod.PATCH,
HttpEntity(endreJournalpostCommand, createEnhetHeader(enhet)),
Void::class.java,
)
val endretJournalpostResponse =
restTemplate
.exchange(
path,
HttpMethod.PATCH,
HttpEntity(endreJournalpostCommand, createEnhetHeader(enhet)),
Void::class.java,
)
return HttpResponse(endretJournalpostResponse)
}

fun opprett(opprettJournalpostRequest: OpprettJournalpostRequest): HttpResponse<OpprettJournalpostResponse> {
val endretJournalpostResponse = restTemplate
.exchange(
PATH_OPPRETT_JOURNALPOST,
HttpMethod.POST,
HttpEntity(opprettJournalpostRequest),
OpprettJournalpostResponse::class.java,
)
val endretJournalpostResponse =
restTemplate
.exchange(
PATH_OPPRETT_JOURNALPOST,
HttpMethod.POST,
HttpEntity(opprettJournalpostRequest),
OpprettJournalpostResponse::class.java,
)
return HttpResponse(endretJournalpostResponse)
}

Expand All @@ -139,13 +152,14 @@ class BidragDokumentConsumer(
uriBuilder = uriBuilder.queryParam(PARAM_BATCHID, batchId)
}
val uri = uriBuilder.toUriString()
val distribuerJournalpostResponse = restTemplate
.exchange(
uri,
HttpMethod.POST,
HttpEntity(distribuerJournalpostRequest),
DistribuerJournalpostResponse::class.java,
)
val distribuerJournalpostResponse =
restTemplate
.exchange(
uri,
HttpMethod.POST,
HttpEntity(distribuerJournalpostRequest),
DistribuerJournalpostResponse::class.java,
)
return HttpResponse(distribuerJournalpostResponse)
}

Expand Down Expand Up @@ -255,6 +269,7 @@ class BidragDokumentConsumer(
const val PATH_HENT_DOKUMENT = "/dokument/%s"
const val PATH_HENT_DOKUMENT_REFERANSE = "/dokumentreferanse/%s"
const val PATH_HENT_DOKUMENT_ER_FERDIGSTILT = "/dokumentreferanse/%s/erFerdigstilt"

private fun typereferansenErListeMedJournalposter(): ParameterizedTypeReference<List<JournalpostDto>> {
return object : ParameterizedTypeReference<List<JournalpostDto>>() {}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.runBlocking
import no.nav.bidrag.commons.util.KildesystemIdenfikator
import no.nav.bidrag.commons.util.KildesystemIdenfikator.Kildesystem
import no.nav.bidrag.commons.util.RequestContextAsyncContext
import no.nav.bidrag.commons.util.SecurityCoroutineContext
import no.nav.bidrag.commons.web.HttpResponse
import no.nav.bidrag.dokument.BidragDokumentConfig
import no.nav.bidrag.dokument.consumer.BidragDokumentConsumer
Expand All @@ -32,7 +34,6 @@ class JournalpostService(
@Qualifier(BidragDokumentConfig.ARKIV_QUALIFIER) private val bidragArkivConsumer: BidragDokumentConsumer,
@Qualifier(BidragDokumentConfig.MIDL_BREVLAGER_QUALIFIER) private val bidragJournalpostConsumer: BidragDokumentConsumer,
) {

fun hentJournalpost(
saksnummer: String?,
kildesystemIdenfikator: KildesystemIdenfikator,
Expand Down

0 comments on commit 15cca6e

Please sign in to comment.