mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 00:48:49 +00:00
añadidos limites cuando lomo interior es menor que 10
This commit is contained in:
@ -248,7 +248,7 @@ public class skApiClient {
|
||||
return (Long) result.get("data");
|
||||
}
|
||||
|
||||
public Integer getMaxSolapas(Map<String, Object> requestBody, Locale locale) {
|
||||
public Map<String, Object> getMaxSolapas(Map<String, Object> requestBody, Locale locale) {
|
||||
try {
|
||||
String jsonResponse = performWithRetry(() -> {
|
||||
String url = this.skApiUrl + "api/calcular-solapas";
|
||||
@ -289,7 +289,11 @@ public class skApiClient {
|
||||
messageSource.getMessage("presupuesto.errores.error-interior", new Object[] { 1 }, locale));
|
||||
}
|
||||
|
||||
return root.get("data").asInt();
|
||||
Integer maxSolapas = root.get("data").asInt();
|
||||
Double lomo = root.get("lomo").asDouble();
|
||||
return Map.of(
|
||||
"maxSolapas", maxSolapas,
|
||||
"lomo", lomo);
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
// Fallback al 80% del ancho
|
||||
@ -302,7 +306,9 @@ public class skApiClient {
|
||||
throw new RuntimeException("Tamaño no válido en la solicitud: " + requestBody);
|
||||
else {
|
||||
int ancho = (int) tamanio.get("ancho");
|
||||
return (int) Math.floor(ancho * 0.8); // 80% del ancho
|
||||
return Map.of(
|
||||
"maxSolapas", (int) (ancho * 0.8 ),
|
||||
"lomo", 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user