generated from Bamdoliro/repository-generator
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[새기능] 특례입학 원서 폼 및 접수증 만들기
- Loading branch information
Showing
13 changed files
with
926 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/main/java/com/bamdoliro/maru/application/form/GenerateProofOfApplicationUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.bamdoliro.maru.application.form; | ||
|
||
import com.bamdoliro.maru.domain.form.domain.Form; | ||
import com.bamdoliro.maru.domain.form.exception.InvalidFormStatusException; | ||
import com.bamdoliro.maru.domain.form.service.FormFacade; | ||
import com.bamdoliro.maru.domain.user.domain.User; | ||
import com.bamdoliro.maru.infrastructure.pdf.GeneratePdfService; | ||
import com.bamdoliro.maru.infrastructure.s3.FileService; | ||
import com.bamdoliro.maru.infrastructure.s3.constants.FolderConstant; | ||
import com.bamdoliro.maru.infrastructure.thymeleaf.ProcessTemplateService; | ||
import com.bamdoliro.maru.infrastructure.thymeleaf.Templates; | ||
import com.bamdoliro.maru.shared.annotation.UseCase; | ||
import com.bamdoliro.maru.shared.constants.Schedule; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.core.io.ByteArrayResource; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.util.Map; | ||
|
||
import static com.bamdoliro.maru.shared.constants.Schedule.ANNOUNCEMENT_OF_FIRST_PASS; | ||
|
||
@RequiredArgsConstructor | ||
@UseCase | ||
public class GenerateProofOfApplicationUseCase { | ||
|
||
private final FormFacade formFacade; | ||
private final ProcessTemplateService processTemplateService; | ||
private final GeneratePdfService generatePdfService; | ||
private final FileService fileService; | ||
|
||
public ByteArrayResource execute(User user) { | ||
Form form = formFacade.getForm(user); | ||
validateFormStatus(form); | ||
|
||
Map<String, Object> formMap = Map.of( | ||
"form", form, | ||
"year", Schedule.getAdmissionYear(), | ||
"announcement_of_first_pass", Schedule.toLocaleString(ANNOUNCEMENT_OF_FIRST_PASS), | ||
"identificationPictureUri", fileService.getPresignedUrl(FolderConstant.IDENTIFICATION_PICTURE, user.getUuid().toString()).getDownloadUrl() | ||
); | ||
String html = processTemplateService.execute(Templates.PROOF_OF_APPLICATION, formMap); | ||
ByteArrayOutputStream outputStream = generatePdfService.execute(html); | ||
|
||
return new ByteArrayResource(outputStream.toByteArray()); | ||
} | ||
|
||
private void validateFormStatus(Form form) { | ||
if (!form.isFinalSubmitted() && !form.isApproved() && !form.isReceived()) { | ||
throw new InvalidFormStatusException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" lang="ko"> | ||
<head> | ||
<meta charset="UTF-8"/> | ||
<style> | ||
@page { | ||
size: A4; | ||
margin: 70px; | ||
} | ||
|
||
* { | ||
font-family: SUIT, sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
table { | ||
border: none; | ||
border-collapse: collapse; | ||
width: 100%; | ||
font-size: 14px; | ||
text-align: center; | ||
line-height: normal; | ||
} | ||
tr { | ||
vertical-align: middle; | ||
} | ||
|
||
td { | ||
padding: 8px 0; | ||
} | ||
|
||
th { | ||
background-color: #ECF2FA; | ||
font-weight: 500; | ||
padding: 8px 0; | ||
} | ||
.format { | ||
font-size: 13px; | ||
font-weight: bold; | ||
} | ||
.ba { | ||
border: #000000 1px solid; | ||
} | ||
|
||
.title { | ||
font-weight: bold; | ||
font-size: 36px; | ||
line-height: 48px; | ||
text-align: center; | ||
letter-spacing: 40px; | ||
margin-left: 74px; | ||
} | ||
.subtitle { | ||
font-size: 22px; | ||
line-height: 2; | ||
} | ||
.left { | ||
text-align: left; | ||
} | ||
|
||
.right { | ||
text-align: right; | ||
} | ||
|
||
.center { | ||
text-align: center; | ||
} | ||
|
||
.text-box { | ||
padding: 15px 10px; | ||
vertical-align: text-top; | ||
} | ||
|
||
.middle { | ||
font-size: 18px; | ||
line-height: 160%; | ||
} | ||
|
||
.indent { | ||
text-indent: 18px; | ||
font-size: 21px; | ||
word-break: keep-all; | ||
line-height: 2; | ||
} | ||
.padding { | ||
padding: 16px; | ||
} | ||
</style> | ||
<title>원서</title> | ||
</head> | ||
<body> | ||
<table> | ||
<p class="format">[서식6]</p> | ||
<div style="height: 14px"></div> | ||
<td class="ba text-box middle left padding" colspan="4"> | ||
<div style="height: 72px"></div> | ||
<div class="title">확인서</div> | ||
<div style="height: 64px"></div> | ||
<p class="subtitle center">성 명 :</p> | ||
<p class="subtitle center" style="margin-left: 164px">생년월일 : 년 월 일</p> | ||
<div style="height: 44px;"></div> | ||
<p class="indent">○ 주 소 : </p> | ||
<p class="indent">○ 연락처 : </p> | ||
<p class="indent">○ 외국 학교명 : </p> | ||
<div style="height: 16px;"></div> | ||
<p class="indent" style="margin-left: 40px">(시트명 : , 행 번호 : )</p> | ||
<div style="height: 32px;"></div> | ||
<p class="indent">위 학생의 특례 신입학 학적 서류는 외국 학교의 재적학교장이 발급한 학적 서류임을 확인하며, | ||
만약 위·변조 서류로 확인될 경우에는 입학 취소 등 모든 행정처분에 따를 것을 확인합니다.</p> | ||
<div style="height: 32px;"></div> | ||
<p class="middle center" th:text="${#dates.format(#dates.createNow(),'YYYY년 MM월 dd일')}">년 월 일</p> | ||
<div style="height: 42px;"></div> | ||
<div class="indent"><span style="margin-right: 80px">확생과의 관계(보호자) :</span> | ||
<span style="margin-right: 80px">성명 :</span> | ||
<span>서명 또는 (인)</span> | ||
</div> | ||
<div style="height: 42px"></div> | ||
</td> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> |
Oops, something went wrong.