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

feat(be:FSADT1-1575): Create read-only Client Summary (BE) #1331

Merged
merged 47 commits into from
Dec 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f13340b
feat(be:FSADT1-1575): First draft
mamartinezmejia Nov 19, 2024
0d67ebd
no message
mamartinezmejia Nov 21, 2024
ec11b14
Merge branch 'main' into feat/be/FSADT1-1575
mamartinezmejia Nov 21, 2024
9f28db1
Merge branch 'main' into feat/be/FSADT1-1575
mamartinezmejia Nov 25, 2024
0887663
Added missing field in dto
mamartinezmejia Nov 25, 2024
cab7aa1
Added missing field in dto
mamartinezmejia Nov 25, 2024
7b32108
feat(be:feat/be/FSADT1-1575): Populated good standing indicator
mamartinezmejia Nov 26, 2024
66fef15
Added descriptions
mamartinezmejia Nov 26, 2024
ac31f73
no message
mamartinezmejia Nov 26, 2024
7551593
Merge branch 'main' into feat/be/FSADT1-1575
mamartinezmejia Nov 26, 2024
5263735
feat(be:FSADT1-1575): Passed groups to legacy
mamartinezmejia Nov 26, 2024
e1f2aac
feat(be:FSADT1-1575): Passed groups to legacy
mamartinezmejia Nov 27, 2024
9ca2aa1
Updated query
mamartinezmejia Nov 27, 2024
3c2df9e
Added missing dto
mamartinezmejia Nov 27, 2024
4e59490
Merge branch 'main' into feat/be/FSADT1-1575
mamartinezmejia Nov 27, 2024
ffa7bbf
Removed unneeded field
mamartinezmejia Nov 28, 2024
4f2862e
Added new field as per requested
mamartinezmejia Nov 29, 2024
25f8e4e
Merge branch 'main' into feat/be/FSADT1-1575
mamartinezmejia Nov 29, 2024
33b32b9
feat(be:FSADT1-1575): Changes done after code review
mamartinezmejia Nov 29, 2024
401537b
Added javadoc
mamartinezmejia Nov 29, 2024
20b0c09
Added test
mamartinezmejia Nov 29, 2024
fe32550
Fixed test
mamartinezmejia Nov 29, 2024
383bd6d
Improved test
mamartinezmejia Nov 29, 2024
385e9b6
feat(be:FSADT1-1575): Added more tests
mamartinezmejia Dec 2, 2024
8c9bbd0
Fixed test
mamartinezmejia Dec 2, 2024
7f454b1
feat(be:FSADT1-1575): Added more tests
mamartinezmejia Dec 2, 2024
4b6f62c
Added javadoc
mamartinezmejia Dec 3, 2024
405a84b
Made code reviews
mamartinezmejia Dec 3, 2024
9ee4993
Merge branch 'main' into feat/be/FSADT1-1575
mamartinezmejia Dec 3, 2024
d94a817
Added more javadocs
mamartinezmejia Dec 3, 2024
24506ba
Made more code reviews
mamartinezmejia Dec 3, 2024
6a94d5a
Made changes after code reviews
mamartinezmejia Dec 3, 2024
baa8144
SonaCloud fixes
mamartinezmejia Dec 3, 2024
c59f69e
SonarCloud fixes
mamartinezmejia Dec 3, 2024
aae7ceb
Merge branch 'main' into feat/be/FSADT1-1575
mamartinezmejia Dec 3, 2024
6068462
Merge branch 'main' into feat/be/FSADT1-1575
mamartinezmejia Dec 3, 2024
55d6769
Added more tests
mamartinezmejia Dec 3, 2024
c0ad9d1
chore: simplifying boolean check
paulushcgcj Dec 4, 2024
f0671de
Merge branch 'main' into feat/be/FSADT1-1575
paulushcgcj Dec 4, 2024
65fae23
Made more code reviews
mamartinezmejia Dec 4, 2024
4ac46f7
chore: forcing a new build
paulushcgcj Dec 4, 2024
6d7e081
Merge remote-tracking branch 'origin/feat/be/FSADT1-1575' into feat/b…
paulushcgcj Dec 4, 2024
00149d3
chore: forcing a new build
paulushcgcj Dec 4, 2024
403b589
chore: forcing a new build
paulushcgcj Dec 4, 2024
528757e
Made code reviews
mamartinezmejia Dec 4, 2024
9a84c3a
chore: forcing a new build
paulushcgcj Dec 5, 2024
e96c047
chore: forcing a new build
paulushcgcj Dec 5, 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
Next Next commit
feat(be:FSADT1-1575): First draft
mamartinezmejia committed Nov 19, 2024
commit f13340b298c9e24971f02b9347d0df8b4b2a68e9
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
import ca.bc.gov.app.dto.bcregistry.ClientDetailsDto;
import ca.bc.gov.app.dto.client.ClientListDto;
import ca.bc.gov.app.dto.client.ClientLookUpDto;
import ca.bc.gov.app.dto.legacy.ForestClientDto;
import ca.bc.gov.app.exception.NoClientDataFound;
import ca.bc.gov.app.service.client.ClientLegacyService;
import ca.bc.gov.app.service.client.ClientService;
@@ -36,7 +37,7 @@ public class ClientController {
private final ClientLegacyService clientLegacyService;

@GetMapping("/{clientNumber}")
public Mono<ClientDetailsDto> getClientDetails(
public Mono<ClientDetailsDto> getClientDetailsByIncorporationNumber(
@PathVariable String clientNumber,
JwtAuthenticationToken principal
) {
@@ -45,14 +46,30 @@ public Mono<ClientDetailsDto> getClientDetails(
JwtPrincipalUtil.getUserId(principal)
);
return clientService
.getClientDetails(
.getClientDetailsByIncorporationNumber(
clientNumber,
JwtPrincipalUtil.getUserId(principal),
JwtPrincipalUtil.getBusinessId(principal),
JwtPrincipalUtil.getProvider(principal)
);
}

@GetMapping("/details/{clientNumber}")
public Mono<ForestClientDto> getClientDetailsByClientNumber(
@PathVariable String clientNumber,
JwtAuthenticationToken principal
) {
log.info("Requesting client details for client number {} from the client service. {}",
clientNumber,
JwtPrincipalUtil.getUserId(principal)
);
return clientService.getClientDetailsByClientNumber(
clientNumber,
JwtPrincipalUtil.getUserId(principal),
JwtPrincipalUtil.getBusinessId(principal),
JwtPrincipalUtil.getProvider(principal));
}

@GetMapping("/search")
public Flux<ClientListDto> fullSearch(
@RequestParam(required = false, defaultValue = "0") int page,
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
* This class is responsible for interacting with the legacy API to fetch client data. It uses the
@@ -87,6 +88,28 @@ public Flux<ForestClientDto> searchLegacy(
registrationNumber, companyName, dto.clientNumber()));
}

public Mono<ForestClientDto> searchByClientNumber(
String clientNumber
) {
log.info("Searching for client number {} in legacy", clientNumber);

return
legacyApi
.get()
.uri(builder ->
builder
.path("/api/search/clientNumber")
.queryParam("clientNumber", clientNumber)
.build(Map.of())
)
.exchangeToMono(response -> response.bodyToMono(ForestClientDto.class))
.doOnNext(
dto -> log.info(
"Found Legacy data for in legacy with client number {}",
dto.clientNumber())
);
}

/**
* This method is used to search for a client in the legacy system using the client's ID and last
* name.
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ public class ClientService {
* @param clientNumber the client number for which to retrieve details
* @return a Mono that emits a ClientDetailsDto object representing the details of the client
*/
public Mono<ClientDetailsDto> getClientDetails(
public Mono<ClientDetailsDto> getClientDetailsByIncorporationNumber(
String clientNumber,
String userId,
String businessId,
@@ -141,6 +141,16 @@ public Mono<ClientDetailsDto> getClientDetails(
"Unable to process request. This sole proprietor is not owned by a person"
)));
}

public Mono<ForestClientDto> getClientDetailsByClientNumber(
String clientNumber,
String userId,
String businessId,
String provider
) {
log.info("Loading details for {} {} {} {}", clientNumber, userId, businessId, provider);
return legacyService.searchByClientNumber(clientNumber);
}

/**
* Searches the BC Registry API for {@link BcRegistryFacetSearchResultEntryDto} instances matching
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@RestController
@Slf4j
@@ -73,6 +74,14 @@ public Flux<ForestClientDto> findByIdAndLastName(
log.info("Receiving request to search by ID {} and Last Name {}", clientId, lastName);
return service.findByIdAndLastName(clientId, lastName);
}

@GetMapping("/clientNumber")
public Mono<ForestClientDto> findByClientNumber(
@RequestParam String clientNumber
) {
log.info("Receiving request to search by ID {} and Last Name", clientNumber);
return service.findByClientNumber(clientNumber);
}

@GetMapping("/id/{idType}/{identification}")
public Flux<ForestClientDto> findByIdentification(
Original file line number Diff line number Diff line change
@@ -536,6 +536,22 @@ public Flux<ForestClientDto> findByClientName(String clientName) {
dto.clientNumber(), dto.clientName())
);
}

public Mono<ForestClientDto> findByClientNumber(String clientNumber) {
log.info("Searching for client with number {}", clientNumber);

if (StringUtils.isBlank(clientNumber)) {
return Mono.error(new MissingRequiredParameterException("clientNumber"));
}

return forestClientRepository.findByClientNumber(clientNumber)
.map(forestClientMapper::toDto)
.doOnNext(
dto -> log.info("Found client with client number {}",
clientNumber,
dto.clientNumber())
);
}

public Flux<Pair<PredictiveSearchResultDto, Long>> complexSearch(String value, Pageable page) {
// This condition is for predictive search, and we will stop here if no query param is provided