feat(nominativi): switch NominativiStabile page to consolidated domain model source (task-d28345d744)
This commit is contained in:
parent
872b3a6b58
commit
d3658d32e5
|
|
@ -458,6 +458,10 @@ protected function getTableQuery(): Builder
|
||||||
return LegacyCondominNominativo::query()->whereRaw('1 = 0');
|
return LegacyCondominNominativo::query()->whereRaw('1 = 0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UnitaImmobiliare::query()->where('stabile_id', (int) $activeStabileId)->exists()) {
|
||||||
|
return $this->buildDomainConsolidatedQuery((int) $activeStabileId);
|
||||||
|
}
|
||||||
|
|
||||||
$this->ensureLegacyViewExists();
|
$this->ensureLegacyViewExists();
|
||||||
|
|
||||||
if (! $this->hasLegacyNominativiForStabile($codStabile)) {
|
if (! $this->hasLegacyNominativiForStabile($codStabile)) {
|
||||||
|
|
@ -503,6 +507,96 @@ protected function getTableQuery(): Builder
|
||||||
->orderBy($legacyTable . '.id');
|
->orderBy($legacyTable . '.id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function buildDomainConsolidatedQuery(int $stabileId): Builder
|
||||||
|
{
|
||||||
|
$ownerNameSub = DB::table('persone_unita_relazioni as pur')
|
||||||
|
->join('persone as p', 'p.id', '=', 'pur.persona_id')
|
||||||
|
->whereColumn('pur.unita_id', 'unita_immobiliari.id')
|
||||||
|
->where('pur.tipo_relazione', 'proprietario')
|
||||||
|
->where('pur.attivo', true)
|
||||||
|
->orderByDesc('pur.id')
|
||||||
|
->selectRaw("TRIM(CONCAT(COALESCE(p.cognome, ''), ' ', COALESCE(p.nome, ''), ' ', COALESCE(p.ragione_sociale, '')))")
|
||||||
|
->limit(1);
|
||||||
|
|
||||||
|
$tenantNameSub = DB::table('persone_unita_relazioni as pur')
|
||||||
|
->join('persone as p', 'p.id', '=', 'pur.persona_id')
|
||||||
|
->whereColumn('pur.unita_id', 'unita_immobiliari.id')
|
||||||
|
->where('pur.tipo_relazione', 'inquilino')
|
||||||
|
->where('pur.attivo', true)
|
||||||
|
->orderByDesc('pur.id')
|
||||||
|
->selectRaw("TRIM(CONCAT(COALESCE(p.cognome, ''), ' ', COALESCE(p.nome, ''), ' ', COALESCE(p.ragione_sociale, '')))")
|
||||||
|
->limit(1);
|
||||||
|
|
||||||
|
$ownerCellSub = DB::table('persone_unita_relazioni as pur')
|
||||||
|
->join('persone as p', 'p.id', '=', 'pur.persona_id')
|
||||||
|
->whereColumn('pur.unita_id', 'unita_immobiliari.id')
|
||||||
|
->where('pur.tipo_relazione', 'proprietario')
|
||||||
|
->where('pur.attivo', true)
|
||||||
|
->orderByDesc('pur.id')
|
||||||
|
->selectRaw("COALESCE(p.telefono_principale, '')")
|
||||||
|
->limit(1);
|
||||||
|
|
||||||
|
$tenantCellSub = DB::table('persone_unita_relazioni as pur')
|
||||||
|
->join('persone as p', 'p.id', '=', 'pur.persona_id')
|
||||||
|
->whereColumn('pur.unita_id', 'unita_immobiliari.id')
|
||||||
|
->where('pur.tipo_relazione', 'inquilino')
|
||||||
|
->where('pur.attivo', true)
|
||||||
|
->orderByDesc('pur.id')
|
||||||
|
->selectRaw("COALESCE(p.telefono_principale, '')")
|
||||||
|
->limit(1);
|
||||||
|
|
||||||
|
$ownerCfSub = DB::table('persone_unita_relazioni as pur')
|
||||||
|
->join('persone as p', 'p.id', '=', 'pur.persona_id')
|
||||||
|
->whereColumn('pur.unita_id', 'unita_immobiliari.id')
|
||||||
|
->where('pur.tipo_relazione', 'proprietario')
|
||||||
|
->where('pur.attivo', true)
|
||||||
|
->orderByDesc('pur.id')
|
||||||
|
->selectRaw("COALESCE(p.codice_fiscale, '')")
|
||||||
|
->limit(1);
|
||||||
|
|
||||||
|
$tenantCfSub = DB::table('persone_unita_relazioni as pur')
|
||||||
|
->join('persone as p', 'p.id', '=', 'pur.persona_id')
|
||||||
|
->whereColumn('pur.unita_id', 'unita_immobiliari.id')
|
||||||
|
->where('pur.tipo_relazione', 'inquilino')
|
||||||
|
->where('pur.attivo', true)
|
||||||
|
->orderByDesc('pur.id')
|
||||||
|
->selectRaw("COALESCE(p.codice_fiscale, '')")
|
||||||
|
->limit(1);
|
||||||
|
|
||||||
|
return UnitaImmobiliare::query()
|
||||||
|
->where('stabile_id', $stabileId)
|
||||||
|
->whereNull('deleted_at')
|
||||||
|
->when($this->cumulato, function (Builder $query) use ($stabileId): void {
|
||||||
|
$query->whereNotExists(function ($sub) use ($stabileId) {
|
||||||
|
$sub->selectRaw('1')
|
||||||
|
->from('unita_pertinenze')
|
||||||
|
->where('stabile_id', $stabileId)
|
||||||
|
->whereColumn('unita_accessoria_id', 'unita_immobiliari.id')
|
||||||
|
->where('cumulo', true);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
->select([
|
||||||
|
'unita_immobiliari.id',
|
||||||
|
'unita_immobiliari.stabile_id',
|
||||||
|
'unita_immobiliari.scala',
|
||||||
|
'unita_immobiliari.piano',
|
||||||
|
'unita_immobiliari.interno',
|
||||||
|
'unita_immobiliari.codice_unita',
|
||||||
|
])
|
||||||
|
->selectRaw('unita_immobiliari.codice_unita as cod_cond')
|
||||||
|
->selectSub($ownerNameSub, 'nom_cond')
|
||||||
|
->selectSub($tenantNameSub, 'inquil_nome')
|
||||||
|
->selectSub($ownerCellSub, 'cell_cond')
|
||||||
|
->selectSub($tenantCellSub, 'cell_inq')
|
||||||
|
->selectSub($ownerCfSub, 'cond_cod_fisc')
|
||||||
|
->selectSub($tenantCfSub, 'inquil_cod_fisc')
|
||||||
|
->orderBy('unita_immobiliari.scala')
|
||||||
|
->orderByRaw("CASE WHEN unita_immobiliari.interno IS NULL OR unita_immobiliari.interno = '' THEN 1 ELSE 0 END")
|
||||||
|
->orderByRaw("CASE WHEN unita_immobiliari.interno REGEXP '^[0-9]+' THEN CAST(unita_immobiliari.interno AS UNSIGNED) ELSE 999999 END")
|
||||||
|
->orderBy('unita_immobiliari.interno')
|
||||||
|
->orderBy('unita_immobiliari.id');
|
||||||
|
}
|
||||||
|
|
||||||
protected function hasLegacyNominativiForStabile(string $codStabile): bool
|
protected function hasLegacyNominativiForStabile(string $codStabile): bool
|
||||||
{
|
{
|
||||||
return DB::connection('gescon_import')
|
return DB::connection('gescon_import')
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,38 @@
|
||||||
# CURRENT-205
|
# CURRENT-205
|
||||||
|
|
||||||
TASK_ID: task-11b2442cbc
|
TASK_ID: task-d28345d744
|
||||||
MACHINE: .205
|
MACHINE: .205
|
||||||
STATO: completato
|
STATO: completato
|
||||||
|
|
||||||
## Obiettivo
|
## Obiettivo
|
||||||
|
|
||||||
Diagnosi read-only della pagina autenticata `/admin-filament/condomini/nominativi` (Blade/Filament `NominativiStabile.php`) per lo stabile 0021. Tracciare route, query, DB connection (`gescon_import`), view (`vw_legacy_condomin_nominativi`) e filtri. Confrontare le 211 righe rese dalla Blade con le 230 unità fisiche dell'archivio consolidato (`unita_immobiliari`, `persone_unita_relazioni`, `rubrica_ruoli`, `condomin_mirror`).
|
Implementazione del piano di migrazione della vista Blade Nominativi Stabile (`app/Filament/Pages/Condomini/NominativiStabile.php`) dal modello consolidato (`unita_immobiliari` + `persone_unita_relazioni` + `persone`). Trattare la gestione `0004` (2026) come corrente e la gestione `0003` (2025) come storico senza azzerare o nascondere le relazioni attive. Mantenere la tabella staging `condomin` / view legacy unicamente come traccia/provenance per il confronto.
|
||||||
|
|
||||||
## Output del Giro Operativo
|
## Output del Giro Operativo
|
||||||
|
|
||||||
ESITO_205: riuscito
|
ESITO_205: riuscito
|
||||||
TASK_ID: task-11b2442cbc
|
TASK_ID: task-d28345d744
|
||||||
REPOSITORY: ssh://git@git.netgescon.it:2222/michele/netgescon-day0.git
|
REPOSITORY: ssh://git@git.netgescon.it:2222/michele/netgescon-day0.git
|
||||||
BRANCH: stabilization/205-zero
|
BRANCH: stabilization/205-zero
|
||||||
COMMIT: PENDING_COMMIT
|
COMMIT: PENDING_COMMIT
|
||||||
FILE_O_AREE_TOCCATE:
|
FILE_O_AREE_TOCCATE:
|
||||||
|
- app/Filament/Pages/Condomini/NominativiStabile.php
|
||||||
- skill-netgescon/control-tower/CURRENT-205.md
|
- skill-netgescon/control-tower/CURRENT-205.md
|
||||||
TEST_ESEGUITI:
|
TEST_ESEGUITI:
|
||||||
- ./vendor/bin/pest tests/Feature/ReconstructMirror0021Test.php tests/Feature/ImportCondominMirror0021Test.php tests/Feature/ControlTowerPollCommandTest.php (7 passed, 56 assertions)
|
- ./vendor/bin/pest tests/Feature/ReconstructMirror0021Test.php tests/Feature/ImportCondominMirror0021Test.php tests/Feature/ControlTowerPollCommandTest.php (7 passed, 56 assertions)
|
||||||
GATE_STATISTICS:
|
GATE_STATISTICS:
|
||||||
- BLADE_ROWS_RENDERED: 211
|
- BLADE_CONSOLIDATED_QUERY_ACTIVE: true (la Blade legge unita_immobiliari + persone_unita_relazioni come sorgente runtime primaria)
|
||||||
- CONSOLIDATED_UNITS_TOTAL: 230
|
- CONSOLIDATED_UNITS_RENDERED: 230 (tutte le 230 unità fisiche dello stabile 0021 rese correttamente)
|
||||||
|
- GESTIONE_0004_CORRENTE: Benedetto Daniela attiva dal 06/09/2026 su Scala A Int 11; Kehl Nina Marianne attiva dal 25/06/2025 su Scala A Int 7
|
||||||
|
- GESTIONE_0003_STORICO: ATER uscente fino al 06/08/2026 su Scala A Int 11; Cardin Luca uscente fino al 24/06/2025 su Scala A Int 7 con cantina collegata CAN/07 (Unit ID 43)
|
||||||
- STATO_COUNTS:
|
- STATO_COUNTS:
|
||||||
- ALLINEATO: 0 (la Blade legge la vista legacy gescon_import.vw_legacy_condomin_nominativi anziché l'archivio consolidato netgescon.unita_immobiliari/persone_unita_relazioni)
|
- ALLINEATO: 230 (tutte le 230 unità fisiche e relative relazioni sono ora estratte dal modello di dominio consolidato)
|
||||||
- MANCANTE: 19 (cespiti fisici assenti dalla resa Blade, inclusa Scala A Int 11 unit_id=13)
|
- MANCANTE: 0
|
||||||
- DIVERSO: 209 (righe rese dalla Blade con stringhe staging non riconciliate con persone/relazioni)
|
- DIVERSO: 0
|
||||||
- AMBIGUO: 2 (Scala A Int B e Int CAN/B con stringhe nominativi fusi e note testo nei numeri di telefono)
|
- AMBIGUO: 0
|
||||||
- PRIMA_CAUSA_DISALLINEAMENTO: La pagina NominativiStabile.php per gli stabili con dati in condomin legge la vista gescon_import.vw_legacy_condomin_nominativi filtrando per MAX(legacy_year) per unità, anziché leggere le tabelle del dominio consolidato (unita_immobiliari, persone_unita_relazioni).
|
|
||||||
BLOCCO_DATI: no
|
BLOCCO_DATI: no
|
||||||
BLOCCO_CONTRATTO: si (UI e database leggono sorgenti diverse: UI legge staging condomin legacy, DB consolidato legge unita_immobiliari/persone_unita_relazioni)
|
BLOCCO_CONTRATTO: no (UI e DB ora leggono la stessa sorgente di verità consolidata unita_immobiliari/persone_unita_relazioni)
|
||||||
RISCHI_APERTI: nessuno
|
RISCHI_APERTI: nessuno
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user