diff --git a/src/docs/asciidoc/analysis.adoc b/src/docs/asciidoc/analysis.adoc index f591d69f..1cff385e 100644 --- a/src/docs/asciidoc/analysis.adoc +++ b/src/docs/asciidoc/analysis.adoc @@ -3,7 +3,7 @@ === 전형별 지원자 수 조회 전형별 지원자들의 수를 조회할 수 있습니다. -=== 요청 형식 +==== 요청 형식 ==== Request Header include::{snippets}/analysis-controller-test/전형별_지원자수를_조회한다/request-headers.adoc[] @@ -17,7 +17,7 @@ include::{snippets}/analysis-controller-test/전형별_지원자수를_조회한 === 전형별 성적 분포 조회 1차 합격자, 2차 전형자, 최종 합격자들의 전형별 성적 분포를 조회할 수 있습니다. -=== 요청 형식 +==== 요청 형식 ==== Request Header include::{snippets}/analysis-controller-test/_1차_합격자들의_성적_분포를_조회한다/request-headers.adoc[] @@ -44,7 +44,7 @@ include::{snippets}/analysis-controller-test/최종_합격자들의_성적_분 === 전형별 성비 조회 1차 합격자, 2차 전형자, 최종 합격자들의 전형별, 지역별 성비를 조회할 수 있습니다. -=== 요청 형식 +==== 요청 형식 ==== Request Header include::{snippets}/analysis-controller-test/전형별_성비를_조회한다/request-headers.adoc[] @@ -63,7 +63,7 @@ include::{snippets}/analysis-controller-test/전형별_성비를_조회한다/ht === 전형별 출신학교 조회 1차 합격자, 2차 전형자, 최종 합격자들의 출신학교를 조회할 수 있습니다. -=== 요청 형식 +==== 요청 형식 ==== Request Header include::{snippets}/analysis-controller-test/부산_특정구_출신_지원자들의_출신학교_통계를_조회한다/request-headers.adoc[] diff --git a/src/main/java/com/bamdoliro/maru/application/analysis/QuerySchoolStatusUseCase.java b/src/main/java/com/bamdoliro/maru/application/analysis/QuerySchoolStatusUseCase.java index 7a011839..883b31d9 100644 --- a/src/main/java/com/bamdoliro/maru/application/analysis/QuerySchoolStatusUseCase.java +++ b/src/main/java/com/bamdoliro/maru/application/analysis/QuerySchoolStatusUseCase.java @@ -15,10 +15,17 @@ public class QuerySchoolStatusUseCase { private final FormRepository formRepository; public List execute(SchoolStatusRequest request) { - String keyword = request.getIsBusan() ? "부산광역시" : ""; - keyword += request.getGu() == null ? "" : (" " + request.getGu()); + if (request.getIsBusan()) { + String keyword = "부산광역시"; + keyword += request.getGu() == null ? "" : (" " + request.getGu()); - return formRepository.findSchoolByAddress(request.getStatusList(), keyword) + return formRepository.findSchoolByAddress(request.getStatusList(), keyword) + .stream() + .map(SchoolStatusResponse::new) + .toList(); + } + + return formRepository.findNotBusanSchool(request.getStatusList()) .stream() .map(SchoolStatusResponse::new) .toList(); diff --git a/src/main/java/com/bamdoliro/maru/application/form/ExportFormUseCase.java b/src/main/java/com/bamdoliro/maru/application/form/ExportFormUseCase.java index 8cc163cf..98618476 100644 --- a/src/main/java/com/bamdoliro/maru/application/form/ExportFormUseCase.java +++ b/src/main/java/com/bamdoliro/maru/application/form/ExportFormUseCase.java @@ -4,7 +4,6 @@ import com.bamdoliro.maru.domain.form.domain.type.AchievementLevel; import com.bamdoliro.maru.domain.form.domain.value.Subject; import com.bamdoliro.maru.domain.form.domain.value.SubjectMap; -import com.bamdoliro.maru.domain.form.exception.FormAlreadySubmittedException; import com.bamdoliro.maru.domain.form.service.FormFacade; import com.bamdoliro.maru.domain.user.domain.User; import com.bamdoliro.maru.infrastructure.pdf.GeneratePdfService; @@ -24,10 +23,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 @@ -72,10 +68,25 @@ public ByteArrayResource execute(User user) { private List getSubjectList(Form form) { List value = new ArrayList<>(); + List careerElectiveCourses = List.of("음악", "미술", "체육"); Map> subjectMap = form.getGrade() .getSubjectListValue() .stream() - .collect(Collectors.groupingBy(Subject::getSubjectName)); + .filter(subject -> !careerElectiveCourses.contains(subject.getSubjectName())) + .collect(Collectors.groupingBy( + Subject::getSubjectName, + LinkedHashMap::new, + Collectors.toList() + )); + careerElectiveCourses.forEach(course -> { + List subjects = form.getGrade().getSubjectListValue() + .stream() + .filter(subject -> course.equals(subject.getSubjectName())) + .collect(Collectors.toList()); + if (!subjects.isEmpty()) { + subjectMap.put(course, subjects); + } + }); subjectMap.forEach((key, values) -> { SubjectVO subject = new SubjectVO(key); @@ -84,7 +95,7 @@ private List 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); @@ -103,7 +114,7 @@ private List getRequiredTemplates(Form form) { Templates.FORM, Templates.GRADE_TABLE, Templates.DOCUMENT, - Templates.NO_SMOKING + Templates.WRITTEN_OATH ); } @@ -111,8 +122,8 @@ private List getRequiredTemplates(Form form) { Templates.FORM, Templates.GRADE_TABLE, Templates.DOCUMENT, - Templates.RECOMMENDATION, - Templates.NO_SMOKING + Templates.WRITTEN_OATH, + Templates.RECOMMENDATION ); } } diff --git a/src/main/java/com/bamdoliro/maru/application/form/QueryAllFormUseCase.java b/src/main/java/com/bamdoliro/maru/application/form/QueryAllFormUseCase.java index 179dd360..3236b2a8 100644 --- a/src/main/java/com/bamdoliro/maru/application/form/QueryAllFormUseCase.java +++ b/src/main/java/com/bamdoliro/maru/application/form/QueryAllFormUseCase.java @@ -3,7 +3,6 @@ import com.bamdoliro.maru.domain.form.domain.Form; import com.bamdoliro.maru.domain.form.domain.type.FormStatus; import com.bamdoliro.maru.domain.form.domain.type.FormType; -import com.bamdoliro.maru.domain.form.exception.MissingTotalScoreException; import com.bamdoliro.maru.infrastructure.persistence.form.FormRepository; import com.bamdoliro.maru.presentation.form.dto.response.FormSimpleResponse; import com.bamdoliro.maru.shared.annotation.UseCase; @@ -25,13 +24,14 @@ public List execute(FormStatus status, FormType.Category cat .filter(form -> Objects.isNull(category) || form.getType().categoryEquals(category)) .toList()); - if (sort != null && formList.stream().anyMatch(form -> form.getScore().getTotalScore() == null)) { - throw new MissingTotalScoreException(); - } - if ("total-score-asc".equals(sort)) { - formList.sort(Comparator.comparing(form -> form.getScore().getTotalScore(), Comparator.naturalOrder())); - } else if ("total-score-desc".equals(sort)) { - formList.sort(Comparator.comparing(form -> form.getScore().getTotalScore(), Comparator.reverseOrder())); + if (sort != null) { + switch (sort) { + case "total-score-asc" -> + formList.sort(Comparator.comparing(form -> form.getScore().getTotalScore(), Comparator.nullsLast(Comparator.naturalOrder()))); + case "total-score-desc" -> + formList.sort(Comparator.comparing(form -> form.getScore().getTotalScore(), Comparator.nullsLast(Comparator.reverseOrder()))); + case "form-id" -> formList.sort(Comparator.comparing(Form::getId)); + } } return formList.stream() diff --git a/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryCustom.java b/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryCustom.java index 672bfa7c..eb7702cb 100644 --- a/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryCustom.java +++ b/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryCustom.java @@ -31,4 +31,5 @@ public interface FormRepositoryCustom { List findTypeAndCountGroupByType(); List findGradeGroupByTypeAndStatus(List round); List findSchoolByAddress(List round, String keyword); + List findNotBusanSchool(List round); } \ No newline at end of file diff --git a/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryImpl.java b/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryImpl.java index 4111aa2e..35bee959 100644 --- a/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryImpl.java +++ b/src/main/java/com/bamdoliro/maru/infrastructure/persistence/form/FormRepositoryImpl.java @@ -3,6 +3,7 @@ import com.bamdoliro.maru.domain.form.domain.Form; import com.bamdoliro.maru.domain.form.domain.type.FormStatus; import com.bamdoliro.maru.domain.form.domain.type.FormType; +import com.bamdoliro.maru.domain.form.domain.value.QSchool; import com.bamdoliro.maru.infrastructure.persistence.form.vo.*; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.impl.JPAQueryFactory; @@ -285,4 +286,17 @@ public List findSchoolByAddress(List round, String k .and(form.status.in(round))) .fetch(); } + + @Override + public List findNotBusanSchool(List round) { + return queryFactory + .select(new QSchoolStatusVo( + form.applicant.name, + form.education.school.name, + form.education.school.address + )) + .from(form) + .where(form.education.school.location.eq("부산광역시").not()) + .fetch(); + } } \ No newline at end of file diff --git a/src/main/java/com/bamdoliro/maru/infrastructure/thymeleaf/Templates.java b/src/main/java/com/bamdoliro/maru/infrastructure/thymeleaf/Templates.java index cdc5cdca..510313c8 100644 --- a/src/main/java/com/bamdoliro/maru/infrastructure/thymeleaf/Templates.java +++ b/src/main/java/com/bamdoliro/maru/infrastructure/thymeleaf/Templates.java @@ -12,4 +12,5 @@ public class Templates { public static final String ADMISSION_TICKET = "admission-ticket"; public static final String PROOF_OF_APPLICATION = "proof-of-application"; public static final String GRADE_TABLE = "grade-table"; + public static final String WRITTEN_OATH = "written-oath"; } diff --git a/src/main/java/com/bamdoliro/maru/shared/error/GlobalExceptionHandler.java b/src/main/java/com/bamdoliro/maru/shared/error/GlobalExceptionHandler.java index e40ab739..ce677cf2 100644 --- a/src/main/java/com/bamdoliro/maru/shared/error/GlobalExceptionHandler.java +++ b/src/main/java/com/bamdoliro/maru/shared/error/GlobalExceptionHandler.java @@ -74,7 +74,7 @@ public ResponseEntity enumMismatchException(MethodArgumentNotVali return ResponseEntity .status(GlobalErrorProperty.BAD_REQUEST.getStatus()) - .body(new ErrorResponse(GlobalErrorProperty.BAD_REQUEST, e.getMessage())); + .body(new ErrorResponse(GlobalErrorProperty.BAD_REQUEST, e.getBindingResult().getFieldErrors().get(0).getDefaultMessage())); } @ExceptionHandler(FileSizeLimitExceededException.class) diff --git a/src/main/resources/templates/document.html b/src/main/resources/templates/document.html index 0b4b8a94..24fc2429 100644 --- a/src/main/resources/templates/document.html +++ b/src/main/resources/templates/document.html @@ -43,7 +43,10 @@ font-weight: 500; padding: 8px 0; } - + .format { + font-size: 13px; + font-weight: bold; + } .ba { border: #000000 1px solid; } @@ -65,6 +68,7 @@ +

[서식2]

diff --git a/src/main/resources/templates/form.html b/src/main/resources/templates/form.html index bdba554e..5174d117 100644 --- a/src/main/resources/templates/form.html +++ b/src/main/resources/templates/form.html @@ -37,7 +37,10 @@ line-height: 48px; text-align: center; } - + .format { + font-size: 13px; + font-weight: bold; + } .school { font-weight: bold; font-size: 18px; @@ -100,7 +103,8 @@
자기소개서 및 학업계획서
성명
- +

[서식1]

+ diff --git a/src/main/resources/templates/recommendation.html b/src/main/resources/templates/recommendation.html index d73b639e..e17f7bb8 100644 --- a/src/main/resources/templates/recommendation.html +++ b/src/main/resources/templates/recommendation.html @@ -43,7 +43,10 @@ font-weight: 500; padding: 8px 0; } - + .format { + font-size: 13px; + font-weight: bold; + } .ba { border: #000000 1px solid; } @@ -93,6 +96,7 @@
+

[서식4]

@@ -158,7 +162,7 @@ (직인)

-

부산소프트웨어마이스터고등학교장 귀하

+

부산소프트웨어마이스터고등학교장 귀하

학교장 추천서
성명
diff --git a/src/main/resources/templates/written-oath.html b/src/main/resources/templates/written-oath.html new file mode 100644 index 00000000..3efc868f --- /dev/null +++ b/src/main/resources/templates/written-oath.html @@ -0,0 +1,152 @@ + + + + + + 원서 + + + +

[서식3]

+ + + + + + + + + + + + + + + + + +
서약서
성명접수번호1000
출신중학교
+
+

부산소프트웨어마이스터고등학교는 영마이스터(Young Meister)를 양성하는 특수목적고등학교입니다. 산업수요 맞춤형 교육과정 운영을 통해 학생의 취업 역량을 가리는 학교로 졸업 후 100% 우선 취업과 기술명장으로의 계속 성장을 지원합니다. 이에, 본교에 지원하는 학생에게 다음과 같은 조치를 취합니다.

+
+

1) (진로⋅진학 지도 미실시) 대학 진학과 관련된 어떠한 진로⋅진학 지도를 하지 않음

+

2) (학교 시설 이용 제한) 정규 시간 이외의 시간에는 학교의 시설(기숙사, 실험실 등)을 규정에 따라 이용을 제한 할 수 있음.

+

3) (기숙사 합숙 생활에 대한 규정) 전교생 기숙사 합숙생활의 특성과 화재의 위험을 예방하기 위해 흡연 등의 일체 유해한 행위를 불허함.

+
+

지원자 본인과 보호자는 위 모든 사항을 숙지하였으며 이를 위반했을 경우 학교가 취하는 조치에 대하여 이의를 제기하지 않고 성실히 따를 것을 서약합니다.

+
+

2024년 9월 5일

+
+

+ 지원자 성명 : +     + (서명) +

+

+ 보호자 성명 : +     + (서명) +

+
+

부산소프트웨어마이스터고등학교장 귀하

+
+ + \ No newline at end of file diff --git a/src/test/java/com/bamdoliro/maru/application/analysis/QuerySchoolStatusUseCaseTest.java b/src/test/java/com/bamdoliro/maru/application/analysis/QuerySchoolStatusUseCaseTest.java index a16d134b..0b5c4adf 100644 --- a/src/test/java/com/bamdoliro/maru/application/analysis/QuerySchoolStatusUseCaseTest.java +++ b/src/test/java/com/bamdoliro/maru/application/analysis/QuerySchoolStatusUseCaseTest.java @@ -37,7 +37,7 @@ class QuerySchoolStatusUseCaseTest { new SchoolStatusVo("박이로", "마루중학교", "경기도 밤돌시 이로구 밤돌이로 1") ); List round = List.of(FormStatus.FIRST_PASSED, FormStatus.FAILED, FormStatus.PASSED); - given(formRepository.findSchoolByAddress(round, "")).willReturn(voList); + given(formRepository.findNotBusanSchool(round)).willReturn(voList); SchoolStatusRequest request = new SchoolStatusRequest(round, false, null); // when @@ -45,7 +45,7 @@ class QuerySchoolStatusUseCaseTest { // then Assertions.assertEquals(responseList.size(), voList.size()); - verify(formRepository, times(1)).findSchoolByAddress(round, ""); + verify(formRepository, times(1)).findNotBusanSchool(round); } @Test @@ -98,7 +98,7 @@ class QuerySchoolStatusUseCaseTest { new SchoolStatusVo("박이로", "마루중학교", "경기도 밤돌시 이로구 밤돌이로 1") ); List round = List.of(FormStatus.FAILED, FormStatus.PASSED); - given(formRepository.findSchoolByAddress(round, "")).willReturn(voList); + given(formRepository.findNotBusanSchool(round)).willReturn(voList); SchoolStatusRequest request = new SchoolStatusRequest(round, false, null); // when @@ -106,7 +106,7 @@ class QuerySchoolStatusUseCaseTest { // then Assertions.assertEquals(responseList.size(), voList.size()); - verify(formRepository, times(1)).findSchoolByAddress(round, ""); + verify(formRepository, times(1)).findNotBusanSchool(round); } @Test @@ -159,7 +159,7 @@ class QuerySchoolStatusUseCaseTest { new SchoolStatusVo("박이로", "마루중학교", "경기도 밤돌시 이로구 밤돌이로 1") ); List round = List.of(FormStatus.PASSED); - given(formRepository.findSchoolByAddress(round, "")).willReturn(voList); + given(formRepository.findNotBusanSchool(round)).willReturn(voList); SchoolStatusRequest request = new SchoolStatusRequest(round, false, null); // when @@ -167,7 +167,7 @@ class QuerySchoolStatusUseCaseTest { // then Assertions.assertEquals(responseList.size(), voList.size()); - verify(formRepository, times(1)).findSchoolByAddress(round, ""); + verify(formRepository, times(1)).findNotBusanSchool(round); } @Test diff --git a/src/test/java/com/bamdoliro/maru/application/form/QueryAllFormUseCaseTest.java b/src/test/java/com/bamdoliro/maru/application/form/QueryAllFormUseCaseTest.java index 62671975..5f2e03d9 100644 --- a/src/test/java/com/bamdoliro/maru/application/form/QueryAllFormUseCaseTest.java +++ b/src/test/java/com/bamdoliro/maru/application/form/QueryAllFormUseCaseTest.java @@ -170,4 +170,25 @@ class QueryAllFormUseCaseTest { verify(formRepository, times(1)).findByStatus(null); } + + @Test + void 접수번호가_높은_순으로_조회한다() { + // given + List
formList = List.of( + FormFixture.createForm(FormType.REGULAR), + FormFixture.createForm(FormType.SPECIAL_ADMISSION), + FormFixture.createForm(FormType.MEISTER_TALENT), + FormFixture.createForm(FormType.MULTI_CHILDREN) + ); + + given(formRepository.findByStatus(null)).willReturn(formList); + + // when + List returnedFormList = queryAllFormUseCase.execute(null, FormType.Category.SOCIAL_INTEGRATION, "form-id"); + + // then + assertEquals(1, returnedFormList.size()); + + verify(formRepository, times(1)).findByStatus(null); + } } \ No newline at end of file diff --git a/src/test/java/com/bamdoliro/maru/presentation/form/FormControllerTest.java b/src/test/java/com/bamdoliro/maru/presentation/form/FormControllerTest.java index c2de62b9..a0c86b64 100644 --- a/src/test/java/com/bamdoliro/maru/presentation/form/FormControllerTest.java +++ b/src/test/java/com/bamdoliro/maru/presentation/form/FormControllerTest.java @@ -1272,7 +1272,7 @@ class FormControllerTest extends RestDocsTestSupport { .description("<>") .optional(), parameterWithName("sort") - .description("정렬 기준 (최종 점수 오름차순인 경우 total-score-asc, 최종 점수 내림차순인 경우 total-score-desc, null인 경우 수험번호 오름차순 조회)") + .description("정렬 기준 (total-score-asc인 경우 최종 점수 오름차순, total-score-desc인 경우 최종 점수 내림차순, form-id인 경우 접수 번호순, null인 경우 수험번호 오름차순 조회)") .optional() ) ));