tengo el texto del resumen final

This commit is contained in:
Jaime Jiménez
2025-09-23 13:25:06 +02:00
parent 479cecf52b
commit 85681b4d6e
13 changed files with 360 additions and 74 deletions

View File

@ -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;
}
}
}