- InquiryCommentCreatedAdminEvent 삭제 및 경로 변경 - userName 정보 추가 및 description 업데이트 - inquirySubject 처리 로직 개선
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package com.eactive.apim.portal.qna.event;
|
||||
|
||||
import com.eactive.apim.portal.template.entity.MessageCode;
|
||||
import com.eactive.apim.portal.template.service.MessageEventHandler;
|
||||
import com.eactive.apim.portal.template.service.MessageRecipient;
|
||||
import com.eactive.apim.portal.template.service.MessageSendEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class InquiryCommentCreatedEvent implements MessageEventHandler {
|
||||
|
||||
public static final MessageCode KEY = MessageCode.INQUIRY_COMMENT_CREATED;
|
||||
|
||||
@Override
|
||||
public MessageCode getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowAdditionalRecipients() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "Q&A 댓글 등록 알림";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "<div>사용 가능 변수: </div><br/>"
|
||||
+ "<div> - userName: 수신자 이름 </div><br/>"
|
||||
+ "<div> - userId: 수신자 ID </div><br/>"
|
||||
+ "<div> - inquiryId: 문의 ID </div><br/>"
|
||||
+ "<div> - inquirySubject: 문의 제목 </div><br/>"
|
||||
+ "<div> - commentContent: 댓글 본문 </div><br/>"
|
||||
+ "<div> - writerName: 작성자 이름 </div><br/>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageSendEvent createEvent(Object source, MessageRecipient recipient, Map<String, Object> params) {
|
||||
Map<String, String> requestParams = new HashMap<>();
|
||||
requestParams.put("inquiryId", toStr(params.get("inquiryId")));
|
||||
requestParams.put("inquirySubject", toStr(params.get("inquirySubject")));
|
||||
requestParams.put("commentContent", toStr(params.get("commentContent")));
|
||||
requestParams.put("writerName", toStr(params.get("writerName")));
|
||||
return new MessageSendEvent(source, KEY, recipient, requestParams);
|
||||
}
|
||||
|
||||
private String toStr(Object value) {
|
||||
return value == null ? "" : value.toString();
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,21 @@ public class InquiryCreatedEvent implements MessageEventHandler {
|
||||
@Override
|
||||
public MessageSendEvent createEvent(Object source, MessageRecipient recipient, Map<String, Object> params) {
|
||||
Map<String, String> requestParams = new HashMap<>();
|
||||
requestParams.put("inquiryId", (String) params.get("inquiryId"));
|
||||
requestParams.put("subject", (String) params.get("subject"));
|
||||
String subject = toStr(params.get("inquirySubject"));
|
||||
if (subject.isEmpty()) {
|
||||
subject = toStr(params.get("subject"));
|
||||
}
|
||||
requestParams.put("inquiryId", toStr(params.get("inquiryId")));
|
||||
requestParams.put("inquirySubject", subject);
|
||||
requestParams.put("subject", subject);
|
||||
requestParams.put("writerName", toStr(params.get("writerName")));
|
||||
return new MessageSendEvent(source, KEY, recipient, requestParams);
|
||||
}
|
||||
|
||||
private String toStr(Object value) {
|
||||
return value == null ? "" : value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageCode getKey() {
|
||||
return KEY;
|
||||
@@ -44,7 +54,9 @@ public class InquiryCreatedEvent implements MessageEventHandler {
|
||||
+ "<div> - userName: 수신자 이름 </div><br/>"
|
||||
+ "<div> - userId: 수신자 ID (이메일) </div><br/>"
|
||||
+ "<div> - inquiryId: 질문 ID </div><br/>"
|
||||
+ "<div> - subject: 제목 </div><br/>";
|
||||
+ "<div> - inquirySubject: 질문 제목 </div><br/>"
|
||||
+ "<div> - subject: 질문 제목 (별칭) </div><br/>"
|
||||
+ "<div> - writerName: 작성자 이름 </div><br/>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user