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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +147,9 @@ public class PresupuestoController {
|
||||
return ResponseEntity.badRequest().body(errores);
|
||||
}
|
||||
Map<String, Object> resultado = new HashMap<>();
|
||||
resultado.put("solapas", apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale));
|
||||
Map<String , Object> datosInterior = apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale);
|
||||
resultado.put("solapas", datosInterior.get("maxSolapas"));
|
||||
resultado.put("lomo", datosInterior.get("lomo"));
|
||||
resultado.putAll(presupuestoService.obtenerOpcionesAcabadosCubierta(presupuesto, locale));
|
||||
return ResponseEntity.ok(resultado);
|
||||
}
|
||||
@ -267,7 +269,10 @@ public class PresupuestoController {
|
||||
}
|
||||
}
|
||||
|
||||
resultado.put("solapas", apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale));
|
||||
Map<String , Object> datosInterior = apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale);
|
||||
resultado.put("solapas", datosInterior.get("maxSolapas"));
|
||||
resultado.put("lomo", datosInterior.get("lomo"));
|
||||
|
||||
return ResponseEntity.ok(resultado);
|
||||
}
|
||||
|
||||
@ -300,7 +305,10 @@ public class PresupuestoController {
|
||||
presupuesto.setGramajeInterior(Integer.parseInt(opciones.get(0))); // Asignar primera opción
|
||||
}
|
||||
}
|
||||
resultado.put("solapas", apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale));
|
||||
Map<String , Object> datosInterior = apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale);
|
||||
resultado.put("solapas", datosInterior.get("maxSolapas"));
|
||||
resultado.put("lomo", datosInterior.get("lomo"));
|
||||
|
||||
return ResponseEntity.ok(resultado);
|
||||
}
|
||||
|
||||
@ -323,7 +331,10 @@ public class PresupuestoController {
|
||||
}
|
||||
|
||||
Map<String, Object> resultado = new HashMap<>();
|
||||
resultado.put("solapas", apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale));
|
||||
Map<String , Object> datosInterior = apiClient.getMaxSolapas(presupuestoService.toSkApiRequest(presupuesto), locale);
|
||||
resultado.put("solapas", datosInterior.get("maxSolapas"));
|
||||
resultado.put("lomo", datosInterior.get("lomo"));
|
||||
|
||||
return ResponseEntity.ok(resultado);
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ public class PresupuestoPapeles {
|
||||
);
|
||||
|
||||
private static final Map<String, String> CABEZADA_COLOR_KEYS = Map.of(
|
||||
"NOCABE", "presupuesto.cabezada-sin-cabezada",
|
||||
"WHI", "presupuesto.cabezada-blanca",
|
||||
"GRE", "presupuesto.cabezada-verde",
|
||||
"BLUE", "presupuesto.cabezada-azul",
|
||||
|
||||
Reference in New Issue
Block a user