|
|
@@ -45,6 +45,7 @@ import es.uv.saic.domain.InformeProcessos;
|
|
|
import es.uv.saic.domain.Instancia;
|
|
|
import es.uv.saic.domain.Link;
|
|
|
import es.uv.saic.domain.Categoria;
|
|
|
+import es.uv.saic.domain.CursoValor;
|
|
|
import es.uv.saic.domain.Document;
|
|
|
import es.uv.saic.domain.Grafica;
|
|
|
import es.uv.saic.domain.Indicador;
|
|
|
@@ -61,6 +62,7 @@ import es.uv.saic.dto.DocumentTmpDTO;
|
|
|
import es.uv.saic.dto.IndicadorDTO;
|
|
|
import es.uv.saic.dto.InstanciaDTO;
|
|
|
import es.uv.saic.dto.InstanciaGanttDTO;
|
|
|
+import es.uv.saic.dto.InstanciaGanttDTOImp;
|
|
|
import es.uv.saic.dto.OrganDTO;
|
|
|
import es.uv.saic.dto.TreeDTOAny;
|
|
|
import es.uv.saic.dto.TreeDTODimensio;
|
|
|
@@ -79,7 +81,7 @@ import es.uv.saic.service.OrganService;
|
|
|
import es.uv.saic.service.UsuariService;
|
|
|
import es.uv.saic.service.UsuarisRolService;
|
|
|
|
|
|
-@Controller
|
|
|
+@RestController
|
|
|
public class DashboardController {
|
|
|
|
|
|
@Autowired
|
|
|
@@ -182,7 +184,7 @@ public class DashboardController {
|
|
|
|
|
|
if(!this.isSuitable(o, u)) {
|
|
|
model.put("redirect", "401");
|
|
|
- return model;
|
|
|
+ return model;
|
|
|
}
|
|
|
|
|
|
if(o.getTambit().equals("C") && o.getId().getTlugar().equals("C") && o.getId().getLugar() == 0) {
|
|
|
@@ -385,7 +387,7 @@ public class DashboardController {
|
|
|
// GET para conseguir el diagrama de gantt a partir del ruct
|
|
|
@GetMapping("/dashboard/gantt/{ruct}")
|
|
|
@ResponseBody
|
|
|
- public List<InstanciaGanttDTO> loadGantt(@PathVariable Integer ruct) {
|
|
|
+ public List<InstanciaGanttDTOImp> loadGantt(@PathVariable Integer ruct) {
|
|
|
Organ o = os.findByRuct(ruct);
|
|
|
List<Integer> ambits = Arrays.asList(1, 2, 3, 0);
|
|
|
if(!o.getTambit().equals("C")) {
|
|
|
@@ -425,7 +427,7 @@ public class DashboardController {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- return data;
|
|
|
+ return data.stream().map(InstanciaGanttDTOImp::new).toList();
|
|
|
}
|
|
|
|
|
|
@GetMapping("/dashboard/documents/cats/{idCategoria}/{tambit}")
|
|
|
@@ -491,18 +493,18 @@ public class DashboardController {
|
|
|
public List<Indicador> getGraphDataTaxes(@PathVariable Integer lugar) throws ParserConfigurationException {
|
|
|
return this.ids.getGraphData(lugar);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//GET para conseguir todos los datos concretos de cada gráfico
|
|
|
- @GetMapping({"/dashboard/graphs/inds/{ruct}", "/dashboard/graphs/inds/{ruct}/{tambit}"})
|
|
|
+ @GetMapping("/dashboard/graphs/inds/{ruct}/{tambit}")
|
|
|
@ResponseBody
|
|
|
- public List<Indicador> getGraphData(@PathVariable Integer ruct, @PathVariable Optional<String> tambit) throws ParserConfigurationException {
|
|
|
+ public List<Indicador> getGraphDataByRuctTambit(@PathVariable Integer ruct, @PathVariable String tambit) throws ParserConfigurationException {
|
|
|
Organ o = os.findByRuct(ruct);
|
|
|
int year = Year.now().getValue();
|
|
|
List<IndicadorDTO> data = new ArrayList<IndicadorDTO>();
|
|
|
|
|
|
if(o.getTambit().equals("C")) {
|
|
|
Integer centre = o.getId().getLugar();
|
|
|
- data = this.ies.getGraphData(centre, tambit.get(), year-10);
|
|
|
+ data = this.ies.getGraphData(centre, tambit, year-10);
|
|
|
}
|
|
|
else {
|
|
|
List<Integer> tits = this.os.getEquivalents(o.getId().getLugar(), "T");
|
|
|
@@ -521,10 +523,10 @@ public class DashboardController {
|
|
|
in.setIndicador(i.getIndicador());
|
|
|
in.setDimension(i.getDimensio());
|
|
|
in.setAmbit(i.getAmbit());
|
|
|
- in.getValores().add(in.new CursoValor(Integer.toString(Integer.parseInt(i.getCurs())-1)+"-"+i.getCurs(), i.getValor()));
|
|
|
+ in.getValores().add(new CursoValor(Integer.toString(Integer.parseInt(i.getCurs())-1)+"-"+i.getCurs(), i.getValor()));
|
|
|
}
|
|
|
else if(inAux.equals(i.getDimensio()+"_"+i.getIndicador()+"_"+i.getAmbit())) {
|
|
|
- in.getValores().add(in.new CursoValor(Integer.toString(Integer.parseInt(i.getCurs())-1)+"-"+i.getCurs(), i.getValor()));
|
|
|
+ in.getValores().add(new CursoValor(Integer.toString(Integer.parseInt(i.getCurs())-1)+"-"+i.getCurs(), i.getValor()));
|
|
|
}
|
|
|
else {
|
|
|
inds.add(in);
|
|
|
@@ -533,7 +535,7 @@ public class DashboardController {
|
|
|
in.setIndicador(i.getIndicador());
|
|
|
in.setDimension(i.getDimensio());
|
|
|
in.setAmbit(i.getAmbit());
|
|
|
- in.getValores().add(in.new CursoValor(Integer.toString(Integer.parseInt(i.getCurs())-1)+"-"+i.getCurs(), i.getValor()));
|
|
|
+ in.getValores().add(new CursoValor(Integer.toString(Integer.parseInt(i.getCurs())-1)+"-"+i.getCurs(), i.getValor()));
|
|
|
}
|
|
|
|
|
|
if(count == data.size()) {
|
|
|
@@ -543,6 +545,12 @@ public class DashboardController {
|
|
|
return inds;
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/dashboard/graphs/inds/{ruct}")
|
|
|
+ @ResponseBody
|
|
|
+ public List<Indicador> getGraphDataByRuct(@PathVariable Integer ruct) throws ParserConfigurationException {
|
|
|
+ return getGraphDataByRuctTambit(ruct, null);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/dashboard/links/{ruct}")
|
|
|
@ResponseBody
|
|
|
public List<Link> getLinks(@PathVariable Integer ruct) {
|