Optimization resource parameters values
This commit is contained in:
parent
b95c6aa1d3
commit
c62cc2ab2e
@ -149,7 +149,6 @@ public class ErrorResponseHelper {
|
||||
|
||||
log.info("Mappings de errores cargados exitosamente, total válidos: {}", result.size());
|
||||
return result;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error cargando mappings de errores: {}", e.getMessage());
|
||||
return createDefaultMappings();
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.banesco.common.infrastructure.config;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -8,6 +9,7 @@ import org.eclipse.microprofile.config.Config;
|
||||
import jakarta.inject.Inject;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@ -28,12 +30,16 @@ public class RestClientConfig {
|
||||
String json = config.getValue("api.rest-client.bus-legal-customer-product-directory", String.class);
|
||||
log.info("Configurando bus-legal-customer-product-directory: {}", json);
|
||||
|
||||
if (json == null || json.trim().isEmpty()) {
|
||||
throw new IllegalStateException("Configuración requerida no encontrada para: api.rest-client.bus-legal-customer-product-directory");
|
||||
}
|
||||
|
||||
Map<String, Object> configMap = objectMapper.readValue(json, new TypeReference<>() {});
|
||||
return objectMapper.convertValue(configMap, BusConfig.class);
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new IllegalArgumentException("Formato JSON inválido en la configuración: api.rest-client.bus-legal-customer-product-directory", e);
|
||||
} catch (Exception e) {
|
||||
log.error("Error cargando config bus-legal-customer-product-directory", e);
|
||||
throw new RuntimeException("Error cargando configuración", e);
|
||||
throw new IllegalStateException("Error cargando configuración del servicio", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,12 +48,16 @@ public class RestClientConfig {
|
||||
String json = config.getValue("api.rest-client.register-security", String.class);
|
||||
log.info("Configurando register-security: {}", json);
|
||||
|
||||
if (json == null || json.trim().isEmpty()) {
|
||||
throw new IllegalStateException("Configuración requerida no encontrada para: api.rest-client.register-security");
|
||||
}
|
||||
|
||||
Map<String, Object> configMap = objectMapper.readValue(json, new TypeReference<>() {});
|
||||
return objectMapper.convertValue(configMap, RegisterSecurityConfig.class);
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new IllegalArgumentException("Formato JSON inválido en la configuración: api.rest-client.register-security", e);
|
||||
} catch (Exception e) {
|
||||
log.error("Error cargando config register-security", e);
|
||||
throw new RuntimeException("Error cargando configuración", e);
|
||||
throw new IllegalStateException("Error cargando configuración del servicio register-security", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ public class RequestIdFilter implements ContainerRequestFilter, ContainerRespons
|
||||
|
||||
@Override
|
||||
public void filter(ContainerRequestContext requestContext) {
|
||||
RequestContext.setRequestId(UUID.randomUUID().toString().substring(0, 8));
|
||||
RequestContext.setRequestId(UUID.randomUUID().toString().substring(0, 13));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -51,12 +51,15 @@ public class LegalCustomerProductDirectoryService implements LegalCustomerProduc
|
||||
try {
|
||||
return business(request);
|
||||
} catch (BaseApiException e) {
|
||||
log.warn("Excepción controlada del api de negocio: {} -> {}", e.getErrorCode(), e.getMessage());
|
||||
|
||||
if(Objects.equals(e.getErrorCode(), "200")) {
|
||||
return createSuccessMock();
|
||||
}
|
||||
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.warn("Excepción generica del api de negocio: {}", e.getMessage(), e);
|
||||
throw new ServiceUnavailableException("503", e.getMessage(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,13 +12,12 @@ import java.util.Map;
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class LegalCustomerProductDirectoryRequest {
|
||||
|
||||
@NonNull
|
||||
private String customerIbsNumber; // VCUSCUN - Obligatorio (Número de cliente IBS)
|
||||
@NonNull
|
||||
private String customerReferenceFintechId; // Header obligatorio
|
||||
@NonNull
|
||||
private String appId; // Header obligatorio
|
||||
private String appId; // Header obligatorio
|
||||
@NonNull
|
||||
private String customerIbsNumber; // VCUSCUN - Obligatorio (Número de cliente IBS)
|
||||
|
||||
private String bankNumber; // VACMBNK - Número de Banco (filtro)
|
||||
private String currencyCode; // VACMCCY - Moneda (filtro)
|
||||
@ -29,7 +28,7 @@ public class LegalCustomerProductDirectoryRequest {
|
||||
private String serviceType; // VAFILICOSER - Tipo de Servicio (filtro)
|
||||
private String affiliationStatus; // VAFILISTATU - Estatus de afiliación (filtro)
|
||||
private String limitType; // VALIMIT - Pagador/Receptor (PAG/REC) (filtro)
|
||||
private String casheaIndicator; // VCASHEA - SI/NO (filtro)
|
||||
private String casheaIndicator; // VCASHEA - SI/NO (filtro)
|
||||
|
||||
public Map<String, String> toBusinessHeaders() {
|
||||
return Map.of(
|
||||
|
||||
@ -6,7 +6,6 @@ import com.banesco.common.domain.exception.SuccessException;
|
||||
import com.banesco.common.domain.model.ApiResponse;
|
||||
import com.banesco.common.domain.model.HttpRequest;
|
||||
import com.banesco.common.infrastructure.config.RestClientConfig;
|
||||
import com.banesco.common.infrastructure.context.RequestContext;
|
||||
import com.banesco.module.legal_customer_product_directory.application.usecase.BusinessUseCase;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
@ -38,8 +37,7 @@ public class BusLegalCustomerDirectoryClient implements BusinessUseCase {
|
||||
Map<String, String> headers,
|
||||
Class<T> responseType
|
||||
) {
|
||||
String requestId = RequestContext.getRequestId();
|
||||
log.info("{} Consultando información del cliente: {}", requestId, customerIbsNumber);
|
||||
log.info("Consultando información del cliente: {}", customerIbsNumber);
|
||||
|
||||
if(isMock) {
|
||||
throw new SuccessException("200", null);
|
||||
|
||||
@ -18,6 +18,8 @@ import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
|
||||
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
|
||||
import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Path("/rec-legal-customer-product-directory")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@ -325,16 +327,16 @@ public class LegalCustomerProductDirectoryResource {
|
||||
.customerIbsNumber(customerIbsNumber)
|
||||
.customerReferenceFintechId(customerReferenceFintechId)
|
||||
.appId(appId)
|
||||
.bankNumber(bankNumber)
|
||||
.currencyCode(currencyCode)
|
||||
.accountStatus(accountStatus)
|
||||
.productCvCode(productCvCode)
|
||||
.productCode(productCode)
|
||||
.channelCode(channelCode)
|
||||
.serviceType(serviceType)
|
||||
.affiliationStatus(affiliationStatus)
|
||||
.limitType(limitType)
|
||||
.casheaIndicator(casheaIndicator)
|
||||
.bankNumber(Objects.toString(bankNumber, ""))
|
||||
.currencyCode(Objects.toString(currencyCode, ""))
|
||||
.accountStatus(Objects.toString(accountStatus, ""))
|
||||
.productCvCode(Objects.toString(productCvCode, ""))
|
||||
.productCode(Objects.toString(productCode, ""))
|
||||
.channelCode(Objects.toString(channelCode, ""))
|
||||
.serviceType(Objects.toString(serviceType, ""))
|
||||
.affiliationStatus(Objects.toString(affiliationStatus, ""))
|
||||
.limitType(Objects.toString(limitType, ""))
|
||||
.casheaIndicator(Objects.toString(casheaIndicator, ""))
|
||||
.build()
|
||||
)).build();
|
||||
} catch (BaseApiException e) {
|
||||
|
||||
@ -19,7 +19,6 @@ quarkus:
|
||||
## OpenApi
|
||||
smallrye-openapi:
|
||||
path: /openapi
|
||||
enable: 'true'
|
||||
## Swagger IU
|
||||
swagger-ui:
|
||||
path: /swagger-ui
|
||||
@ -28,7 +27,6 @@ quarkus:
|
||||
log:
|
||||
level: INFO
|
||||
console:
|
||||
enable: true
|
||||
format: "%d{HH:mm:ss.SSS} %-5p [%t] [%X{requestId}] %c{1} - %s%e%n"
|
||||
debug:
|
||||
print-startup-times: true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user