Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/com/project/mock/controller/MockController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.UUID;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand All @@ -30,6 +31,9 @@ public class MockController {

private final MockMessageRepository repository;

@Value("${mock.filter.target-sub-ids}")
private List<Long> targetSubIds;
Comment on lines +34 to +35
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

targetSubIds 필드를 List로 선언하셨습니다. List.contains() 메소드는 시간 복잡도가 O(n)이므로, 필터링할 ID의 개수가 많아지면 성능에 영향을 줄 수 있습니다. contains 연산의 평균 시간 복잡도가 O(1)인 Set을 사용하는 것이 더 효율적입니다. Spring은 application.yml의 콤마로 구분된 문자열을 Set으로 자동 변환해줍니다.

Suggested change
@Value("${mock.filter.target-sub-ids}")
private List<Long> targetSubIds;
@Value("${mock.filter.target-sub-ids}")
private java.util.Set<Long> targetSubIds;


// ==========================================
// [API] External System Inbound (From api-message)
// ==========================================
Expand All @@ -56,6 +60,11 @@ private void saveMessage(String type, String defaultSender, Map<String, Object>
// sub_id 파싱 (없으면 0으로 처리하여 에러 방지)
Long subId = parseLong(request.get("sub_id"));

if (!targetSubIds.contains(subId)) {
log.debug("🚫 Ignored message for non-target subId: {}", subId);
return;
}

// [수정된 부분] 타입에 따라 '수신자(receiver)' 필드에 넣을 값을 결정
String receiver = "Unknown";

Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ logging:
root: INFO
org.springframework.web: INFO
org.hibernate.SQL: WARN

mock:
filter:
target-sub-ids: ${MOCK_TARGET_SUB_IDS:1001,1002}
27 changes: 11 additions & 16 deletions src/main/resources/templates/email.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1 class="text-2xl font-bold">휴대폰 요금 청구서</h1>
</div>
<div class="bg-white/20 p-2 rounded-lg">
<div class="text-xs uppercase tracking-wider">청구 번호</div>
<div class="font-mono font-bold" th:text="${variables.invoice_number}">INV-2023-11-001</div>
<div class="font-mono font-bold" th:text="${variables.invoiceNumber}">INV-2023-11-001</div>
</div>
</div>
</div>
Expand All @@ -50,17 +50,17 @@ <h1 class="text-2xl font-bold">휴대폰 요금 청구서</h1>
<div>
<h2 class="text-lg font-semibold text-gray-800 mb-2">고객 정보</h2>
<div class="space-y-1">
<p><span class="font-medium text-gray-600">고객명:</span> <span th:text="${variables.customer_name}">홍길동</span></p>
<p><span class="font-medium text-gray-600">연락처:</span> <span th:text="${variables.phone_number}">010-0000-0000</span></p>
<p><span class="font-medium text-gray-600">이메일:</span> <span th:text="${selectedMessage.receiver}">email@test.com</span></p>
<p><span class="font-medium text-gray-600">요금제:</span> <span th:text="${variables.plan_name}">요금제명</span></p>
<p><span class="font-medium text-gray-600">고객명:</span> <span th:text="${variables.customerName}">홍길동</span></p>
<p><span class="font-medium text-gray-600">연락처:</span> <span th:text="${variables.phoneNumber}">010-0000-0000</span></p>
<p><span class="font-medium text-gray-600">이메일:</span> <span th:text="${variables.email}">email@test.com</span></p>
<p><span class="font-medium text-gray-600">요금제:</span> <span th:text="${variables.planName}">요금제명</span></p>
</div>
</div>
<div>
<h2 class="text-lg font-semibold text-gray-800 mb-2">청구 정보</h2>
<div class="space-y-1">
<p><span class="font-medium text-gray-600">청구 날짜:</span> <span th:text="${variables.billing_date}">2023년 11월 15일</span></p>
<p><span class="font-medium text-gray-600">납기일:</span> <span th:text="${variables.due_date}">2023년 11월 30일</span></p>
<p><span class="font-medium text-gray-600">청구 날짜:</span> <span th:text="${variables.billingDate}">2023년 11월 15일</span></p>
<p><span class="font-medium text-gray-600">납기일:</span> <span th:text="${variables.dueDate}">2023년 11월 30일</span></p>
</div>
</div>
</div>
Expand All @@ -74,7 +74,7 @@ <h2 class="text-lg font-semibold text-gray-800">청구 요약</h2>
</div>
<div class="mt-2 md:mt-0">
<span class="text-sm font-medium text-gray-600">총 청구 금액</span>
<div class="text-3xl font-bold text-indigo-700" th:text="${variables.total_amount}">89,500원</div>
<div class="text-3xl font-bold text-indigo-700" th:text="${variables.totalAmount}">89,500원</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -105,7 +105,6 @@ <h2 class="text-lg font-semibold text-gray-800 mb-4">요금 상세 내역</h2>
</td>

<td class="px-4 py-3 text-sm text-right"
th:classappend="${item.styleClass != null ? item.styleClass : 'text-gray-900'}"
th:text="${item.amount}">
3,300원
</td>
Expand All @@ -121,29 +120,25 @@ <h2 class="text-lg font-semibold text-gray-800 mb-4">요금 상세 내역</h2>
<div>
<span class="text-sm font-medium text-gray-600">청구 상태</span>
<div class="mt-1">
<span th:if="${variables.payment_status == 'PAID'}"
<span th:if="${variables.paymentStatus == 'PAID'}"
class="status-paid inline-flex items-center px-3 py-1 rounded-full text-sm font-medium text-white">
<i data-feather="check-circle" class="w-4 h-4 mr-1"></i>
결제 완료
</span>

<span th:if="${variables.payment_status != 'PAID'}"
<span th:if="${variables.paymentStatus != 'PAID'}"
class="status-overdue inline-flex items-center px-3 py-1 rounded-full text-sm font-medium text-white">
<i data-feather="alert-circle" class="w-4 h-4 mr-1"></i>
미납 (납부 필요)
</span>
</div>
</div>
<div class="mt-4 md:mt-0">
<span class="text-sm font-medium text-gray-600">결제 예정일</span>
<div class="mt-1 text-gray-900" th:text="${variables.payment_date}">2023년 11월 25일</div>
</div>
</div>
</div>

<div class="p-6 bg-gray-50 rounded-b-xl">
<h2 class="text-lg font-semibold text-gray-800 mb-3">추가 정보</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-sm">
<div class="text-sm">
<div>
<h3 class="font-medium text-gray-700 mb-1">유의사항</h3>
<ul class="space-y-1 text-gray-600">
Expand Down
Loading