|
|
@@ -5,6 +5,7 @@ import java.text.CharacterIterator;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.text.StringCharacterIterator;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.Year;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
@@ -15,7 +16,6 @@ import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
-import java.util.Optional;
|
|
|
import java.util.UUID;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
@@ -26,9 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.i18n.LocaleContextHolder;
|
|
|
import org.springframework.core.io.FileSystemResource;
|
|
|
-import org.springframework.security.access.annotation.Secured;
|
|
|
-import org.springframework.security.core.Authentication;
|
|
|
-import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
@@ -232,8 +229,15 @@ public class DashboardController {
|
|
|
List<Informe> informes = this.infs.findByGrupWebTambit("D", o.getTambit());
|
|
|
List<AnyDimensioDTO> treeByTitulacio = new ArrayList<AnyDimensioDTO>();
|
|
|
List<TreeDTOAny> treeByCentre = new ArrayList<TreeDTOAny>();
|
|
|
- int currentYear = Year.now().getValue();
|
|
|
- for(int i=currentYear; i>=currentYear-5; i--) {
|
|
|
+
|
|
|
+ int maxYear = Year.now().getValue();
|
|
|
+ int minYear = maxYear-5;
|
|
|
+ LocalDate currentdate = LocalDate.now();
|
|
|
+ if(currentdate.getMonthValue() >= 9){ // Si cambiamos de curso académico incrementamos el año
|
|
|
+ maxYear+=1;
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int i=maxYear; i>=minYear; i--) {
|
|
|
|
|
|
AnyDimensioDTO treeAnyT = new AnyDimensioDTO();
|
|
|
TreeDTOAny treeAnyC = new TreeDTOAny();
|
|
|
@@ -251,12 +255,13 @@ public class DashboardController {
|
|
|
for(InformeProcessos ip : dim.getProcessos()) {
|
|
|
processos.add(ip.getNomProces());
|
|
|
}
|
|
|
- // Create Dimensio
|
|
|
+ // Crear Dimensión
|
|
|
List<TreeDTOOrgan> treeOrgans = new ArrayList<TreeDTOOrgan>();
|
|
|
|
|
|
List<Instancia> instanciesT = new ArrayList<Instancia>();
|
|
|
List<Instancia> instanciesC = new ArrayList<Instancia>();
|
|
|
List<Instancia> instanciesC0 = new ArrayList<Instancia>();
|
|
|
+ List<Instancia> instanciesU = new ArrayList<Instancia>();
|
|
|
if(o.getTambit().equals("C")) {
|
|
|
instanciesC = is.findByOrganCursNom(o.getId().getTlugar(), o.getId().getLugar(),
|
|
|
o.getId().getLugar(), 1, i, processos);
|
|
|
@@ -267,12 +272,18 @@ public class DashboardController {
|
|
|
instanciesC0 = is.findByOrganCursNom(o.getId().getTlugar(), o.getId().getLugar(),
|
|
|
o.getId().getLugar(), 0, i, processos);
|
|
|
|
|
|
+ instanciesU = is.findByOrganCursNom("C", 0, 0, 0, i, processos);
|
|
|
+
|
|
|
instanciesC.addAll(instanciesC0);
|
|
|
|
|
|
TreeDTOOrgan treeOrgC = new TreeDTOOrgan();
|
|
|
+ TreeDTOOrgan treeOrgU = new TreeDTOOrgan();
|
|
|
treeOrgC.setText("Centro");
|
|
|
treeOrgC.setChildren(instanciesC.stream().map(x -> new TreeDTOInstancia(x)).collect(Collectors.toList()));
|
|
|
+ treeOrgU.setText("Universidad");
|
|
|
+ treeOrgU.setChildren(instanciesU.stream().map(x -> new TreeDTOInstancia(x)).collect(Collectors.toList()));
|
|
|
|
|
|
+ treeOrgans.add(treeOrgU);
|
|
|
treeOrgans.add(treeOrgC);
|
|
|
|
|
|
List<Organ> orgChilds = os.findTitulacionsByCentre(Stream.of(o.getId().getLugar()).toList());
|
|
|
@@ -287,13 +298,13 @@ public class DashboardController {
|
|
|
tit.getOrgan().getId().getLugar(),
|
|
|
tit.getId().getLugar(), i, processos);
|
|
|
|
|
|
- TreeDTOOrgan treeOrg = new TreeDTOOrgan();
|
|
|
- treeOrg.setText(tit.getNomCas());
|
|
|
- treeOrg.setChildren(instanciesT.stream().map(x -> new TreeDTOInstancia(x)).collect(Collectors.toList()));
|
|
|
-
|
|
|
- treeOrgans.add(treeOrg);
|
|
|
+ if(instanciesT.size() > 0){
|
|
|
+ TreeDTOOrgan treeOrg = new TreeDTOOrgan();
|
|
|
+ treeOrg.setText(tit.getNomCas());
|
|
|
+ treeOrg.setChildren(instanciesT.stream().map(x -> new TreeDTOInstancia(x)).collect(Collectors.toList()));
|
|
|
+ treeOrgans.add(treeOrg);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
else {
|
|
|
instanciesT = is.findByOrganCursNom(o.getId().getTlugar(), o.getId().getLugar(),
|