# Trang 4: Phân tích cấu trúc mã nguồn

Cấu trúc Package được tổ chức theo chuẩn Clean Architecture đơn giản:

<div class="my-4 rounded-lg overflow-x-auto overflow-y-hidden border border-gray-500/20 [&_thead_tr:first-child_th:first-child]:border-t-0 [&_thead_tr:first-child_th:first-child]:border-l-0 [&_thead_tr:first-child_th:last-child]:border-t-0 [&_thead_tr:first-child_th:last-child]:border-r-0 [&_tbody_tr:last-child_td:first-child]:border-b-0 [&_tbody_tr:last-child_td:first-child]:border-l-0 [&_tbody_tr:last-child_td:last-child]:border-b-0 [&_tbody_tr:last-child_td:last-child]:border-r-0 [&_thead_tr:first-child_th]:border-t-0 [&_tbody_tr:last-child_td]:border-b-0 [&_th:first-child]:border-l-0 [&_td:first-child]:border-l-0 [&_th:last-child]:border-r-0 [&_td:last-child]:border-r-0" id="bkmrk-package-tr%C3%A1ch-nhi%E1%BB%87m-"><table class="min-w-full border-separate border-spacing-0"><thead><tr><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Package</th><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Trách nhiệm</th></tr></thead><tbody><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`com.example.serviceproxy.controller`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Tiếp nhận HTTP Request từ Client, thực hiện Mapping Header.</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`com.example.serviceproxy.service`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Chứa Interface và Implementation điều phối các yêu cầu Proxy.</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`com.example.serviceproxy.client`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">**Trái tim của hệ thống**, thực hiện các cuộc gọi WebClient và logic Retry.</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`com.example.serviceproxy.config`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Thiết lập Security, WebClient và các Bean hệ thống.</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`com.example.serviceproxy.dto`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Chứa các đối tượng trao đổi dữ liệu (Request/Response) cho cả Signing và BPMN.</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`com.example.serviceproxy.response`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Lớp tiện ích để tạo các phản hồi chuẩn (Success/Error).</td></tr></tbody></table>

</div>### Sơ đồ Logic xử lý:

1. `SigningProxyController` nhận request.
2. `SigningProxyServiceImpl` nhận lệnh.
3. `ExternalApiClient` thực thi WebClient (có Retry).
4. Phản hồi được trả ngược lại qua các lớp.