Skip to content

Commit

Permalink
Remove TPS person status related services and tests (#3415)
Browse files Browse the repository at this point in the history
Fjerner TPS-sync ved bestilling
  • Loading branch information
krharum authored Feb 13, 2024
1 parent f3edff5 commit f6fbd8e
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 673 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public class PensjonforvalterClient implements ClientRegister {
private static final String PEN_ALDERSPENSJON = "AP#";
private static final String PEN_UFORETRYGD = "Ufoer#";
private static final String PERIODE = "/periode/";
private static final String TPS_NOT_READY = "Oppretting ikke utført da TPS mangler persondata.";

private final PensjonforvalterConsumer pensjonforvalterConsumer;
private final MapperFacade mapperFacade;
Expand Down Expand Up @@ -173,8 +172,7 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
.flatMap(pensjon -> Flux.merge(

lagreInntekt(pensjon,
dollyPerson.getIdent(), bestilteMiljoer.get(),
progress.getIsTpsSyncEnv())
dollyPerson.getIdent(), bestilteMiljoer.get())
.map(response -> POPP_INNTEKTSREGISTER + decodeStatus(response, dollyPerson.getIdent())),

lagreTpForhold(pensjon, dollyPerson.getIdent(), bestilteMiljoer.get())
Expand All @@ -192,8 +190,7 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
dollyPerson.getIdent(),
bestilteMiljoer.get(),
isOpprettEndre,
bestillingId,
progress.getIsTpsSyncEnv())
bestillingId)
.map(response -> PEN_ALDERSPENSJON + decodeStatus(response, dollyPerson.getIdent())),

lagreUforetrygd(
Expand All @@ -202,8 +199,7 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
dollyPerson.getIdent(),
bestilteMiljoer.get(),
isOpprettEndre,
bestillingId,
progress.getIsTpsSyncEnv())
bestillingId)
.map(response -> PEN_UFORETRYGD + decodeStatus(response, dollyPerson.getIdent()))
)
.collectList()
Expand Down Expand Up @@ -368,8 +364,7 @@ private Flux<PensjonforvalterResponse> opprettPersoner(String hovedperson, Set<S
private Flux<PensjonforvalterResponse> lagreAlderspensjon(PensjonData pensjonData,
Tuple2<List<PdlPersonBolk.PersonBolk>, String> utvidetPersondata,
String ident, Set<String> miljoer,
boolean isOpprettEndre, Long bestillingId,
List<String> isTpsSyncEnv) {
boolean isOpprettEndre, Long bestillingId) {

return Flux.just(pensjonData)
.filter(PensjonData::hasAlderspensjon)
Expand All @@ -379,38 +374,32 @@ private Flux<PensjonforvalterResponse> lagreAlderspensjon(PensjonData pensjonDat

if (isOpprettEndre || !transaksjonMappingService.existAlready(PEN_AP, ident, miljoe, null)) {

if (isTpsSyncEnv.contains(miljoe)) {
AlderspensjonRequest pensjonRequest;
var context = new MappingContext.Factory().getContext();
context.setProperty(IDENT, ident);
context.setProperty(MILJOER, List.of(miljoe));

AlderspensjonRequest pensjonRequest;
var context = new MappingContext.Factory().getContext();
context.setProperty(IDENT, ident);
context.setProperty(MILJOER, List.of(miljoe));

if (isTrue(alderspensjon.getSoknad())) {
context.setProperty("relasjoner", utvidetPersondata.getT1());
pensjonRequest = mapperFacade.map(alderspensjon, AlderspensjonSoknadRequest.class, context);

} else {
context.setProperty(NAV_ENHET, utvidetPersondata.getT2());
pensjonRequest = mapperFacade.map(alderspensjon, AlderspensjonVedtakRequest.class, context);
}

var finalPensjonRequest = new AtomicReference<>(pensjonRequest);
return pensjonforvalterConsumer.lagreAlderspensjon(pensjonRequest)
.map(response -> {
response.getStatus().forEach(status -> {
if (status.getResponse().isResponse2xx()) {
saveAPTransaksjonId(ident, status.getMiljo(), bestillingId,
PEN_AP, finalPensjonRequest);
}
});
return response;
});
if (isTrue(alderspensjon.getSoknad())) {
context.setProperty("relasjoner", utvidetPersondata.getT1());
pensjonRequest = mapperFacade.map(alderspensjon, AlderspensjonSoknadRequest.class, context);

} else {
return getStatus(miljoe, 503, TPS_NOT_READY);
context.setProperty(NAV_ENHET, utvidetPersondata.getT2());
pensjonRequest = mapperFacade.map(alderspensjon, AlderspensjonVedtakRequest.class, context);
}

var finalPensjonRequest = new AtomicReference<>(pensjonRequest);
return pensjonforvalterConsumer.lagreAlderspensjon(pensjonRequest)
.map(response -> {
response.getStatus().forEach(status -> {
if (status.getResponse().isResponse2xx()) {
saveAPTransaksjonId(ident, status.getMiljo(), bestillingId,
PEN_AP, finalPensjonRequest);
}
});
return response;
});

} else {
return getStatus(miljoe, 200, "OK");
}
Expand All @@ -419,7 +408,7 @@ private Flux<PensjonforvalterResponse> lagreAlderspensjon(PensjonData pensjonDat

private Flux<PensjonforvalterResponse> lagreUforetrygd(PensjonData pensjondata, String navEnhetNr,
String ident, Set<String> miljoer, boolean isOpprettEndre,
Long bestillingId, List<String> isTpsSyncEnv) {
Long bestillingId) {

return Flux.just(pensjondata)
.filter(PensjonData::hasUforetrygd)
Expand All @@ -429,8 +418,6 @@ private Flux<PensjonforvalterResponse> lagreUforetrygd(PensjonData pensjondata,

if (isOpprettEndre || !transaksjonMappingService.existAlready(PEN_UT, ident, miljoe, null)) {

if (isTpsSyncEnv.contains(miljoe)) {

var context = MappingContextUtils.getMappingContext();
context.setProperty(IDENT, ident);
context.setProperty(MILJOER, List.of(miljoe));
Expand All @@ -446,10 +433,6 @@ private Flux<PensjonforvalterResponse> lagreUforetrygd(PensjonData pensjondata,
return response;
}));

} else {
return getStatus(miljoe, 503, TPS_NOT_READY);
}

} else {
return getStatus(miljoe, 200, "OK");
}
Expand Down Expand Up @@ -490,24 +473,18 @@ private void saveAPTransaksjonId(String ident, String miljoe, Long bestillingId,
}

private Flux<PensjonforvalterResponse> lagreInntekt(PensjonData pensjonData, String ident,
Set<String> miljoer, List<String> isTpsSyncEnv) {
Set<String> miljoer) {

return Flux.just(pensjonData)
.filter(PensjonData::hasInntekt)
.map(PensjonData::getInntekt)
.flatMap(inntekt -> Flux.fromIterable(miljoer)
.flatMap(miljoe -> {

if (isTpsSyncEnv.stream().anyMatch(sync -> sync.equals(miljoe))) {

var request = mapperFacade.map(inntekt, PensjonPoppInntektRequest.class);
request.setFnr(ident);
request.setMiljoer(List.of(miljoe));
return pensjonforvalterConsumer.lagreInntekter(request);

} else {
return getStatus(miljoe, 503, TPS_NOT_READY);
}
var request = mapperFacade.map(inntekt, PensjonPoppInntektRequest.class);
request.setFnr(ident);
request.setMiljoer(List.of(miljoe));
return pensjonforvalterConsumer.lagreInntekter(request);
}));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import no.nav.dolly.bestilling.pdldata.dto.PdlResponse;
import no.nav.dolly.bestilling.pensjonforvalter.PensjonforvalterClient;
import no.nav.dolly.bestilling.tagshendelseslager.TagsHendelseslagerClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.jpa.Bruker;
Expand Down Expand Up @@ -63,7 +62,6 @@ public class DollyBestillingService {
protected final PdlDataConsumer pdlDataConsumer;
protected final ErrorStatusDecoder errorStatusDecoder;
protected final TransactionHelperService transactionHelperService;
protected final TpsPersonService tpsPersonService;
protected final BestillingElasticRepository bestillingElasticRepository;

public static Set<String> getEnvironments(String miljoer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import no.nav.dolly.bestilling.pdldata.PdlDataConsumer;
import no.nav.dolly.bestilling.pdldata.dto.PdlResponse;
import no.nav.dolly.bestilling.personservice.PersonServiceClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.elastic.BestillingElasticRepository;
Expand Down Expand Up @@ -52,7 +51,6 @@ public GjenopprettBestillingService(
PdlDataConsumer pdlDataConsumer,
TransactionHelperService transactionHelperService,
PersonServiceClient personServiceClient,
TpsPersonService tpsPersonService,
BestillingElasticRepository bestillingElasticRepository
) {
super(
Expand All @@ -65,7 +63,6 @@ public GjenopprettBestillingService(
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService,
tpsPersonService,
bestillingElasticRepository
);
this.bestillingProgressService = bestillingProgressService;
Expand Down Expand Up @@ -101,8 +98,6 @@ public void executeAsync(Bestilling bestilling) {
.filter(BestillingProgress::isPdlSync)
.flatMap(pdlSync -> createBestilling(bestilling, gmlProgress.getBestilling()))
.flatMap(cobestilling -> Flux.concat(
tpsPersonService.syncPerson(dollyPerson, cobestilling, progress)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, cobestilling,
fase2Klienter(),
progress, false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import no.nav.dolly.bestilling.pdldata.PdlDataConsumer;
import no.nav.dolly.bestilling.pdldata.dto.PdlResponse;
import no.nav.dolly.bestilling.personservice.PersonServiceClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.elastic.BestillingElasticRepository;
Expand Down Expand Up @@ -51,7 +50,6 @@ public GjenopprettGruppeService(
PdlDataConsumer pdlDataConsumer,
TransactionHelperService transactionHelperService,
PersonServiceClient personServiceClient,
TpsPersonService tpsPersonService,
BestillingElasticRepository bestillingElasticRepository
) {
super(
Expand All @@ -64,7 +62,6 @@ public GjenopprettGruppeService(
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService,
tpsPersonService,
bestillingElasticRepository
);
this.personServiceClient = personServiceClient;
Expand Down Expand Up @@ -110,8 +107,6 @@ public void executeAsync(Bestilling bestilling) {
.doOnNext(request -> log.info("Startet gjenopprett bestilling {} for ident: {}",
request.getId(), testident.getIdent()))
.flatMapSequential(bestillingRequest -> Flux.concat(
tpsPersonService.syncPerson(dollyPerson, bestillingRequest, progress)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, bestillingRequest,
fase2Klienter(),
progress, false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import no.nav.dolly.bestilling.pdldata.PdlDataConsumer;
import no.nav.dolly.bestilling.pdldata.dto.PdlResponse;
import no.nav.dolly.bestilling.personservice.PersonServiceClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.resultset.RsDollyBestillingRequest;
Expand Down Expand Up @@ -53,7 +52,6 @@ public GjenopprettIdentService(
PdlDataConsumer pdlDataConsumer,
TransactionHelperService transactionHelperService,
PersonServiceClient personServiceClient,
TpsPersonService tpsPersonService,
BestillingElasticRepository bestillingElasticRepository
) {
super(
Expand All @@ -66,7 +64,6 @@ public GjenopprettIdentService(
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService,
tpsPersonService,
bestillingElasticRepository
);
this.personServiceClient = personServiceClient;
Expand Down Expand Up @@ -116,9 +113,6 @@ public void executeAsync(Bestilling bestilling) {
log.info("Startet gjenopprett bestilling {} for ident: {}",
request.getId(), testident.getIdent()))
.flatMap(bestillingRequest -> Flux.concat(
tpsPersonService.syncPerson(dollyPerson, bestillingRequest,
progress)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, bestillingRequest,
fase2Klienter(),
progress, false),
Expand Down
Loading

0 comments on commit f6fbd8e

Please sign in to comment.