Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/organisasjon bestilling #3606

Merged
merged 45 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
160d88f
* Endringer for validering i sigrunstub
stigus Aug 29, 2024
0db9246
Merge branch 'refs/heads/master' into bugfix/sigrunstub-validering
stigus Sep 2, 2024
a3f301d
* Fikset antall mulige elementer i fieldArray på sigrunstub og skreve…
stigus Sep 2, 2024
8fd5e71
Refactor error handling and repository methods #deploy-ereg-batch-sta…
krharum Sep 3, 2024
838a514
Merge branch 'master' into bugfix/organisasjon-bestilling
krharum Sep 3, 2024
d88a7b7
Remove unused Jenkins server configurations
krharum Sep 4, 2024
03d6755
Add OAuth2 and H2 database initialization
krharum Sep 5, 2024
e085b44
Oppdatert response i ordrestatus
krharum Sep 7, 2024
56eb101
Add local and prod configurations for Vault and security #deploy-moda…
krharum Sep 9, 2024
40e9ab6
Oppdatert timere og forberedt for logging
krharum Sep 9, 2024
7dd5822
Deploy #deploy-modapp-ereg-proxy
krharum Sep 9, 2024
5b9de1b
Remove AzureAdApplication and add request logging #deploy-modapp-ereg…
krharum Sep 10, 2024
704ab15
Update Ereg URL configuration
krharum Sep 10, 2024
1999387
Improve status handling in OrderStatusService
krharum Sep 11, 2024
141634f
Refactor ImportService and update reactive dependencies #deploy-organ…
krharum Sep 11, 2024
1ddb0c1
Add 'isFunnet' method to OrganisasjonDTO
krharum Sep 11, 2024
2dd178d
Refactor handling of error messages and JSON responses
krharum Sep 12, 2024
c97e901
Remove caching configuration and service
krharum Sep 12, 2024
a1a416f
Refactor variable names and optimize status update. #deploy-organisas…
krharum Sep 12, 2024
770c683
Merge branch 'master' into bugfix/organisasjon-bestilling
krharum Sep 12, 2024
22467c1
Add Docker Compose for Postgres setup and update configs
krharum Sep 12, 2024
92d45d5
Update Docker services and refine configs #deploy-organisasjon-forvalter
krharum Sep 13, 2024
12771b1
Refactor OrdreStatusService filtering logic
krharum Sep 13, 2024
4cd2a95
Deploy #deploy-ereg-batch-status-service #deploy-organisasjon-bestill…
krharum Sep 13, 2024
1e75a27
Adjust configuration and method annotations
krharum Sep 13, 2024
d682cdf
Simplify error handling in order services
krharum Sep 13, 2024
617955f
Fix environment comparison and handle 404 errors in OrgStatus #deploy…
krharum Sep 13, 2024
e51cfd3
Simplify error handling in organization services
krharum Sep 16, 2024
8ea6d18
Add PENDING_COMPLETE status and refactor order status handling
krharum Sep 16, 2024
ae45476
Disable unused item status retrieval endpoints
krharum Sep 16, 2024
7fb00e8
Deploy #deploy-test-dolly-backend
krharum Sep 16, 2024
b303c57
Deploy #deploy-organisasjon-forvalter
krharum Sep 16, 2024
936abd8
Log status fetch and response from OrganisasjonBestillingService #dep…
krharum Sep 16, 2024
43b3687
Disable unused item status retrieval endpoints
krharum Sep 16, 2024
8ac728f
Remove EregBatchStatusConsumer and related configs
krharum Sep 16, 2024
7a8570c
Remove ereg-batch-status-service and modapp-ereg-proxy
krharum Sep 16, 2024
8e094b2
Refactor status validation in OrganisasjonBestillingService
krharum Sep 16, 2024
fef21b0
Refactor environment matching logic
krharum Sep 16, 2024
5f334bd
Remove commented-out methods and optimize code
krharum Sep 16, 2024
404f7b2
Fix environment filtering in order status check
krharum Sep 16, 2024
956abcf
Update API endpoint versions for order commands
krharum Sep 16, 2024
364cfbc
Refactor environment status check logic
krharum Sep 16, 2024
2fba5fb
Fix order completion logic in OrganisasjonBestillingService
krharum Sep 16, 2024
aba64cb
Revert "Update API endpoint versions for order commands"
krharum Sep 16, 2024
dca7926
Merge branch 'master' into bugfix/organisasjon-bestilling
krharum Sep 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .github/workflows/app.ereg-batch-status-service.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/proxy.modapp-ereg-proxy.yml

This file was deleted.

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 @@ -19,6 +19,7 @@
import org.springframework.stereotype.Service;
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;
Expand Down Expand Up @@ -67,7 +68,7 @@ public Flux<OrganisasjonDetaljer> hentOrganisasjon(List<String> orgnumre) {
.flatMapMany(token -> new GetOrganisasjonCommand(webClient, orgnumre, token.getTokenValue()).call());
}

@Timed(name = "providers", tags = {"operation", "organisasjon-hent"})
@Timed(name = "providers", tags = {"operation", "organisasjon-status-hent"})
public OrganisasjonDeployStatus hentOrganisasjonStatus(List<String> orgnumre) {
var navCallId = getNavCallId();
log.info("Organisasjon hent request sendt, callId: {}, consumerId: {}", navCallId, CONSUMER);
Expand All @@ -85,8 +86,9 @@ public OrganisasjonDeployStatus hentOrganisasjonStatus(List<String> orgnumre) {
.header(HEADER_NAV_CONSUMER_ID, CONSUMER)
.retrieve()
.bodyToMono(OrganisasjonDeployStatus.class)
.retryWhen(Retry.backoff(3, Duration.ofSeconds(5))
.filter(WebClientFilter::is5xxException)))
.doOnError(WebClientFilter::logErrorMessage)
.onErrorResume(throwable -> Mono.empty())
)
.block();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public Flux<OrganisasjonDetaljer> call() {
.bodyToFlux(OrganisasjonDetaljer.class)
.doOnError(WebClientFilter::logErrorMessage)
.retryWhen(Retry.backoff(3, Duration.ofSeconds(5))
.filter(WebClientFilter::is5xxException));
.filter(WebClientFilter::is5xxException))
.onErrorResume(throwable -> Flux.empty());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static no.nav.dolly.domain.resultset.SystemTyper.ORGANISASJON_FORVALTER;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
Expand All @@ -29,8 +30,6 @@ public static List<RsOrganisasjonStatusRapport> buildOrganisasjonStatusMap(Organ

List.of(progress.getOrganisasjonsforvalterStatus()
.replace(",q", "$q")
.replace(",t", "$t")
.replace(",u", "$u")
.split("\\$")).forEach(status -> {
String[] environMsg = status.split(":", 2);
if (environMsg.length < 2) {
Expand Down Expand Up @@ -65,9 +64,11 @@ public static List<RsOrganisasjonStatusRapport> buildOrganisasjonStatusMap(Organ
}

private static String getOrgStatusDetailForMiljo(List<OrganisasjonDeployStatus.OrgStatus> orgStatuser, String miljo) {
return orgStatuser.stream()
.filter(orgStatus -> orgStatus.getEnvironment().equals(miljo))
.findFirst().orElseGet(OrganisasjonDeployStatus.OrgStatus::new)
.getDetails();

return nonNull(orgStatuser) ? orgStatuser.stream()
.filter(orgStatus -> miljo.equals(orgStatus.getEnvironment()))
.map(status -> "%s %s".formatted(status.getDetails(),
status.getDetails().contains("feil") ? status.getError() : ""))
.findFirst().orElse("") : "";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public RsOrganisasjonBestillingStatus fetchBestillingStatusById(Long bestillingI
}

return RsOrganisasjonBestillingStatus.builder()
.status(BestillingOrganisasjonStatusMapper.buildOrganisasjonStatusMap(bestillingProgress, nonNull(orgStatusList) ? orgStatusList : emptyList()))
.status(BestillingOrganisasjonStatusMapper.buildOrganisasjonStatusMap(bestillingProgress, orgStatusList))
.bestilling(jsonBestillingMapper.mapOrganisasjonBestillingRequest(bestilling.getBestKriterier()))
.sistOppdatert(bestilling.getSistOppdatert())
.organisasjonNummer(bestillingProgress.getOrganisasjonsnummer())
Expand Down Expand Up @@ -250,11 +250,12 @@ private void updateBestilling(OrganisasjonBestilling bestilling, List<OrgStatus>
bestilling.setFeil(feil);

var ferdig = orgStatus.stream()
.anyMatch(o -> DEPLOY_ENDED_STATUS_LIST.stream().anyMatch(status -> status.equals(o.getStatus())));
.allMatch(o -> DEPLOY_ENDED_STATUS_LIST.stream()
.anyMatch(status -> status.equals(o.getStatus()) &&
(isBlank(o.getError()) || !o.getError().contains("404"))));

bestilling.setFerdig(ferdig);
bestilling.setSistOppdatert(now());

}

private String forvalterStatusDetails(OrgStatus orgStatus) {
Expand All @@ -274,17 +275,21 @@ private List<OrgStatus> getOrgforvalterStatus(OrganisasjonBestilling bestilling,

log.info("Status for org deploy på org: {} - {}", bestillingProgress.getOrganisasjonsnummer(), organisasjonDeployStatus);

var orgStatus = organisasjonDeployStatus.getOrgStatus()
.getOrDefault(bestillingProgress.getOrganisasjonsnummer(), emptyList());
if (nonNull(organisasjonDeployStatus)) {
var orgStatus = organisasjonDeployStatus.getOrgStatus()
.getOrDefault(bestillingProgress.getOrganisasjonsnummer(), emptyList());

updateBestilling(bestilling, orgStatus);
updateBestilling(bestilling, orgStatus);

var forvalterStatus = orgStatus.stream()
.map(org -> org.getEnvironment() + ":" + forvalterStatusDetails(org))
.collect(Collectors.joining(","));
bestillingProgress.setOrganisasjonsforvalterStatus(forvalterStatus);
var forvalterStatus = orgStatus.stream()
.map(org -> org.getEnvironment() + ":" + forvalterStatusDetails(org))
.collect(Collectors.joining(","));
bestillingProgress.setOrganisasjonsforvalterStatus(forvalterStatus);
return orgStatus;

return orgStatus;
} else {
return emptyList();
}
}

private String toJson(Object object) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ spring:
enabled: false
datasource:
url: jdbc:postgresql://localhost:5432/dolly-test
username: postgres
hikari:
maximum-pool-size: 3
minimum-idle: 1
driver-class-name: org.postgresql.Driver
username: postgres

management:
endpoints:
Expand Down
8 changes: 0 additions & 8 deletions apps/ereg-batch-status-service/Dockerfile

This file was deleted.

19 changes: 0 additions & 19 deletions apps/ereg-batch-status-service/README.md

This file was deleted.

30 changes: 0 additions & 30 deletions apps/ereg-batch-status-service/build.gradle

This file was deleted.

61 changes: 0 additions & 61 deletions apps/ereg-batch-status-service/config.yml

This file was deleted.

Binary file not shown.

This file was deleted.

Loading