Skip to content

Commit

Permalink
Merge branch 'master' into feature/callid-pensjon
Browse files Browse the repository at this point in the history
# Conflicts:
#	apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreAlderspensjonCommand.java
#	apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagrePoppInntektCommand.java
#	apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreTpForholdCommand.java
#	apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreTpYtelseCommand.java
#	apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreUforetrygdCommand.java
  • Loading branch information
stigus committed Apr 2, 2024
2 parents dbe0124 + e86810f commit 6d6516f
Show file tree
Hide file tree
Showing 252 changed files with 5,935 additions and 1,090 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/app.ereg-batch-status-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
workflow:
uses: ./.github/workflows/common.workflow.backend.yml
with:
cluster: "dev-fss"
cluster: "dev-gcp"
working-directory: "apps/ereg-batch-status-service"
deploy-tag: "#deploy-ereg-batch-status-service"
permissions:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/app.team-dolly-lokal-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: team-dolly-lokal-app

on:
push:
paths:
- .nais/team-dolly-lokal-app.yml
- .github/workflows/app.team-dolly-lokal-app.yml

jobs:
deploy:
name: Deploy team-dolly-lokal-app
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/team-dolly-lokal-app.yml
35 changes: 0 additions & 35 deletions .github/workflows/build.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Integration Tests
on:
push:
branches:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/proxy.modapp-ereg-proxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: modapp-ereg-proxy

on:
push:
paths:
- libs/reactive-core
- libs/reactive-proxy
- libs/reactive-security
- libs/security-core
- proxies/modapp-ereg-proxy/**
- .github/workflows/proxy.modapp-ereg-proxy.yml

jobs:
workflow:
uses: ./.github/workflows/common.workflow.backend.yml
with:
cluster: "dev-fss"
working-directory: "proxies/modapp-ereg-proxy"
deploy-tag: "#deploy-proxy"
permissions:
contents: read
id-token: write
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.idea/
*target/
*.iml
*.http

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

Expand Down
18 changes: 18 additions & 0 deletions .nais/team-dolly-lokal-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: nais.io/v1
kind: AzureAdApplication
metadata:
labels:
team: dolly
name: team-dolly-lokal-app
namespace: dolly
spec:
allowAllUsers: true
logoutUrl: https://localhost:8080/oauth2/logout
preAuthorizedApplications:
- application: testnorge-oversikt-frontend
cluster: dev-gcp
namespace: dolly
replyUrls:
- url: http://localhost:8080/login/oauth2/code/aad
secretName: azuread-team-dolly-lokal-app
tenant: nav.no
2 changes: 2 additions & 0 deletions apps/adresse-service/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ spec:
- application: app-1
namespace: plattformsikkerhet
cluster: dev-gcp
- application: testnav-endringsmelding-service
cluster: dev-gcp
outbound:
external:
- host: testnav-pdl-proxy.dev-fss-pub.nais.io
4 changes: 3 additions & 1 deletion apps/adresse-service/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ management:
server:
servlet:
encoding:
charset: UTF-8
charset: UTF-8
error:
include-message: always
4 changes: 3 additions & 1 deletion apps/amelding-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ management:
server:
servlet:
encoding:
charset: UTF-8
charset: UTF-8
error:
include-message: always
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ management:
server:
servlet:
encoding:
charset: UTF-8
charset: UTF-8
error:
include-message: always
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ management:
server:
servlet:
encoding:
charset: UTF-8
charset: UTF-8
error:
include-message: always
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ server:
servlet:
encoding:
charset: UTF-8
error:
include-message: always

consumers:
dolly-backend:
Expand Down
4 changes: 3 additions & 1 deletion apps/brreg-stub/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ management:
server:
servlet:
encoding:
charset: UTF-8
charset: UTF-8
error:
include-message: always
4 changes: 3 additions & 1 deletion apps/bruker-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ management:
server:
servlet:
encoding:
charset: UTF-8
charset: UTF-8
error:
include-message: always
7 changes: 7 additions & 0 deletions apps/budpro-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ consumers:
app:
security:
allow-api: true

server:
servlet:
encoding:
charset: UTF-8
error:
include-message: always
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public static void main(String[] args) {

SpringApplication.run(DollyBackendApplicationStarter.class, args);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
var initStatus = miljoer.stream()
.map(miljo -> String.format("%s:%s", miljo, getInfoVenter(SYSTEM)))
.collect(Collectors.joining(","));

transactionHelperService.persister(progress, BestillingProgress::getAaregStatus,
BestillingProgress::setAaregStatus, initStatus);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import no.nav.testnav.libs.dto.ameldingservice.v1.VirksomhetDTO;
import no.nav.testnav.libs.securitycore.domain.ServerProperties;
import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange;
import org.slf4j.event.Level;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;
Expand All @@ -30,7 +31,6 @@ public class AmeldingConsumer {

private static final String JURIDISK_ENHET_IKKE_FUNNET = "Feil= Juridisk enhet for organisasjon(ene): %s ble ikke funnet i miljø";
private static final DateTimeFormatter YEAR_MONTH = DateTimeFormatter.ofPattern("yyyy-MM");

private final TokenExchange tokenService;
private final WebClient webClient;
private final ServerProperties serverProperties;
Expand All @@ -41,8 +41,8 @@ public AmeldingConsumer(
Consumers consumers,
ObjectMapper objectMapper,
ErrorStatusDecoder errorStatusDecoder,
WebClient.Builder webClientBuilder
) {
WebClient.Builder webClientBuilder) {

this.tokenService = tokenService;
serverProperties = consumers.getTestnavAmeldingService();
this.webClient = webClientBuilder
Expand All @@ -52,7 +52,7 @@ public AmeldingConsumer(
this.errorStatusDecoder = errorStatusDecoder;
}

@Timed(name = "providers", tags = { "operation", "amelding_put" })
@Timed(name = "providers", tags = {"operation", "amelding_put"})
public Flux<String> sendAmeldinger(List<AMeldingDTO> ameldinger, String miljoe) {

return tokenService.exchange(serverProperties)
Expand All @@ -67,9 +67,13 @@ public Flux<String> sendAmeldinger(List<AMeldingDTO> ameldinger, String miljoe)
log.info("Sender Amelding {} til miljø {}: {}",
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()));
errorStatusDecoder.getErrorText(HttpStatus.valueOf(status.getStatusCode().value()), status.getBody()))
.doOnNext(status ->
log.atLevel("OK".equals(status) ? Level.INFO : Level.ERROR)
.log("Ameldingstatus: {}, miljoe: {}, kalendermåned: {}, organisasjon: {}",
status, miljoe, amelding.getKalendermaaned(),
amelding.getOpplysningspliktigOrganisajonsnummer()));
}
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import reactor.core.publisher.Mono;

import java.util.Collection;
import java.util.Comparator;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
Expand All @@ -25,7 +26,7 @@
@Slf4j
public class AmeldingService {

private static final String STATUS_ELEMENT = "%s: arbforhold=1$%s";
private static final String STATUS_ELEMENT = "%s:Amelding$%s";

private final AmeldingConsumer ameldingConsumer;
private final MapperFacade mapperFacade;
Expand All @@ -34,7 +35,7 @@ public class AmeldingService {
public Mono<String> sendAmelding(RsDollyUtvidetBestilling bestilling, DollyPerson dollyPerson,
Set<String> miljoer) {

var orgnumre = bestilling.getAareg().get(0).getAmelding().stream()
var orgnumre = bestilling.getAareg().getFirst().getAmelding().stream()
.map(RsAmeldingRequest::getArbeidsforhold)
.flatMap(Collection::stream)
.map(RsArbeidsforholdAareg::getArbeidsgiver)
Expand All @@ -46,14 +47,15 @@ public Mono<String> sendAmelding(RsDollyUtvidetBestilling bestilling, DollyPerso
.filter(OrganisasjonDTO::isFunnet)
.collect(Collectors.toMap(OrganisasjonDTO::getOrgnummer, OrganisasjonDTO::getJuridiskEnhet))
.flatMapMany(organisasjon ->
prepareAmeldinger(bestilling.getAareg().get(0), dollyPerson.getIdent(),
prepareAmeldinger(bestilling.getAareg().getFirst(), dollyPerson.getIdent(),
organisasjon, miljoe))
.collect(Collectors.joining(",")))
.flatMap(Flux::from)
.collect(Collectors.joining(","));
}

private Flux<String> prepareAmeldinger(RsAareg aareg, String ident, Map<String, String> organisasjon, String miljoe) {
private Flux<String> prepareAmeldinger(RsAareg aareg, String ident, Map<String, String> organisasjon,
String miljoe) {

var context = new MappingContext.Factory().getContext();
context.setProperty("personIdent", ident);
Expand All @@ -62,9 +64,10 @@ private Flux<String> prepareAmeldinger(RsAareg aareg, String ident, Map<String,

return Flux.fromIterable(aareg.getAmelding())
.map(aamelding -> mapperFacade.map(aamelding, AMeldingDTO.class, context))
.sort(Comparator.comparing(AMeldingDTO::getKalendermaaned))
.collectList()
.flatMapMany(reultat -> ameldingConsumer.sendAmeldinger(reultat, miljoe)
.flatMapMany(ameldinger -> ameldingConsumer.sendAmeldinger(ameldinger, miljoe)
.distinct()
.map(status -> String.format(STATUS_ELEMENT, miljoe, status)));
.map(status -> STATUS_ELEMENT.formatted(miljoe, status)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -54,16 +55,21 @@ public void mapAtoB(RsAmeldingRequest rsAmelding,
amelding.setKalendermaaned(LocalDate.of(Integer.parseInt(date[0]), Integer.parseInt(date[1]), 1));
var opplysningsPliktig = (Map<String, String>) context.getProperty("opplysningspliktig");

amelding.setOpplysningspliktigOrganisajonsnummer(opplysningsPliktig.get(rsAmelding.getArbeidsforhold().get(0).getArbeidsgiver().getOrgnummer()));
amelding.setOpplysningspliktigOrganisajonsnummer(opplysningsPliktig.get(rsAmelding.getArbeidsforhold()
.getFirst().getArbeidsgiver().getOrgnummer()));

var virksomheter = mapperFacade.mapAsList(rsAmelding.getArbeidsforhold(), Virksomhet.class, context);
virksomheter.forEach(virksomhet -> {
var arbForholdId = new AtomicInteger(0);
virksomhet.getPersoner()
.forEach(person -> person.getArbeidsforhold()
.forEach(arbeidsforhold -> arbeidsforhold
.setArbeidsforholdId(Integer.toString(arbForholdId.incrementAndGet()))));
});
var arbeidsForholdIder = new HashMap<String, AtomicInteger>();
virksomheter
.forEach(virksomhet -> virksomhet.getPersoner().forEach(person ->
arbeidsForholdIder.put(virksomhet.getOrganisajonsnummer()+person.getIdent(),
new AtomicInteger(0))));
virksomheter.forEach(virksomhet -> virksomhet.getPersoner()
.forEach(person -> person.getArbeidsforhold()
.forEach(arbeidsforhold -> arbeidsforhold
.setArbeidsforholdId(Integer.toString(
arbeidsForholdIder.get(virksomhet.getOrganisajonsnummer()+person.getIdent())
.incrementAndGet())))));
var ameldingVirksomheter = virksomheter.stream().map(virksomhet ->
VirksomhetDTO.builder()
.organisajonsnummer(virksomhet.getOrganisajonsnummer())
Expand Down Expand Up @@ -94,12 +100,14 @@ public void mapAtoB(RsArbeidsforholdAareg rsArbeidsforholdAareg, Virksomhet virk
getDate(rsArbeidsforholdAareg.getAnsettelsesPeriode().getTom()) : null)
.antallTimerPerUke(
!rsArbeidsforholdAareg.getAntallTimerForTimeloennet().isEmpty() ?
rsArbeidsforholdAareg.getAntallTimerForTimeloennet().get(0).getAntallTimer().floatValue() :
rsArbeidsforholdAareg.getAntallTimerForTimeloennet()
.getFirst().getAntallTimer().floatValue() :
getAvtaltArbeidstidPerUke(rsArbeidsforholdAareg))
.arbeidsforholdType((String) context.getProperty("arbeidsforholdstype"))
.arbeidstidsordning(rsArbeidsforholdAareg.getArbeidsavtale().getArbeidstidsordning())
.fartoey(nonNull(rsArbeidsforholdAareg.getFartoy()) && !rsArbeidsforholdAareg.getFartoy().isEmpty() ?
mapperFacade.map(rsArbeidsforholdAareg.getFartoy().get(0), FartoeyDTO.class) : null)
mapperFacade.map(rsArbeidsforholdAareg.getFartoy()
.getFirst(), FartoeyDTO.class) : null)
.inntekter(
(nonNull(rsArbeidsforholdAareg.getUtenlandsopphold()) &&
!rsArbeidsforholdAareg.getUtenlandsopphold().isEmpty()) ||
Expand Down
Loading

0 comments on commit 6d6516f

Please sign in to comment.