Skip to content

Commit

Permalink
perf(#123): 원서 PDF 저장 시 과목명 순서 유지
Browse files Browse the repository at this point in the history
- 이전에는 성적 일람표에서 과목 명이 입력한 순서대로 나오지 않았던 문제를 입력한 순서대로 나오도록 변경했습니다.
  • Loading branch information
cabbage16 committed Sep 7, 2024
1 parent 173063a commit be07047
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
import org.springframework.core.io.ByteArrayResource;

import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;

@Slf4j
Expand Down Expand Up @@ -75,7 +72,12 @@ private List<SubjectVO> getSubjectList(Form form) {
Map<String, List<Subject>> subjectMap = form.getGrade()
.getSubjectListValue()
.stream()
.collect(Collectors.groupingBy(Subject::getSubjectName));
.collect(Collectors.groupingBy(
Subject::getSubjectName,
LinkedHashMap::new,
Collectors.toList()
));


subjectMap.forEach((key, values) -> {
SubjectVO subject = new SubjectVO(key);
Expand All @@ -84,7 +86,7 @@ private List<SubjectVO> getSubjectList(Form form) {
subject.score = v.getOriginalScore();
} else {
try {
SubjectVO.class.getField("achievementLevel" + v.toString())
SubjectVO.class.getField("achievementLevel" + v)
.set(subject, v.getAchievementLevel());
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new RuntimeException(e);
Expand Down

0 comments on commit be07047

Please sign in to comment.