Skip to content

Commit

Permalink
Endret transaksjonsId til å kun returnere inntekten som gjelder for d…
Browse files Browse the repository at this point in the history
…et innsendte dokumentet

#deploy-test-dolly-backend
  • Loading branch information
stigus committed Oct 11, 2023
1 parent accdc51 commit 90b6e49
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.List;
import java.util.stream.Collectors;

import static java.util.Collections.singletonList;
import static java.util.Objects.nonNull;
import static no.nav.dolly.domain.resultset.SystemTyper.INNTKMELD;
import static org.apache.commons.lang3.StringUtils.isBlank;
Expand Down Expand Up @@ -70,6 +71,12 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
return Flux.empty();
}

@Override
public void release(List<String> identer) {

// Inntektsmelding mangler pt. sletting
}

private ClientFuture futurePersist(BestillingProgress progress, String status) {

return () -> {
Expand All @@ -78,12 +85,6 @@ private ClientFuture futurePersist(BestillingProgress progress, String status) {
};
}

@Override
public void release(List<String> identer) {

// Inntektsmelding mangler pt. sletting
}

private Flux<String> postInntektsmelding(boolean isSendMelding,
InntektsmeldingRequest inntektsmeldingRequest, Long bestillingid) {

Expand All @@ -94,17 +95,27 @@ private Flux<String> postInntektsmelding(boolean isSendMelding,

transaksjonMappingService.saveAll(
response.getDokumenter().stream()
.map(dokument -> TransaksjonMapping.builder()
.ident(inntektsmeldingRequest.getArbeidstakerFnr())
.bestillingId(bestillingid)
.transaksjonId(toJson(TransaksjonMappingDTO.builder()
.request(inntektsmeldingRequest)
.dokument(dokument)
.build()))
.datoEndret(LocalDateTime.now())
.miljoe(inntektsmeldingRequest.getMiljoe())
.system(INNTKMELD.name())
.build())
.map(dokument -> {
var gjeldendeInntektRequest = InntektsmeldingRequest.builder()
.arbeidstakerFnr(inntektsmeldingRequest.getArbeidstakerFnr())
.inntekter(singletonList(
inntektsmeldingRequest.getInntekter().get(response.getDokumenter().indexOf(dokument))))
.joarkMetadata(inntektsmeldingRequest.getJoarkMetadata())
.miljoe(inntektsmeldingRequest.getMiljoe())
.build();

return TransaksjonMapping.builder()
.ident(inntektsmeldingRequest.getArbeidstakerFnr())
.bestillingId(bestillingid)
.transaksjonId(toJson(TransaksjonMappingDTO.builder()
.request(gjeldendeInntektRequest)
.dokument(dokument)
.build()))
.datoEndret(LocalDateTime.now())
.miljoe(inntektsmeldingRequest.getMiljoe())
.system(INNTKMELD.name())
.build();
})
.toList());

return inntektsmeldingRequest.getMiljoe() + ":OK";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.time.LocalDateTime;
import java.util.List;

@Builder
@Getter
@Setter
@NoArgsConstructor
Expand Down

0 comments on commit 90b6e49

Please sign in to comment.