mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-03-01 14:19:14 +00:00
trabajando en obtener lomos
This commit is contained in:
@ -908,6 +908,14 @@ public class PresupuestoController {
|
||||
return ResponseEntity.badRequest().body(errores);
|
||||
}
|
||||
|
||||
try{
|
||||
Map<String, Object> lomos = presupuestoService.obtenerLomos(presupuesto);
|
||||
presupuesto.setLomo(Double.valueOf(lomos.get("lomoInterior").toString()));
|
||||
presupuesto.setLomoCubierta(Double.valueOf(lomos.get("lomoCubierta").toString()));
|
||||
}catch(Exception ex){
|
||||
log.error("Error al obtener lomos desde SK API", ex);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Map<String, Object> saveResult = presupuestoService.guardarPresupuesto(
|
||||
|
||||
@ -1297,6 +1297,20 @@ public class PresupuestoService {
|
||||
|
||||
}
|
||||
|
||||
public Map<String, Object> obtenerLomos(Presupuesto presupuesto) {
|
||||
try {
|
||||
Long papelInteriorId = presupuesto.getPapelInteriorId() != null ? presupuesto.getPapelInteriorId() : 0L;
|
||||
Long papelCubiertaId = presupuesto.getPapelCubiertaId() != null ? presupuesto.getPapelCubiertaId() : 0L;
|
||||
int paginas = presupuesto.getPaginasNegro() + presupuesto.getPaginasColor();
|
||||
Map<String, Object> response = apiClient.getLomos(papelInteriorId, papelCubiertaId, paginas);
|
||||
|
||||
return response.get("data") != null ? (Map<String, Object>) response.get("data") : Map.of();
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error obteniendo lomos: " + e.getMessage());
|
||||
return Map.of();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PRIVADO (futuro botón "Guardar"): persiste el presupuesto como borrador.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user