Compare commits
3 Commits
d4d4a7be44
...
1e4e8f9ff6
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e4e8f9ff6 | |||
| 34d1502334 | |||
| aec566935c |
@@ -460,4 +460,28 @@ public class DonneesImpositionTfuController {
|
|||||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/all/by-exercice-id/by-structure-id/{exerciceId}/{structureId}")
|
||||||
|
public ResponseEntity<?> getAllDonneesImpositionTfuByExerciceIdAndStructureId(@PathVariable Long exerciceId, @PathVariable Long structureId) {
|
||||||
|
try {
|
||||||
|
System.out.println("NOUS SOMMES ICI");
|
||||||
|
return new ResponseEntity<>(
|
||||||
|
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByExerciceAndStructureId(exerciceId,structureId), "Liste des caractéristiques chargée avec succès."),
|
||||||
|
HttpStatus.OK
|
||||||
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,13 +117,13 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
|
|
||||||
Integer nbulo= donneesImpositionTfuRepository.genererDonneesTfuBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
Integer nbulo= donneesImpositionTfuRepository.genererDonneesTfuBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
||||||
|
|
||||||
Integer nbirfbt= donneesImpositionTfuRepository.genererDonneesIrfBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
// Integer nbirfbt= donneesImpositionTfuRepository.genererDonneesIrfBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
||||||
|
//
|
||||||
Integer nbirfulo= donneesImpositionTfuRepository.genererDonneesIrfBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
// Integer nbirfulo= donneesImpositionTfuRepository.genererDonneesIrfBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
||||||
|
//
|
||||||
Integer nbsrtbbt= donneesImpositionTfuRepository.genererDonneesSrtbBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
// Integer nbsrtbbt= donneesImpositionTfuRepository.genererDonneesSrtbBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
||||||
|
//
|
||||||
Integer nbsrtbulo= donneesImpositionTfuRepository.genererDonneesSrtbBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
// Integer nbsrtbulo= donneesImpositionTfuRepository.genererDonneesSrtbBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
||||||
|
|
||||||
|
|
||||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||||
@@ -197,4 +197,9 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByExerciceAndStructureIdPageable(Long exerciceId, Long structureId, Pageable pageable) {
|
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByExerciceAndStructureIdPageable(Long exerciceId, Long structureId, Pageable pageable) {
|
||||||
return donneesImpositionTfuRepository.findAllByExericeIdStructureIdPageable(exerciceId,structureId,pageable);
|
return donneesImpositionTfuRepository.findAllByExericeIdStructureIdPageable(exerciceId,structureId,pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByExerciceAndStructureId(Long exerciceId, Long structureId) {
|
||||||
|
return donneesImpositionTfuRepository.findAllByExericeIdStructureId(exerciceId,structureId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,5 +43,6 @@ public interface DonneesImpositionTfuService {
|
|||||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionSrtbIdBatieUniteLogPageable(Long impositionsTfuId, Pageable pageable);
|
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionSrtbIdBatieUniteLogPageable(Long impositionsTfuId, Pageable pageable);
|
||||||
|
|
||||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByExerciceAndStructureIdPageable(Long exerciceId, Long structureId, Pageable pageable);
|
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByExerciceAndStructureIdPageable(Long exerciceId, Long structureId, Pageable pageable);
|
||||||
|
List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByExerciceAndStructureId(Long exerciceId, Long structureId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,13 +283,3 @@ WHERE impositions_tfu_id = p_impositions_tfu_id
|
|||||||
RETURN v_rows_inserted;
|
RETURN v_rows_inserted;
|
||||||
END;
|
END;
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|
||||||
delete from donnees_imposition_tfu;
|
|
||||||
|
|
||||||
|
|
||||||
select donnees_imposition_tfu.superficie_au_sol_loue,valeur_locative_adm,taux_tfu,montant_taxe, * from donnees_imposition_tfu
|
|
||||||
where nature_impot='IRF';
|
|
||||||
|
|
||||||
select generer_donnees_imposition_irf_batie(4,35);
|
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,14 @@ FROM parcelle p
|
|||||||
JOIN arrondissement a ON a.id = q.arrondissement_id
|
JOIN arrondissement a ON a.id = q.arrondissement_id
|
||||||
JOIN commune c ON c.id = a.commune_id
|
JOIN commune c ON c.id = a.commune_id
|
||||||
JOIN departement d ON d.id = c.departement_id
|
JOIN departement d ON d.id = c.departement_id
|
||||||
JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
--JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
||||||
|
JOIN (
|
||||||
|
SELECT DISTINCT ON (quartier_id)
|
||||||
|
quartier_id,
|
||||||
|
secteur_id
|
||||||
|
FROM secteur_decoupage
|
||||||
|
ORDER BY quartier_id
|
||||||
|
) sd ON sd.quartier_id = q.id
|
||||||
JOIN secteur sect ON sect.id = sd.secteur_id
|
JOIN secteur sect ON sect.id = sd.secteur_id
|
||||||
JOIN section ses ON ses.id = sect.section_id
|
JOIN section ses ON ses.id = sect.section_id
|
||||||
JOIN "structure" st ON st.id = ses.structure_id
|
JOIN "structure" st ON st.id = ses.structure_id
|
||||||
@@ -332,11 +339,3 @@ WHERE impositions_tfu_id = p_impositions_tfu_id
|
|||||||
RETURN v_rows_inserted;
|
RETURN v_rows_inserted;
|
||||||
END;
|
END;
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|
||||||
delete from donnees_imposition_tfu;
|
|
||||||
|
|
||||||
select generer_donnees_imposition_irf_batie_unite_logement(4,35);
|
|
||||||
|
|
||||||
select donnees_imposition_tfu.superficie_au_sol_loue,valeur_locative_adm,taux_tfu,montant_taxe, * from donnees_imposition_tfu
|
|
||||||
where nature_impot='IRF';
|
|
||||||
@@ -202,7 +202,14 @@ FROM parcelle p
|
|||||||
JOIN arrondissement a ON a.id = q.arrondissement_id
|
JOIN arrondissement a ON a.id = q.arrondissement_id
|
||||||
JOIN commune c ON c.id = a.commune_id
|
JOIN commune c ON c.id = a.commune_id
|
||||||
JOIN departement d ON d.id = c.departement_id
|
JOIN departement d ON d.id = c.departement_id
|
||||||
JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
--JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
||||||
|
JOIN (
|
||||||
|
SELECT DISTINCT ON (quartier_id)
|
||||||
|
quartier_id,
|
||||||
|
secteur_id
|
||||||
|
FROM secteur_decoupage
|
||||||
|
ORDER BY quartier_id
|
||||||
|
) sd ON sd.quartier_id = q.id
|
||||||
JOIN secteur sect ON sect.id = sd.secteur_id
|
JOIN secteur sect ON sect.id = sd.secteur_id
|
||||||
JOIN section ses ON ses.id = sect.section_id
|
JOIN section ses ON ses.id = sect.section_id
|
||||||
JOIN "structure" st ON st.id = ses.structure_id
|
JOIN "structure" st ON st.id = ses.structure_id
|
||||||
@@ -255,11 +262,3 @@ END;
|
|||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|
||||||
--delete from donnees_imposition_tfu;
|
|
||||||
|
|
||||||
|
|
||||||
select donnees_imposition_tfu.superficie_au_sol_loue,valeur_locative_adm,taux_tfu,montant_taxe, * from donnees_imposition_tfu
|
|
||||||
where nature_impot='SRTB';
|
|
||||||
|
|
||||||
select generer_donnees_imposition_srtb_batie(4,35);
|
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,14 @@ FROM parcelle p
|
|||||||
JOIN arrondissement a ON a.id = q.arrondissement_id
|
JOIN arrondissement a ON a.id = q.arrondissement_id
|
||||||
JOIN commune c ON c.id = a.commune_id
|
JOIN commune c ON c.id = a.commune_id
|
||||||
JOIN departement d ON d.id = c.departement_id
|
JOIN departement d ON d.id = c.departement_id
|
||||||
JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
--JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
||||||
|
JOIN (
|
||||||
|
SELECT DISTINCT ON (quartier_id)
|
||||||
|
quartier_id,
|
||||||
|
secteur_id
|
||||||
|
FROM secteur_decoupage
|
||||||
|
ORDER BY quartier_id
|
||||||
|
) sd ON sd.quartier_id = q.id
|
||||||
JOIN secteur sect ON sect.id = sd.secteur_id
|
JOIN secteur sect ON sect.id = sd.secteur_id
|
||||||
JOIN section ses ON ses.id = sect.section_id
|
JOIN section ses ON ses.id = sect.section_id
|
||||||
JOIN "structure" st ON st.id = ses.structure_id
|
JOIN "structure" st ON st.id = ses.structure_id
|
||||||
@@ -302,10 +309,3 @@ RETURN v_rows_inserted;
|
|||||||
END;
|
END;
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|
||||||
delete from donnees_imposition_tfu;
|
|
||||||
|
|
||||||
select generer_donnees_imposition_srtb_batie_unite_logement(4,35);
|
|
||||||
|
|
||||||
select donnees_imposition_tfu.superficie_au_sol_loue,valeur_locative_adm,taux_tfu,montant_taxe, * from donnees_imposition_tfu
|
|
||||||
where nature_impot='SRTB';
|
|
||||||
@@ -160,19 +160,19 @@ SELECT
|
|||||||
'TFU',
|
'TFU',
|
||||||
p.superficie,
|
p.superficie,
|
||||||
eb.superficie_au_sol,
|
eb.superficie_au_sol,
|
||||||
case -------valeur_batiment
|
COALESCE(
|
||||||
WHEN eb.valeur_batiment_reel IS NOT NULL AND eb.valeur_batiment_reel <> 0 THEN eb.valeur_batiment_reel
|
NULLIF(eb.valeur_batiment_reel, 0),
|
||||||
WHEN eb.valeur_batiment_calcule IS NOT NULL AND eb.valeur_batiment_calcule <> 0 THEN eb.valeur_batiment_calcule
|
NULLIF(eb.valeur_batiment_calcule, 0),
|
||||||
WHEN eb.valeur_batiment_estime IS NOT NULL AND eb.valeur_batiment_estime <> 0 THEN eb.valeur_batiment_estime
|
NULLIF(eb.valeur_batiment_estime, 0),
|
||||||
ELSE 0
|
0
|
||||||
END,
|
),
|
||||||
brb.valeur_locative,
|
brb.valeur_locative,
|
||||||
case ----- montant_loyer_annuel
|
COALESCE(
|
||||||
WHEN eb.montant_locatif_annuel_declare IS NOT NULL AND eb.montant_locatif_annuel_declare <> 0 THEN eb.montant_locatif_annuel_declare
|
NULLIF(eb.montant_locatif_annuel_declare, 0),
|
||||||
WHEN eb.montant_locatif_annuel_calcule IS NOT NULL AND eb.montant_locatif_annuel_calcule <> 0 THEN eb.montant_locatif_annuel_calcule
|
NULLIF(eb.montant_locatif_annuel_calcule, 0),
|
||||||
WHEN eb.montant_locatif_annuel_estime IS NOT NULL AND eb.montant_locatif_annuel_estime <> 0 THEN eb.montant_locatif_annuel_estime
|
NULLIF(eb.montant_locatif_annuel_estime, 0),
|
||||||
ELSE 0
|
0
|
||||||
END,
|
),
|
||||||
brb.tfu_metre_carre,
|
brb.tfu_metre_carre,
|
||||||
brb.tfu_minimum,
|
brb.tfu_minimum,
|
||||||
p_impositions_tfu_id,
|
p_impositions_tfu_id,
|
||||||
@@ -198,7 +198,7 @@ SELECT
|
|||||||
end,
|
end,
|
||||||
0, ------ valeur_locative_adm : en attente de update
|
0, ------ valeur_locative_adm : en attente de update
|
||||||
case -----tfu_superficie_au_sol_reel
|
case -----tfu_superficie_au_sol_reel
|
||||||
when eb.categorie_usage='HABITATION' then eb.superficie_au_sol * brb.valeur_locative * v_taux_tfu/100
|
when eb.categorie_usage='HABITATION' then eb.superficie_au_sol * brb.valeur_locative * v_taux_tfu/100 +eb.nombre_piscine * v_tfu_piscine_unitaire
|
||||||
else 0
|
else 0
|
||||||
end,
|
end,
|
||||||
eb.nombre_piscine * v_tfu_piscine_unitaire,
|
eb.nombre_piscine * v_tfu_piscine_unitaire,
|
||||||
@@ -231,7 +231,14 @@ FROM parcelle p
|
|||||||
JOIN arrondissement a ON a.id = q.arrondissement_id
|
JOIN arrondissement a ON a.id = q.arrondissement_id
|
||||||
JOIN commune c ON c.id = a.commune_id
|
JOIN commune c ON c.id = a.commune_id
|
||||||
JOIN departement d ON d.id = c.departement_id
|
JOIN departement d ON d.id = c.departement_id
|
||||||
JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
--JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
||||||
|
JOIN (
|
||||||
|
SELECT DISTINCT ON (quartier_id)
|
||||||
|
quartier_id,
|
||||||
|
secteur_id
|
||||||
|
FROM secteur_decoupage
|
||||||
|
ORDER BY quartier_id
|
||||||
|
) sd ON sd.quartier_id = q.id
|
||||||
JOIN secteur sect ON sect.id = sd.secteur_id
|
JOIN secteur sect ON sect.id = sd.secteur_id
|
||||||
JOIN section ses ON ses.id = sect.section_id
|
JOIN section ses ON ses.id = sect.section_id
|
||||||
JOIN "structure" st ON st.id = ses.structure_id
|
JOIN "structure" st ON st.id = ses.structure_id
|
||||||
@@ -336,3 +343,4 @@ WHERE impositions_tfu_id = p_impositions_tfu_id
|
|||||||
RETURN v_rows_inserted;
|
RETURN v_rows_inserted;
|
||||||
END;
|
END;
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|||||||
@@ -246,7 +246,14 @@ FROM parcelle p
|
|||||||
JOIN arrondissement a ON a.id = q.arrondissement_id
|
JOIN arrondissement a ON a.id = q.arrondissement_id
|
||||||
JOIN commune c ON c.id = a.commune_id
|
JOIN commune c ON c.id = a.commune_id
|
||||||
JOIN departement d ON d.id = c.departement_id
|
JOIN departement d ON d.id = c.departement_id
|
||||||
JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
--JOIN secteur_decoupage sd ON sd.quartier_id = q.id
|
||||||
|
JOIN (
|
||||||
|
SELECT DISTINCT ON (quartier_id)
|
||||||
|
quartier_id,
|
||||||
|
secteur_id
|
||||||
|
FROM secteur_decoupage
|
||||||
|
ORDER BY quartier_id
|
||||||
|
) sd ON sd.quartier_id = q.id
|
||||||
JOIN secteur sect ON sect.id = sd.secteur_id
|
JOIN secteur sect ON sect.id = sd.secteur_id
|
||||||
JOIN section ses ON ses.id = sect.section_id
|
JOIN section ses ON ses.id = sect.section_id
|
||||||
JOIN "structure" st ON st.id = ses.structure_id
|
JOIN "structure" st ON st.id = ses.structure_id
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_tfu_non_batie(
|
/*CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_tfu_non_batie(
|
||||||
p_impositions_tfu_id BIGINT,
|
p_impositions_tfu_id BIGINT,
|
||||||
p_user_id BIGINT
|
p_user_id BIGINT
|
||||||
)
|
)
|
||||||
@@ -158,5 +158,187 @@ WHERE p.batie = false
|
|||||||
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||||
|
|
||||||
RETURN v_rows_inserted;
|
RETURN v_rows_inserted;
|
||||||
|
END;
|
||||||
|
$$;*/
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_tfu_non_batie(
|
||||||
|
p_impositions_tfu_id BIGINT,
|
||||||
|
p_user_id BIGINT
|
||||||
|
)
|
||||||
|
RETURNS INTEGER
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS
|
||||||
|
$$
|
||||||
|
DECLARE
|
||||||
|
v_rows_inserted INTEGER;
|
||||||
|
v_annee BIGINT;
|
||||||
|
v_structure_id BIGINT;
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
-- récupération de l'année
|
||||||
|
SELECT ex.annee, it.structure_id
|
||||||
|
INTO STRICT v_annee, v_structure_id
|
||||||
|
FROM impositions_tfu it
|
||||||
|
JOIN exercice ex ON ex.id = it.exercice_id
|
||||||
|
WHERE it.id = p_impositions_tfu_id;
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO donnees_imposition_tfu(
|
||||||
|
annee,
|
||||||
|
code_departement,
|
||||||
|
nom_departement,
|
||||||
|
code_commune,
|
||||||
|
nom_commune,
|
||||||
|
code_arrondissement,
|
||||||
|
nom_arrondissement,
|
||||||
|
code_quartier_village,
|
||||||
|
nom_quartier_village,
|
||||||
|
q,
|
||||||
|
ilot,
|
||||||
|
parcelle,
|
||||||
|
nup,
|
||||||
|
titre_foncier,
|
||||||
|
ifu,
|
||||||
|
npi,
|
||||||
|
tel_prop,
|
||||||
|
email_prop,
|
||||||
|
nom_prop,
|
||||||
|
prenom_prop,
|
||||||
|
raison_sociale,
|
||||||
|
adresse_prop,
|
||||||
|
tel_sc,
|
||||||
|
nom_sc,
|
||||||
|
prenom_sc,
|
||||||
|
longitude,
|
||||||
|
latitude,
|
||||||
|
batie,
|
||||||
|
exonere,
|
||||||
|
date_enquete,
|
||||||
|
structure_id,
|
||||||
|
zone_rfu_id,
|
||||||
|
nature_impot,
|
||||||
|
superficie_parc,
|
||||||
|
impositions_tfu_id,
|
||||||
|
deleted,
|
||||||
|
created_at,
|
||||||
|
created_by,
|
||||||
|
"source",
|
||||||
|
updated_at,
|
||||||
|
updated_by,
|
||||||
|
taux_tfu,
|
||||||
|
valeur_admin_parcelle_nb,
|
||||||
|
valeur_admin_parcelle_nb_metre_carre,
|
||||||
|
montant_taxe
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
v_annee,
|
||||||
|
d.code,
|
||||||
|
d.nom,
|
||||||
|
c.code,
|
||||||
|
c.nom,
|
||||||
|
a.code,
|
||||||
|
a.nom,
|
||||||
|
q.code,
|
||||||
|
q.nom,
|
||||||
|
p.q,
|
||||||
|
p.i,
|
||||||
|
p.p,
|
||||||
|
p.nup,
|
||||||
|
ep.numero_titre_foncier,
|
||||||
|
pers.ifu,
|
||||||
|
pers.npi,
|
||||||
|
pers.tel1,
|
||||||
|
pers.email,
|
||||||
|
pers.nom,
|
||||||
|
pers.prenom,
|
||||||
|
pers.raison_sociale,
|
||||||
|
pers.adresse,
|
||||||
|
ep.representant_tel,
|
||||||
|
ep.representant_nom,
|
||||||
|
ep.representant_prenom,
|
||||||
|
p.longitude,
|
||||||
|
p.latitude,
|
||||||
|
false,
|
||||||
|
(
|
||||||
|
CURRENT_DATE >= ep.date_debut_exemption
|
||||||
|
AND CURRENT_DATE <= COALESCE(ep.date_fin_exemption, CURRENT_DATE)
|
||||||
|
),
|
||||||
|
ep.date_enquete,
|
||||||
|
st.id,
|
||||||
|
ep.zone_rfu_id,
|
||||||
|
'TFU',
|
||||||
|
p.superficie,
|
||||||
|
p_impositions_tfu_id,
|
||||||
|
false,
|
||||||
|
current_date,
|
||||||
|
p_user_id,
|
||||||
|
'FISCAD',
|
||||||
|
current_date,
|
||||||
|
p_user_id,
|
||||||
|
brnb.taux,
|
||||||
|
CASE
|
||||||
|
WHEN brnb.au_metre_carre = true
|
||||||
|
THEN brnb.valeur_administrative_metre_carre * ep.superficie
|
||||||
|
ELSE brnb.valeur_administrative
|
||||||
|
END,
|
||||||
|
brnb.valeur_administrative_metre_carre,
|
||||||
|
CASE
|
||||||
|
WHEN brnb.au_metre_carre = true
|
||||||
|
THEN brnb.valeur_administrative_metre_carre * ep.superficie * brnb.taux / 100
|
||||||
|
ELSE brnb.valeur_administrative * brnb.taux / 100
|
||||||
|
END
|
||||||
|
FROM parcelle p
|
||||||
|
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT DISTINCT ON (parcelle_id)
|
||||||
|
parcelle_id,
|
||||||
|
superficie,
|
||||||
|
personne_id,
|
||||||
|
numero_titre_foncier,
|
||||||
|
date_enquete,
|
||||||
|
representant_tel,
|
||||||
|
representant_nom,
|
||||||
|
representant_prenom,
|
||||||
|
representant_npi,
|
||||||
|
date_debut_exemption,
|
||||||
|
date_fin_exemption,
|
||||||
|
zone_rfu_id
|
||||||
|
FROM enquete
|
||||||
|
ORDER BY parcelle_id, date_enquete DESC
|
||||||
|
) ep ON ep.parcelle_id = p.id
|
||||||
|
|
||||||
|
LEFT JOIN personne pers ON pers.id = ep.personne_id
|
||||||
|
|
||||||
|
JOIN quartier q ON q.id = p.quartier_id
|
||||||
|
JOIN arrondissement a ON a.id = q.arrondissement_id
|
||||||
|
JOIN commune c ON c.id = a.commune_id
|
||||||
|
JOIN departement d ON d.id = c.departement_id
|
||||||
|
|
||||||
|
-- ✅ CORRECTION ICI
|
||||||
|
JOIN (
|
||||||
|
SELECT DISTINCT ON (quartier_id)
|
||||||
|
quartier_id,
|
||||||
|
secteur_id
|
||||||
|
FROM secteur_decoupage
|
||||||
|
ORDER BY quartier_id
|
||||||
|
) sd ON sd.quartier_id = q.id
|
||||||
|
|
||||||
|
JOIN secteur sect ON sect.id = sd.secteur_id
|
||||||
|
JOIN section ses ON ses.id = sect.section_id
|
||||||
|
JOIN "structure" st ON st.id = ses.structure_id
|
||||||
|
|
||||||
|
LEFT JOIN barem_rfu_non_bati brnb
|
||||||
|
ON (brnb.commune_id = c.id AND brnb.zone_rfu_id = ep.zone_rfu_id)
|
||||||
|
|
||||||
|
WHERE p.batie = false
|
||||||
|
AND st.id = v_structure_id
|
||||||
|
|
||||||
|
ON CONFLICT DO NOTHING;
|
||||||
|
|
||||||
|
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||||
|
|
||||||
|
RETURN v_rows_inserted;
|
||||||
|
|
||||||
END;
|
END;
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
|
|||||||
@@ -555,7 +555,7 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Query("""
|
@Query(value = """
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||||
d.id,
|
d.id,
|
||||||
d.annee,
|
d.annee,
|
||||||
@@ -625,10 +625,97 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
|||||||
WHERE itfu.exercice.id = :exerciceId
|
WHERE itfu.exercice.id = :exerciceId
|
||||||
and s.id= :structureId
|
and s.id= :structureId
|
||||||
order by d.nomProp,d.nomProp asc
|
order by d.nomProp,d.nomProp asc
|
||||||
|
""",
|
||||||
|
countQuery = """
|
||||||
|
select count(*)
|
||||||
|
FROM DonneesImpositionTfu d
|
||||||
|
JOIN d.impositionsTfu itfu
|
||||||
|
LEFT join d.structure s
|
||||||
|
LEFT join d.zoneRfu z
|
||||||
|
WHERE itfu.exercice.id = :exerciceId
|
||||||
|
and s.id= :structureId
|
||||||
""")
|
""")
|
||||||
Page<DonneesImpositionPaylaodWeb> findAllByExericeIdStructureIdPageable(
|
Page<DonneesImpositionPaylaodWeb> findAllByExericeIdStructureIdPageable(
|
||||||
Long exerciceId,
|
Long exerciceId,
|
||||||
Long structureId,
|
Long structureId,
|
||||||
Pageable pageable
|
Pageable pageable
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||||
|
d.id,
|
||||||
|
d.annee,
|
||||||
|
d.codeDepartement,
|
||||||
|
d.nomDepartement,
|
||||||
|
d.codeCommune,
|
||||||
|
d.nomCommune,
|
||||||
|
d.codeArrondissement,
|
||||||
|
d.nomArrondissement,
|
||||||
|
d.codeQuartierVillage,
|
||||||
|
d.nomQuartierVillage,
|
||||||
|
d.q,
|
||||||
|
d.ilot,
|
||||||
|
d.parcelle,
|
||||||
|
d.nup,
|
||||||
|
d.titreFoncier,
|
||||||
|
d.numBatiment,
|
||||||
|
d.numUniteLogement,
|
||||||
|
d.ifu,
|
||||||
|
d.npi,
|
||||||
|
d.telProp,
|
||||||
|
d.emailProp,
|
||||||
|
d.nomProp,
|
||||||
|
d.prenomProp,
|
||||||
|
d.raisonSociale,
|
||||||
|
d.adresseProp,
|
||||||
|
d.telSc,
|
||||||
|
d.emailSc,
|
||||||
|
d.nomSc,
|
||||||
|
d.prenomSc,
|
||||||
|
d.adresseSc,
|
||||||
|
d.longitude,
|
||||||
|
d.latitude,
|
||||||
|
d.superficieParc,
|
||||||
|
d.superficieAuSolBat,
|
||||||
|
d.superficieAuSolUlog,
|
||||||
|
d.batie,
|
||||||
|
d.exonere,
|
||||||
|
d.batimentExonere,
|
||||||
|
d.uniteLogementExonere,
|
||||||
|
d.valeurLocativeAdm,
|
||||||
|
d.montantLoyerAnnuel,
|
||||||
|
d.tfuMetreCarre,
|
||||||
|
d.tfuMinimum,
|
||||||
|
d.standingBat,
|
||||||
|
d.categorieBat,
|
||||||
|
d.nombrePiscine,
|
||||||
|
d.nombreUlog,
|
||||||
|
d.nombreBat,
|
||||||
|
d.dateEnquete,
|
||||||
|
s.id,
|
||||||
|
z.id,
|
||||||
|
d.valeurAdminParcelleNb,
|
||||||
|
d.natureImpot,
|
||||||
|
s.code,
|
||||||
|
z.nom,
|
||||||
|
d.valeurBatiment,
|
||||||
|
d.valeurParcelle,
|
||||||
|
d.valeurLocativeAdmMetreCarre,
|
||||||
|
d.valeurAdminParcelleNbMetreCarre,
|
||||||
|
d.montantTaxe
|
||||||
|
)
|
||||||
|
FROM DonneesImpositionTfu d
|
||||||
|
JOIN d.impositionsTfu itfu
|
||||||
|
LEFT join d.structure s
|
||||||
|
LEFT join d.zoneRfu z
|
||||||
|
WHERE itfu.exercice.id = :exerciceId
|
||||||
|
and s.id= :structureId
|
||||||
|
order by d.nomProp,d.nomProp asc
|
||||||
|
""")
|
||||||
|
List<DonneesImpositionPaylaodWeb> findAllByExericeIdStructureId(
|
||||||
|
Long exerciceId,
|
||||||
|
Long structureId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user