esoe
3 months ago
9 changed files with 356 additions and 12 deletions
@ -1,5 +1,67 @@ |
|||||||
package ru.mlokoin.gates.model.education; |
package ru.mlokoin.gates.model.education; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import ru.mlokoin.gates.model.course.Course; |
||||||
|
import ru.mlokoin.gates.model.student.Student; |
||||||
|
|
||||||
|
@Data |
||||||
public class EducationEntryWraper { |
public class EducationEntryWraper { |
||||||
|
public List<EducatonEntry> educations; |
||||||
|
public List<Course> courses; |
||||||
|
public List<Student> students; |
||||||
|
|
||||||
|
public EducationEntryWraper(){ |
||||||
|
init(); |
||||||
|
} |
||||||
|
|
||||||
|
public EducationEntryWraper(List<EducatonEntry> list) { |
||||||
|
this.init(); |
||||||
|
this.educations = list; |
||||||
|
} |
||||||
|
|
||||||
|
public void init(){ |
||||||
|
this.educations = new ArrayList<>(); |
||||||
|
this.courses = new ArrayList<>(); |
||||||
|
this.students = new ArrayList<>(); |
||||||
|
} |
||||||
|
|
||||||
|
public void addEducation(EducatonEntry education){ |
||||||
|
this.educations.add(education); |
||||||
|
} |
||||||
|
|
||||||
|
public void addEducations(List<EducatonEntry> educations){ |
||||||
|
for (EducatonEntry education : educations) { |
||||||
|
this.addEducation(education); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void addCourse(Course course){ |
||||||
|
this.courses.add(course); |
||||||
|
} |
||||||
|
|
||||||
|
public void addCourses(List<Course> courses){ |
||||||
|
for (Course course : courses) { |
||||||
|
this.addCourse(course); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void addStudent(Student student){ |
||||||
|
this.students.add(student); |
||||||
|
} |
||||||
|
|
||||||
|
public void addStudents(List<Student> students){ |
||||||
|
for (Student student : students) { |
||||||
|
this.addStudent(student); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
return this.educations.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
} |
} |
||||||
|
@ -0,0 +1,38 @@ |
|||||||
|
package ru.mlokoin.gates.model.fs.xlsx; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Map.Entry; |
||||||
|
|
||||||
|
import ru.mlokoin.gates.model.building.Building; |
||||||
|
import ru.mlokoin.gates.model.course.Course; |
||||||
|
import ru.mlokoin.gates.model.education.EducatonEntry; |
||||||
|
import ru.mlokoin.gates.model.organization.Organization; |
||||||
|
import ru.mlokoin.gates.model.program.Program; |
||||||
|
import ru.mlokoin.gates.model.student.Student; |
||||||
|
import ru.mlokoin.gates.model.teacher.Teacher; |
||||||
|
|
||||||
|
/** |
||||||
|
* Класс для извлечения данных из Реестра обученных (educations) |
||||||
|
*/ |
||||||
|
public class XlsxDocumentReestr extends XlsxDocument { |
||||||
|
|
||||||
|
public XlsxDocumentReestr(XlsxDocument xlsx) { |
||||||
|
super(xlsx); |
||||||
|
} |
||||||
|
|
||||||
|
public List<EducatonEntry> getEducations(List<Course> base_courses, |
||||||
|
List<Student> base_students, |
||||||
|
List<Teacher> base_teachers, |
||||||
|
List<Program> base_programs, |
||||||
|
List<Building> base_buildings, |
||||||
|
List<Organization> base_organizations) { |
||||||
|
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<Integer, List<XlsxCell>>) entry, base_courses, base_students, base_teachers, base_programs, base_buildings, base_organizations)); |
||||||
|
} |
||||||
|
return educations; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue