Search in sources :

Example 1 with Formation

use of fr.univlorraine.ecandidat.entities.ecandidat.Formation in project esup-ecandidat by EsupPortail.

the class SiScolApogeeWSServiceImpl method getVoeuByCandidature.

/**
 * Transforme une candidature en voeuy OPI
 * @param  candidature
 * @return             transforme une candidature en voeu
 */
private MAJOpiVoeuDTO3 getVoeuByCandidature(final Candidature candidature) {
    final Formation formation = candidature.getFormation();
    if (formation.getCodEtpVetApoForm() == null || formation.getCodVrsVetApoForm() == null || formation.getSiScolCentreGestion() == null) {
        return null;
    }
    if (candidature.getTemAcceptCand() == null || !candidature.getTemAcceptCand()) {
        return null;
    }
    final MAJOpiVoeuDTO3 voeu = new MAJOpiVoeuDTO3();
    voeu.setNumCls(1);
    voeu.setCodCmp(null);
    voeu.setCodCge(formation.getSiScolCentreGestion().getCodCge());
    if (formation.getCodDipApoForm() != null && formation.getCodVrsVdiApoForm() != null) {
        voeu.setCodDip(formation.getCodDipApoForm());
        voeu.setCodVrsVdi(Integer.parseInt(formation.getCodVrsVdiApoForm()));
    } else {
        voeu.setCodDip(null);
        voeu.setCodVrsVdi(null);
    }
    voeu.setCodEtp(formation.getCodEtpVetApoForm());
    voeu.setCodVrsVet(Integer.parseInt(formation.getCodVrsVetApoForm()));
    voeu.setCodSpe1Opi(null);
    voeu.setCodSpe2Opi(null);
    voeu.setCodSpe3Opi(null);
    voeu.setCodTyd(null);
    voeu.setCodAttDec(null);
    voeu.setCodDecVeu("F");
    voeu.setCodDemDos("C");
    voeu.setCodMfo(null);
    voeu.setTemValPsd("N");
    voeu.setLibCmtJur(null);
    voeu.setTitreAccesExterne(null);
    voeu.setConvocation(null);
    /* Exonération */
    if (candidature.getSiScolCatExoExt() != null) {
        voeu.setCodCatExoExt(candidature.getSiScolCatExoExt().getCodCatExoExt());
        if (candidature.getMntChargeCand() != null) {
            final String montant = MethodUtils.parseBigDecimalAsString(candidature.getMntChargeCand());
            if (montant != null && montant.length() <= 15) {
                voeu.setComExoExt(String.valueOf(candidature.getMntChargeCand()));
            }
        }
    }
    if (candidature.getMntChargeCand() != null) {
        final String montant = MethodUtils.parseBigDecimalAsString(candidature.getMntChargeCand());
        if (montant != null && montant.length() <= 15) {
            voeu.setComExoExt(String.valueOf(candidature.getMntChargeCand()));
        }
    }
    return voeu;
}
Also used : MAJOpiVoeuDTO3(gouv.education.apogee.commun.client.ws.OpiMetier.MAJOpiVoeuDTO3) Formation(fr.univlorraine.ecandidat.entities.ecandidat.Formation)

Example 2 with Formation

use of fr.univlorraine.ecandidat.entities.ecandidat.Formation in project esup-ecandidat by EsupPortail.

the class CandidatureController method getInformationsCandidature.

/**
 * @param  candidature
 * @return             une liste de données perso à afficher
 */
public List<SimpleTablePresentation> getInformationsCandidature(final Candidature candidature, final Boolean isCandidatOfCandidature) {
    final List<SimpleTablePresentation> liste = new ArrayList<>();
    final Formation formation = candidature.getFormation();
    final TypeDecisionCandidature typeDecision = getLastTypeDecisionCandidature(candidature);
    liste.add(new SimpleTablePresentation("candidature." + Candidature_.formation.getName() + "." + Formation_.libForm.getName(), applicationContext.getMessage("candidature." + Candidature_.formation.getName() + "." + Formation_.libForm.getName(), null, UI.getCurrent().getLocale()), formation.getLibForm()));
    final SimpleTablePresentation stpStatutDossier = new SimpleTablePresentation("candidature." + ConstanteUtils.CANDIDATURE_LIB_STATUT, applicationContext.getMessage("candidature." + ConstanteUtils.CANDIDATURE_LIB_STATUT, null, UI.getCurrent().getLocale()), i18nController.getI18nTraduction(candidature.getTypeStatut().getI18nLibTypStatut()));
    stpStatutDossier.setShortValue(candidature.getTypeStatut().getCodTypStatut());
    liste.add(stpStatutDossier);
    /* gestionnaire-->On affiche le type de traitement */
    if (!isCandidatOfCandidature) {
        String libTypTraitement = i18nController.getI18nTraduction(candidature.getTypeTraitement().getI18nLibTypTrait());
        if (candidature.getTemValidTypTraitCand()) {
            libTypTraitement = libTypTraitement + " (" + applicationContext.getMessage("valide", null, UI.getCurrent().getLocale()) + ")";
        } else {
            libTypTraitement = libTypTraitement + " (" + applicationContext.getMessage("non.valide", null, UI.getCurrent().getLocale()) + ")";
        }
        liste.add((new SimpleTablePresentation("candidature." + ConstanteUtils.CANDIDATURE_LIB_TYPE_TRAITEMENT, applicationContext.getMessage("candidature." + ConstanteUtils.CANDIDATURE_LIB_TYPE_TRAITEMENT, null, UI.getCurrent().getLocale()), libTypTraitement)));
    }
    String libTypDecision = getLibLastTypeDecisionCandidature(typeDecision, isCandidatOfCandidature);
    String commentaire = null;
    String codeTypeDecision = NomenclatureUtils.TYP_AVIS_ATTENTE;
    /* La decision n'est pas null et le candidat est candidiat avec un avis validé */
    if (typeDecision != null && (!isCandidatOfCandidature || (isCandidatOfCandidature && typeDecision.getTemValidTypeDecCand()))) {
        if (typeDecision.getTemValidTypeDecCand()) {
            if (!isCandidatOfCandidature) {
                libTypDecision = libTypDecision + " (" + applicationContext.getMessage("valide.date", new Object[] { typeDecision.getDatValidTypeDecCand() != null ? formatterDate.format(typeDecision.getDatValidTypeDecCand()) : "" }, UI.getCurrent().getLocale()) + ")";
            }
            if (candidature.getTemAcceptCand() != null && candidature.getTemAcceptCand()) {
                libTypDecision = libTypDecision + " : " + applicationContext.getMessage("candidature.confirm.label", null, UI.getCurrent().getLocale());
            } else if (candidature.getTemAcceptCand() != null && !candidature.getTemAcceptCand()) {
                libTypDecision = libTypDecision + " : " + applicationContext.getMessage("candidature.desist.label", null, UI.getCurrent().getLocale());
            }
        } else {
            libTypDecision = libTypDecision + " (" + applicationContext.getMessage("non.valide", null, UI.getCurrent().getLocale()) + ")";
        }
        if (typeDecision.getTypeDecision().getTypeAvis().equals(tableRefController.getTypeAvisPreselect())) {
            libTypDecision = libTypDecision + "<br>" + ctrCandCandidatureController.getComplementPreselectMail(typeDecision);
        }
        codeTypeDecision = typeDecision.getTypeDecision().getTypeAvis().getCodTypAvis();
        if (!isCandidatOfCandidature || typeDecision.getTypeDecision().getTemAffCommentTypDec()) {
            commentaire = typeDecision.getCommentTypeDecCand();
        }
    }
    final SimpleTablePresentation stpDecision = new SimpleTablePresentation("candidature." + ConstanteUtils.CANDIDATURE_LIB_LAST_DECISION, applicationContext.getMessage("candidature." + ConstanteUtils.CANDIDATURE_LIB_LAST_DECISION, null, UI.getCurrent().getLocale()), libTypDecision);
    stpDecision.setShortValue(codeTypeDecision);
    liste.add(stpDecision);
    /* Ajout de l'info de confirmation pour les gestionnaires */
    if (!isCandidatOfCandidature) {
        if (candidature.getTemAcceptCand() != null && candidature.getDatAcceptCand() != null && candidature.getUserAcceptCand() != null) {
            final Object[] params = new Object[] { formatterDateTime.format(candidature.getDatAcceptCand()), candidature.getUserAcceptCand() };
            String code = "candidature." + ConstanteUtils.CANDIDATURE_LIB_DESIST;
            if (candidature.getTemAcceptCand()) {
                code = "candidature." + ConstanteUtils.CANDIDATURE_LIB_CONFIRM;
            }
            liste.add((new SimpleTablePresentation(code, applicationContext.getMessage(code, null, UI.getCurrent().getLocale()), applicationContext.getMessage(code + ".val", params, UI.getCurrent().getLocale()))));
        }
    }
    /* On ajoute le commentaire lié à l'avis à la suite */
    if (commentaire != null && !commentaire.equals("")) {
        liste.add(new SimpleTablePresentation("candidature." + ConstanteUtils.CANDIDATURE_COMMENTAIRE, applicationContext.getMessage("candidature." + ConstanteUtils.CANDIDATURE_COMMENTAIRE, null, UI.getCurrent().getLocale()), commentaire));
    }
    /* gestionnaire-->On affiche le numéro OPI */
    if (!isCandidatOfCandidature) {
        String opi = applicationContext.getMessage("candidature.no.opi", null, UI.getCurrent().getLocale());
        if (candidature.getOpi() != null && candidature.getOpi().getDatPassageOpi() != null) {
            if (candidature.getOpi().getCodOpi() != null) {
                opi = candidature.getOpi().getCodOpi();
            } else {
                opi = parametreController.getPrefixeOPI() + candidature.getCandidat().getCompteMinima().getNumDossierOpiCptMin();
            }
            opi = applicationContext.getMessage("candidature.valOpi", new Object[] { opi, formatterDateTime.format(candidature.getOpi().getDatPassageOpi()) }, UI.getCurrent().getLocale());
        }
        liste.add(new SimpleTablePresentation("candidature." + ConstanteUtils.CANDIDATURE_OPI, applicationContext.getMessage("candidature." + ConstanteUtils.CANDIDATURE_OPI, null, UI.getCurrent().getLocale()), opi));
        /* Exoneration */
        if (candidature.getSiScolCatExoExt() != null) {
            liste.add(new SimpleTablePresentation("candidature." + ConstanteUtils.CANDIDATURE_EXO, applicationContext.getMessage("candidature." + ConstanteUtils.CANDIDATURE_EXO, null, UI.getCurrent().getLocale()), candidature.getSiScolCatExoExt().getDisplayLibelle()));
        }
        /* Complément Exoneration */
        if (candidature.getCompExoExtCand() != null) {
            liste.add(new SimpleTablePresentation("candidature." + ConstanteUtils.CANDIDATURE_COMP_EXO, applicationContext.getMessage("candidature." + ConstanteUtils.CANDIDATURE_COMP_EXO, null, UI.getCurrent().getLocale()), candidature.getCompExoExtCand()));
        }
    } else {
        if (candidature.getOpi() != null && candidature.getOpi().getDatPassageOpi() != null && candidature.getOpi().getCodOpi() != null) {
            liste.add(new SimpleTablePresentation("candidature." + ConstanteUtils.CANDIDATURE_ID_INS, applicationContext.getMessage("candidature." + ConstanteUtils.CANDIDATURE_ID_INS, null, UI.getCurrent().getLocale()), candidature.getOpi().getCodOpi()));
        }
    }
    /* Si montant on l'affiche */
    if (candidature.getMntChargeCand() != null) {
        liste.add(new SimpleTablePresentation("candidature." + ConstanteUtils.CANDIDATURE_MNT, applicationContext.getMessage("candidature." + ConstanteUtils.CANDIDATURE_MNT, null, UI.getCurrent().getLocale()), MethodUtils.parseBigDecimalAsString(candidature.getMntChargeCand()) + "&euro;"));
    }
    return liste;
}
Also used : SimpleTablePresentation(fr.univlorraine.ecandidat.utils.bean.presentation.SimpleTablePresentation) ArrayList(java.util.ArrayList) PDImageXObject(org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject) Formation(fr.univlorraine.ecandidat.entities.ecandidat.Formation) TypeDecisionCandidature(fr.univlorraine.ecandidat.entities.ecandidat.TypeDecisionCandidature)

Example 3 with Formation

use of fr.univlorraine.ecandidat.entities.ecandidat.Formation in project esup-ecandidat by EsupPortail.

the class CandidatureGestionController method calculRangLcAllFormation.

/**
 * @param batchHisto
 */
public void calculRangLcAllFormation(final BatchHisto batchHisto) {
    final Campagne camp = campagneController.getCampagneActive();
    if (camp == null) {
        return;
    }
    final List<Formation> listForm = formationRepository.findByTesFormAndTemListCompForm(true, true);
    batchController.addDescription(batchHisto, "Lancement batch de recalcul des rangs LC pour " + listForm.size() + " formations");
    final int[] cpt = { 0 };
    listForm.forEach(formation -> {
        final List<TypeDecisionCandidature> listeTdc = findTypDecLc(formation, camp);
        final int size = listeTdc.size();
        cpt[0] = cpt[0] + size;
        batchController.addDescription(batchHisto, "Batch calcul rang : formation '" + formation.getCodForm() + "', " + size + " décisions à recalculer");
        calculRangReel(listeTdc);
    });
    batchController.addDescription(batchHisto, "Fin batch de recalcul des rangs LC, recalcul terminé pour " + cpt[0] + " décisions");
}
Also used : Campagne(fr.univlorraine.ecandidat.entities.ecandidat.Campagne) Formation(fr.univlorraine.ecandidat.entities.ecandidat.Formation) TypeDecisionCandidature(fr.univlorraine.ecandidat.entities.ecandidat.TypeDecisionCandidature)

Example 4 with Formation

use of fr.univlorraine.ecandidat.entities.ecandidat.Formation in project esup-ecandidat by EsupPortail.

the class FormationController method editNewFormation.

/**
 * Ouvre une fenêtre d'édition d'un nouveau formation.
 */
public void editNewFormation(final SecurityCtrCandFonc securityCtrCand) {
    final CentreCandidature ctrCand = securityCtrCand.getCtrCand();
    final Formation form = new Formation(userController.getCurrentUserLogin());
    final I18n i18n = new I18n(i18nController.getTypeTraduction(NomenclatureUtils.TYP_TRAD_FORM_INFO_COMP));
    if (ctrCand.getInfoCompCtrCand() != null) {
        final I18nTraduction trad = new I18nTraduction(ctrCand.getInfoCompCtrCand(), i18n, cacheController.getLangueDefault());
        final List<I18nTraduction> i18nTraductions = new ArrayList<>();
        i18nTraductions.add(trad);
        i18n.setI18nTraductions(i18nTraductions);
    }
    form.setI18nInfoCompForm(i18n);
    form.setTemDematForm(ctrCand.getTemDematCtrCand());
    form.setDatConfirmForm(ctrCand.getDatConfirmCtrCand());
    form.setDelaiConfirmForm(ctrCand.getDelaiConfirmCtrCand());
    form.setDatConfirmListCompForm(ctrCand.getDatConfirmListCompCtrCand());
    form.setDelaiConfirmListCompForm(ctrCand.getDelaiConfirmListCompCtrCand());
    form.setDatDebDepotForm(ctrCand.getDatDebDepotCtrCand());
    form.setDatAnalyseForm(ctrCand.getDatAnalyseCtrCand());
    form.setDatFinDepotForm(ctrCand.getDatFinDepotCtrCand());
    form.setDatJuryForm(ctrCand.getDatJuryCtrCand());
    form.setDatPubliForm(ctrCand.getDatPubliCtrCand());
    form.setDatRetourForm(ctrCand.getDatRetourCtrCand());
    form.setTemListCompForm(ctrCand.getTemListCompCtrCand());
    form.setTypeDecisionFav(ctrCand.getTypeDecisionFav());
    UI.getCurrent().addWindow(new CtrCandFormationWindow(form, securityCtrCand));
}
Also used : CtrCandFormationWindow(fr.univlorraine.ecandidat.views.windows.CtrCandFormationWindow) I18nTraduction(fr.univlorraine.ecandidat.entities.ecandidat.I18nTraduction) CentreCandidature(fr.univlorraine.ecandidat.entities.ecandidat.CentreCandidature) SecurityCentreCandidature(fr.univlorraine.ecandidat.services.security.SecurityCentreCandidature) ArrayList(java.util.ArrayList) Formation(fr.univlorraine.ecandidat.entities.ecandidat.Formation) I18n(fr.univlorraine.ecandidat.entities.ecandidat.I18n)

Example 5 with Formation

use of fr.univlorraine.ecandidat.entities.ecandidat.Formation in project esup-ecandidat by EsupPortail.

the class OffreFormationController method getDiplomesByCtrCand.

/**
 * Renvoi la liste de diplome d'un centre de candidature
 * @param formations
 * @return la liste d'odf diplomes
 */
private List<OdfDiplome> getDiplomesByCtrCand(Integer idCtr, List<Formation> formations) {
    List<OdfDiplome> diplomes = new ArrayList<OdfDiplome>();
    /*Parcourt des formations*/
    formations.forEach(formation -> {
        if (formation.getTesForm()) {
            SiScolTypDiplome diplome = formation.getSiScolTypDiplome();
            /*Verification que le diplome est deja présent dans la liste des diplomes*/
            Optional<OdfDiplome> dipOpt = diplomes.stream().filter(dip -> dip.getCodDip().equals(diplome.getCodTpdEtb())).findAny();
            OdfDiplome leDiplome = null;
            /*Si deja présent-->on le recupere et on ajoute la formation à ce diplome*/
            if (dipOpt.isPresent()) {
                leDiplome = dipOpt.get();
            } else /*Si pas present on en créé un nouveau*/
            {
                leDiplome = new OdfDiplome(idCtr + "-" + diplome.getCodTpdEtb(), diplome.getCodTpdEtb(), diplome.getLibTpd());
                diplomes.add(leDiplome);
            }
            leDiplome.getListeFormation().add(new OdfFormation(formation.getLibForm(), formation.getIdForm(), formation.getMotCleForm(), formation.getDatDebDepotForm(), formation.getDatFinDepotForm(), formation.getTemDematForm()));
            leDiplome.getListeFormation().sort((p1, p2) -> p1.getTitle().compareTo(p2.getTitle()));
        }
    });
    diplomes.sort((p1, p2) -> p1.getTitle().compareTo(p2.getTitle()));
    return diplomes;
}
Also used : List(java.util.List) Component(org.springframework.stereotype.Component) CentreCandidature(fr.univlorraine.ecandidat.entities.ecandidat.CentreCandidature) OdfFormation(fr.univlorraine.ecandidat.utils.bean.odf.OdfFormation) Resource(javax.annotation.Resource) Optional(java.util.Optional) OdfDiplome(fr.univlorraine.ecandidat.utils.bean.odf.OdfDiplome) OdfCtrCand(fr.univlorraine.ecandidat.utils.bean.odf.OdfCtrCand) Formation(fr.univlorraine.ecandidat.entities.ecandidat.Formation) SiScolTypDiplome(fr.univlorraine.ecandidat.entities.ecandidat.SiScolTypDiplome) ArrayList(java.util.ArrayList) OdfFormation(fr.univlorraine.ecandidat.utils.bean.odf.OdfFormation) ArrayList(java.util.ArrayList) SiScolTypDiplome(fr.univlorraine.ecandidat.entities.ecandidat.SiScolTypDiplome) OdfDiplome(fr.univlorraine.ecandidat.utils.bean.odf.OdfDiplome)

Aggregations

Formation (fr.univlorraine.ecandidat.entities.ecandidat.Formation)22 ArrayList (java.util.ArrayList)14 CentreCandidature (fr.univlorraine.ecandidat.entities.ecandidat.CentreCandidature)8 Campagne (fr.univlorraine.ecandidat.entities.ecandidat.Campagne)6 Commission (fr.univlorraine.ecandidat.entities.ecandidat.Commission)6 TypeDecisionCandidature (fr.univlorraine.ecandidat.entities.ecandidat.TypeDecisionCandidature)6 List (java.util.List)6 Resource (javax.annotation.Resource)5 Component (org.springframework.stereotype.Component)5 UI (com.vaadin.ui.UI)4 Candidat (fr.univlorraine.ecandidat.entities.ecandidat.Candidat)4 Candidature (fr.univlorraine.ecandidat.entities.ecandidat.Candidature)4 CompteMinima (fr.univlorraine.ecandidat.entities.ecandidat.CompteMinima)4 I18n (fr.univlorraine.ecandidat.entities.ecandidat.I18n)4 NomenclatureUtils (fr.univlorraine.ecandidat.utils.NomenclatureUtils)4 OnDemandFile (fr.univlorraine.ecandidat.vaadin.components.OnDemandFile)4 LocalDate (java.time.LocalDate)4 Collectors (java.util.stream.Collectors)4 ApplicationContext (org.springframework.context.ApplicationContext)4 Notification (com.vaadin.ui.Notification)3