|
|
@ -3,16 +3,17 @@ package ru.mlokoin.gates.model.fs.xlsx; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map.Entry; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import ru.mlokoin.gates.model.building.Building; |
|
|
|
import ru.mlokoin.gates.model.building.Building; |
|
|
|
import ru.mlokoin.gates.model.course.Course; |
|
|
|
import ru.mlokoin.gates.model.course.Course; |
|
|
|
|
|
|
|
import ru.mlokoin.gates.model.cretarea.ProgramCretarea; |
|
|
|
import ru.mlokoin.gates.model.education.EducatonEntry; |
|
|
|
import ru.mlokoin.gates.model.education.EducatonEntry; |
|
|
|
import ru.mlokoin.gates.model.organization.Organization; |
|
|
|
import ru.mlokoin.gates.model.organization.Organization; |
|
|
|
import ru.mlokoin.gates.model.program.Program; |
|
|
|
import ru.mlokoin.gates.model.program.Program; |
|
|
|
import ru.mlokoin.gates.model.student.Student; |
|
|
|
import ru.mlokoin.gates.model.student.Student; |
|
|
|
import ru.mlokoin.gates.model.teacher.Teacher; |
|
|
|
import ru.mlokoin.gates.model.teacher.Teacher; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Класс для извлечения данных из Реестра обученных (educations) |
|
|
|
* Класс для извлечения данных из Реестра обученных (educations) |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -22,6 +23,16 @@ public class XlsxDocumentReestr extends XlsxDocument { |
|
|
|
super(xlsx); |
|
|
|
super(xlsx); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Получение списка обучений с вложенными объектами сверенными с базой и содержащими id |
|
|
|
|
|
|
|
* @param base_courses |
|
|
|
|
|
|
|
* @param base_students |
|
|
|
|
|
|
|
* @param base_teachers |
|
|
|
|
|
|
|
* @param base_programs |
|
|
|
|
|
|
|
* @param base_buildings |
|
|
|
|
|
|
|
* @param base_organizations |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
public List<EducatonEntry> getEducations(List<Course> base_courses, |
|
|
|
public List<EducatonEntry> getEducations(List<Course> base_courses, |
|
|
|
List<Student> base_students, |
|
|
|
List<Student> base_students, |
|
|
|
List<Teacher> base_teachers, |
|
|
|
List<Teacher> base_teachers, |
|
|
@ -31,8 +42,262 @@ public class XlsxDocumentReestr extends XlsxDocument { |
|
|
|
List<EducatonEntry> educations = new ArrayList<>(); |
|
|
|
List<EducatonEntry> educations = new ArrayList<>(); |
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
educations.add(new EducatonEntry((Entry<Integer, List<XlsxCell>>) entry, base_courses, base_students, base_teachers, base_programs, base_buildings, base_organizations)); |
|
|
|
educations.add(new EducatonEntry(entry, base_courses, base_students, base_teachers, base_programs, base_buildings, base_organizations)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return educations; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Получить список обучений из xlsx-документа, |
|
|
|
|
|
|
|
* вложенные объекты не сверены с базой, не указаны id |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public List<EducatonEntry> getEducationsAsIs() { |
|
|
|
|
|
|
|
List<EducatonEntry> educations = new ArrayList<>(); |
|
|
|
|
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
|
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
|
|
|
|
educations.add(new EducatonEntry(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return educations; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Получить список уникальных обучений из xlsx-документа |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public List<EducatonEntry> getUniqueEducations() { |
|
|
|
|
|
|
|
List<EducatonEntry> educations = new ArrayList<>(); |
|
|
|
|
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
|
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
|
|
|
|
educations.add(new EducatonEntry(entry)); |
|
|
|
} |
|
|
|
} |
|
|
|
return educations; |
|
|
|
return educations; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getEducationsCount(){ |
|
|
|
|
|
|
|
return getUniqueEducations().size(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Подсчет количества обучений |
|
|
|
|
|
|
|
* @return количество внесенных в реестр обучений |
|
|
|
|
|
|
|
* считаем по количеству строк в документе, отнимаем одну строку, содержащую заголовки |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
// public int getEducationsCount() {
|
|
|
|
|
|
|
|
// if (getData() == null || getData().isEmpty() || getData().size() == 0 || getData().size() == 1) {
|
|
|
|
|
|
|
|
// return 0;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// return getData().size() -1;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Получить список критериев из Реестра обученных |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return список объеков критериев, с заполненными краткими наименованиями критериев. |
|
|
|
|
|
|
|
* не актуализируются по сведениям базы данных |
|
|
|
|
|
|
|
* критерии в перечне соответствуют столбцу в файле, не сортируютс, не фильтруются, не выбираются уникальные |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public List<ProgramCretarea> getCretareasAsIs() { |
|
|
|
|
|
|
|
List<ProgramCretarea> programCretareas = new ArrayList<>(); |
|
|
|
|
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
|
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
|
|
|
|
if (entry.getKey() != 0) { |
|
|
|
|
|
|
|
programCretareas.add(new ProgramCretarea(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return programCretareas; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Получить список уникальных критериев из xlsx-документа |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public List<ProgramCretarea> getUniqueCretareas(){ |
|
|
|
|
|
|
|
List<ProgramCretarea> programCretareas = getCretareasAsIs(); |
|
|
|
|
|
|
|
List<ProgramCretarea> unique = new ArrayList<>(); |
|
|
|
|
|
|
|
for (ProgramCretarea programCretarea : programCretareas) { |
|
|
|
|
|
|
|
if (!unique.contains(programCretarea) && programCretarea.getName_short() != "") { |
|
|
|
|
|
|
|
unique.add(programCretarea); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return unique; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Подсчет количества уникальных критериев |
|
|
|
|
|
|
|
* @return количество уникальных критериев |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public int getCretareasCount() { |
|
|
|
|
|
|
|
return getUniqueCretareas().size(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Program> getProgramsAsIs() { |
|
|
|
|
|
|
|
List<Program> programs = new ArrayList<>(); |
|
|
|
|
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
|
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
|
|
|
|
//исключаем строку заголовков
|
|
|
|
|
|
|
|
if (entry.getKey() != 0) { |
|
|
|
|
|
|
|
programs.add(new Program(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return programs; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Получить список уникальных программ обучения из xlsx-документа |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public List<Program> getUniquePrograms() { |
|
|
|
|
|
|
|
List<Program> programs = getProgramsAsIs(); |
|
|
|
|
|
|
|
List<Program> unique = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Program program : programs) { |
|
|
|
|
|
|
|
if (!unique.contains(program) && program.getName() != "") { |
|
|
|
|
|
|
|
unique.add(program); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return unique; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Подсчет количества уникальных программ |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public int getProgramsCount() { |
|
|
|
|
|
|
|
return getUniquePrograms().size(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Building> getBuildingsAsIs() { |
|
|
|
|
|
|
|
List<Building> buildings = new ArrayList<>(); |
|
|
|
|
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
|
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
|
|
|
|
//исключаем строку заголовков
|
|
|
|
|
|
|
|
if (entry.getKey() != 0) { |
|
|
|
|
|
|
|
buildings.add(new Building(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return buildings; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Building> getUniqueBuildings() { |
|
|
|
|
|
|
|
List<Building> buildings = getBuildingsAsIs(); |
|
|
|
|
|
|
|
List<Building> unique = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Building building : buildings) { |
|
|
|
|
|
|
|
if (!unique.contains(building) && building.getName_short() != "") { |
|
|
|
|
|
|
|
unique.add(building); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return unique; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getBuildingsCount() { |
|
|
|
|
|
|
|
return getUniqueBuildings().size(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Organization> getOrganizationsAsIs() { |
|
|
|
|
|
|
|
List<Organization> organizations = new ArrayList<>(); |
|
|
|
|
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
|
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
|
|
|
|
//исключаем строку заголовков
|
|
|
|
|
|
|
|
if (entry.getKey() != 0) { |
|
|
|
|
|
|
|
organizations.add(new Organization(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return organizations; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Organization> getUniqueOrganizations() { |
|
|
|
|
|
|
|
List<Organization> organizations = getOrganizationsAsIs(); |
|
|
|
|
|
|
|
List<Organization> unique = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Organization organization : organizations) { |
|
|
|
|
|
|
|
if (!unique.contains(organization) && organization.getName_full() != "") { |
|
|
|
|
|
|
|
unique.add(organization); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return unique; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getOrganizationsCount() { |
|
|
|
|
|
|
|
return getUniqueOrganizations().size(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Teacher> getTeachersAsIs() { |
|
|
|
|
|
|
|
List<Teacher> teachers = new ArrayList<>(); |
|
|
|
|
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
|
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
|
|
|
|
//исключаем строку заголовков
|
|
|
|
|
|
|
|
if (entry.getKey() != 0) { |
|
|
|
|
|
|
|
teachers.add(new Teacher(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return teachers; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Teacher> getUniqueTeachers() { |
|
|
|
|
|
|
|
List<Teacher> teachers = getTeachersAsIs(); |
|
|
|
|
|
|
|
List<Teacher> unique = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Teacher teacher : teachers) { |
|
|
|
|
|
|
|
if (!unique.contains(teacher) && teacher.getFullName() != "") { |
|
|
|
|
|
|
|
unique.add(teacher); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return unique; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getTeachersCount() { |
|
|
|
|
|
|
|
return getUniqueTeachers().size(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Course> getCoursesAsIs() { |
|
|
|
|
|
|
|
List<Course> courses = new ArrayList<>(); |
|
|
|
|
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
|
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
|
|
|
|
//исключаем строку заголовков
|
|
|
|
|
|
|
|
if (entry.getKey() != 0) { |
|
|
|
|
|
|
|
courses.add(new Course(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return courses; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Course> getUniqueCourses() { |
|
|
|
|
|
|
|
List<Course> courses = getCoursesAsIs(); |
|
|
|
|
|
|
|
List<Course> unique = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Course course : courses) { |
|
|
|
|
|
|
|
if (!unique.contains(course)) { |
|
|
|
|
|
|
|
unique.add(course); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return unique; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getCoursesCount() { |
|
|
|
|
|
|
|
return getUniqueCourses().size(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Student> getStudentsAsIs() { |
|
|
|
|
|
|
|
List<Student> students = new ArrayList<>(); |
|
|
|
|
|
|
|
Map<Integer, List<XlsxCell>> map = getData(); |
|
|
|
|
|
|
|
for (Map.Entry<Integer, List<XlsxCell>> entry : map.entrySet()) { |
|
|
|
|
|
|
|
//исключаем строку заголовков
|
|
|
|
|
|
|
|
if (entry.getKey() != 0) { |
|
|
|
|
|
|
|
students.add(new Student(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return students; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Student> getUniqueStudents() { |
|
|
|
|
|
|
|
List<Student> students = getStudentsAsIs(); |
|
|
|
|
|
|
|
List<Student> unique = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Student student : students) { |
|
|
|
|
|
|
|
if (!unique.contains(student)) { |
|
|
|
|
|
|
|
unique.add(student); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return unique; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getStudentsCount() { |
|
|
|
|
|
|
|
return getUniqueStudents().size(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|