mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 00:48:49 +00:00
voy a empezar con los acabados de cubierta
This commit is contained in:
@ -8,7 +8,7 @@ public class ImagenPresupuesto {
|
||||
private String imagen;
|
||||
private String alt;
|
||||
private String texto;
|
||||
private boolean selected;
|
||||
private boolean selected = false;
|
||||
private Map<String, String> extra_data;
|
||||
|
||||
// Constructores
|
||||
|
||||
@ -52,20 +52,7 @@ public class PresupuestoController {
|
||||
|
||||
// opciones color
|
||||
Map<String, Object> resultado = presupuestoService.obtenerOpcionesColor(presupuesto, locale);
|
||||
List<ImagenPresupuesto> opcionesColor = (List<ImagenPresupuesto>) resultado.get("opciones_color");
|
||||
if (opcionesColor != null && !opcionesColor.isEmpty()) {
|
||||
Presupuesto.TipoImpresion colorActual = presupuesto.getTipoImpresion();
|
||||
if (!opcionesColor.stream().anyMatch(opcion -> opcion.getId().equals(colorActual.name()))) {
|
||||
String idSeleccionado = opcionesColor.get(0).getId();
|
||||
try {
|
||||
Presupuesto.TipoImpresion tipo = Presupuesto.TipoImpresion.valueOf(idSeleccionado);
|
||||
presupuesto.setTipoImpresion(tipo);
|
||||
} catch (IllegalArgumentException e) {
|
||||
System.err.println("Tipo de impresión no válido: " + idSeleccionado);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// opciones papel interior
|
||||
resultado.putAll(presupuestoService.obtenerOpcionesPapelInterior(presupuesto, locale));
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ public class Presupuesto {
|
||||
private Integer gramajeGuardas;
|
||||
|
||||
@Column(name = "guardas_impresas")
|
||||
private Boolean guardasImpresas;
|
||||
private Integer guardasImpresas;
|
||||
|
||||
@Column(name = "cabezada")
|
||||
private String cabezada;
|
||||
@ -343,11 +343,11 @@ public class Presupuesto {
|
||||
this.gramajeGuardas = gramajeGuardas;
|
||||
}
|
||||
|
||||
public Boolean getGuardasImpresas() {
|
||||
public Integer getGuardasImpresas() {
|
||||
return guardasImpresas;
|
||||
}
|
||||
|
||||
public void setGuardasImpresas(Boolean guardasImpresas) {
|
||||
public void setGuardasImpresas(Integer guardasImpresas) {
|
||||
this.guardasImpresas = guardasImpresas;
|
||||
}
|
||||
|
||||
|
||||
@ -52,37 +52,32 @@ public class PresupuestoService {
|
||||
|
||||
List<ImagenPresupuesto> opciones = new ArrayList<>();
|
||||
|
||||
ImagenPresupuesto opcion;
|
||||
|
||||
if (presupuesto.getPaginasColor() > 0) {
|
||||
if (!this.isPOD(presupuesto)) {
|
||||
// POD solo color foto
|
||||
opcion = this.presupuestadorItems.getImpresionColor(locale);
|
||||
opcion.setSelected(presupuesto.getTipoImpresion() == Presupuesto.TipoImpresion.color);
|
||||
opciones.add(opcion);
|
||||
ImagenPresupuesto opcionColor = this.presupuestadorItems.getImpresionColor(locale);
|
||||
opcionColor.setSelected(Presupuesto.TipoImpresion.color.equals(presupuesto.getTipoImpresion()));
|
||||
opciones.add(opcionColor);
|
||||
}
|
||||
opcion = this.presupuestadorItems.getImpresionColorPremium(locale);
|
||||
opcion.setSelected(presupuesto.getTipoImpresion() == Presupuesto.TipoImpresion.colorhq);
|
||||
opciones.add(opcion);
|
||||
ImagenPresupuesto opcionColorHq = this.presupuestadorItems.getImpresionColorPremium(locale);
|
||||
if(Presupuesto.TipoImpresion.colorhq.equals(presupuesto.getTipoImpresion()))
|
||||
opcionColorHq.setSelected(true);
|
||||
opciones.add(opcionColorHq);
|
||||
} else {
|
||||
opcion = this.presupuestadorItems.getImpresionNegro(locale);
|
||||
opcion.setSelected(presupuesto.getTipoImpresion() == Presupuesto.TipoImpresion.negro);
|
||||
opciones.add(opcion);
|
||||
opcion = this.presupuestadorItems.getImpresionNegroPremium(locale);
|
||||
opcion.setSelected(presupuesto.getTipoImpresion() == Presupuesto.TipoImpresion.negrohq);
|
||||
opciones.add(opcion);
|
||||
ImagenPresupuesto opcionNegro = this.presupuestadorItems.getImpresionNegro(locale);
|
||||
if(Presupuesto.TipoImpresion.negro.equals(presupuesto.getTipoImpresion()))
|
||||
opcionNegro.setSelected(true);
|
||||
opciones.add(opcionNegro);
|
||||
ImagenPresupuesto opcionNegroHq = this.presupuestadorItems.getImpresionNegroPremium(locale);
|
||||
if(Presupuesto.TipoImpresion.negrohq.equals(presupuesto.getTipoImpresion()))
|
||||
opcionNegroHq.setSelected(true);
|
||||
opciones.add(opcionNegroHq);
|
||||
}
|
||||
|
||||
boolean opcionSeleccionada = opciones.stream()
|
||||
.findFirst()
|
||||
.map(op -> {
|
||||
op.setSelected(true);
|
||||
return true;
|
||||
})
|
||||
.orElse(false);
|
||||
boolean opcionSeleccionada = opciones.stream().anyMatch(ImagenPresupuesto::isSelected);
|
||||
if (!opcionSeleccionada) {
|
||||
opciones.get(0).setSelected(true);
|
||||
presupuesto.setPapelInteriorId(Integer.parseInt(opciones.get(0).getExtra_data().get("sk-id")));
|
||||
presupuesto.setTipoImpresion(Presupuesto.TipoImpresion.valueOf(opciones.get(0).getId()));
|
||||
}
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
@ -114,16 +109,12 @@ public class PresupuestoService {
|
||||
String.valueOf(presupuesto.getPapelInteriorId())));
|
||||
}
|
||||
|
||||
boolean opcionSeleccionada = opciones.stream()
|
||||
.findFirst()
|
||||
.map(opcion -> {
|
||||
opcion.setSelected(true);
|
||||
return true;
|
||||
})
|
||||
.orElse(false);
|
||||
if (!opcionSeleccionada) {
|
||||
opciones.get(0).setSelected(true);
|
||||
presupuesto.setPapelInteriorId(Integer.parseInt(opciones.get(0).getExtra_data().get("sk-id")));
|
||||
boolean yaSeleccionado = opciones.stream().anyMatch(ImagenPresupuesto::isSelected);
|
||||
|
||||
if (!yaSeleccionado && !opciones.isEmpty()) {
|
||||
ImagenPresupuesto primeraOpcion = opciones.get(0);
|
||||
primeraOpcion.setSelected(true);
|
||||
presupuesto.setPapelInteriorId(Integer.parseInt(primeraOpcion.getExtra_data().get("sk-id")));
|
||||
}
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
@ -242,13 +233,12 @@ public class PresupuestoService {
|
||||
gramajes.add("300");
|
||||
gramajes.add("350");
|
||||
} else if (presupuesto.getPapelCubiertaId() != null && presupuesto.getPapelCubiertaId() == ESTUCADO_MATE_ID) {
|
||||
if(presupuesto.getTipoCubierta() == Presupuesto.TipoCubierta.tapaBlanda) {
|
||||
if (presupuesto.getTipoCubierta() == Presupuesto.TipoCubierta.tapaBlanda) {
|
||||
|
||||
gramajes.add("250");
|
||||
gramajes.add("300");
|
||||
gramajes.add("350");
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
gramajes.add("170");
|
||||
}
|
||||
}
|
||||
@ -258,7 +248,6 @@ public class PresupuestoService {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> toSkApiRequest(Presupuesto presupuesto) {
|
||||
|
||||
final int SK_CLIENTE_ID = 1284;
|
||||
|
||||
Reference in New Issue
Block a user