Skip to content

Commit 38758c1

Browse files
authored
Merge pull request #76 from Gathering-Organization/be/feat/admin
[feat] 관리자가 모집글 삭제 시 메일 전송 기능 완성
2 parents 7933148 + 8cfa5c7 commit 38758c1

File tree

4 files changed

+150
-19
lines changed

4 files changed

+150
-19
lines changed

Gathering_be/src/main/java/com/Gathering_be/service/AdminService.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,22 @@ public void deleteProject(Long projectId) {
8484
return;
8585
}
8686

87-
Set<String> recipientEmails = new HashSet<>();
88-
8987
Profile authorProfile = project.getProfile();
90-
/*recipientEmails.add(authorProfile.getMember().getEmail());
88+
emailService.sendProjectDeletetionNotice(
89+
authorProfile.getMember().getEmail(), project.getTitle(), authorProfile.getNickname());
9190

91+
Map<String, String> applicants = new HashMap<>();
9292
List<Application> applications = applicationRepository.findAllByProjectId(projectId);
93-
9493
for (Application application : applications) {
9594
Profile applicantProfile = application.getProfileFromSnapshot();
9695

9796
if (applicantProfile != null) {
98-
recipientEmails.add(applicantProfile.getMember().getEmail());
97+
applicants.put(applicantProfile.getMember().getEmail(), applicantProfile.getNickname());
9998
applicantProfile.removeApplication(application.getStatus());
10099
}
101100
}
101+
emailService.sendProjectDeletionNotice(applicants, project.getTitle());
102102

103-
emailService.sendProjectDeletionNotice(new ArrayList<>(recipientEmails));
104-
*/
105103
authorProfile.removeProject(project.isClosed());
106104
project.delete();
107105
}

Gathering_be/src/main/java/com/Gathering_be/service/EmailService.java

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.thymeleaf.spring6.SpringTemplateEngine;
1313

1414
import java.util.List;
15+
import java.util.Map;
1516

1617
@Service
1718
@RequiredArgsConstructor
@@ -23,7 +24,7 @@ public void sendResultMail(String to, String projectTitle, String applicantName,
2324
Context context = new Context();
2425
context.setVariable("projectTitle", projectTitle);
2526
context.setVariable("applicantName", applicantName);
26-
context.setVariable("link", "https://www.naver.com");
27+
context.setVariable("link", "https://www.gathering.work");
2728

2829
String templateName = isApproved ? "approve" : "reject";
2930
String htmlContent = templateEngine.process(templateName, context);
@@ -36,7 +37,7 @@ public void sendCloseMailToAuthor(String to, String projectTitle, String authorN
3637
Context context = new Context();
3738
context.setVariable("projectTitle", projectTitle);
3839
context.setVariable("authorName", authorName);
39-
context.setVariable("link", "https://www.naver.com");
40+
context.setVariable("link", "https://www.gathering.work");
4041

4142
String htmlContent = templateEngine.process("deadline_author", context);
4243
String subject = "[Gathering] 프로젝트 마감 안내";
@@ -48,7 +49,7 @@ public void sendCloseMailToApplicant(String to, String projectTitle, String appl
4849
Context context = new Context();
4950
context.setVariable("projectTitle", projectTitle);
5051
context.setVariable("applicantName", applicantName);
51-
context.setVariable("link", "https://www.naver.com");
52+
context.setVariable("link", "https://www.gathering.work");
5253

5354
String htmlContent = templateEngine.process("deadline_applicant", context);
5455
String subject = "[Gathering] 지원 프로젝트 마감 안내";
@@ -60,25 +61,39 @@ public void sendNewApplyMail(String to, String projectTitle, String authorName)
6061
Context context = new Context();
6162
context.setVariable("projectTitle", projectTitle);
6263
context.setVariable("authorName", authorName);
63-
context.setVariable("link", "https://www.naver.com");
64+
context.setVariable("link", "https://www.gathering.work");
6465

6566
String htmlContent = templateEngine.process("notify", context);
6667
String subject = "[Gathering] 새 지원서가 도착했습니다!";
6768

6869
sendHtmlMail(to, subject, htmlContent);
6970
}
7071

71-
public void sendProjectDeletionNotice(List<String> recipients) {
72+
public void sendProjectDeletetionNotice(String authorEmail, String projectTitle, String authorName) {
7273
Context context = new Context();
73-
//context.setVariable("projectTitle", projectTitle);
74-
//context.setVariable("authorName", authorName);
75-
context.setVariable("link", "https://www.gathering.work");
74+
context.setVariable("projectTitle", projectTitle);
75+
context.setVariable("authorName", authorName);
7676

77-
String htmlContent = templateEngine.process("notify", context);
78-
String subject = "[Gathering] 삭제";
77+
String htmlContent = templateEngine.process("delete_notify_author", context);
78+
String subject = "[Gathering] 게더링 모집글 삭제 안내";
79+
80+
sendHtmlMail(authorEmail, subject, htmlContent);
81+
}
82+
83+
public void sendProjectDeletionNotice(Map<String, String> recipients, String projectTitle) {
84+
String subject = "[Gathering] 모집글 삭제 안내";
85+
86+
for (Map.Entry<String, String> recipient : recipients.entrySet()) {
87+
String emailAddress = recipient.getKey();
88+
String applicantName = recipient.getValue();
89+
90+
Context context = new Context();
91+
context.setVariable("projectTitle", projectTitle);
92+
context.setVariable("applicantName", applicantName);
93+
94+
String htmlContent = templateEngine.process("delete_notify_applicant", context);
7995

80-
for (String to : recipients) {
81-
sendHtmlMail(to, subject, htmlContent);
96+
sendHtmlMail(emailAddress, subject, htmlContent);
8297
}
8398
}
8499

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!DOCTYPE html>
2+
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>게더링 모집글 삭제 처리</title>
7+
</head>
8+
<body style="margin:0; padding:0; background-color:#f4f4f4; font-family:'Segoe UI', sans-serif;">
9+
<table align="center" width="100%" style="max-width:600px; margin:0 auto; background-color:#ffffff; border-radius:10px; overflow:hidden; box-shadow:0 4px 12px rgba(0,0,0,0.08);">
10+
<!-- Header -->
11+
<tr>
12+
<td style="background-color:#3387E5; padding:20px 30px; text-align:center;">
13+
<h1 style="margin:0; font-size:22px; color:white;">게더링 모집글 삭제 안내</h1>
14+
</td>
15+
</tr>
16+
<!-- Content -->
17+
<tr>
18+
<td style="padding:30px; color:#333333;">
19+
<p style="font-size:16px; line-height:1.8; margin-top:0;">
20+
안녕하십니까, <strong th:text="${applicantName}"></strong>님.<br />
21+
게더링 팀입니다.
22+
</p>
23+
24+
<strong style="color:#E53E3E; font-size:16px; line-height:1.8;">
25+
<strong th:text="${applicantName}"></strong>님이 지원하셨던 모집글인
26+
<strong th:text="${projectTitle}"></strong>에 부적절한 부분이 있다고 판단되어 <br />
27+
삭제되었습니다.<br />
28+
</strong>
29+
30+
<p style="font-size:16px; line-height:1.8;">
31+
해당 모집글은 프로필 보기의 지원 현황에서 확인하실 수 없습니다.
32+
<br />궁금한 사항이 있으시면 언제든지 게더링 팀으로 연락주시기 바랍니다.
33+
</p>
34+
35+
<p style="font-size:16px; line-height:1.8;">
36+
게더링을 통해 소중한 인연을 맺게 되기를 진심으로 바라며,<br />
37+
앞으로의 여정에서도 함께 성장해 나가기를 기대하겠습니다.
38+
</p>
39+
40+
<p style="font-size:16px; line-height:1.8;">감사합니다.<br />게더링 팀 드림</p>
41+
42+
<!-- Button -->
43+
<div style="text-align:center; margin:30px 0;">
44+
<div style="background-color:#3387E5; color:white; padding:12px 24px; text-decoration:none; border-radius:6px; font-weight:bold; display:inline-block;">
45+
메일 문의 : [email protected]
46+
</div>
47+
</div>
48+
</td>
49+
</tr>
50+
51+
<!-- Footer -->
52+
<tr>
53+
<td style="background-color:#f1f1f1; padding:20px; text-align:center; font-size:13px; color:#888888;">
54+
ⓒ 2025 Gathering, Inc. All rights reserved.
55+
</td>
56+
</tr>
57+
</table>
58+
</body>
59+
</html>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!DOCTYPE html>
2+
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>게더링 모집글 삭제 처리</title>
7+
</head>
8+
<body style="margin:0; padding:0; background-color:#f4f4f4; font-family:'Segoe UI', sans-serif;">
9+
<table align="center" width="100%" style="max-width:600px; margin:0 auto; background-color:#ffffff; border-radius:10px; overflow:hidden; box-shadow:0 4px 12px rgba(0,0,0,0.08);">
10+
<!-- Header -->
11+
<tr>
12+
<td style="background-color:#3387E5; padding:20px 30px; text-align:center;">
13+
<h1 style="margin:0; font-size:22px; color:white;">게더링 모집글 삭제 안내</h1>
14+
</td>
15+
</tr>
16+
<!-- Content -->
17+
<tr>
18+
<td style="padding:30px; color:#333333;">
19+
<p style="font-size:16px; line-height:1.8; margin-top:0;">
20+
안녕하십니까, <strong th:text="${authorName}"></strong>님.<br />
21+
게더링 팀입니다.
22+
</p>
23+
24+
<strong style="color:#E53E3E; font-size:16px; line-height:1.8;">
25+
<strong th:text="${authorName}"></strong>님의 모집글인
26+
<strong th:text="${projectTitle}"></strong>에 부적절한 부분이 있다고 판단되어 <br /> 삭제되었습니다.<br />
27+
</strong>
28+
29+
<p style="font-size:16px; line-height:1.8;">
30+
해당 모집글은 프로필 보기의 모집 현황에서 확인하실 수 없습니다.
31+
<br /> 지원하신 회원님이 있다면 안내 메일을 발송할 예정입니다.
32+
<br />궁금한 사항이 있으시면 언제든지 게더링 팀으로 연락주시기 바랍니다.
33+
</p>
34+
35+
<p style="font-size:16px; line-height:1.8;">
36+
게더링을 통해 소중한 인연을 맺게 되기를 진심으로 바라며,<br />
37+
앞으로의 여정에서도 함께 성장해 나가기를 기대하겠습니다.
38+
</p>
39+
40+
<p style="font-size:16px; line-height:1.8;">감사합니다.<br />게더링 팀 드림</p>
41+
42+
<!-- Button -->
43+
<div style="text-align:center; margin:30px 0;">
44+
<div style="background-color:#3387E5; color:white; padding:12px 24px; text-decoration:none; border-radius:6px; font-weight:bold; display:inline-block;">
45+
메일 문의 : [email protected]
46+
</div>
47+
</div>
48+
</td>
49+
</tr>
50+
51+
<!-- Footer -->
52+
<tr>
53+
<td style="background-color:#f1f1f1; padding:20px; text-align:center; font-size:13px; color:#888888;">
54+
ⓒ 2025 Gathering, Inc. All rights reserved.
55+
</td>
56+
</tr>
57+
</table>
58+
</body>
59+
</html>

0 commit comments

Comments
 (0)