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