From 4df6f9bd86cef11b624452898666aea57f556a72 Mon Sep 17 00:00:00 2001 From: SmartRootsSrl Date: Sat, 21 Mar 2026 11:47:45 +0100 Subject: [PATCH] docs: update README and CLAUDE.md with expired certificate report feature --- CLAUDE.md | 24 ++++++++++++++++++------ README.md | 33 +++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 88c745b..e14a152 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -27,21 +27,33 @@ Non esistono test automatici al momento. ## Architettura -Il flusso di generazione è orchestrato da `ReportOrchestrator`: +Il flusso di generazione è orchestrato da `ReportOrchestrator`, che sceglie il template in base al campo `Stato` del certificato: ``` HTTP (ISIN) → ReportController → ReportOrchestrator ├── CertificateDataService (4 SP → anagrafica, sottostanti, eventi, scenario) - ├── AnagraficaSectionRenderer → PdfDocument (Sezione 1) - ├── EventiSectionRenderer → PdfDocument (Sezione 2) - ├── ScenarioSectionRenderer → PdfDocument (Sezione 3, opzionale) + │ + ├── [Stato == "Quotazione"] — report certificati in quotazione (4 sezioni) + │ ├── AnagraficaSectionRenderer → PdfDocument (Sezione 1) + │ ├── EventiSectionRenderer → PdfDocument (Sezione 2) + │ ├── ScenarioSectionRenderer → PdfDocument (Sezione 3, opzionale) + │ └── ChartSectionRenderer → PdfDocument (Sezione 4) + │ + ├── [Stato != "Quotazione"] — report certificati non in quotazione (3 sezioni) + │ ├── ExpiredAnagraficaSectionRenderer → PdfDocument (Sezione 1) + │ ├── EventiSectionRenderer → PdfDocument (Sezione 2, colonne adattate) + │ └── ChartSectionRenderer → PdfDocument (Sezione 3) + │ ├── ChartDataService (3 SP → dati grafico) ├── SkiaChartRenderer → PNG in memoria - ├── ChartSectionRenderer → PdfDocument (Sezione 4) └── PdfMergerService → byte[] → Response ``` -**Aggiungere una nuova sezione PDF**: implementare `IPdfSectionRenderer`, impostare `SectionName` e `Order`, registrare in `Program.cs` come `AddScoped()`. L'orchestratore la include automaticamente ordinandola per `Order`. +**Stato certificato**: il campo `Stato` viene dalla SP `rpt_Master_CFT_ISIN`. Valori: `"Quotazione"` (report attivo), `"Scaduto"` / `"Rimborsato"` / `"Revocato"` (report expired). Se `Stato` è vuoto, viene usato il flusso attivo come fallback. + +**Aggiungere una nuova sezione PDF al flusso attivo**: implementare `IPdfSectionRenderer`, impostare `SectionName` e `Order`, registrare in `Program.cs` come `AddScoped()`. L'orchestratore la include automaticamente ordinandola per `Order`. + +**`ExpiredAnagraficaSectionRenderer`**: registrata come `AddScoped()` (senza interfaccia) e iniettata direttamente nell'orchestratore — non partecipa al ciclo `IEnumerable`. **Tema**: tutto in `PdfTheme.cs` — colori, font, layout, brush/pen. Modificare lì per aggiornare tutti i renderer. diff --git a/README.md b/README.md index 2f91785..02021a5 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,10 @@ Generatore di report PDF per certificati finanziari strutturati, sviluppato in A ## Caratteristiche principali - Generazione PDF multi-sezione da dati SQL Server +- **Due template report**: certificati in quotazione (4 sezioni) e certificati non in quotazione / scaduti / rimborsati / revocati (3 sezioni) — rilevamento automatico dal campo `Stato` - Grafico performance sottostanti (SkiaSharp → PNG in memoria) - Footer con branding opzionale e hyperlink cliccabile -- Cache in memoria per ISIN già generati +- Cache in memoria per ISIN già generati (chiavi separate per tipo report e branding) - Endpoint per PDF inline, download e grafico standalone - Supporto Docker @@ -23,13 +24,25 @@ Generatore di report PDF per certificati finanziari strutturati, sviluppato in A ## Struttura del report +### Certificati in quotazione (Stato = "Quotazione") — 4 sezioni + | Sezione | Contenuto | |---------|-----------| | **1 — Anagrafica** | Header con Tipologia / Data / Bid / Ask, caratteristiche prodotto, analisi KV, tabella sottostanti | | **2 — Eventi** | Lista eventi cedole e autocall (tabella landscape multi-pagina) | -| **3 — Scenario** | Scenari di rendimento (opzionale) | +| **3 — Scenario** | Scenari di rendimento (opzionale, saltato se assente) | | **4 — Grafico** | Performance storica dei sottostanti | +### Certificati non in quotazione (Stato = "Scaduto" / "Rimborsato" / "Revocato") — 3 sezioni + +| Sezione | Contenuto | +|---------|-----------| +| **1 — Anagrafica (semplificata)** | Header con solo Tipologia, caratteristiche con Valore/Data Rimborso, analisi KV senza Sottostanti né Bid/Ask | +| **2 — Eventi** | Lista eventi con colonne adattate (Barriera Cedola, Soglia Rimborso, Barriera Capitale, Rimborso Capitale) | +| **3 — Grafico** | Performance storica dei sottostanti | + +Il tipo di report viene selezionato automaticamente dall'orchestratore in base al campo `Stato` restituito dalla SP `rpt_Master_CFT_ISIN`. + ## API Endpoints ``` @@ -102,12 +115,20 @@ Tutto il tema (colori, font, layout, brush/pen) è centralizzato in `CertReports ``` HTTP (ISIN) → ReportController → ReportOrchestrator ├── CertificateDataService (SP → anagrafica, sottostanti, eventi, scenario) - ├── AnagraficaSectionRenderer → PdfDocument (Sezione 1) - ├── EventiSectionRenderer → PdfDocument (Sezione 2) - ├── ScenarioSectionRenderer → PdfDocument (Sezione 3, opzionale) + │ + ├── [Stato == "Quotazione"] ────────────────────────────────────────── + │ ├── AnagraficaSectionRenderer → PdfDocument (Sezione 1) + │ ├── EventiSectionRenderer → PdfDocument (Sezione 2) + │ ├── ScenarioSectionRenderer → PdfDocument (Sezione 3, opzionale) + │ └── ChartSectionRenderer → PdfDocument (Sezione 4) + │ + ├── [Stato != "Quotazione"] ───────────────────────────────────────── + │ ├── ExpiredAnagraficaSectionRenderer → PdfDocument (Sezione 1) + │ ├── EventiSectionRenderer → PdfDocument (Sezione 2, colonne adattate) + │ └── ChartSectionRenderer → PdfDocument (Sezione 3) + │ ├── ChartDataService (SP → dati grafico) ├── SkiaChartRenderer → PNG in memoria - ├── ChartSectionRenderer → PdfDocument (Sezione 4) └── PdfMergerService → byte[] → Response ```