mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 00:48:49 +00:00
tengo el texto del resumen final
This commit is contained in:
@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
@ -376,14 +377,31 @@ public class PresupuestoController {
|
||||
}
|
||||
|
||||
// Se hace un post para no tener problemas con la longitud de la URL
|
||||
@PostMapping("/public/getresumen")
|
||||
public ResponseEntity<?> getResumen(@ModelAttribute("presupuesto") Presupuesto presupuesto,
|
||||
@RequestParam String summary, Locale locale) throws JsonProcessingException {
|
||||
|
||||
Map<String, Object> summaryMap = new ObjectMapper().readValue(summary,
|
||||
new TypeReference<Map<String, Object>>() {
|
||||
});
|
||||
return ResponseEntity.ok(presupuestoService.getResumen(presupuesto, summaryMap, locale));
|
||||
@PostMapping("/public/resumen")
|
||||
public ResponseEntity<?> getResumen(@RequestBody PresupuestoRequest req, Locale locale) {
|
||||
Presupuesto p = req.getPresupuesto();
|
||||
String[] servicios = req.getServicios() != null ? req.getServicios() : new String[0];
|
||||
return ResponseEntity.ok(presupuestoService.getResumen(p, servicios, locale));
|
||||
}
|
||||
|
||||
public static class PresupuestoRequest {
|
||||
private Presupuesto presupuesto;
|
||||
private String[] servicios;
|
||||
|
||||
public Presupuesto getPresupuesto() {
|
||||
return presupuesto;
|
||||
}
|
||||
|
||||
public void setPresupuesto(Presupuesto p) {
|
||||
this.presupuesto = p;
|
||||
}
|
||||
|
||||
public String[] getServicios() {
|
||||
return servicios;
|
||||
}
|
||||
|
||||
public void setServicios(String[] servicios) {
|
||||
this.servicios = servicios;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user