diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceClient.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceClient.java index 9b2067db120..8585dd2916f 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceClient.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceClient.java @@ -139,7 +139,11 @@ private Flux>> getIdentWithRelasjoner(DollyPerson .map(PdlPerson.ForelderBarnRelasjon::getRelatertPersonsIdent) .filter(Objects::nonNull), person.getPerson().getFullmakt().stream() - .map(FullmaktDTO::getMotpartsPersonident)) + .map(FullmaktDTO::getMotpartsPersonident), + person.getPerson().getVergemaalEllerFremtidsfullmakt().stream() + .map(PdlPerson.Vergemaal::getVergeEllerFullmektig) + .map(PdlPerson.VergeEllerFullmektig::getMotpartsPersonident) + .filter(Objects::nonNull)) .flatMap(Function.identity()))) .map(ident -> Map.entry(ident, new HashSet<>()))); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/YrkesskadeClient.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/YrkesskadeClient.java new file mode 100644 index 00000000000..84715ee34f3 --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/YrkesskadeClient.java @@ -0,0 +1,119 @@ +package no.nav.dolly.bestilling.yrkesskade; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import ma.glasnost.orika.MapperFacade; +import no.nav.dolly.bestilling.ClientFuture; +import no.nav.dolly.bestilling.ClientRegister; +import no.nav.dolly.bestilling.personservice.PersonServiceConsumer; +import no.nav.dolly.bestilling.yrkesskade.dto.ResponseDTO; +import no.nav.dolly.bestilling.yrkesskade.dto.ResponseDTO.Status; +import no.nav.dolly.domain.jpa.BestillingProgress; +import no.nav.dolly.domain.jpa.TransaksjonMapping; +import no.nav.dolly.domain.resultset.RsDollyUtvidetBestilling; +import no.nav.dolly.domain.resultset.dolly.DollyPerson; +import no.nav.dolly.errorhandling.ErrorStatusDecoder; +import no.nav.dolly.mapper.MappingContextUtils; +import no.nav.dolly.service.TransaksjonMappingService; +import no.nav.dolly.util.TransactionHelperService; +import no.nav.testnav.libs.dto.yrkesskade.v1.YrkesskadeRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Flux; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +import static no.nav.dolly.domain.resultset.SystemTyper.YRKESSKADE; + +@Slf4j +@Service +@RequiredArgsConstructor +public class YrkesskadeClient implements ClientRegister { + + private final MapperFacade mapper; + private final ObjectMapper objectMapper; + private final YrkesskadeConsumer yrkesskadeConsumer; + private final TransactionHelperService transactionHelperService; + private final TransaksjonMappingService transaksjonMappingService; + private final PersonServiceConsumer personServiceConsumer; + + @Override + public Flux gjenopprett(RsDollyUtvidetBestilling bestilling, DollyPerson dollyPerson, BestillingProgress progress, boolean isOpprettEndre) { + + var index = new AtomicInteger(0); + + return Flux.from( + personServiceConsumer.getPdlPersoner(List.of(dollyPerson.getIdent())) + .filter(yrkesskadeRequest -> isOpprettEndre) + .flatMap(personbolk -> Flux.fromIterable(bestilling.getYrkesskader()) + .map(yrkesskade -> { + var context = MappingContextUtils.getMappingContext(); + context.setProperty("ident", dollyPerson.getIdent()); + context.setProperty("personBolk", personbolk); + return mapper.map(yrkesskade, YrkesskadeRequest.class, context); + }) + .flatMap(yrkesskade -> yrkesskadeConsumer.lagreYrkesskade(yrkesskade) + .map(status -> lagreTransaksjon(status, yrkesskade, progress.getBestilling().getId()))) + .map(status -> encodeStatus(status, index.incrementAndGet())) + .collectList() + .map(resultat -> futurePersist(progress, resultat)))); + } + + @Override + public void release(List identer) { + // Er ikke støttet + } + + private ResponseDTO encodeStatus(ResponseEntity status, int index) { + + return ResponseDTO.builder() + .id(index) + .status(status.getStatusCode().is2xxSuccessful() ? Status.OK : Status.FEIL) + .melding(status.getBody()) + .build(); + } + + private ClientFuture futurePersist(BestillingProgress progress, List response) { + + var status = response.stream() + .map(entry -> "Yrkesskade#%d:%s".formatted(entry.getId(), + entry.getStatus() == Status.OK ? "OK" : + "Feil: %s".formatted(ErrorStatusDecoder.encodeStatus(entry.getMelding())))) + .collect(Collectors.joining(",")); + + return () -> { + transactionHelperService.persister(progress, BestillingProgress::setYrkesskadeStatus, status); + return progress; + }; + } + + private ResponseEntity lagreTransaksjon(ResponseEntity status, YrkesskadeRequest request, + Long bestillingId) { + + if (status.getStatusCode().is2xxSuccessful()) { + transaksjonMappingService.save(TransaksjonMapping.builder() + .bestillingId(bestillingId) + .transaksjonId(toJson(request)) + .ident(request.getSkadelidtIdentifikator()) + .datoEndret(LocalDateTime.now()) + .system(YRKESSKADE.name()) + .build()); + } + return status; + } + + private String toJson(Object object) { + + try { + return objectMapper.writeValueAsString(object); + } catch (JsonProcessingException e) { + log.error("Feilet å konvertere transaksjonsId for dokarkiv", e); + } + return null; + } +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/YrkesskadeConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/YrkesskadeConsumer.java new file mode 100644 index 00000000000..d37d893bb36 --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/YrkesskadeConsumer.java @@ -0,0 +1,37 @@ +package no.nav.dolly.bestilling.yrkesskade; + +import no.nav.dolly.bestilling.yrkesskade.command.YrkesskadePostCommand; +import no.nav.dolly.config.Consumers; +import no.nav.testnav.libs.dto.yrkesskade.v1.YrkesskadeRequest; +import no.nav.testnav.libs.securitycore.domain.ServerProperties; +import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.core.publisher.Flux; + +@Service +public class YrkesskadeConsumer { + + private final WebClient webClient; + private final TokenExchange tokenExchange; + private final ServerProperties serverProperties; + + public YrkesskadeConsumer( + TokenExchange tokenExchange, + Consumers consumers, + WebClient.Builder webClientBuilder) { + + this.tokenExchange = tokenExchange; + serverProperties = consumers.getYrkesskadeProxy(); + webClient = webClientBuilder + .baseUrl(serverProperties.getUrl()) + .build(); + } + + public Flux> lagreYrkesskade(YrkesskadeRequest request) { + + return tokenExchange.exchange(serverProperties) + .flatMapMany(token -> new YrkesskadePostCommand(webClient, request, token.getTokenValue()).call()); + } +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/command/YrkesskadePostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/command/YrkesskadePostCommand.java new file mode 100644 index 00000000000..9bd3ee62b05 --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/command/YrkesskadePostCommand.java @@ -0,0 +1,49 @@ +package no.nav.dolly.bestilling.yrkesskade.command; + +import lombok.RequiredArgsConstructor; +import no.nav.testnav.libs.dto.yrkesskade.v1.YrkesskadeRequest; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; +import no.nav.testnav.libs.securitycore.config.UserConstant; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.util.retry.Retry; + +import java.time.Duration; +import java.util.concurrent.Callable; + +import static no.nav.dolly.util.TokenXUtil.getUserJwt; + +@RequiredArgsConstructor +public class YrkesskadePostCommand implements Callable>> { + + private static final String YRKESSKADE_URL = "/api/v1/yrkesskader"; + + private final WebClient webClient; + private final YrkesskadeRequest yrkesskadeRequest; + private final String token; + + @Override + public Flux> call() { + + return webClient + .post() + .uri(uriBuilder -> uriBuilder.path(YRKESSKADE_URL).build()) + .accept(MediaType.APPLICATION_JSON) + .header(HttpHeaders.AUTHORIZATION, "Bearer " + token) + .header(UserConstant.USER_HEADER_JWT, getUserJwt()) + .bodyValue(yrkesskadeRequest) + .retrieve() + .bodyToFlux(ResponseEntity.class) + .map(response -> (new ResponseEntity<>(response.toString(), response.getStatusCode()))) + .doOnError(WebClientFilter::logErrorMessage) + .onErrorResume(throwable -> Mono.just(new ResponseEntity<>( + WebClientFilter.getMessage(throwable), + WebClientFilter.getStatus(throwable)))) + .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) + .filter(WebClientFilter::is5xxException)); + } +} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/dto/ResponseDTO.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/dto/ResponseDTO.java new file mode 100644 index 00000000000..66138b1508e --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/dto/ResponseDTO.java @@ -0,0 +1,19 @@ +package no.nav.dolly.bestilling.yrkesskade.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ResponseDTO { + + public enum Status {OK, FEIL} + + private Integer id; + private Status status; + private String melding; +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/mapper/YrkesskadeMappingStrategy.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/mapper/YrkesskadeMappingStrategy.java new file mode 100644 index 00000000000..9b1ee0b208d --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/yrkesskade/mapper/YrkesskadeMappingStrategy.java @@ -0,0 +1,49 @@ +package no.nav.dolly.bestilling.yrkesskade.mapper; + +import ma.glasnost.orika.CustomMapper; +import ma.glasnost.orika.MapperFactory; +import ma.glasnost.orika.MappingContext; +import no.nav.dolly.domain.PdlPerson; +import no.nav.dolly.domain.PdlPersonBolk; +import no.nav.dolly.mapper.MappingStrategy; +import no.nav.testnav.libs.dto.yrkesskade.v1.YrkesskadeRequest; +import org.springframework.stereotype.Component; + +import java.util.Collection; +import java.util.Objects; + +@Component +public class YrkesskadeMappingStrategy implements MappingStrategy { + + @Override + public void register(MapperFactory factory) { + + factory.classMap(YrkesskadeRequest.class, YrkesskadeRequest.class) + .customize(new CustomMapper<>() { + @Override + public void mapAtoB(YrkesskadeRequest kilde, YrkesskadeRequest destinasjon, MappingContext context) { + + var ident = (String) context.getProperty("ident"); + var personBolk = (PdlPersonBolk) context.getProperty("personBolks"); + + destinasjon.setSkadelidtIdentifikator(ident); + destinasjon.setInnmelderIdentifikator( + switch (destinasjon.getInnmelderrolle()) { + case denSkadelidte -> ident; + case vergeOgForesatt -> personBolk.getData().getHentPersonBolk().stream() + .map(PdlPersonBolk.PersonBolk::getPerson) + .map(PdlPerson.Person::getVergemaalEllerFremtidsfullmakt) + .flatMap(Collection::stream) + .map(PdlPerson.Vergemaal::getVergeEllerFullmektig) + .map(PdlPerson.VergeEllerFullmektig::getMotpartsPersonident) + .filter(Objects::nonNull) + .findFirst() + .orElse(null); + case virksomhetsrepresentant -> destinasjon.getSkadelidtIdentifikator(); + }); + } + }) + .byDefault() + .register(); + } +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java b/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java index 13ff48fa4e2..552dd1854e0 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/config/Consumers.java @@ -45,4 +45,5 @@ public class Consumers { private ServerProperties testnavTpsMessagingService; private ServerProperties testnavUdistubProxy; private ServerProperties testnavSkattekortService; + private ServerProperties yrkesskadeProxy; } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java index aa5ead29790..b7d5586db10 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/jpa/BestillingProgress.java @@ -121,6 +121,9 @@ public class BestillingProgress implements Serializable { @Column(name = "SKATTEKORT_STATUS") private String skattekortStatus; + @Column(name = "YRKESSKADE_STATUS") + private String yrkesskadeStatus; + @Column(name = "master") @Enumerated(EnumType.STRING) private Master master; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/BestilteKriterier.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/BestilteKriterier.java index 21369fd65a2..fe57c6e9900 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/BestilteKriterier.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/BestilteKriterier.java @@ -27,6 +27,7 @@ import no.nav.dolly.domain.resultset.tpsmessagingservice.RsTpsMessaging; import no.nav.dolly.domain.resultset.udistub.model.RsUdiPerson; import no.nav.testnav.libs.data.arbeidsplassencv.v1.ArbeidsplassenCVDTO; +import no.nav.testnav.libs.dto.yrkesskade.v1.YrkesskadeRequest; import java.util.List; @@ -61,4 +62,5 @@ public class BestilteKriterier { private RsSykemelding sykemelding; private ArbeidsplassenCVDTO arbeidsplassenCV; private SkattekortRequestDTO skattekort; + private List yrkesskader; } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/RsDollyBestilling.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/RsDollyBestilling.java index 50c44963069..048cde79b94 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/RsDollyBestilling.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/RsDollyBestilling.java @@ -28,6 +28,7 @@ import no.nav.dolly.domain.resultset.tpsmessagingservice.RsTpsMessaging; import no.nav.dolly.domain.resultset.udistub.model.RsUdiPerson; import no.nav.testnav.libs.data.arbeidsplassencv.v1.ArbeidsplassenCVDTO; +import no.nav.testnav.libs.dto.yrkesskade.v1.YrkesskadeRequest; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; @@ -77,6 +78,7 @@ public class RsDollyBestilling { private RsSkjerming skjerming; private ArbeidsplassenCVDTO arbeidsplassenCV; private SkattekortRequestDTO skattekort; + private List yrkesskader; public List getAareg() { if (isNull(aareg)) { @@ -113,6 +115,13 @@ public List getInstdata() { return instdata; } + public List getYrkesskader() { + if (isNull(yrkesskader)) { + yrkesskader = new ArrayList<>(); + } + return yrkesskader; + } + @JsonIgnore public boolean isNonEmpty() { diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java index 3eae32959e0..63007d3d916 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/domain/resultset/SystemTyper.java @@ -44,7 +44,8 @@ public enum SystemTyper { SYKEMELDING("NAV sykemelding"), TPS_MESSAGING("Meldinger til TPS"), TP_FORVALTER("Tjenestepensjon (TP)"), - UDISTUB("Utlendingsdirektoratet (UDI)"); + UDISTUB("Utlendingsdirektoratet (UDI)"), + YRKESSKADE("Yrkesskade (YRKESSKADE)"); private String beskrivelse; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java index b4a8a33ca60..15a18aaeaab 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/ElasticBestilling.java @@ -26,6 +26,7 @@ import no.nav.dolly.domain.resultset.udistub.model.RsUdiPerson; import no.nav.testnav.libs.data.arbeidsplassencv.v1.ArbeidsplassenCVDTO; import no.nav.testnav.libs.dto.skattekortservice.v1.SkattekortRequestDTO; +import no.nav.testnav.libs.dto.yrkesskade.v1.YrkesskadeRequest; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.domain.Persistable; @@ -97,6 +98,8 @@ public boolean isNew() { @Field private SkattekortRequestDTO skattekort; @Field + private List yrkesskader; + @Field private List identer; @Transient diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingYrkesskadeStatusMapper.java b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingYrkesskadeStatusMapper.java new file mode 100644 index 00000000000..fff9030b7a7 --- /dev/null +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/BestillingYrkesskadeStatusMapper.java @@ -0,0 +1,95 @@ +package no.nav.dolly.mapper; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import no.nav.dolly.domain.jpa.BestillingProgress; +import no.nav.dolly.domain.resultset.RsStatusRapport; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static java.util.Collections.emptyList; +import static no.nav.dolly.domain.resultset.SystemTyper.SKATTEKORT; +import static no.nav.dolly.mapper.AbstractRsStatusMiljoeIdentForhold.decodeMsg; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class BestillingYrkesskadeStatusMapper { + + public static List buildYrkesskadeStatusMap(List progressList) { + + // status org+year ident + Map>> errorEnvIdents = new HashMap<>(); + + progressList.forEach(progress -> { + if (isNotBlank(progress.getSkattekortStatus()) && isNotBlank(progress.getIdent())) { + var entries = progress.getSkattekortStatus().split(","); + for (var entry : entries) { + var orgYear = entry.split(":")[0]; + var status = entry.split(":")[1]; + if (errorEnvIdents.containsKey(status)) { + if (errorEnvIdents.get(status).containsKey(orgYear)) { + errorEnvIdents.get(status).get(orgYear).add(progress.getIdent()); + } else { + errorEnvIdents.get(status).put(orgYear, new HashSet<>(Set.of(progress.getIdent()))); + } + } else { + errorEnvIdents.put(status, new HashMap<>(Map.of(orgYear, new HashSet<>(Set.of(progress.getIdent()))))); + } + } + } + }); + + if (errorEnvIdents.isEmpty()) { + return emptyList(); + + } else { + if (errorEnvIdents.entrySet().stream() + .allMatch(entry -> entry.getKey().equals("Skattekort lagret"))) { + + return errorEnvIdents.values().stream() + .map(entry -> RsStatusRapport.builder() + .id(SKATTEKORT) + .navn(SKATTEKORT.getBeskrivelse()) + .statuser(List.of(RsStatusRapport.Status.builder() + .melding("OK") + .identer(entry.values().stream() + .map(orgYear -> orgYear.stream().toList()) + .flatMap(Collection::stream) + .distinct() + .toList()) + .build())) + .build()) + .toList(); + + } else { + + return errorEnvIdents.entrySet().stream() + .filter(entry -> !entry.getKey().equals("Skattekort lagret")) + .map(entry -> RsStatusRapport.builder() + .id(SKATTEKORT) + .navn(SKATTEKORT.getBeskrivelse()) + .statuser(entry.getValue().entrySet().stream() + .map(orgYear -> RsStatusRapport.Status.builder() + .melding(formatMelding(orgYear.getKey(), entry.getKey())) + .identer(orgYear.getValue().stream().toList()) + .build()) + .toList()) + .build()) + .toList(); + } + } + } + + private static String formatMelding(String orgYear, String melding) { + + return "FEIL: organisasjon:%s, inntektsår:%s, melding:%s".formatted( + orgYear.split("\\+")[0], + orgYear.split("\\+")[1], + decodeMsg(melding)); + } +} diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java index 980af17af28..bf6bc1c59b9 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/mapper/strategy/BestillingStatusMappingStrategy.java @@ -43,6 +43,7 @@ import static no.nav.dolly.mapper.BestillingSykemeldingStatusMapper.buildSykemeldingStatusMap; import static no.nav.dolly.mapper.BestillingTpsMessagingStatusMapper.buildTpsMessagingStatusMap; import static no.nav.dolly.mapper.BestillingUdiStubStatusMapper.buildUdiStubStatusMap; +import static no.nav.dolly.mapper.BestillingYrkesskadeStatusMapper.buildYrkesskadeStatusMap; import static org.apache.commons.lang3.StringUtils.isBlank; @Slf4j @@ -105,6 +106,7 @@ public void mapAtoB(Bestilling bestilling, RsBestillingStatus bestillingStatus, bestillingStatus.getStatus().addAll(buildSkjermingsRegisterStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildArbeidsplassenCVStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildSkattekortStatusMap(progresser)); + bestillingStatus.getStatus().addAll(buildYrkesskadeStatusMap(progresser)); bestillingStatus.getStatus().addAll(buildAnnenFeilStatusMap(progresser)); } }) diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java index 5ab6be48e40..af84fb9129a 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/service/BestillingService.java @@ -409,6 +409,7 @@ public String getBestKriterier(RsDollyBestilling request) { .sykemelding(request.getSykemelding()) .arbeidsplassenCV(request.getArbeidsplassenCV()) .skattekort(request.getSkattekort()) + .yrkesskader(request.getYrkesskader()) .build()); } diff --git a/apps/dolly-backend/src/main/resources/application-local.yaml b/apps/dolly-backend/src/main/resources/application-local.yaml index 0d82f5cf55b..00fe3f9ac22 100644 --- a/apps/dolly-backend/src/main/resources/application-local.yaml +++ b/apps/dolly-backend/src/main/resources/application-local.yaml @@ -62,4 +62,6 @@ consumers: testnav-kodeverk-service: url: https://testnav-kodeverk-service.intern.dev.nav.no testnav-skattekort-service: - url: https://testnav-skattekort-service.intern.dev.nav.no \ No newline at end of file + url: https://testnav-skattekort-service.intern.dev.nav.no + yrkesskade-proxy: + url: https://testnav-yrkesskade-proxy.intern.dev.nav.no \ No newline at end of file diff --git a/apps/dolly-backend/src/main/resources/application.yaml b/apps/dolly-backend/src/main/resources/application.yaml index 054493fae3c..1bfe69daf7e 100644 --- a/apps/dolly-backend/src/main/resources/application.yaml +++ b/apps/dolly-backend/src/main/resources/application.yaml @@ -244,4 +244,9 @@ consumers: namespace: dolly url: http://testnav-skattekort-service.dolly.svc.cluster.local cluster: dev-gcp + yrkesskade-proxy: + name: testnav-yrkesskade-proxy + namespace: dolly + url: http://testnav-yrkesskade-proxy.dolly.svc.cluster.local + cluster: dev-gcp \ No newline at end of file diff --git a/apps/dolly-backend/src/main/resources/db/migration/V1.7.26__AlterBestillingProgressYrkesskade.sql b/apps/dolly-backend/src/main/resources/db/migration/V1.7.26__AlterBestillingProgressYrkesskade.sql new file mode 100644 index 00000000000..01f187ca183 --- /dev/null +++ b/apps/dolly-backend/src/main/resources/db/migration/V1.7.26__AlterBestillingProgressYrkesskade.sql @@ -0,0 +1,6 @@ +----------------------------- +-- A L T E R T A B L E S -- +----------------------------- + +alter table bestilling_progress +add column yrkesskade_status varchar(2048); \ No newline at end of file diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/FerdigstillSak.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/FerdigstillSak.java new file mode 100644 index 00000000000..67a012a2510 --- /dev/null +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/FerdigstillSak.java @@ -0,0 +1,5 @@ +package no.nav.testnav.libs.dto.yrkesskade.v1; + +public enum FerdigstillSak { + GODKJENT, AVSLAG + } \ No newline at end of file diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/InnmelderRolletype.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/InnmelderRolletype.java new file mode 100644 index 00000000000..8e01ee9e8b6 --- /dev/null +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/InnmelderRolletype.java @@ -0,0 +1,5 @@ +package no.nav.testnav.libs.dto.yrkesskade.v1; + +public enum InnmelderRolletype { + virksomhetsrepresentant, denSkadelidte, vergeOgForesatt + } \ No newline at end of file diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/Klassifisering.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/Klassifisering.java new file mode 100644 index 00000000000..52768e2251f --- /dev/null +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/Klassifisering.java @@ -0,0 +1,5 @@ +package no.nav.testnav.libs.dto.yrkesskade.v1; + +public enum Klassifisering { + BAGATELLMESSIGE_SKADER, MANUELL, IMPORT + } \ No newline at end of file diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/RolleType.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/RolleType.java new file mode 100644 index 00000000000..b8a7643e367 --- /dev/null +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/RolleType.java @@ -0,0 +1,16 @@ +package no.nav.testnav.libs.dto.yrkesskade.v1; + +public enum RolleType { + arbeidstaker, laerling, elevEllerStudent, tiltaksdeltaker, arbeidstakerPaaSjoenOgSkip, + fiskerOgFangstfolkIFiskermanntallet, laerlingPaaSjoenOgSkip, lottaker, rederTilknyttetFiskeOgFangst, + naeringsdrivendeISmaaskipsfart, vernepliktigIFoerstegangstjenesten, militaerTilsatt, militaerLaerling, + militaerElev, vernepliktigIRepetisjonstjeneste, frivilligTjenestegjoerendeIForsvaret, + militaertPersonellIInternasjonaleOperasjonerIUtlandet, sivilArbeidstakerIForsvaret, + sivilArbeidstakerIInternasjonaleOperasjonerIUtlandet, + tjenestepliktigOgfrivilligTjenestegjoerendeEtterSivilbeskyttelsesloven, + tjenestepliktigOgfrivilligTjenestegjoerendeEtterPolititjenestepliktloven, innsatt, + personSomUtfoererSamfunnsstraff, personIVaretekt, personerIRehabiliteringOgHelseinstitusjon, + branntjenesteUtenforArbeidsforhold, redningspersonellIOrganisasjonerOgForeninger, + privatpersonSomUtfoererLivredningEllerAvvergerMaterielleTap, arbeidstakerIPetroleum, laerlingIPetroleum, + selvstendigNaeringsdrivende, frilanser + } \ No newline at end of file diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/Tidstype.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/Tidstype.java new file mode 100644 index 00000000000..020ad169df1 --- /dev/null +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/Tidstype.java @@ -0,0 +1,5 @@ +package no.nav.testnav.libs.dto.yrkesskade.v1; + +public enum Tidstype { + tidspunkt, periode, ukjent + } \ No newline at end of file diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/YrkesskadeRequest.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/YrkesskadeRequest.java new file mode 100644 index 00000000000..17d64571c59 --- /dev/null +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/YrkesskadeRequest.java @@ -0,0 +1,23 @@ +package no.nav.testnav.libs.dto.yrkesskade.v1; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.RequiredArgsConstructor; + +@Data +@Builder +@RequiredArgsConstructor +@AllArgsConstructor +public class YrkesskadeRequest { + + private String skadelidtIdentifikator; + private RolleType rolletype; + private String innmelderIdentifikator; + private InnmelderRolletype innmelderrolle; + private Klassifisering klassifisering; + private String paaVegneAv; + private Tidstype tidstype; + private String referanse; + private FerdigstillSak ferdigstillSak; +} diff --git a/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/YrkesskadeResponse.java b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/YrkesskadeResponse.java new file mode 100644 index 00000000000..b5450cc3113 --- /dev/null +++ b/libs/data-transfer-objects/src/main/java/no/nav/testnav/libs/dto/yrkesskade/v1/YrkesskadeResponse.java @@ -0,0 +1,35 @@ +package no.nav.testnav.libs.dto.yrkesskade.v1; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class YrkesskadeResponse { + + private List saker; + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class Sak { + + private LocalDate mottattdato; + private LocalDate skadedato; + private LocalDate vedtaksdato; + private String sakstype; + private String kommunenr; + private String saksnr; + private String resultat; + private String resultattekst; + private String kildesystem; + } +}