Skip to content

Commit

Permalink
Multiple transaksjonsmappinger, rettet feil #deploy-test-dolly-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
krharum committed Sep 27, 2023
1 parent b712b13 commit e8d2c37
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ private Flux<PensjonforvalterResponse> lagreAlderspensjon(PensjonData pensjonDat
.flatMap(alderspensjon -> Flux.fromIterable(miljoer)
.flatMap(miljoe -> {

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

if (isTpsSyncEnv.contains(miljoe)) {

Expand Down Expand Up @@ -350,7 +350,7 @@ private Flux<PensjonforvalterResponse> lagreUforetrygd(PensjonData pensjondata,
.flatMap(uforetrygd -> Flux.fromIterable(miljoer)
.flatMap(miljoe -> {

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

if (isTpsSyncEnv.contains(miljoe)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import no.nav.dolly.util.WebClientFilter;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
import reactor.util.retry.Retry;

import java.time.Duration;
import java.util.Arrays;
import java.util.concurrent.Callable;

Expand Down Expand Up @@ -42,8 +40,6 @@ public Mono<PensjonSamboerResponse> call() {
.retrieve()
.bodyToMono(PensjonSamboerResponse.class)
.doOnError(WebClientFilter::logErrorMessage)
.retryWhen(Retry.backoff(3, Duration.ofSeconds(5))
.filter(WebClientFilter::is5xxException))
.onErrorResume(error -> Mono.just(pensjonforvalterResponseFromError(miljoe, error)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
import reactor.util.retry.Retry;

import java.time.Duration;
import java.util.Arrays;
import java.util.concurrent.Callable;

Expand Down Expand Up @@ -44,8 +42,6 @@ public Mono<PensjonforvalterResponse> call() {
.toBodilessEntity()
.map(response -> pensjonforvalterResponse(miljoe, HttpStatus.valueOf(response.getStatusCode().value())))
.doOnError(WebClientFilter::logErrorMessage)
.retryWhen(Retry.backoff(3, Duration.ofSeconds(5))
.filter(WebClientFilter::is5xxException))
.onErrorResume(error -> Mono.just(pensjonforvalterResponseFromError(miljoe, error)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;

import java.time.LocalDate;
Expand All @@ -15,6 +16,7 @@

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static class Response {
private String path;

public boolean isResponse2xx() {
return httpStatus.getStatus()>= 200 && httpStatus.getStatus() < 300;
return httpStatus.getStatus() >= 200 && httpStatus.getStatus() < 300;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public void executeAsync(Bestilling bestilling) {
var bestKriterier = getDollyBestillingRequest(bestilling);
if (nonNull(bestKriterier)) {
bestKriterier.setEkskluderEksternePersoner(true);
bestKriterier.setId(bestilling.getOpprettetFraId());

var gamleProgresser = bestillingProgressService.fetchBestillingProgressByBestillingId(bestilling.getOpprettetFraId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void oppdaterPersonAsync(RsDollyUpdateRequest request, Bestilling bestill

log.info("Bestilling med id=#{} med type={} er startet ...", bestilling.getId(), getBestillingType(bestilling));
MDC.put(MDC_KEY_BESTILLING, bestilling.getId().toString());
request.setId(bestilling.getId());

var testident = identService.getTestIdent(bestilling.getIdent());
Flux.just(OriginatorUtility.prepOriginator(request, testident, mapperFacade))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class RsDollyBestilling {

private static final Set<String> EXCLUDE_METHODS = Set.of("getClass", "getMalBestillingNavn", "getEnvironments", "getPdldata");
private static final Set<String> EXCLUDE_METHODS = Set.of("getClass", "getMalBestillingNavn", "getEnvironments", "getPdldata", "getId");

@JsonIgnore
private long id; // Ved gjenopprett vil denne ID kan ha verdi fra bestillingen som gjenopprettes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ public interface IdentRepository extends JpaRepository<Testident, Long> {
@Query(value = "update Testident ti set ti.ident = :newIdent where ti.ident = :oldIdent")
int swapIdent(@Param(value = "oldIdent") String oldIdent, @Param(value = "newIdent") String newIdent);

@Query(value = "select bp.ident as ident, b.id as bestillingid, " +
@Query(value = "select bp.ident as ident, b.id as bestillingId, " +
"b.bestKriterier as bestkriterier, b.miljoer as miljoer from Bestilling b " +
"join BestillingProgress bp on bp.bestilling.id = b.id " +
"and b.gruppe = :gruppe ")
List<GruppeBestillingIdent> getBestillingerFromGruppe(@Param(value = "gruppe") Testgruppe testgruppe);

@Query(value = "select bp.ident as ident, b.id as bestillingid, " +
@Query(value = "select bp.ident as ident, b.id as bestillingId, " +
"b.bestKriterier as bestkriterier, b.miljoer as miljoer from Bestilling b " +
"join BestillingProgress bp on bp.bestilling.id = b.id " +
"and bp.ident = :ident")
Expand Down

0 comments on commit e8d2c37

Please sign in to comment.