From 560d6438dcc61c9b6c2d4f89ebe97726d6ded37c Mon Sep 17 00:00:00 2001 From: Maria Martinez <77364706+mamartinezmejia@users.noreply.github.com> Date: Mon, 24 Jun 2024 16:28:07 -0700 Subject: [PATCH] fix: deleted unneeded code (#1015) cleanup: deleted unneeded code --- .../ca/bc/gov/app/service/ClientService.java | 56 +------------------ 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/legacy/src/main/java/ca/bc/gov/app/service/ClientService.java b/legacy/src/main/java/ca/bc/gov/app/service/ClientService.java index bf50e1b74c..b193d0318e 100644 --- a/legacy/src/main/java/ca/bc/gov/app/service/ClientService.java +++ b/legacy/src/main/java/ca/bc/gov/app/service/ClientService.java @@ -3,7 +3,6 @@ import ca.bc.gov.app.dto.ForestClientDto; import ca.bc.gov.app.entity.ForestClientEntity; import ca.bc.gov.app.mappers.AbstractForestClientMapper; -import ca.bc.gov.app.repository.ForestClientRepository; import io.micrometer.observation.annotation.Observed; import java.util.Optional; import lombok.RequiredArgsConstructor; @@ -20,8 +19,6 @@ public class ClientService { private final R2dbcEntityOperations entityTemplate; - private final ForestClientRepository repository; - private final ClientSearchService searchService; private final AbstractForestClientMapper mapper; public Mono saveAndGetIndex(ForestClientDto dto) { @@ -38,7 +35,6 @@ public Mono saveAndGetIndex(ForestClientDto dto) { ) ) .map(mapper::toEntity) - .filterWhen(this::locateClient) .flatMap(entity -> getNextClientNumber().map(entity::withClientNumber)) .flatMap(entity -> entityTemplate .insert(ForestClientEntity.class) @@ -64,57 +60,7 @@ public Mono saveAndGetIndex(ForestClientDto dto) { ) ); } - - private Mono locateClient( - ForestClientEntity entity - ) { - - log.info("Searching forest client {}", entity.getName()); - - if ( - entity - .getClientTypeCode() - .equalsIgnoreCase("I") - ) { - return - searchService - .findByIndividual( - entity.getLegalFirstName(), - entity.getClientName(), - entity.getBirthdate().toLocalDate(), - null, - false - ) - .map(client -> false) // means you can't create it - .defaultIfEmpty(true) - .doOnNext( - tag -> log.info("Individual {} forest client missing? {}", entity.getName(), tag)) - .last(); - } - - return - repository - .findClientByIncorporationOrName( - entity.getClientName().toUpperCase(), - String.join( - StringUtils.EMPTY, - entity.getRegistryCompanyTypeCode().toUpperCase(), - entity.getCorpRegnNmbr() - ) - ) - .map(client -> false) // means you can't create it - .defaultIfEmpty(true) - .doOnNext(tag -> - log.info( - "Forest client {} with type {} missing? {}", - entity.getName(), - entity.getClientTypeCode(), - tag - ) - ) - .last(); - } - + private Mono getNextClientNumber() { return entityTemplate