Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f73e6fcd0 | |||
| 2d5d8e4c4f | |||
| a14e755e6d | |||
| 2882ed035d | |||
| d4b9fe8ed5 | |||
| f361a5adac | |||
| d0c029e954 | |||
| 9270167790 | |||
| 38d100543b | |||
| 264bb8f729 | |||
| ddb0ce8397 | |||
| 9725a19b35 | |||
| 5cb490722c |
@@ -0,0 +1,130 @@
|
||||
name: eapim-portal CI (from elink-portal-common)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- feats/ci-test
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [self-hosted, linux, eapim-portal]
|
||||
env:
|
||||
JAVA_HOME: /apps/opts/jdk8
|
||||
JAVA_HOME_TOMCAT: /apps/opts/jdk17
|
||||
CATALINA_BASE: /prod/eapim/devportal
|
||||
CATALINA_HOME: /prod/eapim/apache-tomcat-9.0.116
|
||||
CATALINA_PID: /prod/eapim/devportal/temp/catalina.pid
|
||||
DEPLOY_HTTP_PORT: "39130"
|
||||
defaults:
|
||||
run:
|
||||
working-directory: eapim-portal
|
||||
|
||||
steps:
|
||||
- name: Checkout elink-portal-common (trigger SHA)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: elink-portal-common
|
||||
|
||||
- name: Checkout eapim-portal (master)
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
rm -rf eapim-portal
|
||||
git clone --depth=1 --branch master \
|
||||
http://oauth2:${{ secrets.CI_TOKEN }}@172.30.1.50:3000/djb-eapim/eapim-portal.git \
|
||||
eapim-portal
|
||||
|
||||
- name: Checkout elink-online-core-jpa (master)
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
mkdir -p eapim-online
|
||||
rm -rf eapim-online/elink-online-core-jpa
|
||||
git clone --depth=1 --branch master \
|
||||
http://oauth2:${{ secrets.CI_TOKEN }}@172.30.1.50:3000/djb-eapim/elink-online-core-jpa.git \
|
||||
eapim-online/elink-online-core-jpa
|
||||
|
||||
- name: Verify toolchain
|
||||
run: |
|
||||
java -version
|
||||
gradle --version
|
||||
|
||||
- name: Gradle build (no tests)
|
||||
run: gradle clean build -x test --no-daemon
|
||||
|
||||
- name: Upload WAR artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: eapim-portal-wars-${{ github.sha }}
|
||||
path: |
|
||||
eapim-portal/build/libs/eapim-portal.war
|
||||
eapim-portal/build/libs/eapim-portal-boot.war
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Stop tomcat (pre-clean)
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
if [ -f "$CATALINA_PID" ] && kill -0 "$(cat $CATALINA_PID)" 2>/dev/null; then
|
||||
JAVA_HOME=$JAVA_HOME_TOMCAT "$CATALINA_HOME/bin/shutdown.sh" 30 -force || true
|
||||
for i in $(seq 1 30); do
|
||||
[ -f "$CATALINA_PID" ] && kill -0 "$(cat $CATALINA_PID)" 2>/dev/null || break
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
rm -f "$CATALINA_PID"
|
||||
|
||||
- name: Deploy war as ROOT
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
DEPLOY_DIR="$CATALINA_BASE/webapps"
|
||||
rm -rf "$DEPLOY_DIR/ROOT" "$DEPLOY_DIR/ROOT.war"
|
||||
cp eapim-portal/build/libs/eapim-portal.war "$DEPLOY_DIR/ROOT.war"
|
||||
ls -la "$DEPLOY_DIR"
|
||||
|
||||
- name: Start tomcat and health check (timeout 90s)
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
LOG="$CATALINA_BASE/logs/catalina.$(date +%Y-%m-%d).log"
|
||||
BEFORE=0
|
||||
[ -f "$LOG" ] && BEFORE=$(stat -c %s "$LOG")
|
||||
|
||||
mkdir -p "$(dirname $CATALINA_PID)"
|
||||
JAVA_HOME=$JAVA_HOME_TOMCAT "$CATALINA_HOME/bin/startup.sh"
|
||||
|
||||
DEADLINE=$(($(date +%s) + 90))
|
||||
STATUS=000
|
||||
while [ $(date +%s) -lt $DEADLINE ]; do
|
||||
STATUS=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 3 http://localhost:$DEPLOY_HTTP_PORT/ 2>/dev/null || echo "000")
|
||||
if [ "$STATUS" = "200" ]; then
|
||||
echo "HTTP 200 received from /"
|
||||
break
|
||||
fi
|
||||
if [ -f "$LOG" ] && tail -c +$((BEFORE+1)) "$LOG" | grep -qE "Application listener .* Exception|SEVERE.*startup.Catalina"; then
|
||||
echo "::error::Startup error detected in log"
|
||||
tail -c +$((BEFORE+1)) "$LOG" | tail -80
|
||||
exit 1
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
if [ "$STATUS" != "200" ]; then
|
||||
echo "::error::Health check failed within 90s (last HTTP status: $STATUS)"
|
||||
[ -f "$LOG" ] && tail -c +$((BEFORE+1)) "$LOG" | tail -100
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "--- key boot log lines ---"
|
||||
tail -c +$((BEFORE+1)) "$LOG" | grep -E "Server startup|Deployment of web" | head -10 || true
|
||||
|
||||
- name: Stop tomcat (post-clean)
|
||||
if: always()
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
if [ -f "$CATALINA_PID" ] && kill -0 "$(cat $CATALINA_PID)" 2>/dev/null; then
|
||||
JAVA_HOME=$JAVA_HOME_TOMCAT "$CATALINA_HOME/bin/shutdown.sh" 30 -force || true
|
||||
for i in $(seq 1 30); do
|
||||
[ -f "$CATALINA_PID" ] && kill -0 "$(cat $CATALINA_PID)" 2>/dev/null || break
|
||||
sleep 1
|
||||
done
|
||||
[ -f "$CATALINA_PID" ] && kill -9 "$(cat $CATALINA_PID)" 2>/dev/null || true
|
||||
fi
|
||||
rm -f "$CATALINA_PID"
|
||||
@@ -87,6 +87,9 @@ dependencies {
|
||||
api "com.querydsl:querydsl-apt:${queryDslVersion}"
|
||||
api "org.mapstruct:mapstruct:1.5.5.Final", "org.projectlombok:lombok:1.18.28"
|
||||
|
||||
// JDK 11+ 에서 javax.annotation.* 가 제거되어 (JEP 320) 명시 의존성 필요
|
||||
api 'javax.annotation:javax.annotation-api:1.3.2'
|
||||
|
||||
// project > properties > Java Compiler > Annoation Processing
|
||||
annotationProcessor "org.projectlombok:lombok:1.18.28", "org.projectlombok:lombok-mapstruct-binding:0.2.0", "org.mapstruct:mapstruct-processor:1.5.5.Final", "com.querydsl:querydsl-apt:${queryDslVersion}:jpa", "jakarta.persistence:jakarta.persistence-api:2.2.3", "jakarta.annotation:jakarta.annotation-api:1.3.5"
|
||||
|
||||
|
||||
@@ -75,4 +75,7 @@ public class Approval implements Serializable, com.eactive.eai.data.Data {
|
||||
@Column(length = 17, name = "end_date")
|
||||
@Convert(converter = LocalDateTimeToStringConverter17.class)
|
||||
private LocalDateTime approvalDate;
|
||||
|
||||
@Column(name = "expect_end_date")
|
||||
private String expectEndDate; //예상완료일
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@ import com.eactive.eai.data.converter.LocalDateTimeToStringConverter17;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -25,12 +26,12 @@ public class Approver implements Serializable, com.eactive.eai.data.Data {
|
||||
|
||||
@ManyToOne
|
||||
@MapsId("approval")
|
||||
@JoinColumn(name = "APPROVAL_ID", nullable = false)
|
||||
@JoinColumn(name = "APPROVAL_ID", nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private Approval approval;
|
||||
|
||||
@NotNull
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "USER_ID", nullable = false)
|
||||
@JoinColumn(name = "USER_ID", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
@NotFound(action = NotFoundAction.IGNORE)
|
||||
private UserInfo user;
|
||||
|
||||
@Enumerated(value = STRING)
|
||||
|
||||
@@ -28,4 +28,8 @@ public interface ApprovalState extends Serializable {
|
||||
}
|
||||
|
||||
String getDescription();
|
||||
|
||||
default String getCode() {
|
||||
return toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ProcessingState implements ApprovalState {
|
||||
boolean statusChanged = false;
|
||||
// Update current approver status and track if it changed
|
||||
for (Approver approver : approval.getApprovers()) {
|
||||
if (approver.getUser().getId().equals(approverId) && !ApproverStatus.APPROVED.equals(approver.getApproverStatus())) {
|
||||
if (approver.getUser() != null && approverId.equals(approver.getUser().getId()) && !ApproverStatus.APPROVED.equals(approver.getApproverStatus())) {
|
||||
approver.setApproverStatus(ApproverStatus.APPROVED);
|
||||
approver.setApprovedDate(LocalDateTime.now());
|
||||
statusChanged = true;
|
||||
@@ -76,7 +76,7 @@ public class ProcessingState implements ApprovalState {
|
||||
String approverId = (String) options.getOrDefault(ApprovalConstants.APPROVER, "");
|
||||
if (isAuthorizedApprover(approval, approverId, options)) {
|
||||
approval.getApprovers().forEach(approver -> {
|
||||
if(approver.getUser().getId().equals(approverId)) {
|
||||
if(approver.getUser() != null && approverId.equals(approver.getUser().getId())) {
|
||||
approver.setApproverStatus(ApproverStatus.DENIED);
|
||||
approver.setApprovedDate(LocalDateTime.now());
|
||||
String message = (String) options.getOrDefault("message", "");
|
||||
|
||||
@@ -48,7 +48,7 @@ public class RequestedState implements ApprovalState {
|
||||
|
||||
// Update current approver status and track if it changed
|
||||
for (Approver approver : approval.getApprovers()) {
|
||||
if (approver.getUser().getId().equals(approverId) && !ApproverStatus.APPROVED.equals(approver.getApproverStatus())) {
|
||||
if (approver.getUser() != null && approverId.equals(approver.getUser().getId()) && !ApproverStatus.APPROVED.equals(approver.getApproverStatus())) {
|
||||
approver.setApproverStatus(ApproverStatus.APPROVED);
|
||||
approver.setApprovedDate(LocalDateTime.now());
|
||||
statusChanged = true;
|
||||
@@ -78,7 +78,7 @@ public class RequestedState implements ApprovalState {
|
||||
String approverId = (String) options.getOrDefault(ApprovalConstants.APPROVER, "");
|
||||
if (isAuthorizedApprover(approval, approverId, options)) {
|
||||
approval.getApprovers().forEach(approver -> {
|
||||
if (approver.getUser().getId().equals(approverId)) {
|
||||
if (approver.getUser() != null && approverId.equals(approver.getUser().getId())) {
|
||||
approver.setApproverStatus(ApproverStatus.DENIED);
|
||||
approver.setApprovedDate(LocalDateTime.now());
|
||||
String message = (String) options.getOrDefault("message", "");
|
||||
@@ -97,7 +97,7 @@ public class RequestedState implements ApprovalState {
|
||||
String approverId = (String) options.getOrDefault(ApprovalConstants.APPROVER, "");
|
||||
if (isAuthorizedApprover(approval, approverId, options)) {
|
||||
approval.getApprovers().forEach(approver -> {
|
||||
if (approver.getUser().getId().equals(approverId)) {
|
||||
if (approver.getUser() != null && approverId.equals(approver.getUser().getId())) {
|
||||
approver.setApproverStatus(ApproverStatus.CANCELED);
|
||||
approver.setApprovedDate(LocalDateTime.now());
|
||||
}
|
||||
|
||||
+71
@@ -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";
|
||||
}
|
||||
+38
@@ -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;
|
||||
}
|
||||
+18
@@ -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;
|
||||
}
|
||||
+51
@@ -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
|
||||
}
|
||||
+19
@@ -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);
|
||||
}
|
||||
+17
@@ -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);
|
||||
}
|
||||
+18
@@ -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);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.eactive.apim.portal.file.service;
|
||||
import static com.eactive.apim.portal.file.service.StorageType.FILESYSTEM;
|
||||
|
||||
import com.eactive.apim.portal.portalproperty.service.PortalPropertyService;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
package com.eactive.apim.portal.portalNotice.entity;
|
||||
|
||||
import com.eactive.apim.portal.common.entity.Auditable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.JoinColumnOrFormula;
|
||||
import org.hibernate.annotations.JoinColumnsOrFormulas;
|
||||
import org.hibernate.annotations.JoinFormula;
|
||||
|
||||
import javax.persistence.*;
|
||||
import com.eactive.apim.portal.common.entity.Auditable;
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCode;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
@@ -48,4 +63,14 @@ public class PortalNotice extends Auditable {
|
||||
@Comment("작성자이름")
|
||||
private String inquirerName;
|
||||
|
||||
@Column(name = "fix_yn", length = 1, nullable = false)
|
||||
@Comment("상단고정여부")
|
||||
private String fixYn;
|
||||
|
||||
@Column(name = "notice_type", length = 1, nullable = false)
|
||||
@Comment("게시유형")
|
||||
private String noticeType;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@ public class Inquiry extends Auditable {
|
||||
* 응답자
|
||||
*/
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "RESPONDER_ID")
|
||||
@JoinColumn(name = "RESPONDER_ID", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
@NotFound(action = NotFoundAction.IGNORE)
|
||||
private UserInfo responder;
|
||||
|
||||
@Column(name = "ATTACH_FILE")
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.eactive.apim.portal.qna.entity;
|
||||
|
||||
import com.eactive.apim.portal.common.entity.Auditable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
@Table(name = "PTL_INQUIRY_COMMENT")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(exclude = "inquiry")
|
||||
public class InquiryComment extends Auditable implements Serializable {
|
||||
|
||||
@Id
|
||||
@Column(name = "id", length = 36, nullable = false)
|
||||
@GenericGenerator(name = "uuid-gen", strategy = "uuid2")
|
||||
@GeneratedValue(generator = "uuid-gen", strategy = GenerationType.IDENTITY)
|
||||
private String id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "INQUIRY_ID", nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
||||
private Inquiry inquiry;
|
||||
|
||||
@Lob
|
||||
@Column(name = "COMMENT_DETAIL")
|
||||
private String commentDetail;
|
||||
|
||||
@Column(name = "DEL_YN", length = 1)
|
||||
private String delYn = "N";
|
||||
|
||||
@Column(name = "ADMIN_YN", length = 1)
|
||||
private String adminYn = "N";
|
||||
|
||||
public void markDeleted() {
|
||||
this.delYn = "Y";
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
return "Y".equals(this.delYn);
|
||||
}
|
||||
|
||||
public boolean isAdmin() {
|
||||
return "Y".equals(this.adminYn);
|
||||
}
|
||||
}
|
||||
@@ -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,6 +30,16 @@ public enum MessageCode {
|
||||
APP_REGISTER_APPROVED("앱 등록 승인", "FM_APIM009", Channels.EMAIL),
|
||||
APP_REGISTER_REJECTED("앱 등록 거절", "FM_APIM010", Channels.EMAIL),
|
||||
|
||||
// Q&A 등록/댓글 등록 알림 (DJBank 커스텀 — portal-admin 수신)
|
||||
INQUIRY_CREATED("Q&A 등록 알림", null, Channels.NONE),
|
||||
INQUIRY_COMMENT_CREATED("Q&A 댓글 등록 알림", null, Channels.NONE),
|
||||
|
||||
|
||||
// API상태 모니터링
|
||||
API_STATUS_CHANGED("API 상태 변화", "FM_APIM011", Channels.MESSENGER),
|
||||
// 유량제어 토큰 획득 실패
|
||||
INFLOW_TOKEN_FAILED("유량제어 토큰 획득 실패", "FM_APIM012", Channels.MESSENGER),
|
||||
|
||||
|
||||
// 미 사용, 미 분류
|
||||
@Deprecated
|
||||
@@ -78,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)
|
||||
;
|
||||
@@ -115,6 +122,7 @@ public enum MessageCode {
|
||||
NONE (0b0000),
|
||||
EMAIL (0b0001),
|
||||
KAKAO_ALIMTALK (0b0010),
|
||||
MESSENGER (0b0100),
|
||||
;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.eactive.apim.portal.template.service;
|
||||
|
||||
import com.eactive.apim.portal.portaluser.entity.PortalUser;
|
||||
import kjb.safedb.KjbNotRnnoJpaAttributeConverter;
|
||||
import lombok.*;
|
||||
|
||||
import javax.persistence.Convert;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
|
||||
@@ -111,20 +111,17 @@ public class MessageSendService {
|
||||
logger.debug(emailRequest.toString());
|
||||
}
|
||||
|
||||
//메신저는 사용하지 않아서 주석 처리함.
|
||||
// if (template.getEnableMessenger().equalsIgnoreCase("Y")) {
|
||||
// MessageRequest messengerRequest = new MessageRequest();
|
||||
// messengerRequest.setMessageCode(MessageRequestEnums.MessageCode.valueOf(template.getMessageCode()));
|
||||
// messengerRequest.setSubject(subject);
|
||||
// String messengerTemplate = buildMessage(template.getMessengerTemplate(), messageParams);
|
||||
// messengerRequest.setMessage(messengerTemplate);
|
||||
// messengerRequest.setRequestDate(LocalDateTime.now());
|
||||
// messengerRequest.setUsername(user.getUsername());
|
||||
// messengerRequest.setMessengerId(user.getMessengerId());
|
||||
// messengerRequest.setEaiInterfaceId();
|
||||
// messengerRequest.setServiceId();
|
||||
// messageRequestRepository.save(messengerRequest);
|
||||
// }
|
||||
if (template.getEnableMessenger().equalsIgnoreCase("Y")) {
|
||||
MessageRequest messengerRequest = new MessageRequest();
|
||||
messengerRequest.setMessageCode(MessageCode.valueOf(template.getMessageCode()));
|
||||
messengerRequest.setSubject(subject);
|
||||
String messengerTemplate = buildMessage(template.getMessengerTemplate(), messageParams);
|
||||
messengerRequest.setMessage(messengerTemplate);
|
||||
messengerRequest.setRequestDate(LocalDateTime.now());
|
||||
messengerRequest.setUsername(user.getUsername());
|
||||
messengerRequest.setMessengerId(user.getUserId());
|
||||
messageRequestRepository.save(messengerRequest);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMessageParams(MessageRecipient user, Map<String, String> messageParams) {
|
||||
|
||||
Reference in New Issue
Block a user