MAJ V1.0.1 (JRE1.8 with JDK1.8.0_271)
This commit is contained in:
parent
f7a122679a
commit
86714bd941
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -83,7 +83,7 @@ public class demarre extends JFrame {
|
|||||||
actCharge = new JButton("<html>Importer des inscriptions<br>depuis CSV (UTF-8, point-virgule)</html>");
|
actCharge = new JButton("<html>Importer des inscriptions<br>depuis CSV (UTF-8, point-virgule)</html>");
|
||||||
actCharge.addActionListener(new ActionListener() {
|
actCharge.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
lecture.lect();
|
importInscriptionCSV.importe();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
actCharge.setHorizontalAlignment(SwingConstants.LEFT);
|
actCharge.setHorizontalAlignment(SwingConstants.LEFT);
|
||||||
@ -154,6 +154,14 @@ public class demarre extends JFrame {
|
|||||||
btnimporterDesInscriptionsdepuis.setHorizontalAlignment(SwingConstants.LEFT);
|
btnimporterDesInscriptionsdepuis.setHorizontalAlignment(SwingConstants.LEFT);
|
||||||
btnimporterDesInscriptionsdepuis.setFont(new Font("Arial", Font.BOLD, 16));
|
btnimporterDesInscriptionsdepuis.setFont(new Font("Arial", Font.BOLD, 16));
|
||||||
btnimporterDesInscriptionsdepuis.setBounds(376, 109, 356, 60);
|
btnimporterDesInscriptionsdepuis.setBounds(376, 109, 356, 60);
|
||||||
|
btnimporterDesInscriptionsdepuis.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
File f = FileChooserXLSX.retourneFileXLSX();
|
||||||
|
if(f!=null) {
|
||||||
|
importInscriptionXLS.importe(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
frmEvalwriter.getContentPane().add(btnimporterDesInscriptionsdepuis);
|
frmEvalwriter.getContentPane().add(btnimporterDesInscriptionsdepuis);
|
||||||
|
|
||||||
JLabel lblNewLabel_2 = new JLabel("version 1.0.1");
|
JLabel lblNewLabel_2 = new JLabel("version 1.0.1");
|
||||||
@ -164,15 +172,15 @@ public class demarre extends JFrame {
|
|||||||
lblNewLabel_3.setBounds(10, 426, 151, 14);
|
lblNewLabel_3.setBounds(10, 426, 151, 14);
|
||||||
frmEvalwriter.getContentPane().add(lblNewLabel_3);
|
frmEvalwriter.getContentPane().add(lblNewLabel_3);
|
||||||
|
|
||||||
JButton btnNewButton_1 = new JButton("Aide à la mise en jour");
|
JButton btnNAideMiseAJour = new JButton("Aide à la mise en jour");
|
||||||
btnNewButton_1.addActionListener(new ActionListener() {
|
btnNAideMiseAJour.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 12));
|
btnNAideMiseAJour.setFont(new Font("Tahoma", Font.BOLD, 12));
|
||||||
btnNewButton_1.setBounds(10, 378, 356, 30);
|
btnNAideMiseAJour.setBounds(10, 378, 356, 30);
|
||||||
frmEvalwriter.getContentPane().add(btnNewButton_1);
|
frmEvalwriter.getContentPane().add(btnNAideMiseAJour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,11 +16,27 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||||||
public class importAllBaseToExcel {
|
public class importAllBaseToExcel {
|
||||||
|
|
||||||
public static void lecture(File file) {
|
public static void lecture(File file) {
|
||||||
|
|
||||||
if(commandes.nBase==null) {
|
if(commandes.nBase==null) {
|
||||||
commandes.nBase = recupeBases.recupeLaBase();
|
commandes.nBase = recupeBases.recupeLaBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
int compteur = 0 ;
|
noeud nYear = null;
|
||||||
|
if(commandes.nBase.getAttributes("defaut_Year")!=null) {
|
||||||
|
String defautYear = commandes.nBase.getAttributes("defaut_Year");
|
||||||
|
if(commandes.nBase.getChild(defautYear)!=null) {
|
||||||
|
nYear = commandes.nBase.getChild(defautYear);
|
||||||
|
}else {
|
||||||
|
JOptionPane.showMessageDialog(null, "Il n'y a pas d'année universitaire par défaut.", "Erreur", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
JOptionPane.showMessageDialog(null, "Il n'y a pas d'année universitaire par défaut.", "Erreur", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int compteur = 0 ;
|
||||||
|
|
||||||
try (FileInputStream fileInputStream = new FileInputStream(file.getAbsolutePath());
|
try (FileInputStream fileInputStream = new FileInputStream(file.getAbsolutePath());
|
||||||
Workbook workbook = new XSSFWorkbook(fileInputStream)) {
|
Workbook workbook = new XSSFWorkbook(fileInputStream)) {
|
||||||
@ -41,7 +57,7 @@ public class importAllBaseToExcel {
|
|||||||
|
|
||||||
if(indexCol==0) { // Colonne formation
|
if(indexCol==0) { // Colonne formation
|
||||||
if(cell.getCellType() == CellType.STRING) {
|
if(cell.getCellType() == CellType.STRING) {
|
||||||
nBF = commandes.nBase.getChild(supprimeCaracatresSpeciaux.TousLesCaracatresSpeciaux(cell.getStringCellValue()));
|
nBF = nYear.getChild(supprimeCaracatresSpeciaux.TousLesCaracatresSpeciaux(cell.getStringCellValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ import javax.swing.JLabel;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
public class lecture {
|
public class importInscriptionCSV {
|
||||||
|
|
||||||
|
|
||||||
public static void lect() {
|
public static void importe() {
|
||||||
|
|
||||||
|
|
||||||
noeud noeudCSV = null;
|
noeud noeudCSV = null;
|
146
src/baseUFRHG/importInscriptionXLS.java
Normal file
146
src/baseUFRHG/importInscriptionXLS.java
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
package baseUFRHG;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.CellType;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
public class importInscriptionXLS {
|
||||||
|
|
||||||
|
public static void importe(File file) {
|
||||||
|
if(commandes.nBase==null) {
|
||||||
|
commandes.nBase = recupeBases.recupeLaBase();
|
||||||
|
}
|
||||||
|
|
||||||
|
noeud nYear = null;
|
||||||
|
if(commandes.nBase.getAttributes("defaut_Year")!=null) {
|
||||||
|
String defautYear = commandes.nBase.getAttributes("defaut_Year");
|
||||||
|
if(commandes.nBase.getChild(defautYear)!=null) {
|
||||||
|
nYear = commandes.nBase.getChild(defautYear);
|
||||||
|
}else {
|
||||||
|
JOptionPane.showMessageDialog(null, "Il n'y a pas d'année universitaire par défaut.", "Erreur", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
JOptionPane.showMessageDialog(null, "Il n'y a pas d'année universitaire par défaut.", "Erreur", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try (FileInputStream fileInputStream = new FileInputStream(file.getAbsolutePath());
|
||||||
|
Workbook workbook = new XSSFWorkbook(fileInputStream)) {
|
||||||
|
|
||||||
|
// int numSheets = workbook.getNumberOfSheets();
|
||||||
|
|
||||||
|
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
|
||||||
|
if(!sheet.getSheetName().equals("Inscrits détail")) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Ce n'est pas une feuille d'inscription de luniversité d'Artois.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Integer,String> Head = new HashMap<Integer, String>();
|
||||||
|
|
||||||
|
|
||||||
|
for (Row row : sheet) {
|
||||||
|
|
||||||
|
Map<String, String> Student = new HashMap<String, String>();
|
||||||
|
for (Cell cell : row) {
|
||||||
|
if(row.getRowNum()==0) {
|
||||||
|
Head.put(cell.getColumnIndex(),cell.getStringCellValue());
|
||||||
|
}else {
|
||||||
|
if(cell.getCellType()== CellType.STRING) {
|
||||||
|
Student.put(Head.get(cell.getColumnIndex()), String.valueOf(cell.getStringCellValue()));
|
||||||
|
}if (cell.getCellType()== CellType.NUMERIC) {
|
||||||
|
Student.put(Head.get(cell.getColumnIndex()), String.valueOf(Integer.valueOf((int) cell.getNumericCellValue())));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Student.get("IAE - Etape (lib.)")!=null) {
|
||||||
|
String nameFormation = supprimeCaracatresSpeciaux.TousLesCaracatresSpeciaux(Student.get("IAE - Etape (lib.)"));
|
||||||
|
noeud nFormation = null;
|
||||||
|
if(nYear.getChild(nameFormation)!=null) {
|
||||||
|
nFormation = nYear.getChild(nameFormation);
|
||||||
|
}else {
|
||||||
|
nFormation = new noeud(supprimeCaracatresSpeciaux.TousLesCaracatresSpeciaux(nameFormation));
|
||||||
|
nYear.addChild(nFormation);
|
||||||
|
}
|
||||||
|
String nameNoeudStudent = "n"+String.valueOf(Student.get("Individu - Code Etudiant"));
|
||||||
|
noeud nStudent = null;
|
||||||
|
if(nFormation.getChild(nameNoeudStudent)!=null) {
|
||||||
|
nStudent = nFormation.getChild(nameNoeudStudent);
|
||||||
|
} else {
|
||||||
|
nStudent = new noeud(nameNoeudStudent);
|
||||||
|
nFormation.addChild(nStudent);
|
||||||
|
}
|
||||||
|
for (Map.Entry<String, String> entry : Student.entrySet()) {
|
||||||
|
if(entry.getKey().equals("Individu - Nom")
|
||||||
|
|| entry.getKey().equals("Individu - Prénom")
|
||||||
|
|| entry.getKey().equals("Individu - Code Etudiant")
|
||||||
|
|| entry.getKey().equals("IAE - Etape (lib.)")
|
||||||
|
|| entry.getKey().equals("Profil étudiant (lib.)")
|
||||||
|
|| entry.getKey().equals("Bac ou équivalence (lib.)")
|
||||||
|
|| entry.getKey().equals("Individu - Email personnel")
|
||||||
|
|| entry.getKey().equals("Individu - Email")
|
||||||
|
|| entry.getKey().equals("Individu - Tél. portable")) {
|
||||||
|
nStudent.setAttribut(supprimeCaracatresSpeciaux.TousLesCaracatresSpeciaux(entry.getKey()), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(nStudent.getAttributes("Groupe_Principal")==null) nStudent.setAttribut("Groupe_Principal","");
|
||||||
|
if(nStudent.getAttributes("Groupe_Informatique")==null) nStudent.setAttribut("Groupe_Informatique","");
|
||||||
|
if(nStudent.getAttributes("Groupe_TD")==null) nStudent.setAttribut("Groupe_TD","");
|
||||||
|
if(nStudent.getAttributes("Groupe_Langue")==null) nStudent.setAttribut("Groupe_Langue","");
|
||||||
|
if(nStudent.getAttributes("Groupe_Doc")==null) nStudent.setAttribut("Groupe_Doc","");
|
||||||
|
if(nStudent.getAttributes("Groupe_Projet")==null) nStudent.setAttribut("Groupe_Projet","");
|
||||||
|
if(nStudent.getAttributes("Covoiturage")==null) nStudent.setAttribut("Covoiturage","non");
|
||||||
|
if(nStudent.getAttributes("Etudiant_Covoiturage")==null) nStudent.setAttribut("Etudiant_Covoiturage","");
|
||||||
|
if(nStudent.getAttributes("LV1")==null) nStudent.setAttribut("LV1","");
|
||||||
|
if(nStudent.getAttributes("LV2")==null) nStudent.setAttribut("LV2","");
|
||||||
|
if(nStudent.getAttributes("UE_Libre")==null) nStudent.setAttribut("UE_Libre","");
|
||||||
|
if(nStudent.getAttributes("Option")==null) nStudent.setAttribut("Option","");
|
||||||
|
if(nStudent.getAttributes("Stage_1")==null) nStudent.setAttribut("Stage_1","");
|
||||||
|
if(nStudent.getAttributes("Num_convention_1")==null) nStudent.setAttribut("Num_convention_1","");
|
||||||
|
if(nStudent.getAttributes("Periode_1")==null) nStudent.setAttribut("Periode_1","");
|
||||||
|
if(nStudent.getAttributes("Stage_2")==null) nStudent.setAttribut("Stage_2","");
|
||||||
|
if(nStudent.getAttributes("Num_convention_2")==null) nStudent.setAttribut("Num_convention_2","");
|
||||||
|
if(nStudent.getAttributes("Periode_2")==null) nStudent.setAttribut("Periode_2","");
|
||||||
|
if(nStudent.getAttributes("Information")==null) nStudent.setAttribut("Information","");
|
||||||
|
if(nStudent.getAttributes("Atelier-rentree_horaire")==null) nStudent.setAttribut("Atelier-rentree_horaire","");
|
||||||
|
if(nStudent.getAttributes("Atelier_pre-rentree_enseignant")==null) nStudent.setAttribut("Atelier_pre-rentree_enseignant","");
|
||||||
|
if(nStudent.getAttributes("Atelier_pre-rentree_salle")==null) nStudent.setAttribut("Atelier_pre-rentree_salle","");
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println( nStudent.toWrite()); // Nouvelle ligne après chaque ligne du tableau
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
sauvegardeXMLBase.save(commandes.nBase,sauvegardeXMLBase.saveType.SANS_MESSAGE);
|
||||||
|
JOptionPane.showMessageDialog(null, "Importation des inscription et les mises à jour sont réussies.");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user