3 Commits

Author SHA1 Message Date
Rinjae 7f73e6fcd0 djb_apistatus_incident 엔티티/리포지토리 신설
- DjbApistatusIncident / Api / Timeline 3개 엔티티
- IncidentKind / IncidentState enum
- EMSADM 스키마 1:1 매핑, Spring Data JPA 리포지토리

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-16 09:11:14 +09:00
Rinjae 2d5d8e4c4f Q&A 이벤트 리팩토링
eapim-portal CI (from elink-portal-common) / build (push) Has been cancelled
- InquiryCommentCreatedAdminEvent 삭제 및 경로 변경
- userName 정보 추가 및 description 업데이트
- inquirySubject 처리 로직 개선
2026-06-15 18:57:51 +09:00
Rinjae a14e755e6d Q&A 댓글 관련 코드 리팩토링 및 역할 기반 알림 기능 개선
eapim-portal CI (from elink-portal-common) / build (push) Has been cancelled
- InquiryComment 코드 구조 리팩토링 및 역할 분리
- portal-admin 알림 기능 추가 및 예외 처리 개선
- InquiryComment 관련 불필요 클래스/메서드 제거
2026-06-15 18:49:14 +09:00
12 changed files with 321 additions and 8 deletions
@@ -0,0 +1,71 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
import com.eactive.apim.portal.common.entity.Auditable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.time.LocalDateTime;
@Entity
@Table(name = "DJB_APISTATUS_INCIDENT")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class DjbApistatusIncident extends Auditable {
@Id
@SequenceGenerator(name = "seqDjbApistatusIncident",
sequenceName = "SEQ_DJB_APISTATUS_INCIDENT", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqDjbApistatusIncident")
@Column(name = "INCIDENT_ID", nullable = false)
private Long incidentId;
@Enumerated(EnumType.STRING)
@Column(name = "KIND", length = 20, nullable = false)
private IncidentKind kind;
@Enumerated(EnumType.STRING)
@Column(name = "STATE", length = 30)
private IncidentState state;
@Enumerated(EnumType.STRING)
@Column(name = "PREVIOUS_STATE", length = 30)
private IncidentState previousState;
@Column(name = "TITLE", length = 500, nullable = false)
private String title;
@Column(name = "SUMMARY", length = 2000)
private String summary;
@Column(name = "STARTED_AT")
private LocalDateTime startedAt;
@Column(name = "END_AT")
private LocalDateTime endAt;
@Column(name = "DETECTED_BY", length = 30, nullable = false)
private String detectedBy = "MANUAL";
@Column(name = "INTERFACE_ID", length = 200)
private String interfaceId;
@Column(name = "NOTICE_ID", length = 36)
private String noticeId;
@Column(name = "DRAFT_YN", length = 1, nullable = false)
private String draftYn = "N";
@Column(name = "FIX_YN", length = 1, nullable = false)
private String fixYn = "N";
}
@@ -0,0 +1,38 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
import com.eactive.apim.portal.common.entity.Auditable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import java.time.LocalDateTime;
@Entity
@Table(name = "DJB_APISTATUS_INCIDENT_API")
@IdClass(DjbApistatusIncidentApiId.class)
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true)
public class DjbApistatusIncidentApi extends Auditable {
@Id
@EqualsAndHashCode.Include
@Column(name = "INCIDENT_ID", nullable = false)
private Long incidentId;
@Id
@EqualsAndHashCode.Include
@Column(name = "API_ID", length = 30, nullable = false)
private String apiId;
@Column(name = "API_NAME", length = 200)
private String apiName;
@Column(name = "RECOVERED_AT")
private LocalDateTime recoveredAt;
}
@@ -0,0 +1,18 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DjbApistatusIncidentApiId implements Serializable {
private static final long serialVersionUID = 1L;
private Long incidentId;
private String apiId;
}
@@ -0,0 +1,51 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
import com.eactive.apim.portal.common.entity.Auditable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.time.LocalDateTime;
@Entity
@Table(name = "DJB_APISTATUS_INCIDENT_TIMELINE")
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class DjbApistatusIncidentTimeline extends Auditable {
@Id
@SequenceGenerator(name = "seqDjbApistatusIncidentTimeline",
sequenceName = "SEQ_DJB_APISTATUS_INCIDENT_TIMELINE", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqDjbApistatusIncidentTimeline")
@Column(name = "TIMELINE_ID", nullable = false)
private Long timelineId;
@Column(name = "INCIDENT_ID", nullable = false)
private Long incidentId;
@Column(name = "EVENT_AT", nullable = false)
private LocalDateTime eventAt;
@Enumerated(EnumType.STRING)
@Column(name = "STATE_AFTER", length = 30)
private IncidentState stateAfter;
@Column(name = "BODY", length = 4000, nullable = false)
private String body;
@Column(name = "AUTHOR_TYPE", length = 20, nullable = false)
private String authorType = "OPERATOR";
@Column(name = "VISIBLE_YN", length = 1, nullable = false)
private String visibleYn = "Y";
}
@@ -0,0 +1,6 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
public enum IncidentKind {
INCIDENT,
MAINTENANCE
}
@@ -0,0 +1,9 @@
package com.eactive.apim.portal.djb.apistatus.incident.entity;
public enum IncidentState {
INVESTIGATING,
IDENTIFIED,
MONITORING,
RESOLVED,
CANCELED
}
@@ -0,0 +1,19 @@
package com.eactive.apim.portal.djb.apistatus.incident.repository;
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncidentApi;
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncidentApiId;
import com.eactive.eai.rms.data.EMSDataSource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@EMSDataSource
public interface DjbApistatusIncidentApiRepository
extends JpaRepository<DjbApistatusIncidentApi, DjbApistatusIncidentApiId> {
List<DjbApistatusIncidentApi> findByIncidentIdOrderByApiId(Long incidentId);
void deleteByIncidentId(Long incidentId);
}
@@ -0,0 +1,17 @@
package com.eactive.apim.portal.djb.apistatus.incident.repository;
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncident;
import com.eactive.eai.rms.data.EMSDataSource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
@EMSDataSource
public interface DjbApistatusIncidentRepository
extends JpaRepository<DjbApistatusIncident, Long>, JpaSpecificationExecutor<DjbApistatusIncident> {
Optional<DjbApistatusIncident> findByNoticeId(String noticeId);
}
@@ -0,0 +1,18 @@
package com.eactive.apim.portal.djb.apistatus.incident.repository;
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncidentTimeline;
import com.eactive.eai.rms.data.EMSDataSource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
@EMSDataSource
public interface DjbApistatusIncidentTimelineRepository
extends JpaRepository<DjbApistatusIncidentTimeline, Long> {
List<DjbApistatusIncidentTimeline> findByIncidentIdOrderByEventAtAsc(Long incidentId);
void deleteByIncidentId(Long incidentId);
}
@@ -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/>";
}
}
@@ -30,8 +30,9 @@ public enum MessageCode {
APP_REGISTER_APPROVED("앱 등록 승인", "FM_APIM009", Channels.EMAIL),
APP_REGISTER_REJECTED("앱 등록 거절", "FM_APIM010", Channels.EMAIL),
// Q&A 댓글 등록 (DJBank 커스텀)
INQUIRY_COMMENT_CREATED_ADMIN("Q&A 댓글 등록 알림", null, Channels.NONE),
// Q&A 등록/댓글 등록 알림 (DJBank 커스텀 — portal-admin 수신)
INQUIRY_CREATED("Q&A 등록 알림", null, Channels.NONE),
INQUIRY_COMMENT_CREATED("Q&A 댓글 등록 알림", null, Channels.NONE),
// API상태 모니터링
@@ -87,9 +88,6 @@ public enum MessageCode {
@Deprecated // 정확한 용도 모름
USER_REGISTRATION_REQUEST_USER("사용자 등록 요청 완료", null, Channels.NONE),
@Deprecated // 정확한 용도 모름
INQUIRY_CREATED("QnA 질문 등록", null, Channels.NONE),
@Deprecated
INQUIRY_RESPONSE("QnA 답변 작성", null, Channels.NONE)
;