diff --git a/legacy/src/main/java/ca/bc/gov/app/dto/PredictiveSearchResultDto.java b/legacy/src/main/java/ca/bc/gov/app/dto/PredictiveSearchResultDto.java index 1e591cd33d..c6c973ce40 100644 --- a/legacy/src/main/java/ca/bc/gov/app/dto/PredictiveSearchResultDto.java +++ b/legacy/src/main/java/ca/bc/gov/app/dto/PredictiveSearchResultDto.java @@ -1,7 +1,6 @@ package ca.bc.gov.app.dto; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.lang3.StringUtils; @@ -22,14 +21,14 @@ public record PredictiveSearchResultDto( @JsonProperty("name") public String name() { - if (StringUtils.isNotBlank(this.clientFirstName)) { - return Stream.of(this.clientFirstName, this.clientMiddleName, this.clientName) - .filter(Objects::nonNull) - .map(String::trim) - .collect(Collectors.joining(" ")); - } else { - return this.clientName; - } + String finalName = Stream.of(this.clientFirstName, this.clientMiddleName, this.clientName) + .filter(StringUtils::isNotBlank) + .map(String::trim) + .collect(Collectors.joining(" ")); + + return StringUtils.isNotBlank(this.doingBusinessAs) + ? finalName + " (" + this.doingBusinessAs + ")" + : finalName; } } diff --git a/legacy/src/main/java/ca/bc/gov/app/repository/ForestClientRepository.java b/legacy/src/main/java/ca/bc/gov/app/repository/ForestClientRepository.java index 3643fea834..88610a8ff2 100644 --- a/legacy/src/main/java/ca/bc/gov/app/repository/ForestClientRepository.java +++ b/legacy/src/main/java/ca/bc/gov/app/repository/ForestClientRepository.java @@ -71,7 +71,7 @@ Flux findClientByIncorporationOrName( c.legal_middle_name as client_middle_name, cl.city as city, ctc.description as client_type, - c.client_status_code as status_code, + csc.description as status_code, ( CASE WHEN c.client_number = :value THEN 112 ELSE 0 END + CASE WHEN c.CLIENT_ACRONYM = :value THEN 111 ELSE 0 END + @@ -85,6 +85,7 @@ Flux findClientByIncorporationOrName( LEFT JOIN the.CLIENT_DOING_BUSINESS_AS dba ON c.client_number = dba.client_number LEFT JOIN the.CLIENT_TYPE_CODE ctc ON c.client_type_code = ctc.client_type_code LEFT JOIN the.CLIENT_LOCATION cl ON c.client_number = cl.client_number + LEFT JOIN the.CLIENT_STATUS_CODE csc ON c.client_status_code = csc.client_status_code WHERE ( c.client_number = :value diff --git a/legacy/src/test/java/ca/bc/gov/app/controller/ClientSearchControllerIntegrationTest.java b/legacy/src/test/java/ca/bc/gov/app/controller/ClientSearchControllerIntegrationTest.java index 1a05541894..91c5567b4b 100644 --- a/legacy/src/test/java/ca/bc/gov/app/controller/ClientSearchControllerIntegrationTest.java +++ b/legacy/src/test/java/ca/bc/gov/app/controller/ClientSearchControllerIntegrationTest.java @@ -526,9 +526,9 @@ private static Stream doingBusinessAs() { private static Stream byPredictive() { return Stream .of( - Arguments.of("indian canada", "00000006", "INDIAN CANADA"), + Arguments.of("pollich", "00000114", "POLLICH-ABERNATHY"), Arguments.of("kilback", "00000123", "REICHERT, KILBACK AND EMARD"), - Arguments.of("darbie", "00000145", "DARBIE BLIND"), + Arguments.of("darbie", "00000145", "DARBIE BLIND (MINYX)"), Arguments.of("pietro", StringUtils.EMPTY, StringUtils.EMPTY) ); } diff --git a/legacy/src/test/java/ca/bc/gov/app/service/ClientSearchServiceIntegrationTest.java b/legacy/src/test/java/ca/bc/gov/app/service/ClientSearchServiceIntegrationTest.java index 9db033101d..f4354175dd 100644 --- a/legacy/src/test/java/ca/bc/gov/app/service/ClientSearchServiceIntegrationTest.java +++ b/legacy/src/test/java/ca/bc/gov/app/service/ClientSearchServiceIntegrationTest.java @@ -324,7 +324,7 @@ private static Stream byPredictive() { .of( Arguments.of("indian canada", "00000006", "INDIAN CANADA"), Arguments.of("kilback", "00000123", "REICHERT, KILBACK AND EMARD"), - Arguments.of("darbie", "00000145", "DARBIE BLIND"), + Arguments.of("darbie", "00000145", "DARBIE BLIND (MINYX)"), Arguments.of("pietro", StringUtils.EMPTY, StringUtils.EMPTY) ); }