제휴 생성 이벤트 처리 로직 추가: PartnershipCreatedEvent 구현
eapim-portal CI (from elink-portal-common) / build (push) Has been cancelled
eapim-portal CI (from elink-portal-common) / build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package com.eactive.apim.portal.partnership.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 PartnershipCreatedEvent implements MessageEventHandler {
|
||||
|
||||
public static final MessageCode KEY = MessageCode.PARTNERSHIP_CREATED;
|
||||
|
||||
@Override
|
||||
public boolean allowAdditionalRecipients() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageSendEvent createEvent(Object source, MessageRecipient recipient, Map<String, Object> params) {
|
||||
Map<String, String> requestParams = new HashMap<>();
|
||||
String subject = toStr(params.get("bizSubject"));
|
||||
if (subject.isEmpty()) {
|
||||
subject = toStr(params.get("subject"));
|
||||
}
|
||||
requestParams.put("partnershipId", toStr(params.get("partnershipId")));
|
||||
requestParams.put("bizSubject", 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "개선요청/제휴 게시물 등록";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "<div>사용 가능 변수: </div><br/>"
|
||||
+ "<div> - userName: 수신자 이름 </div><br/>"
|
||||
+ "<div> - userId: 수신자 ID (이메일) </div><br/>"
|
||||
+ "<div> - partnershipId: 신청 ID </div><br/>"
|
||||
+ "<div> - bizSubject: 신청 제목 </div><br/>"
|
||||
+ "<div> - subject: 신청 제목 (별칭) </div><br/>"
|
||||
+ "<div> - writerName: 작성자 이름 </div><br/>";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user