Q&A/제휴/문의 이벤트 클래스 제거 - 메시지 이벤트 핸들러 단순화
eapim-portal CI (from elink-portal-common) / build (push) Has been cancelled
eapim-portal CI (from elink-portal-common) / build (push) Has been cancelled
- API 상태 관리 레포지토리 조회 메서드 추가 - GW 처리 방식 관련 DB 필드 추가
This commit is contained in:
@@ -68,6 +68,11 @@ public class AppRequest implements com.eactive.eai.data.Data {
|
||||
@Column(name = "reason")
|
||||
private String reason;
|
||||
|
||||
//DELETE 승인 시 admin 이 선택한 GW 처리방식. null=차단(BLOCK)과 동일
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "gw_action", length = 10)
|
||||
private GwAction gwAction;
|
||||
|
||||
@Column(name = "app_description", length = 500)
|
||||
private String appDescription;
|
||||
|
||||
|
||||
+7
@@ -6,6 +6,7 @@ import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@@ -15,5 +16,11 @@ public interface DjbApistatusIncidentApiRepository
|
||||
|
||||
List<DjbApistatusIncidentApi> findByIncidentIdOrderByApiId(Long incidentId);
|
||||
|
||||
List<DjbApistatusIncidentApi> findByIncidentIdInOrderByIncidentIdAscApiIdAsc(Collection<Long> incidentIds);
|
||||
|
||||
List<DjbApistatusIncidentApi> findByApiIdInAndRecoveredAtIsNull(Collection<String> apiIds);
|
||||
|
||||
long countByIncidentIdAndRecoveredAtIsNull(Long incidentId);
|
||||
|
||||
void deleteByIncidentId(Long incidentId);
|
||||
}
|
||||
|
||||
+29
@@ -1,11 +1,17 @@
|
||||
package com.eactive.apim.portal.djb.apistatus.incident.repository;
|
||||
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.DjbApistatusIncident;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentKind;
|
||||
import com.eactive.apim.portal.djb.apistatus.incident.entity.IncidentState;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
@@ -14,4 +20,27 @@ public interface DjbApistatusIncidentRepository
|
||||
extends JpaRepository<DjbApistatusIncident, Long>, JpaSpecificationExecutor<DjbApistatusIncident> {
|
||||
|
||||
Optional<DjbApistatusIncident> findByNoticeId(String noticeId);
|
||||
|
||||
Optional<DjbApistatusIncident> findByInterfaceId(String interfaceId);
|
||||
|
||||
List<DjbApistatusIncident> findByKindAndStateNotInOrderByStartedAtDesc(
|
||||
IncidentKind kind, Collection<IncidentState> excludedStates);
|
||||
|
||||
/**
|
||||
* 특정 API 들에 영향을 주는 미종결 장애. 자동 탐지 시 기존 장애 병합 대상 판별용.
|
||||
*
|
||||
* <p>{@code detectedBy} 로 등록 주체를 한정한다. 자동 탐지는 자동 등록 건에만 영향 API 를 덧붙여야
|
||||
* 관리자가 직접 작성한 장애 공지의 내용이 바뀌지 않는다.</p>
|
||||
*/
|
||||
@Query("SELECT DISTINCT i FROM DjbApistatusIncident i, DjbApistatusIncidentApi a"
|
||||
+ " WHERE a.incidentId = i.incidentId"
|
||||
+ " AND i.kind = :kind"
|
||||
+ " AND i.detectedBy = :detectedBy"
|
||||
+ " AND i.state NOT IN :excludedStates"
|
||||
+ " AND a.apiId IN :apiIds"
|
||||
+ " ORDER BY i.startedAt DESC")
|
||||
List<DjbApistatusIncident> findOpenByApiIds(@Param("kind") IncidentKind kind,
|
||||
@Param("detectedBy") String detectedBy,
|
||||
@Param("excludedStates") Collection<IncidentState> excludedStates,
|
||||
@Param("apiIds") Collection<String> apiIds);
|
||||
}
|
||||
|
||||
+6
@@ -5,6 +5,7 @@ import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@@ -14,5 +15,10 @@ public interface DjbApistatusIncidentTimelineRepository
|
||||
|
||||
List<DjbApistatusIncidentTimeline> findByIncidentIdOrderByEventAtAsc(Long incidentId);
|
||||
|
||||
List<DjbApistatusIncidentTimeline> findByIncidentIdOrderByEventAtDesc(Long incidentId);
|
||||
|
||||
List<DjbApistatusIncidentTimeline> findByIncidentIdInAndVisibleYnOrderByEventAtDesc(
|
||||
Collection<Long> incidentIds, String visibleYn);
|
||||
|
||||
void deleteByIncidentId(Long incidentId);
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
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/>";
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
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 InquiryCreatedEvent implements MessageEventHandler {
|
||||
// public static final String KEY = "inquiry_created";
|
||||
public static final MessageCode KEY = MessageCode.INQUIRY_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("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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "QnA 질문 등록";
|
||||
}
|
||||
|
||||
@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> - subject: 질문 제목 (별칭) </div><br/>"
|
||||
+ "<div> - writerName: 작성자 이름 </div><br/>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user