mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 00:48:49 +00:00
trbajando en las funciones de leer los estados
This commit is contained in:
@ -229,7 +229,7 @@ public class skApiClient {
|
||||
Long id = ((Integer) responseBody.get("id")).longValue();
|
||||
|
||||
if (success != null && id != null && success) {
|
||||
|
||||
|
||||
return Map.of("data", id);
|
||||
} else {
|
||||
// Tu lógica actual: si success es true u otra cosa → error 2
|
||||
@ -307,7 +307,7 @@ public class skApiClient {
|
||||
else {
|
||||
int ancho = (int) tamanio.get("ancho");
|
||||
return Map.of(
|
||||
"maxSolapas", (int) (ancho * 0.8 ),
|
||||
"maxSolapas", (int) (ancho * 0.8),
|
||||
"lomo", 0.0);
|
||||
}
|
||||
}
|
||||
@ -395,18 +395,46 @@ public class skApiClient {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public Map<String, Object> checkPedidoEstado(Long presupuestoId){
|
||||
public Map<String, Object> checkPedidoEstado(Long presupuestoId, Locale locale) {
|
||||
|
||||
try{
|
||||
try {
|
||||
|
||||
}
|
||||
catch(Exception e){
|
||||
e.printStackTrace();
|
||||
return Map.of("error", "Internal Server Error: 1"); // Fallback en caso de error
|
||||
String jsonResponse = performWithRetry(() -> {
|
||||
String url = this.skApiUrl + "api/estado-pedido/" + presupuestoId;
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.setBearerAuth(authService.getToken()); // token actualizado
|
||||
|
||||
HttpEntity<Void> entity = new HttpEntity<>(headers);
|
||||
|
||||
ResponseEntity<String> response = restTemplate.exchange(
|
||||
url,
|
||||
HttpMethod.GET,
|
||||
entity,
|
||||
String.class);
|
||||
|
||||
return response.getBody();
|
||||
});
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode root = mapper.readTree(jsonResponse);
|
||||
|
||||
if (root.get("data") == null || !root.get("data").isInt()) {
|
||||
throw new RuntimeException(
|
||||
"Sin respuesta desde el servidor del proveedor");
|
||||
}
|
||||
|
||||
String estado = root.get("estado").asText();
|
||||
return Map.of(
|
||||
"estado", estado);
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
// Fallback al 80% del ancho
|
||||
return Map.of(
|
||||
"estado", null);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/******************
|
||||
* PRIVATE METHODS
|
||||
|
||||
Reference in New Issue
Block a user