Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/inntektsmelding_q1_q2
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc3092 committed Mar 11, 2024
2 parents 00e027d + df46433 commit 6e0a0a1
Show file tree
Hide file tree
Showing 104 changed files with 5,539 additions and 4,591 deletions.
2 changes: 1 addition & 1 deletion apps/adresse-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
limits:
memory: 2048Mi
requests:
cpu: 300m
cpu: 200m
memory: 1024Mi
accessPolicy:
inbound:
Expand Down
2 changes: 1 addition & 1 deletion apps/amelding-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
cluster: dev-gcp
outbound:
rules:
- application: oppsummeringsdokument-service
- application: testnav-oppsummeringsdokument-service
tokenx:
enabled: true
azure:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package no.nav.registre.testnav.ameldingservice.consumer;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.core.util.Json;
import lombok.extern.slf4j.Slf4j;
import no.nav.registre.testnav.ameldingservice.config.Consumers;
import no.nav.testnav.libs.commands.GetOppsummeringsdokumentByIdCommand;
import no.nav.testnav.libs.commands.GetOppsummeringsdokumentCommand;
Expand All @@ -12,13 +14,14 @@
import org.springframework.http.MediaType;
import org.springframework.http.codec.json.Jackson2JsonDecoder;
import org.springframework.http.codec.json.Jackson2JsonEncoder;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;

import java.time.LocalDate;

@Component
@Slf4j
@Service
public class OppsummeringsdokumentConsumer {
private static final int BYTE_COUNT = 16 * 1024 * 1024;
private final WebClient webClient;
Expand Down Expand Up @@ -48,6 +51,9 @@ public OppsummeringsdokumentConsumer(
}

public Mono<String> save(OppsummeringsdokumentDTO dto, String miljo, AccessToken accessToken) {

log.info("Dokument til innsending: {}", Json.pretty(dto));

return new SaveOppsummeringsdokumenterCommand(
webClient,
accessToken.getTokenValue(),
Expand All @@ -65,8 +71,9 @@ public Mono<OppsummeringsdokumentDTO> get(String opplysningspliktigOrgnummer, Lo
accessToken.getTokenValue(),
opplysningspliktigOrgnummer,
kalendermaaned,
miljo
).call();
miljo)
.call()
.doOnNext(response -> log.info("Eksisterende dokument: {}", response));
}

public Mono<OppsummeringsdokumentDTO> get(String id, Mono<String> accessToken) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

consumers:
oppsummeringsdokument-service:
url: https://oppsummeringsdokument-service.intern.dev.nav.no
url: https://testnav-oppsummeringsdokument-service.intern.dev.nav.no
8 changes: 2 additions & 6 deletions apps/amelding-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ spring:
issuer-uri: ${AAD_ISSUER_URI}/v2.0
jwk-set-uri: ${AAD_ISSUER_URI}/discovery/v2.0/keys
accepted-audience: ${azure.app.client.id}, api://${azure.app.client.id}
tokenx:
issuer-uri: ${TOKEN_X_ISSUER}
jwk-set-uri: ${TOKEN_X_JWKS_URI}
accepted-audience: ${TOKEN_X_CLIENT_ID}

springdoc:
swagger-ui:
Expand All @@ -26,8 +22,8 @@ consumers:
oppsummeringsdokument-service:
cluster: dev-gcp
namespace: dolly
name: oppsummeringsdokument-service
url: http://oppsummeringsdokument-service.dolly.svc.cluster.local
name: testnav-oppsummeringsdokument-service
url: http://testnav-oppsummeringsdokument-service.dolly.svc.cluster.local

management:
endpoints:
Expand Down
7 changes: 7 additions & 0 deletions apps/bruker-service/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ metadata:
spec:
image: "{{image}}"
port: 8080
azure:
application:
enabled: true
tenant: nav.no
claims:
groups:
- id: 9c7efec1-1599-4216-a67e-6fd53a6a951c
tokenx:
enabled: true
accessPolicy:
Expand Down
7 changes: 7 additions & 0 deletions apps/bruker-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ metadata:
spec:
image: "{{image}}"
port: 8080
azure:
application:
enabled: true
tenant: nav.no
claims:
groups:
- id: 9c7efec1-1599-4216-a67e-6fd53a6a951c
tokenx:
enabled: true
accessPolicy:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.dolly.bestilling.aareg.amelding;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.core.util.Json;
import lombok.extern.slf4j.Slf4j;
import no.nav.dolly.bestilling.aareg.command.AmeldingPutCommand;
import no.nav.dolly.config.Consumers;
Expand Down Expand Up @@ -64,8 +65,9 @@ public Flux<String> sendAmeldinger(List<AMeldingDTO> ameldinger, String miljoe)
.collect(Collectors.joining(",")))));
} else {
log.info("Sender Amelding {} til miljø {}: {}",
amelding.getKalendermaaned().format(YEAR_MONTH), miljoe, amelding);
amelding.getKalendermaaned().format(YEAR_MONTH), miljoe, Json.pretty(amelding));
return new AmeldingPutCommand(webClient, amelding, miljoe, token.getTokenValue()).call()
.doOnNext(status -> log.info("Ameldingstatus: {}", status.getStatusCode()))
.map(status -> status.getStatusCode().is2xxSuccessful() ? "OK" :
errorStatusDecoder.getErrorText(HttpStatus.valueOf(status.getStatusCode().value()), status.getBody()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@RequiredArgsConstructor
public class ArbeidsplassenPutCVCommand implements Callable<Flux<ArbeidsplassenCVStatusDTO>> {

private static final String ARBEIDSPLASSEN_CV_URL = "/rest/v2/cv";
private static final String ARBEIDSPLASSEN_CV_URL = "/rest/v3/cv";
private static final String FNR = "fnr";

private final WebClient webClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
public class PdlDataOrdreCommand implements Callable<Flux<PdlResponse>> {

private static final String PDL_FORVALTER_ORDRE_URL = "/api/v1/personer/{ident}/ordre";
private static final String IS_TPS_MASTER = "isTpsMaster";
private static final String EXCLUDE_EKSTERNE_PERSONER = "ekskluderEksternePersoner";

private final WebClient webClient;
Expand All @@ -35,7 +34,6 @@ public Flux<PdlResponse> call() {
return webClient
.post()
.uri(uriBuilder -> uriBuilder.path(PDL_FORVALTER_ORDRE_URL)
.queryParam(IS_TPS_MASTER, false)
.queryParam(EXCLUDE_EKSTERNE_PERSONER, ekskluderEksternePersoner)
.build(ident))
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import no.nav.dolly.domain.resultset.dolly.DollyPerson;
import no.nav.dolly.errorhandling.ErrorStatusDecoder;
import no.nav.dolly.util.TransactionHelperService;
import no.nav.testnav.libs.data.pdlforvalter.v1.SikkerhetstiltakDTO;
import no.nav.testnav.libs.data.tpsmessagingservice.v1.SpraakDTO;
import no.nav.testnav.libs.data.tpsmessagingservice.v1.TpsMeldingResponseDTO;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -26,7 +25,6 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -98,15 +96,7 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
sendEgenansattSlett(bestilling, dollyPerson.getIdent())
.map(respons -> Map.of("Egenansatt_slett", respons)),
sendEgenansatt(bestilling, dollyPerson.getIdent())
.map(respons -> Map.of("Egenansatt_opprett", respons)),
sendSikkerhetstiltakSlett(personer.stream()
.filter(personBolk -> personBolk.getIdent().equals(dollyPerson.getIdent()))
.findFirst())
.map(respons -> Map.of("Sikkerhetstiltak_slett", respons)),
sendSikkerhetstiltakOpprett(personer.stream()
.filter(personBolk -> personBolk.getIdent().equals(dollyPerson.getIdent()))
.findFirst())
.map(respons -> Map.of("Sikkerhetstiltak_opprett", respons))
.map(respons -> Map.of("Egenansatt_opprett", respons))
))
.map(respons -> respons.entrySet().stream()
.map(entry -> getStatus(entry.getKey(), entry.getValue()))
Expand All @@ -127,8 +117,7 @@ private boolean isTpsMessage(RsDollyUtvidetBestilling bestilling) {
nonNull(bestilling.getSkjerming()) ||

(nonNull(bestilling.getPdldata()) &&
nonNull(bestilling.getPdldata().getPerson()) &&
!bestilling.getPdldata().getPerson().getSikkerhetstiltak().isEmpty());
nonNull(bestilling.getPdldata().getPerson()));
}

private ClientFuture futurePersist(DollyPerson dollyPerson, BestillingProgress progress, String status) {
Expand Down Expand Up @@ -178,30 +167,6 @@ private Flux<PdlPersonBolk.PersonBolk> getPersonData(List<String> identer) {
.filter(personBolk -> nonNull(personBolk.getPerson()));
}

private Mono<List<TpsMeldingResponseDTO>> sendSikkerhetstiltakSlett(Optional<PdlPersonBolk.PersonBolk> personBolk) {

return personBolk.isPresent() && !personBolk.get().getPerson().getSikkerhetstiltak().isEmpty() ?

tpsMessagingConsumer.deleteSikkerhetstiltakRequest(
personBolk.get().getIdent(), null)
.collectList() :

Mono.just(emptyList());
}

private Mono<List<TpsMeldingResponseDTO>> sendSikkerhetstiltakOpprett(Optional<PdlPersonBolk.PersonBolk> personBolk) {

return personBolk.isPresent() && !personBolk.get().getPerson().getSikkerhetstiltak().isEmpty() ?

tpsMessagingConsumer.sendSikkerhetstiltakRequest(
personBolk.get().getIdent(), null,
personBolk.get().getPerson().getSikkerhetstiltak()
.stream().findFirst().orElse(new SikkerhetstiltakDTO()))
.collectList() :

Mono.just(emptyList());
}

private Mono<List<TpsMeldingResponseDTO>> sendSpraakkode(RsDollyUtvidetBestilling bestilling, String ident) {

return nonNull(bestilling.getTpsMessaging()) && nonNull(bestilling.getTpsMessaging().getSpraakKode()) ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import no.nav.dolly.bestilling.tpsmessagingservice.command.EgenansattDeleteCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.EgenansattPostCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.PersonGetCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.SikkerhetstiltakDeleteCommand;
import no.nav.dolly.bestilling.tpsmessagingservice.command.TpsMessagingPostCommand;
import no.nav.dolly.config.Consumers;
import no.nav.dolly.metrics.Timed;
Expand All @@ -33,7 +32,6 @@ public class TpsMessagingConsumer implements ConsumerStatus {
private static final String BASE_URL = "/api/v1/personer/{ident}";
private static final String UTENLANDSK_BANKKONTO_URL = BASE_URL + "/bankkonto-utenlandsk";
private static final String NORSK_BANKKONTO_URL = BASE_URL + "/bankkonto-norsk";
private static final String SIKKERHETSTILTAK_URL = BASE_URL + "/sikkerhetstiltak";
private static final String SPRAAKKODE_URL = BASE_URL + "/spraakkode";

private final WebClient webClient;
Expand Down Expand Up @@ -71,21 +69,6 @@ public Flux<TpsMeldingResponseDTO> sendNorskBankkontoRequest(String ident, List<
new TpsMessagingPostCommand(webClient, ident, miljoer, body, NORSK_BANKKONTO_URL, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_deleteSikkerhetstiltak"})
public Flux<TpsMeldingResponseDTO> deleteSikkerhetstiltakRequest(String ident, List<String> miljoer) {

return tokenService.exchange(serverProperties)
.flatMapMany(token -> new SikkerhetstiltakDeleteCommand(webClient, ident, miljoer, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_createSikkerhetstiltak"})
public Flux<TpsMeldingResponseDTO> sendSikkerhetstiltakRequest(String ident, List<String> miljoer, Object body) {

return tokenService.exchange(serverProperties)
.flatMapMany(token ->
new TpsMessagingPostCommand(webClient, ident, miljoer, body, SIKKERHETSTILTAK_URL, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "tps_messaging_createSkjerming"})
public Flux<TpsMeldingResponseDTO> sendEgenansattRequest(String ident, List<String> miljoer, LocalDate fraOgMed) {

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ public static BoolQueryBuilder buildTyperQuery(ElasticTyper[] typer) {
return queryBuilder;
}

public static BoolQueryBuilder buildSearchQuery(String ident) {

return QueryBuilders.boolQuery()
.must(getRandomScoreQueryBuilder())
.must(QueryBuilders.matchQuery("identer", ident));
}

private void setPersonQuery(BoolQueryBuilder queryBuilder, SearchRequest request) {

Optional.ofNullable(request.getPersonRequest())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ public Mono<RsWhereAmI> navigerTilTestident(@PathVariable String ident) {
return navigasjonService.navigerTilIdent(ident);
}

@Operation(description = "Sjekk om ønsket testperson finnes i Dolly")
@GetMapping("/finnes/{ident}")
public Boolean finnesTestident(@PathVariable String ident) {

return identService.exists(ident);
}

@Operation(description = "Send ønsket testperson til miljø")
@Transactional
@PostMapping("/ident/{ident}/ordre")
Expand Down
4 changes: 2 additions & 2 deletions apps/dolly-frontend/config.idporten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
- application: testnav-miljoer-service
- application: testnav-organisasjon-service
- application: testnav-organisasjon-forvalter
- application: oppsummeringsdokument-service
- application: testnav-oppsummeringsdokument-service
- application: testnorge-profil-api
- application: testnav-organisasjon-tilgang-service
- application: testnav-joark-dokument-service
Expand Down Expand Up @@ -79,7 +79,7 @@ spec:
path: /internal/metrics
resources:
requests:
cpu: 1000m
cpu: 250m
memory: 1024Mi
limits:
memory: 2048Mi
Expand Down
4 changes: 2 additions & 2 deletions apps/dolly-frontend/config.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
- application: testnav-organisasjon-forvalter
- application: testnorge-profil-api-dev
- application: testnav-organisasjon-tilgang-service
- application: oppsummeringsdokument-service
- application: testnav-oppsummeringsdokument-service
- application: testnav-joark-dokument-service
- application: testnav-organisasjon-faste-data-service
- application: testnav-tps-messaging-service
Expand Down Expand Up @@ -87,7 +87,7 @@ spec:
path: /internal/metrics
resources:
requests:
cpu: 1000m
cpu: 500m
memory: 1024Mi
limits:
memory: 2048Mi
Expand Down
Loading

0 comments on commit 6e0a0a1

Please sign in to comment.