Skip to content

Commit

Permalink
🧩 :: (#857) μ§€μ›μ„œ μ•Œλ¦Ό 메세지 μ„€μ •
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyoil2 committed Nov 21, 2024
1 parent 2aba6f6 commit d7cec15
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import team.retum.jobis.domain.notification.spi.CommandNotificationPort;
import team.retum.jobis.domain.user.model.User;
import team.retum.jobis.domain.user.spi.QueryUserPort;
import team.retum.jobis.event.application.message.ApplicationMessage;
import team.retum.jobis.thirdparty.fcm.FCMUtil;

import java.util.List;
Expand Down Expand Up @@ -50,11 +51,11 @@ public void onApplicationStatusChanged(ApplicationsStatusChangedEvent event) {

String companyName = companyNameMap.get(application.getRecruitmentId());

setNotificationMessage(event, companyName);
ApplicationMessage notificationMessage = fcmUtil.applicationMessage(event, companyName);

Notification notification = Notification.builder()
.title(title)
.content(content)
.title(notificationMessage.getTitle())
.content(notificationMessage.getContent())
.userId(application.getStudentId())
.topic(Topic.APPLICATION)
.detailId(application.getId())
Expand All @@ -69,59 +70,4 @@ public void onApplicationStatusChanged(ApplicationsStatusChangedEvent event) {
);
}
}

private void setNotificationMessage(ApplicationsStatusChangedEvent event, String companyName) {

switch(event.getStatus()) {
case REQUESTED:
title = "μ§€μ›μ„œ 제좜 μ™„λ£Œ";
content = "μ§€μ›μ„œκ°€ μ œμΆœλ˜μ—ˆμŠ΅λ‹ˆλ‹€. κ²€ν† κ°€ 진행될 μ˜ˆμ •μž…λ‹ˆλ‹€. 쑰금만 κΈ°λ‹€λ € μ£Όμ„Έμš”!";
break;

case APPROVED:
title = "μ§€μ›μ„œκ°€ μŠΉμΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€!";
content = "μ§€μ›μ„œκ°€ μŠΉμΈλ˜μ—ˆμ–΄μš”. 곧 νšŒμ‚¬μ— 전솑될 κ±°μ˜ˆμš”!";
break;

case SEND:
title = "μ§€μ›μ„œ 전솑 μ™„λ£Œ";
content = "'" + companyName + "'에 μ§€μ›μ„œκ°€ μ„±κ³΅μ μœΌλ‘œ μ „μ†‘λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 쒋은 κ²°κ³Όλ₯Ό κΈ°μ›ν•©λ‹ˆλ‹€!";
break;

case PROCESSING:
title = "μ§€μ›μ„œκ°€ μ§„ν–‰μ€‘μž…λ‹ˆλ‹€";
content = "'" + companyName + "'μ—μ„œ μ§€μ›μ„œλ₯Ό κ²€ν†  μ€‘μž…λ‹ˆλ‹€. 진행 상황을 계속 확인해 μ£Όμ„Έμš”.";
break;

case FAILED:
title = companyName + "μ§€μ›μ„œ νƒˆλ½";
content = "μ•„μ‰½κ²Œλ„ '" + companyName + "'의 μ§€μ›μ—μ„œ νƒˆλ½ν•˜μ…¨μŠ΅λ‹ˆλ‹€. λ‹€μŒ κΈ°νšŒμ— 더 쒋은 κ²°κ³Όκ°€ 있길 λ°”λžλ‹ˆλ‹€.";
break;

case PASS:
title = "(μ·¨λ½€) " + companyName + "에 ν•©κ²©ν•˜μ…¨μŠ΅λ‹ˆλ‹€!! πŸ₯³";
content = "합격을 μ§„μ‹¬μœΌλ‘œ μΆ•ν•˜λ“œλ¦½λ‹ˆλ‹€.";
break;

case FIELD_TRAIN:
title = "ν˜„μž₯μ‹€μŠ΅μ΄ ν™•μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€!";
content = "'" + companyName + "'μ—μ„œ ν˜„μž₯μ‹€μŠ΅μ΄ ν™•μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μƒˆλ‘œμš΄ κ²½ν—˜μ„ 톡해 μ„±μž₯ν•˜μ‹œκΈΈ λ°”λžλ‹ˆλ‹€!";
break;

case ACCEPTANCE:
title = "κ·Όλ‘œκ³„μ•½μ΄ μ²΄κ²°λ¬μŠ΅λ‹ˆλ‹€!";
content = "'" + companyName + "'과의 κ·Όλ‘œκ³„μ•½μ΄ μ²΄κ²°λ¬μŠ΅λ‹ˆλ‹€. μƒˆλ‘œμš΄ 여정을 μ‘μ›ν•©λ‹ˆλ‹€!";
break;

case REJECTED:
title = "μ§€μ›μ„œκ°€ λ°˜λ €λ˜μ—ˆμŠ΅λ‹ˆλ‹€.";
content = "μ§€μ›μ„œκ°€ '" + companyName + "'에 μ˜ν•΄ λ°˜λ €λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ§€μ›μ„œ λ‚΄μš©μ„ λ‹€μ‹œ ν™•μΈν•˜κ³  μˆ˜μ • ν›„ μž¬μ œμΆœν•΄ μ£Όμ„Έμš”.";
break;

default:
title = "μ§€μ›μ„œ μƒνƒœκ°€ λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€";
content = "μ§€μ›μ„œ μƒνƒœκ°€ " + event.getStatus().getName() + "으둜 λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.";
break;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package team.retum.jobis.event.application.message;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public class ApplicationMessage {
private final String title;
private final String content;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
import com.google.firebase.messaging.Message;
import com.google.firebase.messaging.MulticastMessage;
import org.springframework.stereotype.Component;
import team.retum.jobis.domain.application.event.ApplicationsStatusChangedEvent;
import team.retum.jobis.domain.notification.exception.DeviceTokenNotFoundException;
import team.retum.jobis.domain.notification.exception.FailedToSubscriptionException;
import team.retum.jobis.domain.notification.exception.FailedToUnsubscriptionException;
import team.retum.jobis.domain.notification.model.Notification;
import team.retum.jobis.domain.notification.model.Topic;
import team.retum.jobis.event.application.message.ApplicationMessage;
import team.retum.jobis.global.exception.FailedSendingMessagesException;

import java.util.Arrays;
Expand Down Expand Up @@ -97,4 +99,62 @@ public void sendMessageToTopic(Notification notification) {
throw FailedSendingMessagesException.EXCEPTION;
}
}

public ApplicationMessage applicationMessage (ApplicationsStatusChangedEvent event, String companyName) {
String title, content;

switch(event.getStatus()) {
case REQUESTED:
title = "μ§€μ›μ„œ 제좜 μ™„λ£Œ";
content = "μ§€μ›μ„œκ°€ μ œμΆœλ˜μ—ˆμŠ΅λ‹ˆλ‹€. κ²€ν† κ°€ 진행될 μ˜ˆμ •μž…λ‹ˆλ‹€. 쑰금만 κΈ°λ‹€λ € μ£Όμ„Έμš”!";
break;

case APPROVED:
title = "μ§€μ›μ„œκ°€ μŠΉμΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€!";
content = "μ§€μ›μ„œκ°€ μŠΉμΈλ˜μ—ˆμ–΄μš”. 곧 νšŒμ‚¬μ— 전솑될 κ±°μ˜ˆμš”!";
break;

case SEND:
title = "μ§€μ›μ„œ 전솑 μ™„λ£Œ";
content = "'" + companyName + "'에 μ§€μ›μ„œκ°€ μ„±κ³΅μ μœΌλ‘œ μ „μ†‘λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 쒋은 κ²°κ³Όλ₯Ό κΈ°μ›ν•©λ‹ˆλ‹€!";
break;

case PROCESSING:
title = "μ§€μ›μ„œκ°€ μ§„ν–‰μ€‘μž…λ‹ˆλ‹€";
content = "'" + companyName + "'μ—μ„œ μ§€μ›μ„œλ₯Ό κ²€ν†  μ€‘μž…λ‹ˆλ‹€. 진행 상황을 계속 확인해 μ£Όμ„Έμš”.";
break;

case FAILED:
title = companyName + "μ§€μ›μ„œ νƒˆλ½";
content = "μ•„μ‰½κ²Œλ„ '" + companyName + "'의 μ§€μ›μ—μ„œ νƒˆλ½ν•˜μ…¨μŠ΅λ‹ˆλ‹€. λ‹€μŒ κΈ°νšŒμ— 더 쒋은 κ²°κ³Όκ°€ 있길 λ°”λžλ‹ˆλ‹€.";
break;

case PASS:
title = "(μ·¨λ½€) " + companyName + "에 ν•©κ²©ν•˜μ…¨μŠ΅λ‹ˆλ‹€!! πŸ₯³";
content = "합격을 μ§„μ‹¬μœΌλ‘œ μΆ•ν•˜λ“œλ¦½λ‹ˆλ‹€.";
break;

case FIELD_TRAIN:
title = "ν˜„μž₯μ‹€μŠ΅μ΄ ν™•μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€!";
content = "'" + companyName + "'μ—μ„œ ν˜„μž₯μ‹€μŠ΅μ΄ ν™•μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μƒˆλ‘œμš΄ κ²½ν—˜μ„ 톡해 μ„±μž₯ν•˜μ‹œκΈΈ λ°”λžλ‹ˆλ‹€!";
break;

case ACCEPTANCE:
title = "κ·Όλ‘œκ³„μ•½μ΄ μ²΄κ²°λ¬μŠ΅λ‹ˆλ‹€!";
content = "'" + companyName + "'과의 κ·Όλ‘œκ³„μ•½μ΄ μ²΄κ²°λ¬μŠ΅λ‹ˆλ‹€. μƒˆλ‘œμš΄ 여정을 μ‘μ›ν•©λ‹ˆλ‹€!";
break;

case REJECTED:
title = "μ§€μ›μ„œκ°€ λ°˜λ €λ˜μ—ˆμŠ΅λ‹ˆλ‹€.";
content = "μ§€μ›μ„œκ°€ '" + companyName + "'에 μ˜ν•΄ λ°˜λ €λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ§€μ›μ„œ λ‚΄μš©μ„ λ‹€μ‹œ ν™•μΈν•˜κ³  μˆ˜μ • ν›„ μž¬μ œμΆœν•΄ μ£Όμ„Έμš”.";
break;

default:
title = "μ§€μ›μ„œ μƒνƒœκ°€ λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€";
content = "μ§€μ›μ„œ μƒνƒœκ°€ " + event.getStatus().getName() + "으둜 λ³€κ²½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.";
break;
}

return new ApplicationMessage(title, content);
}
}

0 comments on commit d7cec15

Please sign in to comment.