Search in sources :

Example 1 with StatFormationPresentation

use of fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation in project esup-ecandidat by EsupPortail.

the class StatController method getStatCommission.

/**
 * Retourne les stats des commissions
 *
 * @param campagne
 * @param securityCtrCandFonc
 * @return les stats des commissions
 */
public List<StatFormationPresentation> getStatCommission(final Campagne campagne, final Boolean afficheHs, final SecurityCtrCandFonc securityCtrCandFonc) {
    List<StatFormationPresentation> listeStat = new ArrayList<>();
    if (campagne == null) {
        return listeStat;
    }
    Integer idCtrCand = securityCtrCandFonc.getCtrCand().getIdCtrCand();
    /* Definition des commissions à afficher. Si afficheHs est coché, on affiche les commissions hors service */
    List<Commission> listeCommission;
    if (afficheHs) {
        listeCommission = commissionRepository.findByCentreCandidatureIdCtrCand(idCtrCand);
    } else {
        listeCommission = commissionRepository.findByCentreCandidatureIdCtrCandAndTesComm(idCtrCand, true);
    }
    listeStat.addAll(listeCommission.stream().filter(e -> securityCtrCandFonc.getIsGestAllCommission() || MethodUtils.isIdInListId(e.getIdComm(), securityCtrCandFonc.getListeIdCommission())).map(e -> new StatFormationPresentation(e)).collect(Collectors.toList()));
    // Liste des nombre de candidature
    List<Object[]> listeNbCandidature = commissionRepository.findStatNbCandidature(idCtrCand, campagne.getIdCamp());
    // Liste des nombre de candidature cancel
    List<Object[]> listeNbCandidatureCancel = commissionRepository.findStatNbCandidatureCancel(idCtrCand, campagne.getIdCamp());
    // Liste des type de statut
    List<Object[]> listeNbCandidatureByStatut = commissionRepository.findStatNbCandidatureByStatut(idCtrCand, campagne.getIdCamp());
    // Liste des type de confirmation
    List<Object[]> listeNbCandidatureByConfirm = commissionRepository.findStatNbCandidatureByConfirm(idCtrCand, campagne.getIdCamp());
    // Liste des type de statut
    List<Object[]> listeNbCandidatureByAvis = commissionRepository.findStatNbCandidatureByAvis(idCtrCand, campagne.getIdCamp());
    return generateListStat(listeStat, listeNbCandidature, listeNbCandidatureByStatut, listeNbCandidatureByConfirm, listeNbCandidatureByAvis, listeNbCandidatureCancel);
}
Also used : Campagne(fr.univlorraine.ecandidat.entities.ecandidat.Campagne) MethodUtils(fr.univlorraine.ecandidat.utils.MethodUtils) SecurityCtrCandFonc(fr.univlorraine.ecandidat.services.security.SecurityCtrCandFonc) LocalDateTime(java.time.LocalDateTime) Resource(javax.annotation.Resource) UI(com.vaadin.ui.UI) HashMap(java.util.HashMap) Collectors(java.util.stream.Collectors) ApplicationContext(org.springframework.context.ApplicationContext) CentreCandidatureRepository(fr.univlorraine.ecandidat.repositories.CentreCandidatureRepository) ArrayList(java.util.ArrayList) Commission(fr.univlorraine.ecandidat.entities.ecandidat.Commission) List(java.util.List) Component(org.springframework.stereotype.Component) CentreCandidature(fr.univlorraine.ecandidat.entities.ecandidat.CentreCandidature) NomenclatureUtils(fr.univlorraine.ecandidat.utils.NomenclatureUtils) CommissionRepository(fr.univlorraine.ecandidat.repositories.CommissionRepository) OnDemandFile(fr.univlorraine.ecandidat.vaadin.components.OnDemandFile) DateTimeFormatter(java.time.format.DateTimeFormatter) Map(java.util.Map) FormationRepository(fr.univlorraine.ecandidat.repositories.FormationRepository) StatFormationPresentation(fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation) Formation(fr.univlorraine.ecandidat.entities.ecandidat.Formation) StatFormationPresentation(fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation) ArrayList(java.util.ArrayList) Commission(fr.univlorraine.ecandidat.entities.ecandidat.Commission)

Example 2 with StatFormationPresentation

use of fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation in project esup-ecandidat by EsupPortail.

the class StatController method getStatCtrCand.

/**
 * Recupere les stats par centre de candidature
 *
 * @param campagne
 * @return les stats des centres de candidature
 */
public List<StatFormationPresentation> getStatCtrCand(final Campagne campagne, final Boolean afficheHs) {
    List<StatFormationPresentation> listeStat = new ArrayList<>();
    if (campagne == null) {
        return listeStat;
    }
    /* Definition des centre de candidature à afficher. Si afficheHs est coché, on affiche les ctrCand hors service */
    List<CentreCandidature> listeCtrCand;
    if (afficheHs) {
        listeCtrCand = centreCandidatureRepository.findAll();
    } else {
        listeCtrCand = centreCandidatureRepository.findByTesCtrCand(true);
    }
    listeStat.addAll(listeCtrCand.stream().map(e -> new StatFormationPresentation(e)).collect(Collectors.toList()));
    // Liste des nombre de candidature
    List<Object[]> listeNbCandidature = centreCandidatureRepository.findStatNbCandidature(campagne.getIdCamp());
    // Liste des nombre de candidature
    List<Object[]> listeNbCandidatureCancel = centreCandidatureRepository.findStatNbCandidatureCancel(campagne.getIdCamp());
    // Liste des type de statut
    List<Object[]> listeNbCandidatureByStatut = centreCandidatureRepository.findStatNbCandidatureByStatut(campagne.getIdCamp());
    // Liste des type de confirmation
    List<Object[]> listeNbCandidatureByConfirm = centreCandidatureRepository.findStatNbCandidatureByConfirm(campagne.getIdCamp());
    // Liste des type de statut
    List<Object[]> listeNbCandidatureByAvis = centreCandidatureRepository.findStatNbCandidatureByAvis(campagne.getIdCamp());
    return generateListStat(listeStat, listeNbCandidature, listeNbCandidatureByStatut, listeNbCandidatureByConfirm, listeNbCandidatureByAvis, listeNbCandidatureCancel);
}
Also used : StatFormationPresentation(fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation) ArrayList(java.util.ArrayList) CentreCandidature(fr.univlorraine.ecandidat.entities.ecandidat.CentreCandidature)

Example 3 with StatFormationPresentation

use of fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation in project esup-ecandidat by EsupPortail.

the class StatViewTemplate method init.

/**
 * Initialise le template
 *
 * @param title
 * @param code
 * @param libelle
 */
public void init(final String title, final String code, final String libelle, final String libelleHs) {
    /* Style */
    setSizeFull();
    setMargin(true);
    setSpacing(true);
    /* Titre */
    Label titleParam = new Label(title);
    titleParam.addStyleName(StyleConstants.VIEW_TITLE);
    addComponent(titleParam);
    /* Boutons */
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setWidth(100, Unit.PERCENTAGE);
    buttonsLayout.setSpacing(true);
    addComponent(buttonsLayout);
    /* Choix de campagne */
    HorizontalLayout campagneLayout = new HorizontalLayout();
    campagneLayout.setWidth(100, Unit.PERCENTAGE);
    campagneLayout.setSpacing(true);
    buttonsLayout.addComponent(campagneLayout);
    /* Label campagne */
    Label labelCampagne = new Label(applicationContext.getMessage("stat.change.camp", null, UI.getCurrent().getLocale()));
    labelCampagne.setSizeUndefined();
    campagneLayout.addComponent(labelCampagne);
    campagneLayout.setComponentAlignment(labelCampagne, Alignment.MIDDLE_LEFT);
    /* ListeBox campagne */
    List<Campagne> listeCampagne = campagneController.getCampagnes();
    listeCampagne.sort(Comparator.comparing(Campagne::getCodCamp).reversed());
    cbCampagne = new RequiredComboBox<>(listeCampagne, Campagne.class);
    cbCampagne.setValue(campagneController.getCampagneActive());
    campagneLayout.addComponent(cbCampagne);
    campagneLayout.setExpandRatio(cbCampagne, 1);
    campagneLayout.setComponentAlignment(cbCampagne, Alignment.BOTTOM_LEFT);
    cbCampagne.addValueChangeListener(e -> {
        majContainer();
    });
    cbDisplayHs.setCaption(libelleHs);
    campagneLayout.addComponent(cbDisplayHs);
    campagneLayout.setComponentAlignment(cbDisplayHs, Alignment.MIDDLE_LEFT);
    cbDisplayHs.addValueChangeListener(e -> {
        majContainer();
    });
    /* Export des candidatures désactivé */
    /*
		 * OneClickButton btnExportCandidature = new
		 * OneClickButton(applicationContext.getMessage("stat.export.candidature.btn",
		 * null, UI.getCurrent().getLocale()), FontAwesome.FILE_EXCEL_O);
		 * btnExportCandidature.setDescription(applicationContext.getMessage(
		 * "stat.export.candidature.btn", null, UI.getCurrent().getLocale()));
		 * btnExportCandidature.addClickListener(e->{ CtrCandExportWindow window = new
		 * CtrCandExportWindow(securityCtrCandFonc.getCtrCand());
		 * UI.getCurrent().addWindow(window); });
		 */
    /* La grid */
    grid = new GridFormatting<>(StatFormationPresentation.class);
    grid.initColumn(new String[] { StatFormationPresentation.CHAMPS_COD, StatFormationPresentation.CHAMPS_LIB, StatFormationPresentation.CHAMPS_LIB_SUPP, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_TOTAL, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_CANCEL, StatFormationPresentation.CHAMPS_NB_STATUT_ATTENTE, StatFormationPresentation.CHAMPS_NB_STATUT_RECEPTIONNE, StatFormationPresentation.CHAMPS_NB_STATUT_COMPLET, StatFormationPresentation.CHAMPS_NB_STATUT_INCOMPLET, StatFormationPresentation.CHAMPS_NB_AVIS_FAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_DEFAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_LISTECOMP, StatFormationPresentation.CHAMPS_NB_AVIS_LISTEATTENTE, StatFormationPresentation.CHAMPS_NB_AVIS_PRESELECTION, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_VALIDE, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_NON_VALIDE, StatFormationPresentation.CHAMPS_NB_CONFIRM, StatFormationPresentation.CHAMPS_NB_DESIST, StatFormationPresentation.CHAMPS_CAPACITE_ACCUEIL }, "stat.table.", StatFormationPresentation.CHAMPS_LIB);
    grid.setSizeFull();
    grid.setFrozenColumnCount(2);
    grid.setSelectionMode(SelectionMode.NONE);
    /* Largeur des colonnes */
    grid.setColumnWidth(StatFormationPresentation.CHAMPS_COD, 150);
    grid.setColumnsWidth(300, StatFormationPresentation.CHAMPS_LIB, StatFormationPresentation.CHAMPS_LIB_SUPP);
    grid.setColumnsWidth(115, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_TOTAL, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_CANCEL, StatFormationPresentation.CHAMPS_NB_STATUT_ATTENTE, StatFormationPresentation.CHAMPS_NB_STATUT_RECEPTIONNE, StatFormationPresentation.CHAMPS_NB_STATUT_COMPLET, StatFormationPresentation.CHAMPS_NB_STATUT_INCOMPLET, StatFormationPresentation.CHAMPS_NB_AVIS_FAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_DEFAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_LISTECOMP, StatFormationPresentation.CHAMPS_NB_AVIS_LISTEATTENTE, StatFormationPresentation.CHAMPS_NB_AVIS_PRESELECTION, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_VALIDE, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_NON_VALIDE, StatFormationPresentation.CHAMPS_NB_CONFIRM, StatFormationPresentation.CHAMPS_NB_DESIST);
    grid.removeFilterCells(StatFormationPresentation.CHAMPS_NB_CANDIDATURE_TOTAL, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_CANCEL, StatFormationPresentation.CHAMPS_NB_STATUT_ATTENTE, StatFormationPresentation.CHAMPS_NB_STATUT_RECEPTIONNE, StatFormationPresentation.CHAMPS_NB_STATUT_COMPLET, StatFormationPresentation.CHAMPS_NB_STATUT_INCOMPLET, StatFormationPresentation.CHAMPS_NB_AVIS_FAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_DEFAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_LISTECOMP, StatFormationPresentation.CHAMPS_NB_AVIS_LISTEATTENTE, StatFormationPresentation.CHAMPS_NB_AVIS_PRESELECTION, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_VALIDE, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_NON_VALIDE, StatFormationPresentation.CHAMPS_NB_CONFIRM, StatFormationPresentation.CHAMPS_NB_DESIST);
    /* Header */
    HeaderRow headerRow = grid.prependHeaderRow();
    headerRow.setStyleName(ValoTheme.TEXTFIELD_ALIGN_CENTER);
    headerRow.join(StatFormationPresentation.CHAMPS_COD, StatFormationPresentation.CHAMPS_LIB).setText("");
    headerRow.join(StatFormationPresentation.CHAMPS_NB_CANDIDATURE_TOTAL, StatFormationPresentation.CHAMPS_NB_CANDIDATURE_CANCEL).setText(applicationContext.getMessage("stat.table.header.join.nbCandidature", null, UI.getCurrent().getLocale()));
    headerRow.join(StatFormationPresentation.CHAMPS_NB_STATUT_ATTENTE, StatFormationPresentation.CHAMPS_NB_STATUT_RECEPTIONNE, StatFormationPresentation.CHAMPS_NB_STATUT_COMPLET, StatFormationPresentation.CHAMPS_NB_STATUT_INCOMPLET).setText(applicationContext.getMessage("stat.table.header.join.statut", null, UI.getCurrent().getLocale()));
    headerRow.join(StatFormationPresentation.CHAMPS_NB_AVIS_FAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_DEFAVORABLE, StatFormationPresentation.CHAMPS_NB_AVIS_LISTECOMP, StatFormationPresentation.CHAMPS_NB_AVIS_LISTEATTENTE, StatFormationPresentation.CHAMPS_NB_AVIS_PRESELECTION).setText(applicationContext.getMessage("stat.table.header.join.avis", null, UI.getCurrent().getLocale()));
    headerRow.join(StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_VALIDE, StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_NON_VALIDE).setText(applicationContext.getMessage("stat.table.header.join.avis.total", null, UI.getCurrent().getLocale()));
    headerRow.join(StatFormationPresentation.CHAMPS_NB_CONFIRM, StatFormationPresentation.CHAMPS_NB_DESIST).setText(applicationContext.getMessage("stat.table.header.join.confirm", null, UI.getCurrent().getLocale()));
    addComponent(grid);
    setExpandRatio(grid, 1);
    /* Ajout des totaux dans le footer */
    footerRow = grid.prependFooterRow();
    footerRow.setStyleName(StyleConstants.GRID_FOOTER);
    FooterCell cellTxt = footerRow.join(StatFormationPresentation.CHAMPS_COD, StatFormationPresentation.CHAMPS_LIB);
    cellTxt.setText(applicationContext.getMessage("stat.table.footer.join.sum", null, UI.getCurrent().getLocale()));
    cellTxt.setStyleName(StyleConstants.GRID_FOOTER_TITLE);
    grid.addFilterListener(new FilterListener() {

        @Override
        public void filter() {
            updateFooter();
        }
    });
    grid.setRowStyleGenerator(new RowStyleGenerator() {

        @Override
        public String getStyle(final RowReference row) {
            StatFormationPresentation pres = (StatFormationPresentation) row.getItemId();
            if (!pres.getTes()) {
                return StyleConstants.GRID_ROW_STAT_HS;
            }
            return null;
        }
    });
    /* Export */
    Button btnExport = new Button(applicationContext.getMessage("btnExport", null, UI.getCurrent().getLocale()), FontAwesome.FILE_EXCEL_O);
    btnExport.setDescription(applicationContext.getMessage("btnExport", null, UI.getCurrent().getLocale()));
    buttonsLayout.addComponent(btnExport);
    buttonsLayout.setComponentAlignment(btnExport, Alignment.MIDDLE_RIGHT);
    btnExport.setDisableOnClick(true);
    new OnDemandFileDownloader(new OnDemandStreamFile() {

        @Override
        public OnDemandFile getOnDemandFile() {
            OnDemandFile file = statController.generateExport(getCampagne(), code, libelle, grid.getItems(), footerStat, getLibelleExport(), getLibelleSuppExport(), getDisplayCapaciteAccueil());
            if (file != null) {
                btnExport.setEnabled(true);
                return file;
            }
            btnExport.setEnabled(true);
            return null;
        }
    }, btnExport);
}
Also used : OnDemandStreamFile(fr.univlorraine.ecandidat.vaadin.components.OnDemandFileUtils.OnDemandStreamFile) OnDemandFileDownloader(fr.univlorraine.ecandidat.vaadin.components.OnDemandFileDownloader) Label(com.vaadin.ui.Label) StatFormationPresentation(fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation) OnDemandFile(fr.univlorraine.ecandidat.vaadin.components.OnDemandFile) FooterCell(com.vaadin.ui.Grid.FooterCell) HorizontalLayout(com.vaadin.ui.HorizontalLayout) RowReference(com.vaadin.ui.Grid.RowReference) FilterListener(fr.univlorraine.ecandidat.vaadin.components.GridFormatting.FilterListener) Button(com.vaadin.ui.Button) HeaderRow(com.vaadin.ui.Grid.HeaderRow) RowStyleGenerator(com.vaadin.ui.Grid.RowStyleGenerator) Campagne(fr.univlorraine.ecandidat.entities.ecandidat.Campagne)

Example 4 with StatFormationPresentation

use of fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation in project esup-ecandidat by EsupPortail.

the class StatViewTemplate method updateFooter.

/**
 * :odifie le footer
 */
private void updateFooter() {
    footerStat = new StatFormationPresentation();
    footerStat.setFooter();
    for (StatFormationPresentation stat : grid.getItems()) {
        /* Nombre de candidature total */
        footerStat.setNbCandidatureTotal(footerStat.getNbCandidatureTotal() + MethodUtils.getLongValue(stat.getNbCandidatureTotal()));
        /* Nombre de candidature cancel */
        footerStat.setNbCandidatureCancel(footerStat.getNbCandidatureCancel() + MethodUtils.getLongValue(stat.getNbCandidatureCancel()));
        /* Les statuts de dossier */
        footerStat.setNbStatutAttente(footerStat.getNbStatutAttente() + MethodUtils.getLongValue(stat.getNbStatutAttente()));
        footerStat.setNbStatutComplet(footerStat.getNbStatutComplet() + MethodUtils.getLongValue(stat.getNbStatutComplet()));
        footerStat.setNbStatutIncomplet(footerStat.getNbStatutIncomplet() + MethodUtils.getLongValue(stat.getNbStatutIncomplet()));
        footerStat.setNbStatutReceptionne(footerStat.getNbStatutReceptionne() + MethodUtils.getLongValue(stat.getNbStatutReceptionne()));
        /* Les avis */
        footerStat.setNbAvisFavorable(footerStat.getNbAvisFavorable() + MethodUtils.getLongValue(stat.getNbAvisFavorable()));
        footerStat.setNbAvisDefavorable(footerStat.getNbAvisDefavorable() + MethodUtils.getLongValue(stat.getNbAvisDefavorable()));
        footerStat.setNbAvisListeAttente(footerStat.getNbAvisListeAttente() + MethodUtils.getLongValue(stat.getNbAvisListeAttente()));
        footerStat.setNbAvisListeComp(footerStat.getNbAvisListeComp() + MethodUtils.getLongValue(stat.getNbAvisListeComp()));
        footerStat.setNbAvisPreselection(footerStat.getNbAvisPreselection() + MethodUtils.getLongValue(stat.getNbAvisPreselection()));
        /* Total des avis */
        footerStat.setNbAvisTotal(footerStat.getNbAvisTotal() + MethodUtils.getLongValue(stat.getNbAvisTotal()));
        footerStat.setNbAvisTotalValide(footerStat.getNbAvisTotalValide() + MethodUtils.getLongValue(stat.getNbAvisTotalValide()));
        footerStat.setNbAvisTotalNonValide(footerStat.getNbAvisTotalNonValide() + MethodUtils.getLongValue(stat.getNbAvisTotalNonValide()));
        /* Les confirmations */
        footerStat.setNbConfirm(footerStat.getNbConfirm() + MethodUtils.getLongValue(stat.getNbConfirm()));
        footerStat.setNbDesist(footerStat.getNbDesist() + MethodUtils.getLongValue(stat.getNbDesist()));
        /* Capacite accueil totale */
        if (getDisplayCapaciteAccueil()) {
            footerStat.setCapaciteAccueil(footerStat.getCapaciteAccueil() + MethodUtils.getLongValue(stat.getCapaciteAccueil()));
        }
    }
    /* Les totaux */
    /* Nombre de candidature total */
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_CANDIDATURE_TOTAL).setText(footerStat.getNbCandidatureTotal().toString());
    /* Nombre de candidature total */
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_CANDIDATURE_CANCEL).setText(footerStat.getNbCandidatureCancel().toString());
    /* Les statuts de dossier */
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_STATUT_ATTENTE).setText(footerStat.getNbStatutAttente().toString());
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_STATUT_RECEPTIONNE).setText(footerStat.getNbStatutReceptionne().toString());
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_STATUT_COMPLET).setText(footerStat.getNbStatutComplet().toString());
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_STATUT_INCOMPLET).setText(footerStat.getNbStatutIncomplet().toString());
    /* Les avis */
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_AVIS_FAVORABLE).setText(footerStat.getNbAvisFavorable().toString());
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_AVIS_DEFAVORABLE).setText(footerStat.getNbAvisDefavorable().toString());
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_AVIS_LISTECOMP).setText(footerStat.getNbAvisListeComp().toString());
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_AVIS_LISTEATTENTE).setText(footerStat.getNbAvisListeAttente().toString());
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_AVIS_PRESELECTION).setText(footerStat.getNbAvisPreselection().toString());
    /* Total des avis */
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL).setText(footerStat.getNbAvisTotal().toString());
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_VALIDE).setText(footerStat.getNbAvisTotalValide().toString());
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_AVIS_TOTAL_NON_VALIDE).setText(footerStat.getNbAvisTotalNonValide().toString());
    /* Les confirmations */
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_CONFIRM).setText(footerStat.getNbConfirm().toString());
    footerRow.getCell(StatFormationPresentation.CHAMPS_NB_DESIST).setText(footerStat.getNbDesist().toString());
    /* Capacite accueil */
    if (getDisplayCapaciteAccueil()) {
        footerRow.getCell(StatFormationPresentation.CHAMPS_CAPACITE_ACCUEIL).setText(footerStat.getCapaciteAccueil().toString());
    }
}
Also used : StatFormationPresentation(fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation)

Example 5 with StatFormationPresentation

use of fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation in project esup-ecandidat by EsupPortail.

the class StatController method getStatFormation.

/**
 * Retourne les stats de formation
 *
 * @param campagne
 * @param securityCtrCandFonc
 * @return les stats de formation
 */
public List<StatFormationPresentation> getStatFormation(final Campagne campagne, final Boolean afficheHs, final SecurityCtrCandFonc securityCtrCandFonc) {
    List<StatFormationPresentation> listeStat = new ArrayList<>();
    if (campagne == null) {
        return listeStat;
    }
    Integer idCtrCand = securityCtrCandFonc.getCtrCand().getIdCtrCand();
    /* Definition des Formation à afficher. Si afficheHs est coché, on affiche les Formation hors service */
    List<Formation> listeFormation;
    if (afficheHs) {
        listeFormation = formationRepository.findByCommissionCentreCandidatureIdCtrCand(idCtrCand);
    } else {
        listeFormation = formationRepository.findByCommissionCentreCandidatureIdCtrCandAndTesForm(idCtrCand, true);
    }
    listeStat.addAll(listeFormation.stream().filter(e -> securityCtrCandFonc.getIsGestAllCommission() || MethodUtils.isIdInListId(e.getCommission().getIdComm(), securityCtrCandFonc.getListeIdCommission())).map(e -> new StatFormationPresentation(e)).collect(Collectors.toList()));
    // Liste des nombre de candidature
    List<Object[]> listeNbCandidature = formationRepository.findStatNbCandidature(idCtrCand, campagne.getIdCamp());
    // Liste des nombre de candidature
    List<Object[]> listeNbCandidatureCancel = formationRepository.findStatNbCandidatureCancel(idCtrCand, campagne.getIdCamp());
    // Liste des type de statut
    List<Object[]> listeNbCandidatureByStatut = formationRepository.findStatNbCandidatureByStatut(idCtrCand, campagne.getIdCamp());
    // Liste des type de confirmation
    List<Object[]> listeNbCandidatureByConfirm = formationRepository.findStatNbCandidatureByConfirm(idCtrCand, campagne.getIdCamp());
    // Liste des type de statut
    List<Object[]> listeNbCandidatureByAvis = formationRepository.findStatNbCandidatureByAvis(idCtrCand, campagne.getIdCamp());
    return generateListStat(listeStat, listeNbCandidature, listeNbCandidatureByStatut, listeNbCandidatureByConfirm, listeNbCandidatureByAvis, listeNbCandidatureCancel);
}
Also used : Campagne(fr.univlorraine.ecandidat.entities.ecandidat.Campagne) MethodUtils(fr.univlorraine.ecandidat.utils.MethodUtils) SecurityCtrCandFonc(fr.univlorraine.ecandidat.services.security.SecurityCtrCandFonc) LocalDateTime(java.time.LocalDateTime) Resource(javax.annotation.Resource) UI(com.vaadin.ui.UI) HashMap(java.util.HashMap) Collectors(java.util.stream.Collectors) ApplicationContext(org.springframework.context.ApplicationContext) CentreCandidatureRepository(fr.univlorraine.ecandidat.repositories.CentreCandidatureRepository) ArrayList(java.util.ArrayList) Commission(fr.univlorraine.ecandidat.entities.ecandidat.Commission) List(java.util.List) Component(org.springframework.stereotype.Component) CentreCandidature(fr.univlorraine.ecandidat.entities.ecandidat.CentreCandidature) NomenclatureUtils(fr.univlorraine.ecandidat.utils.NomenclatureUtils) CommissionRepository(fr.univlorraine.ecandidat.repositories.CommissionRepository) OnDemandFile(fr.univlorraine.ecandidat.vaadin.components.OnDemandFile) DateTimeFormatter(java.time.format.DateTimeFormatter) Map(java.util.Map) FormationRepository(fr.univlorraine.ecandidat.repositories.FormationRepository) StatFormationPresentation(fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation) Formation(fr.univlorraine.ecandidat.entities.ecandidat.Formation) StatFormationPresentation(fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation) ArrayList(java.util.ArrayList) Formation(fr.univlorraine.ecandidat.entities.ecandidat.Formation)

Aggregations

StatFormationPresentation (fr.univlorraine.ecandidat.utils.bean.presentation.StatFormationPresentation)5 Campagne (fr.univlorraine.ecandidat.entities.ecandidat.Campagne)3 CentreCandidature (fr.univlorraine.ecandidat.entities.ecandidat.CentreCandidature)3 OnDemandFile (fr.univlorraine.ecandidat.vaadin.components.OnDemandFile)3 ArrayList (java.util.ArrayList)3 UI (com.vaadin.ui.UI)2 Commission (fr.univlorraine.ecandidat.entities.ecandidat.Commission)2 Formation (fr.univlorraine.ecandidat.entities.ecandidat.Formation)2 CentreCandidatureRepository (fr.univlorraine.ecandidat.repositories.CentreCandidatureRepository)2 CommissionRepository (fr.univlorraine.ecandidat.repositories.CommissionRepository)2 FormationRepository (fr.univlorraine.ecandidat.repositories.FormationRepository)2 SecurityCtrCandFonc (fr.univlorraine.ecandidat.services.security.SecurityCtrCandFonc)2 MethodUtils (fr.univlorraine.ecandidat.utils.MethodUtils)2 NomenclatureUtils (fr.univlorraine.ecandidat.utils.NomenclatureUtils)2 LocalDateTime (java.time.LocalDateTime)2 DateTimeFormatter (java.time.format.DateTimeFormatter)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2