Compare commits
230 Commits
51845b085a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a192520b30 | |||
| ada442ffa4 | |||
| 77671bfb90 | |||
| 4cd6e7cbae | |||
| 5d519855a7 | |||
| 44827030be | |||
| 6c0fa1ca27 | |||
| 8bcae0751a | |||
| 14ca79d49e | |||
| 1e4e8f9ff6 | |||
| 34d1502334 | |||
| aec566935c | |||
| d4d4a7be44 | |||
| e2468328fd | |||
| d06d6336de | |||
| 5ea1c93d2b | |||
| 41e55da1df | |||
| 16dd68c72c | |||
| 705af14b4e | |||
| bfe7b319c2 | |||
| e325b12546 | |||
| 9063162c33 | |||
| 4997fd32c1 | |||
| 47bcda41fd | |||
| 3f9cdcdad3 | |||
| d85b622acf | |||
| 3438da3880 | |||
| e58e338123 | |||
| db8b38b1c0 | |||
| afc44b95fb | |||
| ebb91f8318 | |||
| 253332bbd3 | |||
| faf2ccdb8f | |||
| 767756acfc | |||
| 6dcd549889 | |||
| 04ca166db4 | |||
| 6ba1365148 | |||
| 84ede82428 | |||
| 0d27aaebac | |||
| 0d5f7bba1c | |||
| 5beddc7c1b | |||
| afbf525af5 | |||
| 81bd7d9034 | |||
| a6f7f3d465 | |||
| 8ee2f7c9b0 | |||
| cec02e24ae | |||
| 43b060371a | |||
| 6bdfa3ad1e | |||
| dae64dc079 | |||
| 71f0aa6cd0 | |||
| b8ba15c6fb | |||
| 9de2564108 | |||
| 87f8ad7a61 | |||
| 698b7e7c99 | |||
| b3e3e7109f | |||
| 6a29a3f43c | |||
| 9e597386f8 | |||
| b22b6c8288 | |||
| 3e871a31e6 | |||
| cb2faeea32 | |||
| d326e227c4 | |||
| 9c62c99305 | |||
| 6b3ab8fc43 | |||
| 85be8a2e24 | |||
| 8fb0088010 | |||
| 906a74571f | |||
| fcc81e0607 | |||
| 862b917689 | |||
| 1e810f0ddb | |||
| 6494fe235e | |||
| 9b4edcdcea | |||
| a54adcdcb8 | |||
| 28da361054 | |||
| db1fd2c821 | |||
| ee07fec0ac | |||
| 6b63ae2f52 | |||
| 3993d28d51 | |||
| a5cabc8102 | |||
| 443b563d69 | |||
| a799764d16 | |||
| 6851270bd5 | |||
| 09d8b21909 | |||
| eba53a42aa | |||
| 274b47d116 | |||
| bd8bd64a2d | |||
| bdb08b88fd | |||
| 5dcb2adf30 | |||
| 739cc89872 | |||
| b86c685cd0 | |||
| d1c3cb190d | |||
| dffd6a54a3 | |||
| d46a14626e | |||
| 4897712e08 | |||
| 920c70c877 | |||
| dc28d88763 | |||
| 267c09c064 | |||
| 2ab5b9299c | |||
| 35393954c3 | |||
| be4524ed67 | |||
| bf19ab6e6a | |||
| 06ea9474f1 | |||
| 84451d5a15 | |||
| c0267fca5e | |||
| e687a9a904 | |||
| 55b97936ab | |||
| 9685c73513 | |||
| adcd51e32b | |||
| 650470efff | |||
| 666519df84 | |||
| 9f5cc61726 | |||
| beb41af562 | |||
| 41175d93f0 | |||
| 57dfdaf64f | |||
| 1ecaecdee3 | |||
| f7e3c118e2 | |||
| 122dfcbead | |||
| 2b4adc0db2 | |||
| d168b68d4b | |||
| a0baf985d4 | |||
| 2af14dd4cd | |||
| 85e9a41fe2 | |||
| 76f0d34e79 | |||
| 3102dbc053 | |||
| 666779ecce | |||
| a21be6aef3 | |||
| 7fcd676fc0 | |||
| 4d708ff4ca | |||
| fffdef7103 | |||
| ea1f92c7e2 | |||
| 95c0dacd1e | |||
| 9e5e8551f0 | |||
| 7ac6b953d3 | |||
| b8b28a673b | |||
| e010100472 | |||
| 70c8c26367 | |||
| 177a9c7b56 | |||
| e1459d85ea | |||
| 3054930a86 | |||
| f927db064a | |||
| 4397abd041 | |||
| 0589883f8e | |||
| a4b403ca20 | |||
| d73e64dbac | |||
| ff7b88f9f8 | |||
| cf7c3aaeb2 | |||
| 37fdba1d85 | |||
| cd4fcb7aa0 | |||
| f50ed9aa5f | |||
| 1e0cfead5b | |||
| 966fd2ca7a | |||
| 0837d0ce08 | |||
| a10253b2e8 | |||
| b58316bb88 | |||
| 08b68f9e08 | |||
| 209d1cd777 | |||
| be487d6a03 | |||
| 1eb3aeeda0 | |||
| 3be64e7f44 | |||
| 03a661cdc0 | |||
| b3c288628c | |||
| a68ec444cc | |||
| d45e01ac85 | |||
| 58f517bf31 | |||
| 9bb0cc5c75 | |||
| 7f18f22efb | |||
| 3a68fd2ce4 | |||
| af3218412f | |||
| fa7421c35b | |||
| f35670c72e | |||
| 5cb9497163 | |||
| a77c0e854d | |||
| 15cac660bc | |||
| e75eff4e20 | |||
| 0feec2982f | |||
| 40d078c653 | |||
| b5ab0772a0 | |||
| 31dd11d017 | |||
| f293f65650 | |||
| 6dfd12fae8 | |||
| cfd1104c28 | |||
| a4ad0a4556 | |||
| 7d64390bae | |||
| 411a6c0c2d | |||
| 4876d8ab14 | |||
| bed73b2b16 | |||
| 2bfb298054 | |||
| 5a0814a0ba | |||
| 54ef33d1ab | |||
| 126254ea94 | |||
| 3fd779854f | |||
| f9e4681af4 | |||
| de2928414b | |||
| 84089d3639 | |||
| 9d6d278d78 | |||
| 02b0a937b4 | |||
| c8b0457195 | |||
| c0096457fb | |||
| b6062ba4d1 | |||
| 8dc8c974d3 | |||
| 9cc74a9a38 | |||
| 957416df9e | |||
| 8e6168d4ee | |||
| 8d8af75108 | |||
| c1a8ce86a6 | |||
| 555f13508e | |||
| 14feb49dcd | |||
| d92a2b2503 | |||
| 39de1c48c0 | |||
| 5ccfdb6a3f | |||
| f9e2b32118 | |||
| 87b3bfbe83 | |||
| 3ebb1cf165 | |||
| 62f25ea726 | |||
| c84176b8d3 | |||
| 6125fcbd0b | |||
| 61f4dd513f | |||
| 211af6103a | |||
| 5e9f437497 | |||
| d27b622db8 | |||
| 69af57f876 | |||
| c80b40082c | |||
| 56f78e77f3 | |||
| 4a88af6487 | |||
| 0c7dc082fd | |||
| 966b0af1c2 | |||
| 3f5d7e980c | |||
| 58aa088ac3 | |||
| 87be4e4483 | |||
| 033b430051 | |||
| b8dbc7f625 |
@@ -52,8 +52,10 @@ jobs:
|
||||
echo "JAVA_HOME=$JAVA_HOME" >> "$GITHUB_ENV"
|
||||
|
||||
# 4) Checkout du dépôt
|
||||
#- name: Checkout repository
|
||||
# uses: https://gitea.com/actions/checkout@v4 #actions/checkout@v4
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
run: git clone ${{ gitea.server_url }}/${{ gitea.repository }} .
|
||||
|
||||
# 5) Informations de contexte (sans secrets)
|
||||
- name: Show context information
|
||||
|
||||
@@ -52,8 +52,10 @@ jobs:
|
||||
echo "JAVA_HOME=$JAVA_HOME" >> "$GITHUB_ENV"
|
||||
|
||||
# 4) Checkout du dépôt
|
||||
#- name: Checkout repository
|
||||
# uses: https://gitea.com/actions/checkout@v4 #actions/checkout@v4
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
run: git clone ${{ gitea.server_url }}/${{ gitea.repository }} .
|
||||
|
||||
# 5) Création des secrets runtime (CI uniquement)
|
||||
- name: Create runtime secrets
|
||||
|
||||
@@ -315,5 +315,31 @@ public class SecteurController {
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "recuperer tous les secteurs d'un departement",
|
||||
description = "Permet de récuperer l'ensemble des secteurs du departement dont l'ID est fourni en path"
|
||||
)
|
||||
@GetMapping("/by-departement-id/{departementId}")
|
||||
public ResponseEntity<?> getSecteurByDepartementId(@PathVariable Long departementId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurService.getListSecteurByDepartementId(departementId), "Secteur trouvé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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.gmss.fiscad.controllers.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
@@ -248,4 +249,221 @@ public class SecteurDecoupageController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-en-cours/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteEncoursByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteDecoupageByUserId(userId, StatutEnquete.EN_COURS.toString()), "SecteurDecoupage trouvé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) {
|
||||
e.printStackTrace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-valide/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteValideByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteDecoupageByUserId(userId, StatutEnquete.VALIDE.toString()), "SecteurDecoupage trouvé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) {
|
||||
e.printStackTrace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-cloture/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteClotureByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteDecoupageByUserId(userId, StatutEnquete.CLOTURE.toString()), "SecteurDecoupage trouvé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) {
|
||||
e.printStackTrace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-batiment-en-cours/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteBatimentEncoursByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteBatimentDecoupageByUserId(userId, StatutEnquete.EN_COURS.toString()), "SecteurDecoupage trouvé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) {
|
||||
e.printStackTrace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-batiment-valide/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteBatimentValideByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteBatimentDecoupageByUserId(userId, StatutEnquete.VALIDE.toString()), "SecteurDecoupage trouvé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) {
|
||||
e.printStackTrace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-batiment-cloture/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteBatimentClotureByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteBatimentDecoupageByUserId(userId, StatutEnquete.CLOTURE.toString()), "SecteurDecoupage trouvé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) {
|
||||
e.printStackTrace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-unitlog-en-cours/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteUniteLogEncoursByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteUniteLogementDecoupageByUserId(userId, StatutEnquete.EN_COURS.toString()), "SecteurDecoupage trouvé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) {
|
||||
e.printStackTrace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-unitlog-valide/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteUniteLogValideByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteUniteLogementDecoupageByUserId(userId, StatutEnquete.VALIDE.toString()), "SecteurDecoupage trouvé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) {
|
||||
e.printStackTrace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-unitlog-cloture/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteUniteLigClotureByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteUniteLogementDecoupageByUserId(userId, StatutEnquete.CLOTURE.toString()), "SecteurDecoupage trouvé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) {
|
||||
e.printStackTrace();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package io.gmss.fiscad.controllers.infocad.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
@@ -10,6 +12,8 @@ import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.synchronisation.EnquetePayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -64,7 +68,8 @@ public class EnqueteController {
|
||||
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());
|
||||
e.printStackTrace();
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -119,6 +124,7 @@ public class EnqueteController {
|
||||
@PutMapping("/rejet")
|
||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
@@ -480,5 +486,65 @@ public class EnqueteController {
|
||||
|
||||
|
||||
|
||||
@GetMapping("/all-paged/en-cours/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllEnqueteEncoursByQuartierPaged(@CurrentUser UserPrincipal currentUser,@PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteListByQuartierByStatutPageableToDto(userId,quartierId, StatutEnquete.EN_COURS, pageable), "Liste des enquetes en cours 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/cloture/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllEnqueteClotureByQuartierPaged(@CurrentUser UserPrincipal currentUser,@PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteListByQuartierByStatutPageableToDto(userId,quartierId, StatutEnquete.CLOTURE, pageable), "Liste des enquetes en cours 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ParcelleController {
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleService.getParcelleByIdToDto(userId,id), "enquete trouvé avec succès."),
|
||||
new ApiResponse<>(true, parcelleService.getParcelleByIdToDto(userId,id), "parcelle trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -388,6 +388,33 @@ public class ParcelleController {
|
||||
|
||||
|
||||
|
||||
@PutMapping("/syncrhonise-etat-batie-parcelle")
|
||||
public ResponseEntity<?> putSynchroniseEtatBatieParcelle() {
|
||||
try {
|
||||
Integer nombreParcelleSync= parcelleService.majParcelleBatieNonbatie();
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,nombreParcelleSync , "Parcelle mise à jour avec succes."),
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "ParcelleGeometrie")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')")
|
||||
//@PreAuthorize("hasRole('ADMIN') or hasRole('SUPERVISEUR') or hasRole('ENQUETEUR')")
|
||||
public class ParcelleGeomController {
|
||||
|
||||
private final ParcelleGeomService parcelleGeomService;
|
||||
@@ -63,6 +63,24 @@ public class ParcelleGeomController {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getParcellesGeomsByQuartierId(@PathVariable Long quartierId) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleGeomService.getParcelleGeomListByQuatierId(quartierId), "Liste des parcelle chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/page/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getParcellesGeomsByQuartierIdPaged(@PathVariable Long quartierId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleGeomService.getParcelleGeomListByQuatierIdPaged(quartierId,pageable), "Liste des parcelle chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/by-arrondissement/{codeArrondissement}")
|
||||
public ResponseEntity<?> getParcellesGeomsByArrondissement(@PathVariable String codeArrondissement) {
|
||||
return new ResponseEntity<>(
|
||||
|
||||
@@ -223,4 +223,52 @@ public class BatimentController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllBatimentByQuartierPaged(@PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, batimentService.getBatimentListByquartierPageable(quartierId,pageable), "Liste des batiments 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllBatimentByQuartier(@PathVariable Long quartierId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, batimentService.getBatimentListByquartier(quartierId), "Liste des batiments 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,10 @@ import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.ImpositionsTfuRepository;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -117,7 +120,7 @@ public class DonneesImpositionTfuController {
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesImpositionTfuList(), "Liste des caractéristiques chargée avec succès."),
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesImpositionTfuList(), "Liste des impositions chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -141,7 +144,105 @@ public class DonneesImpositionTfuController {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesImpositionTfuList(pageable), "Liste des caractéristiques chargée avec succès."),
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesImpositionTfuList(pageable), "Liste des impositions 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-page/by-imposition-id/{impositionId}")
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuByImpositionIdPaged(@PathVariable Long impositionId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByImpositionTfuIdPageable(impositionId, pageable), "Liste des impositions 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);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-page/by-imposition-id/non-batie/{impositionId}")
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuByImpositionIdNonBatiePaged(@PathVariable Long impositionId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByImpositionTfuIdNonBatiePageable(impositionId, pageable), "Liste des impositions 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-page/by-imposition-id/batie-batiment/{impositionId}")
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuByImpositionIdBatieBatimentPaged(@PathVariable Long impositionId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByImpositionTfuIdBatieBatimentPageable(impositionId, pageable), "Liste des impositions 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);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-page/by-imposition-id/batie-unite-logement/{impositionId}")
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuByImpositionIdBatieUniteLogPaged(@PathVariable Long impositionId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByImpositionTfuIdBatieUniteLogPageable(impositionId, pageable), "Liste des impositions chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -182,31 +283,91 @@ public class DonneesImpositionTfuController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@Operation(summary = "Générer les données fiscales TFU")
|
||||
@PostMapping("/generer")
|
||||
public ResponseEntity<?> genererDonneesFiscale(@RequestBody ImpositionsTfu impositionsTfu) {
|
||||
@Operation(summary = "Générer les données fiscales TFU des parcelle baties")
|
||||
@PostMapping("/generer-batie")
|
||||
public ResponseEntity<?> genererDonneesFiscaleBatie(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) {
|
||||
try {
|
||||
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfu.getId());
|
||||
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfuPaylaodWeb.getId());
|
||||
|
||||
if(optionalImpositionsTfu.isEmpty()){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "L'imposition tfu n'est pas trouvée."),
|
||||
new ApiResponse<>(false, null, "L'instance d'imposition n'est pas trouvée."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
if(!optionalImpositionsTfu.get().getStatusAvis().equals(StatusAvis.CREE)){
|
||||
if(!optionalImpositionsTfu.get().getStatusAvis().equals(StatusAvis.TFU_FNB_GENERE)){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "le statut actuel ne permet pas cette opération."),
|
||||
new ApiResponse<>(false, null, "l'état actuel : "+optionalImpositionsTfu.get().getStatusAvis()+" ne permet pas cette opération."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
optionalImpositionsTfu.get().setStatusAvis(StatusAvis.GENERE);
|
||||
if(userPrincipal==null){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Vous n'êtes pas autorisé à accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleBatie(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId());
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.genererDonneesFiscales(optionalImpositionsTfu.get()), "DonneesImpositionTfu trouvée avec succès."),
|
||||
new ApiResponse<>(true,impositionsTfuPaylaodWeb, "Données d'imposition des fonciers batis Générées 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "Générer les données fiscales TFU des parcelle baties")
|
||||
@PostMapping("/generer-non-batie")
|
||||
public ResponseEntity<?> genererDonneesImpositionNonBaties(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) {
|
||||
try {
|
||||
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfuPaylaodWeb.getId());
|
||||
|
||||
if(optionalImpositionsTfu.isEmpty()){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "L'instance d'imposition n'est pas trouvée."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
if(!optionalImpositionsTfu.get().getStatusAvis().equals(StatusAvis.GENERATION_AUTORISE)){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "l'état actuel : "+optionalImpositionsTfu.get().getStatusAvis()+" ne permet pas cette opération."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
if(userPrincipal==null){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Vous n'êtes pas autorisé à accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleNonBatie(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId());
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,impositionsTfuPaylaodWeb, "Données d'imposition pour les fonciers non batis Générées 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);
|
||||
@@ -273,4 +434,79 @@ public class DonneesImpositionTfuController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-page/by-exercice-id/by-structure-id/{exerciceId}/{structureId}")
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuByExerciceIdAndStructureIdPaged(@PathVariable Long exerciceId, @PathVariable Long structureId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
System.out.println("NOUS SOMMES ICI");
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByExerciceAndStructureIdPageable(exerciceId,structureId, pageable), "Liste des impositions 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);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all/by-exercice-id/by-structure-id/by-quartier-id/{exerciceId}/{structureId}/{quartierId}")
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuByExerciceIdAndStructureId(@PathVariable Long exerciceId, @PathVariable Long structureId, @PathVariable Long quartierId) {
|
||||
try {
|
||||
System.out.println("NOUS SOMMES ICI");
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByExerciceAndStructureId(exerciceId,structureId,quartierId), "Liste des imposition 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/all/by-personne-id/{personneId}")
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuByPersonneId(@PathVariable Long personneId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByPersonneId(personneId), "Liste des impositions 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteBatimentService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -20,6 +24,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/enquete-batiment", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@@ -51,6 +57,7 @@ public class EnqueteBatimentController {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
@@ -223,4 +230,159 @@ public class EnqueteBatimentController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/en-cours/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllEnqueteBatimentEnCoursByQuartierPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentListByQuartierByStatutPageableToDto(userId,quartierId, StatutEnquete.EN_COURS, pageable), "Liste des enquetes en cours 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);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged/cloture/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllEnqueteBatimentClotureByQuartierPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentListByQuartierByStatutPageableToDto(userId,quartierId, StatutEnquete.CLOTURE, pageable), "Liste des enquetes en cours 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/validation")
|
||||
public ResponseEntity<?> validerEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.validerEnquete(enqueteTraitementPayLoad), "Validation effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet")
|
||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/validation-lot")
|
||||
public ResponseEntity<?> validerEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.validerEnquete(enqueteTraitementPayLoads), "Validation effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet-lot")
|
||||
public ResponseEntity<?> rejeterEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.rejeterEnquete(enqueteTraitementPayLoads), "Rejet effectué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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteUniteLogementService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -20,6 +24,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/enquete-unite-logement", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@@ -223,4 +229,160 @@ public class EnqueteUniteLogementController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/en-cours/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllEnqueteUniteLogementEncoursByQuartierPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementListByQuartierByStatutPageableToDto(userId,quartierId, StatutEnquete.EN_COURS, pageable), "Liste des enquetes en cours 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/cloture/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllEnqueteUniteLogementClotureByQuartierPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementListByQuartierByStatutPageableToDto(userId,quartierId, StatutEnquete.CLOTURE, pageable), "Liste des enquetes en cours 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/validation")
|
||||
public ResponseEntity<?> validerEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.validerEnquete(enqueteTraitementPayLoad), "Validation effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet")
|
||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/validation-lot")
|
||||
public ResponseEntity<?> validerEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.validerEnquete(enqueteTraitementPayLoads), "Validation effectué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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet-lot")
|
||||
public ResponseEntity<?> rejeterEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.rejeterEnquete(enqueteTraitementPayLoads), "Rejet effectué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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,21 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.ws.rs.NotAcceptableException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@@ -21,6 +30,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping(value = "api/impositions-tfu", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Impositions TFU")
|
||||
@@ -28,41 +38,32 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
public class ImpositionsTfuController {
|
||||
|
||||
private final ImpositionsTfuService impositionsTfuService;
|
||||
private final EnqueteService enqueteService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(ImpositionsTfuController.class);
|
||||
|
||||
public ImpositionsTfuController(ImpositionsTfuService impositionsTfuService) {
|
||||
this.impositionsTfuService = impositionsTfuService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createImpositionsTfu(@RequestBody @Valid @Validated ImpositionsTfu impositionsTfu) {
|
||||
public ResponseEntity<?> createImpositionsTfu(@CurrentUser UserPrincipal currentUser,@RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) {
|
||||
try {
|
||||
impositionsTfu = impositionsTfuService.createImpositionsTfu(impositionsTfu);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfu, "Unite de logement créé 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);
|
||||
}
|
||||
}
|
||||
if(currentUser==null){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Vous n'etes pas autorisé à accéder à cette ressource."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
User user=currentUser.getUser();
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateImpositionsTfu(@PathVariable Long id, @RequestBody ImpositionsTfu impositionsTfu) {
|
||||
try {
|
||||
if(user.getStructure().getId()!=impositionsTfuPaylaodWeb.getStructureId()){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Vous n'etes pas autorisé à accéder à cette ressource."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
impositionsTfuPaylaodWeb = impositionsTfuService.createImpositionsTfu(impositionsTfuPaylaodWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.updateImpositionsTfu(id, impositionsTfu), "Unite de logement mise à jour avec succès."),
|
||||
new ApiResponse<>(true, impositionsTfuPaylaodWeb, "Unite de logement créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -82,11 +83,27 @@ public class ImpositionsTfuController {
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/valider/{id}")
|
||||
public ResponseEntity<?> validerImpositionsTfu(@RequestBody ImpositionsTfu impositionsTfu) {
|
||||
@PutMapping("/cloturer-enquete")
|
||||
public ResponseEntity<?> cloturer(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb ) {
|
||||
try {
|
||||
|
||||
if(userPrincipal==null){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, null, "Accès non autorisé"),
|
||||
HttpStatus.NOT_ACCEPTABLE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
User user= userPrincipal.getUser();
|
||||
if(user.getStructure().getId()!=impositionsTfuPaylaodWeb.getStructureId()){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous n'êtes pas autorisé à cloturer les enquetes du : "+user.getStructure().getNom()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.validerImpositionsTfu(impositionsTfu), "Unite de logement mise à jour avec succès."),
|
||||
new ApiResponse<>(true, impositionsTfuService.cloturerImpositionsTfu(impositionsTfuPaylaodWeb), "enquete cloturées avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -105,11 +122,62 @@ public class ImpositionsTfuController {
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/annuler/{id}")
|
||||
public ResponseEntity<?> annulerImpositionsTfu(@PathVariable Long id, @RequestBody ImpositionsTfu impositionsTfu) {
|
||||
// @PutMapping("/update/{id}")
|
||||
// public ResponseEntity<?> updateImpositionsTfu(@PathVariable Long id, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) {
|
||||
// try {
|
||||
// return new ResponseEntity<>(
|
||||
// new ApiResponse<>(true, impositionsTfuService.updateImpositionsTfu(id, impositionsTfuPaylaodWeb), "Unite de logement mise à jour 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);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Operation(
|
||||
summary = "Autoriser la génération des avis d'un centre",
|
||||
description = "Permet d'autoriser la génération des avis d'un centre pour un exervice données"
|
||||
)
|
||||
|
||||
@PutMapping("/autoriser-generation-avis")
|
||||
public ResponseEntity<?> autoriserImpositionsTfu(@RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.annulerImpositionsTfu(impositionsTfu), "Unite de logement mise à jour avec succès."),
|
||||
new ApiResponse<>(true, impositionsTfuService.autoriserGenerationImpositionsTfu(impositionsTfuPaylaodWeb), "Unite de logement mise à jour 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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejeter")
|
||||
public ResponseEntity<?> annulerImpositionsTfu(@RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.rejeterImpositionsTfu(impositionsTfuPaylaodWeb), "Unite de logement mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -152,11 +220,19 @@ public class ImpositionsTfuController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllImpositionsTfuList() {
|
||||
@GetMapping("/all/by-user")
|
||||
public ResponseEntity<?> getAllImpositionsTfuList(@CurrentUser UserPrincipal userPrincipal) {
|
||||
try {
|
||||
|
||||
if(userPrincipal==null){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, null, "Vous n'êtes pas autorisé à acceder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
User user= userPrincipal.getUser();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.getImpositionsTfuList(), "Liste des Enquetes des unites Logements chargée avec succès."),
|
||||
new ApiResponse<>(true, impositionsTfuService.getImpositionsTfuByUserIdIds(user.getId()), "Liste des Enquetes des unites Logements chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
|
||||
@@ -247,4 +247,54 @@ public class UniteLogementController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllUniteLogementByQuartierPaged(@PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementListByQuartierPageable(quartierId,pageable), "Liste des unites de logements 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllUniteLogementByQuartier(@PathVariable Long quartierId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementListByQuartier(quartierId), "Liste des unites de logements 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ package io.gmss.fiscad.controllers.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuBati;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuService;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuBatiService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BaremRfuBatiPayloadWeb;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -24,20 +25,20 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Barem Rfu")
|
||||
public class BaremRfuController {
|
||||
private final BaremRfuService baremRfuService;
|
||||
private final BaremRfuBatiService baremRfuBatiService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(BaremRfuController.class);
|
||||
|
||||
public BaremRfuController(BaremRfuService baremRfuService) {
|
||||
this.baremRfuService = baremRfuService;
|
||||
public BaremRfuController(BaremRfuBatiService baremRfuBatiService) {
|
||||
this.baremRfuBatiService = baremRfuBatiService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createBaremRfu(@RequestBody @Valid @Validated BaremRfuBati baremRfuBati) {
|
||||
public ResponseEntity<?> createBaremRfu(@RequestBody @Valid @Validated BaremRfuBatiPayloadWeb baremRfuBatiPayloadWeb) {
|
||||
try {
|
||||
baremRfuBati = baremRfuService.createBaremRfu(baremRfuBati);
|
||||
baremRfuBatiPayloadWeb = baremRfuBatiService.createBaremRfu(baremRfuBatiPayloadWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuBati, "BaremRfuBati créé avec succès."),
|
||||
new ApiResponse<>(true, baremRfuBatiPayloadWeb, "BaremRfuBati créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -57,10 +58,10 @@ public class BaremRfuController {
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateBaremRfu(@PathVariable Long id, @RequestBody BaremRfuBati baremRfuBati) {
|
||||
public ResponseEntity<?> updateBaremRfu(@PathVariable Long id, @RequestBody BaremRfuBatiPayloadWeb baremRfuBatiPayloadWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.updateBaremRfu(id, baremRfuBati), "BaremRfuBati mis à jour avec succès."),
|
||||
new ApiResponse<>(true, baremRfuBatiService.updateBaremRfu(id, baremRfuBatiPayloadWeb), "BaremRfuBati mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -82,7 +83,7 @@ public class BaremRfuController {
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteBaremRfur(@PathVariable Long id) {
|
||||
try {
|
||||
baremRfuService.deleteBaremRfu(id);
|
||||
baremRfuBatiService.deleteBaremRfu(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "BaremRfuBati supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
@@ -107,7 +108,7 @@ public class BaremRfuController {
|
||||
public ResponseEntity<?> getAllBaremRfuList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.getBaremRfuList(), "Liste des baremRfus chargée avec succès."),
|
||||
new ApiResponse<>(true, baremRfuBatiService.getBaremRfuList(), "Liste des baremRfus chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -132,7 +133,7 @@ public class BaremRfuController {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.getBaremRfuList(pageable), "Liste des baremRfus chargée avec succès."),
|
||||
new ApiResponse<>(true, baremRfuBatiService.getBaremRfuList(pageable), "Liste des baremRfus chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -155,7 +156,7 @@ public class BaremRfuController {
|
||||
public ResponseEntity<?> getBaremRfuById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.getBaremRfuById(id), "BaremRfuBati trouvée avec succès."),
|
||||
new ApiResponse<>(true, baremRfuBatiService.getBaremRfuById(id), "BaremRfuBati trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -174,13 +175,68 @@ public class BaremRfuController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/categorie-batiment/{idCategorieBatiment}")
|
||||
@GetMapping("/by-categorie-batiment-id/{idCategorieBatiment}")
|
||||
public ResponseEntity<?> getBaremRfuByType( //@Parameter(description = "ID de la catégorie de bâtiment", required = true)
|
||||
@PathVariable Long idCategorieBatiment) {
|
||||
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.getBaremRfuByType(idCategorieBatiment), "Liste des baremRfu par categorie de batiments chargée avec succès."),
|
||||
new ApiResponse<>(true, baremRfuBatiService.getBaremRfuByCategorieBatiment(idCategorieBatiment), "Liste des baremRfu par categorie de batiments 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/by-arrondissement-id/by-categorie-batiment-id/{idArrondissement}/{idCategorieBatiment}")
|
||||
public ResponseEntity<?> getBaremRfuByArrondisementAndCategorie( //@Parameter(description = "ID de la catégorie de bâtiment", required = true)
|
||||
@PathVariable Long idArrondissement,
|
||||
@PathVariable Long idCategorieBatiment
|
||||
) {
|
||||
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuBatiService.getBaremRfuByArrondissementAndCategorieBatiment(idArrondissement,idCategorieBatiment), "Liste des baremRfu par categorie de batiments 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);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/by-quartier-id/by-categorie-batiment-id/{idQuartier}/{idCategorieBatiment}")
|
||||
public ResponseEntity<?> getBaremRfuByQuartierAndCategorie( //@Parameter(description = "ID de la catégorie de bâtiment", required = true)
|
||||
@PathVariable Long idQuartier,
|
||||
@PathVariable Long idCategorieBatiment
|
||||
) {
|
||||
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuBatiService.getBaremRfuByQuartierAndCategorieBatiment(idQuartier,idCategorieBatiment), "Liste des baremRfu par categorie de batiments chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuNonBatiService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BaremRfuNonBatiPayloadWeb;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -34,11 +35,11 @@ public class BaremRfuNonBatiController {
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createBaremRfuNonBati(@RequestBody @Valid @Validated BaremRfuNonBati baremRfuNonBati) {
|
||||
public ResponseEntity<?> createBaremRfuNonBati(@RequestBody BaremRfuNonBatiPayloadWeb baremRfuNonBatiPayloadWeb) {
|
||||
try {
|
||||
baremRfuNonBati = baremRfuNonBatiService.createBaremRfuNonBati(baremRfuNonBati);
|
||||
baremRfuNonBatiPayloadWeb = baremRfuNonBatiService.createBaremRfuNonBati(baremRfuNonBatiPayloadWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuNonBati, "BaremRfuNonBati créé avec succès."),
|
||||
new ApiResponse<>(true, baremRfuNonBatiPayloadWeb, "BaremRfuNonBati créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -58,10 +59,10 @@ public class BaremRfuNonBatiController {
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateBaremRfuNonBati(@PathVariable Long id, @RequestBody BaremRfuNonBati baremRfuNonBati) {
|
||||
public ResponseEntity<?> updateBaremRfuNonBati(@PathVariable Long id, @RequestBody BaremRfuNonBatiPayloadWeb baremRfuNonBatiPayloadWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuNonBatiService.updateBaremRfuNonBati(id, baremRfuNonBati), "BaremRfuNonBati mis à jour avec succès."),
|
||||
new ApiResponse<>(true, baremRfuNonBatiService.updateBaremRfuNonBati(id, baremRfuNonBatiPayloadWeb), "BaremRfuNonBati mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -156,7 +157,31 @@ public class BaremRfuNonBatiController {
|
||||
public ResponseEntity<?> getBaremRfuNonBatiById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuNonBatiService.getBaremRfuNonBatiById(id), "BaremRfuNonBati trouvée avec succès."),
|
||||
new ApiResponse<>(true, baremRfuNonBatiService.getBaremRfuNonBatiById(id).orElse(null), "BaremRfuNonBati trouvé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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/by-commune-id/by-zone-id/{communeId}/{zoneId}")
|
||||
public ResponseEntity<?> getBaremRfuNonBatiByCommineAndZoneId(@PathVariable Long communeId, Long zoneId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuNonBatiService.getBaremRfuNonBatiByCommuneAndZoneId(communeId,zoneId).orElse(null), "BaremRfuNonBati trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package io.gmss.fiscad.controllers.statistique;
|
||||
|
||||
import io.gmss.fiscad.enums.NiveauDecoupage;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -174,4 +177,77 @@ public class StatistiqueController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "Statistique des enquetes en cours par object ",
|
||||
description = "Donnes le nombre d'enquetes en coures par objet"
|
||||
)
|
||||
@GetMapping(path = "/nombre-enquete/par-objet/en-cours")
|
||||
public ResponseEntity<?> getStatistiquesEnqueteEnCoursParObjet(@CurrentUser UserPrincipal currentUser) {
|
||||
try {
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, statistiquesService.getStatNombreEnqueteParObjetUserConnect(userId,StatutEnquete.EN_COURS.toString()), "Statistique des personne par type."),
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "Statistique des enquetes en cours par object ",
|
||||
description = "Donnes le nombre d'enquetes en coures par objet"
|
||||
)
|
||||
@GetMapping(path = "/nombre-enquete/par-objet/cloture")
|
||||
public ResponseEntity<?> getStatistiquesEnqueteClotureParObjet(@CurrentUser UserPrincipal currentUser) {
|
||||
try {
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, statistiquesService.getStatNombreEnqueteParObjetUserConnect(userId, StatutEnquete.CLOTURE.toString()), "Statistique des personne par type."),
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -29,6 +29,8 @@ public class Quartier extends BaseEntity implements Serializable {
|
||||
@ManyToOne
|
||||
private Arrondissement arrondissement;
|
||||
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
// @JsonIgnore
|
||||
// @OneToOne(mappedBy = "quartier")
|
||||
// private Bloc bloc;
|
||||
|
||||
@@ -99,9 +99,9 @@ public class Enquete extends BaseEntity implements Serializable {
|
||||
@ManyToOne
|
||||
private Campagne campagne;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Equipe equipe;
|
||||
// @JsonIgnore
|
||||
// @ManyToOne
|
||||
// private Equipe equipe;
|
||||
|
||||
// @JsonIgnore
|
||||
@ManyToOne
|
||||
@@ -188,6 +188,7 @@ public class Enquete extends BaseEntity implements Serializable {
|
||||
private Long montantAnnuelleLocation;
|
||||
private Long valeurParcelleEstime;
|
||||
private Long valeurParcelleReel;
|
||||
private Long valeurParcelleCalcule;
|
||||
private String ncProprietaire;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package io.gmss.fiscad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
|
||||
@@ -58,7 +61,7 @@ public class Parcelle extends BaseEntity implements Serializable {
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
private String autreNumeroTitreFoncier;
|
||||
private Long numeroProvisoire;
|
||||
private String numeroProvisoire;
|
||||
private Long blocId;
|
||||
@ColumnDefault("false")
|
||||
private boolean synchronise;
|
||||
@@ -73,6 +76,13 @@ public class Parcelle extends BaseEntity implements Serializable {
|
||||
private Integer nombrePiscine;
|
||||
@ManyToOne
|
||||
private Usage usage;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebutExemption;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFinExemption;
|
||||
// private String ncProprietaire ;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "parcelle")
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.decoupage.Departement;
|
||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.enums.SourceDonnee;
|
||||
import io.gmss.fiscad.enums.StatutParcelle;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -24,6 +25,7 @@ import org.n52.jackson.datatype.jts.GeometryDeserializer;
|
||||
import org.n52.jackson.datatype.jts.GeometrySerializer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@@ -39,27 +41,63 @@ public class ParcelleGeom extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String NomDepartement;
|
||||
private String NomCommune;
|
||||
private String NomArrondissement;
|
||||
private String NomVillageQuartier;
|
||||
private String codeBloc;
|
||||
private String q;
|
||||
private String ilot;
|
||||
private String zone;
|
||||
private String p;
|
||||
@Column(unique = true,nullable = true)
|
||||
private String nup;
|
||||
@Column(unique = true,nullable = true)
|
||||
private String nupProvisoire;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private String codeDepartement;
|
||||
private String nomDepartement;
|
||||
private String codeCommune;
|
||||
private String nomCommune;
|
||||
private String codeArrondissement;
|
||||
private String nomArrondissement;
|
||||
private String codeQuartierVillage;
|
||||
private String nomVillageQuartier;
|
||||
private String codeBloc;
|
||||
private String numeroRue;
|
||||
private String numeroEntreePorte;
|
||||
|
||||
private String codeInstad;
|
||||
private String numeroEtatLieux;
|
||||
private String numeroTitreFoncier;
|
||||
private LocalDate dateTitreFoncier;
|
||||
private Boolean batie ;
|
||||
|
||||
private String npi;
|
||||
private String ifu;
|
||||
private String nom;
|
||||
private String prenom;
|
||||
private String raisonSociale;
|
||||
private String nomEtPrenoms;
|
||||
private String telephone;
|
||||
private String adresse;
|
||||
|
||||
private String nomRepresentant;
|
||||
private String prenomRepresentant;
|
||||
private String raisonSocialeRepresentant;
|
||||
private String nomEtPrenomsRepresentant;
|
||||
private String telephoneRepresentant;
|
||||
private String adresseRepresentant;
|
||||
|
||||
private String q;
|
||||
private String zone;
|
||||
private String ilot;
|
||||
private String p;
|
||||
|
||||
private String qLotissement;
|
||||
private String ilotLotissement;
|
||||
private String pLotissement;
|
||||
|
||||
private String pointsPolygone;
|
||||
private Integer superficie;
|
||||
private String nomEtPrenoms;
|
||||
|
||||
private String dateCollecte;
|
||||
private String sourceDonnees;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private SourceDonnee sourceDonnees;
|
||||
private String observations;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatutParcelle statutParcelle;
|
||||
private Long uploadId;
|
||||
@@ -77,35 +115,22 @@ public class ParcelleGeom extends BaseEntity implements Serializable {
|
||||
private Arrondissement arrondissement;
|
||||
|
||||
@ManyToOne //(fetch = FetchType.LAZY)
|
||||
//@JsonBackReference
|
||||
@JsonBackReference
|
||||
private Quartier quartier ;
|
||||
|
||||
@ColumnDefault("0")
|
||||
private int geomSrid;
|
||||
private Integer geomSrid;
|
||||
@JsonSerialize(using = GeometrySerializer.class)
|
||||
@JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
||||
@Column(name = "geometry",columnDefinition = "geometry(Polygon,32631)")
|
||||
private Polygon geometry;
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String geometryString;
|
||||
private String codeInsae;
|
||||
private String numeroEtatLieux;
|
||||
private String numeroTitreFoncier;
|
||||
private String telephone;
|
||||
//private String codeParcelle;
|
||||
//private String codeEquipe;
|
||||
|
||||
//private String elLot;
|
||||
//private String elLettreParcelle;
|
||||
//private String rfuQuartierOuZone;
|
||||
//private String rfuIlot;
|
||||
//private String rfuLettreParcelle;
|
||||
|
||||
//private String nomLotissement;
|
||||
////////////
|
||||
// @JsonIgnore
|
||||
// @OneToOne
|
||||
// private Parcelle parcelle;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JsonBackReference
|
||||
private Parcelle parcelle;
|
||||
// @JsonSerialize(using = GeometrySerializer.class)
|
||||
// @JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
||||
// @Column(name = "geom",columnDefinition = "geometry(Polygon,4326)")
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -88,7 +89,7 @@ public class Piece extends BaseEntity implements Serializable {
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "piece")
|
||||
private List<Upload> uploads;
|
||||
private List<Upload> uploads=new ArrayList<>();
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@@ -103,4 +104,9 @@ public class Piece extends BaseEntity implements Serializable {
|
||||
private boolean synchronise;
|
||||
private String observation;
|
||||
|
||||
private Long nombreFichier;
|
||||
|
||||
public Long getNombreFichier() {
|
||||
return uploads==null? 0l:uploads.size() ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,13 @@ public class Batiment extends BaseEntity implements Serializable {
|
||||
private Integer nombrePiscine;
|
||||
private Long montantLocatifAnnuelDeclare;
|
||||
private Long montantLocatifAnnuelCalcule;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long valeurBatimentEstime;
|
||||
private Long valeurBatimentReel;
|
||||
private Long valeurBatimentCalcule;
|
||||
private Long montantMensuelLocation;
|
||||
|
||||
private Integer nbreUniteLogement;
|
||||
private Integer idToitRfu;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@@ -65,4 +68,11 @@ public class Batiment extends BaseEntity implements Serializable {
|
||||
// private Long enqueteId;
|
||||
private Long mobileDataId;
|
||||
private Long parcelleExternalKey;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebutExemption;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFinExemption;
|
||||
}
|
||||
|
||||
@@ -47,3 +47,5 @@ public class CaracteristiqueUniteLogement extends BaseEntity implements Serializ
|
||||
private Long enqueteId;
|
||||
private Long mobileDataId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.ZoneRfu;
|
||||
import io.gmss.fiscad.enums.NatureImpot;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -70,16 +74,22 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
private String latitude;
|
||||
private int superficieParc;
|
||||
private Long superficieAuSolBat;
|
||||
private Long superficieAuSolLoue;
|
||||
private Long superficieAuSolUlog;
|
||||
private String batieOuiNon;
|
||||
private String exhonereOuiNon;
|
||||
private String batimentExhonereOuiNon;
|
||||
private String uniteLogementExhonereOuiNon;
|
||||
private Boolean batie;
|
||||
private Boolean exonere;
|
||||
private Boolean batimentExonere;
|
||||
private Boolean uniteLogementExonere;
|
||||
private Long valeurLocativeAdm;
|
||||
private Long valeurLocativeAdmTauxPropParc;
|
||||
private Long valeurLocativeAdmSupReel;
|
||||
private Long superficieAuSolTauxPropParc;
|
||||
private Long valeurLocativeAdmMetreCarre;
|
||||
private Long montantLoyerAnnuel;
|
||||
private Long tfuMetreCarre;
|
||||
private Long tfuMinimum;
|
||||
private String standingBat;
|
||||
private String categorieUsage;
|
||||
private String categorieBat;
|
||||
private Long nombrePiscine;
|
||||
private Long nombreUlog;
|
||||
@@ -88,14 +98,53 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
private Long enqueteId;
|
||||
private Long structureId;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "structure_id")
|
||||
private Structure structure ;
|
||||
|
||||
private Long secteurId;
|
||||
private Long zoneRfuId;
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "zone_rfu_id")
|
||||
private ZoneRfu zoneRfu ;
|
||||
|
||||
@ColumnDefault("0")
|
||||
private float tauxParcelleNonBati;
|
||||
private Long valeurAdministrativeParcelleNonBati;
|
||||
private Long valeurAdminParcelleNb;
|
||||
private Float tauxTfu;
|
||||
private Long tfuPiscine;
|
||||
private Float montantTaxe;
|
||||
private Float tfuCalculeTauxPropParc;
|
||||
private Float tfuSuperficieAuSolReel;
|
||||
private Long valeurAdminParcelleNbMetreCarre;
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "impositions_tfu_id", nullable = false)
|
||||
private ImpositionsTfu impositionsTfu;
|
||||
private ImpositionsTfu impositionsTfu ;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private NatureImpot natureImpot;
|
||||
private Long valeurBatiment;
|
||||
private Long valeurParcelle;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "parcelle_id")
|
||||
private Parcelle parcelleImposee ;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "batiment_id")
|
||||
private Batiment batimentImpose ;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "unite_logement_id")
|
||||
private UniteLogement uniteLogementImposee ;
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
private Personne personne ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
private Boolean soneb;
|
||||
private String numCompteurSoneb;
|
||||
private Integer nbreLotUnite;
|
||||
private Integer nbreUniteLogement;
|
||||
private Integer nbrePiece;
|
||||
private Integer nbreUniteLocation;
|
||||
private Float superficieLouee;
|
||||
private Float superficieAuSol;
|
||||
@@ -61,9 +63,11 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
private Integer nbreHabitant;
|
||||
private Long montantMensuelLocation;
|
||||
private Long montantLocatifAnnuelDeclare;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long montantLocatifAnnuelCalcule;
|
||||
private Long valeurBatimentEstime;
|
||||
private Long valeurBatimentReel;
|
||||
private Long valeurBatimentCalcule;
|
||||
private Integer nombrePiscine;
|
||||
private Integer nbreMoisLocation;
|
||||
private String autreCaracteristiquePhysique;
|
||||
@@ -79,6 +83,14 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateValidation;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateRejet;
|
||||
private String descriptionMotifRejet;
|
||||
@ManyToOne
|
||||
private Exercice exercice;
|
||||
|
||||
@@ -134,4 +146,5 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
private CategorieBatiment categorieBatiment ;
|
||||
@ManyToOne
|
||||
private Usage usage ;
|
||||
|
||||
}
|
||||
|
||||
@@ -53,8 +53,10 @@ public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
||||
private Integer nbreMoisLocation;
|
||||
private Long montantLocatifAnnuelDeclare;
|
||||
private Long montantLocatifAnnuelCalcule;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long valeurUniteLogementEstime;
|
||||
private Long valeurUniteLogementReel;
|
||||
private Long valeurUniteLogementCalcule;
|
||||
private Integer nombrePiscine;
|
||||
private Float superficieLouee;
|
||||
private Float superficieAuSol;
|
||||
@@ -71,6 +73,15 @@ public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateValidation;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateRejet;
|
||||
private String descriptionMotifRejet;
|
||||
private String observation;
|
||||
private Long uniteLogementExternalKey;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Participer;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
@@ -33,24 +34,39 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
||||
private Long id;
|
||||
@ManyToOne
|
||||
private Exercice exercice;
|
||||
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
|
||||
@ManyToOne
|
||||
private Structure structure ;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateGeneration;
|
||||
private String ReferencePieceAdmin;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateCloture;
|
||||
|
||||
private String referencePieceAdmin;
|
||||
private String datePieceAdmin;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatusAvis statusAvis;
|
||||
private Long nombreAvis;
|
||||
|
||||
private Integer nombreAvis;
|
||||
private Integer nombreAvisFnb;
|
||||
private Integer nombreAvisBatiment;
|
||||
private Integer nombreAvisUniteLog;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String motif;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "impositions_tfu_id")
|
||||
private List<DonneesImpositionTfu> donneesImpositionTfus;
|
||||
|
||||
public Long getNombreAvis(){
|
||||
return donneesImpositionTfus==null?0l:donneesImpositionTfus.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ public class SituationFiscaleParcelle extends BaseEntity implements Serializable
|
||||
private Long montantDu ;
|
||||
private Long montantPaye ;
|
||||
private Long resteAPayer ;
|
||||
private StatutParcelle etatFiscalParcelle ;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateSync;
|
||||
|
||||
@@ -51,7 +51,9 @@ public class UniteLogement extends BaseEntity implements Serializable {
|
||||
private Long montantLocatifAnnuelDeclare;
|
||||
private Long montantLocatifAnnuelCalcule;
|
||||
private Long valeurUniteLogementEstime;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long valeurUniteLogementReel;
|
||||
private Long valeurUniteLogementCalcule;
|
||||
private Integer nombrePiscine;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@@ -60,4 +62,13 @@ public class UniteLogement extends BaseEntity implements Serializable {
|
||||
private Long mobileDataId;
|
||||
@ManyToOne
|
||||
private CategorieBatiment categorieBatiment ;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebutExemption;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFinExemption;
|
||||
private Integer idToitRfu;
|
||||
private Integer nombreEtage;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -28,4 +29,6 @@ public class BaremRfuBati extends BaseEntity implements Serializable {
|
||||
private CategorieBatiment categorieBatiment;
|
||||
@ManyToOne
|
||||
private Arrondissement arrondissement;
|
||||
@ManyToOne
|
||||
private Quartier quartier ;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ public class BaremRfuNonBati extends BaseEntity implements Serializable {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Long valeurAdministrative;
|
||||
private float taux;
|
||||
private Long valeurAdministrativeMetreCarre;
|
||||
private Boolean auMetreCarre;
|
||||
private Float taux;
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
@ManyToOne
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import io.gmss.fiscad.enums.CategorieUsage;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -25,5 +23,7 @@ public class Usage extends BaseEntity implements Serializable {
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private CategorieUsage categorieUsage;
|
||||
}
|
||||
|
||||
|
||||
8
src/main/java/io/gmss/fiscad/enums/CategorieUsage.java
Normal file
8
src/main/java/io/gmss/fiscad/enums/CategorieUsage.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum CategorieUsage {
|
||||
|
||||
HABITATION,
|
||||
PROFESSIONNELLE,
|
||||
MIXTE
|
||||
}
|
||||
7
src/main/java/io/gmss/fiscad/enums/NatureImpot.java
Executable file
7
src/main/java/io/gmss/fiscad/enums/NatureImpot.java
Executable file
@@ -0,0 +1,7 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum NatureImpot {
|
||||
TFU,
|
||||
IRF,
|
||||
SRTB
|
||||
}
|
||||
@@ -12,5 +12,11 @@ public enum ParametersType {
|
||||
CORPS_RESET_PASSWORD,
|
||||
OBJET_CREATE_ACCOUNT,
|
||||
CORPS_CREATE_ACCOUNT,
|
||||
TOKEN_IFU_EN_LIGNE ;
|
||||
TOKEN_IFU_EN_LIGNE,
|
||||
TAUX_TFU,
|
||||
TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE,
|
||||
TAUX_DEFAUT_SUPERFICIE_AU_SOL,
|
||||
TAUX_IRF,
|
||||
TAXE_SRTB,
|
||||
TFU_PAR_PISCINE;
|
||||
}
|
||||
|
||||
7
src/main/java/io/gmss/fiscad/enums/SourceDonnee.java
Normal file
7
src/main/java/io/gmss/fiscad/enums/SourceDonnee.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum SourceDonnee {
|
||||
RFU,
|
||||
ANDF,
|
||||
SIGIBE
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum StatusAvis {
|
||||
CREE,
|
||||
GENERE,
|
||||
ANNULE,
|
||||
VALIDE,
|
||||
EN_COURS,
|
||||
|
||||
CLOTURE,
|
||||
GENERATION_AUTORISE,
|
||||
|
||||
REJETE,
|
||||
TFU_FNB_GENERE,
|
||||
GENERE
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum StatutParcelle {
|
||||
NON_ENQUETER,
|
||||
ENQUETER_NON_BATIE_AJOUR,
|
||||
ENQUETER_BATIE_AJOUR,
|
||||
ENQUETER_NON_BATIE_NON_AJOUR,
|
||||
ENQUETER_BATIE_NON_AJOUR
|
||||
|
||||
NON_ENQUETE,
|
||||
AJOUR,
|
||||
NON_AJOUR;
|
||||
}
|
||||
|
||||
@@ -2,15 +2,18 @@ package io.gmss.fiscad.implementations.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
||||
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||
import io.gmss.fiscad.persistence.repositories.decoupage.SecteurDecoupageRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteUniteLogementRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -26,6 +29,9 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
||||
private final SecteurDecoupageRepository secteurDecoupageRepository;
|
||||
private final SecteurService secteurService;
|
||||
private final ParcelleRepository parcelleRepository;
|
||||
private final EnqueteRepository enqueteRepository;
|
||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
|
||||
@@ -112,4 +118,35 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
||||
|
||||
return parcelleStatsProjectionUnSecteurs ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteDecoupageByUserId(Long userId, String statutEnquete) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
System.out.println(statutEnquete);
|
||||
return enqueteRepository.findStatsEnqueteBySecteurs(secteurIds,statutEnquete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteBatimentDecoupageByUserId(Long userId, String statutEnquete) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
System.out.println(statutEnquete);
|
||||
return enqueteBatimentRepository.findStatsEnqueteBatimentBySecteurs(secteurIds,statutEnquete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteUniteLogementDecoupageByUserId(Long userId, String statutEnquete) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
return enqueteUniteLogementRepository.findStatsEnqueteBatimentBySecteurs(secteurIds,statutEnquete);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -163,8 +163,15 @@ public class SecteurServiceImpl implements SecteurService {
|
||||
secteurs.addAll(secteurRepository.findDistinctBySection_Id(avoirFonction.getFonction().getSection().getId()));
|
||||
}else if(avoirFonction.getFonction().getStructure()!=null){
|
||||
secteurs.addAll(secteurRepository.findDistinctBySection_Structure_Id(avoirFonction.getFonction().getStructure().getId()));
|
||||
}else if(avoirFonction.getFonction().getDepartement()!=null){
|
||||
secteurs.addAll(secteurRepository.findSectionsByDepartement(avoirFonction.getFonction().getDepartement().getId()));
|
||||
}
|
||||
});
|
||||
return secteurs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Secteur> getListSecteurByDepartementId(Long departementId) {
|
||||
return secteurRepository.findSectionsByDepartement(departementId);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.implementations.infocad.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.*;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueParcelle;
|
||||
@@ -13,7 +14,9 @@ import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.ApplicationException;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.ParcelleService;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.PieceService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueParcelleService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DeclarationNcService;
|
||||
@@ -23,6 +26,7 @@ import io.gmss.fiscad.interfaces.user.UserService;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.* ;
|
||||
import io.gmss.fiscad.paylaods.response.FicheResponse.* ;
|
||||
import io.gmss.fiscad.paylaods.response.synchronisation.EnqueteNonSyncResponse;
|
||||
@@ -43,6 +47,8 @@ import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.persistence.Query;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.NotAcceptableException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -77,13 +83,9 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
private final ParcelleServiceImpl parcelleService;
|
||||
private final PersonneRepository personneRepository;
|
||||
private final ZoneRfuRepository zoneRfuRepository ;
|
||||
private final EquipeRepository equipeRepository ;
|
||||
private final RueRepository rueRepository ;
|
||||
private final CaracteristiqueParcelleService caracteristiqueParcelleService ;
|
||||
private final PieceService pieceService ;
|
||||
private final UploadRepository uploadRepository ;
|
||||
private final DeclarationNcService declarationNcService ;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService ;
|
||||
private final SecteurService secteurService ;
|
||||
;
|
||||
|
||||
@PersistenceContext
|
||||
private final EntityManager em;
|
||||
@@ -91,69 +93,75 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public EnquetePayLoadWeb createEnquete(EnquetePayLoadWeb enquetePayLoadWeb) throws BadRequestException {
|
||||
|
||||
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
||||
if (!optionalUser.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : Enquêteur inexistant");
|
||||
}
|
||||
|
||||
Optional<Personne> optionalPersonne = personneRepository.findById(enquetePayLoadWeb.getPersonneId());
|
||||
if (!optionalPersonne.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : Propriétaire inexistant");
|
||||
}
|
||||
|
||||
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(enquetePayLoadWeb.getParcelleId());
|
||||
if (!optionalParcelle.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : Parcelle inexistante");
|
||||
if(enquetePayLoadWeb.getParcelleId()!=null) {
|
||||
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(enquetePayLoadWeb.getParcelleId());
|
||||
if (!optionalParcelle.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : Parcelle inexistante");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Optional<ZoneRfu> optionalZoneRfu = zoneRfuRepository.findById(enquetePayLoadWeb.getZoneRfuId());
|
||||
if (!optionalZoneRfu.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
|
||||
}
|
||||
|
||||
if (enquetePayLoadWeb.getParcelleId() == null) {
|
||||
throw new ApplicationException("Echec de l'enregistrement : La parcelle non renseignée.");
|
||||
}
|
||||
Enquete enquete = entityFromPayLoadService.getEnqueteFromPayLoadWeb(enquetePayLoadWeb);
|
||||
////enregistrement de l'enquete
|
||||
ParcellePayLoadWeb parcellePayLoadWeb= getParcellePayloadFromEnquetePl(enquetePayLoadWeb);
|
||||
|
||||
if(parcellePayLoadWeb.getId()==null){
|
||||
parcellePayLoadWeb=parcelleService.createParcelle(parcellePayLoadWeb);
|
||||
}else{
|
||||
parcellePayLoadWeb=parcelleService.updateParcelle(parcellePayLoadWeb.getId(),parcellePayLoadWeb);
|
||||
}
|
||||
|
||||
enquetePayLoadWeb.setParcelleId(parcellePayLoadWeb.getId());
|
||||
|
||||
Enquete enquete = entityFromPayLoadService.getEnqueteFromPayLoadWeb(enquetePayLoadWeb);
|
||||
////enregistrement de l'enquete
|
||||
enquete=enqueteRepository.save(enquete);
|
||||
|
||||
//////Enregistrement des caractéristiques parcelle
|
||||
// enquetePayLoadWeb.getCaracteristiqueParcellePayloadWebs().forEach(caracteristiqueParcellePayloadWeb -> {
|
||||
// caracteristiqueParcellePayloadWeb.setEnqueteId(finalEnquete.getId());
|
||||
// CaracteristiqueParcelle caracteristiqueParcelle=entityFromPayLoadService.getCaracteristiqueParcelleFromPayLoadWeb(caracteristiqueParcellePayloadWeb);
|
||||
// caracteristiqueParcelleService.createCaracteristiqueParcelle(caracteristiqueParcelle);
|
||||
// });
|
||||
|
||||
/////Enregistrement des pièce de parcelles
|
||||
// enquetePayLoadWeb.getPiecePayLoadWebs().forEach(piecePayLoadWeb -> {
|
||||
// piecePayLoadWeb.setEnqueteId(finalEnquete.getId());
|
||||
// //Piece piece=entityFromPayLoadService.getPieceFromPayLoadWeb(piecePayLoadWeb);
|
||||
// Piece piecefinal = pieceService.createPiece(entityFromPayLoadService.getPieceFromPayLoadWeb(piecePayLoadWeb));
|
||||
// piecePayLoadWeb.getUploadPayLoadWebs().forEach(uploadPayLoadWeb -> {
|
||||
// uploadPayLoadWeb.setEnqueteId(finalEnquete.getId());
|
||||
// Upload upload=entityFromPayLoadService.getUploadFromPayLoadWeb(uploadPayLoadWeb);
|
||||
// upload.setPiece(piecefinal);
|
||||
// uploadRepository.save(upload);
|
||||
// });
|
||||
// });
|
||||
|
||||
/////Enregistrement des pièce de parcelles
|
||||
// enquetePayLoadWeb.getDeclarationNcPayloadWebs().forEach(declarationNcPayloadWeb -> {
|
||||
// declarationNcPayloadWeb.setEnqueteId(finalEnquete.getId());
|
||||
// DeclarationNc declarationNcfinal=declarationNcService.createDeclarationNc(entityFromPayLoadService.getDeclarationNcFromPayLoadWeb(declarationNcPayloadWeb));
|
||||
// declarationNcPayloadWeb.getUploadPayLoadWebs().forEach(uploadPayLoadWeb -> {
|
||||
// uploadPayLoadWeb.setEnqueteId(finalEnquete.getId());
|
||||
// Upload upload=entityFromPayLoadService.getUploadFromPayLoadWeb(uploadPayLoadWeb);
|
||||
// upload.setDeclarationNc(declarationNcfinal);
|
||||
// uploadRepository.save(upload);
|
||||
// });
|
||||
// });
|
||||
|
||||
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||
}
|
||||
|
||||
private ParcellePayLoadWeb getParcellePayloadFromEnquetePl(EnquetePayLoadWeb enquetePayLoadWeb) {
|
||||
ParcellePayLoadWeb parcellePayLoadWeb=new ParcellePayLoadWeb();
|
||||
parcellePayLoadWeb.setId(enquetePayLoadWeb.getParcelleId());
|
||||
parcellePayLoadWeb.setQ(enquetePayLoadWeb.getParcelleQ());
|
||||
parcellePayLoadWeb.setI(enquetePayLoadWeb.getParcelleI());
|
||||
parcellePayLoadWeb.setP(enquetePayLoadWeb.getParcelleP());
|
||||
parcellePayLoadWeb.setNup(enquetePayLoadWeb.getParcelleNup());
|
||||
parcellePayLoadWeb.setNupProvisoire(enquetePayLoadWeb.getNupProvisoire());
|
||||
parcellePayLoadWeb.setNumTitreFoncier(enquetePayLoadWeb.getNumeroTitreFoncier());
|
||||
parcellePayLoadWeb.setLongitude(enquetePayLoadWeb.getLongitude());
|
||||
parcellePayLoadWeb.setLatitude(enquetePayLoadWeb.getLatitude());
|
||||
parcellePayLoadWeb.setAltitude(enquetePayLoadWeb.getAltitude());
|
||||
parcellePayLoadWeb.setSuperficie(enquetePayLoadWeb.getSuperficie());
|
||||
parcellePayLoadWeb.setObservation(enquetePayLoadWeb.getObservation());
|
||||
parcellePayLoadWeb.setSituationGeographique(enquetePayLoadWeb.getSituationGeographique());
|
||||
parcellePayLoadWeb.setNumEntreeParcelle(enquetePayLoadWeb.getNumEntreeParcelle());
|
||||
parcellePayLoadWeb.setQuartierId(enquetePayLoadWeb.getQuartierId());
|
||||
parcellePayLoadWeb.setNatureDomaineId(enquetePayLoadWeb.getNatureDomaineId());
|
||||
parcellePayLoadWeb.setTypeDomaineId(enquetePayLoadWeb.getTypeDomaineId());
|
||||
parcellePayLoadWeb.setRueId(enquetePayLoadWeb.getRueId());
|
||||
parcellePayLoadWeb.setProprietaireId(enquetePayLoadWeb.getPersonneId());
|
||||
parcellePayLoadWeb.setNatureDomaineId(enquetePayLoadWeb.getNatureDomaineId());
|
||||
parcellePayLoadWeb.setNatureDomaineId(enquetePayLoadWeb.getNatureDomaineId());
|
||||
return parcellePayLoadWeb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnquetePayLoadWeb updateEnquete(Long id,EnquetePayLoadWeb enquetePayLoadWeb) throws NotFoundException {
|
||||
if (enquetePayLoadWeb.getId() == null) {
|
||||
@@ -167,8 +175,6 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
throw new BadRequestException("Impossible d'enregistrer une enquête avec une parcelle inexistante");
|
||||
}
|
||||
|
||||
Optional<Parcelle> optionalParcelle=Optional.empty();
|
||||
Long rueId;
|
||||
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
||||
if (!optionalUser.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : Enquêteur inexistant");
|
||||
@@ -182,13 +188,26 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
if (!optionalZoneRfu.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
|
||||
}
|
||||
///enregistrement de la pacelle
|
||||
if (enquetePayLoadWeb.getParcelleId() == null) {
|
||||
throw new ApplicationException("Echec de l'enregistrement : La parcelle non renseignée.");
|
||||
} else {
|
||||
optionalParcelle = parcelleService.getParcelleById(enquetePayLoadWeb.getParcelleId());
|
||||
|
||||
if(enquetePayLoadWeb.getParcelleId()!=null) {
|
||||
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(enquetePayLoadWeb.getParcelleId());
|
||||
if (!optionalParcelle.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : Parcelle inexistante");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ParcellePayLoadWeb parcellePayLoadWeb= getParcellePayloadFromEnquetePl(enquetePayLoadWeb);
|
||||
|
||||
if(parcellePayLoadWeb.getId()==null){
|
||||
parcellePayLoadWeb=parcelleService.createParcelle(parcellePayLoadWeb);
|
||||
}else{
|
||||
parcellePayLoadWeb=parcelleService.updateParcelle(parcellePayLoadWeb.getId(),parcellePayLoadWeb);
|
||||
}
|
||||
|
||||
enquetePayLoadWeb.setParcelleId(parcellePayLoadWeb.getId());
|
||||
|
||||
|
||||
Enquete enquete = entityFromPayLoadService.getEnqueteFromPayLoadWeb(enquetePayLoadWeb);
|
||||
enquete=enqueteRepository.save(enquete);
|
||||
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||
@@ -337,7 +356,7 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enquete validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
public EnquetePayLoadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null) {
|
||||
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
||||
}
|
||||
@@ -345,15 +364,22 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
if (!optionalEnquete.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
||||
}
|
||||
if(optionalEnquete.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnquete.get().getStatutEnquete()==StatutEnquete.REJETE ){
|
||||
throw new NotAcceptableException("Impossible de valider : Le statut actuel "+optionalEnquete.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
|
||||
Enquete enquete = optionalEnquete.get();
|
||||
enquete.setDateValidation(LocalDate.now());
|
||||
enquete.setStatutEnquete(StatutEnquete.VALIDE);
|
||||
enquete.setSynchronise(false);
|
||||
return enqueteRepository.save(enquete);
|
||||
enquete.setSynchronise(true);
|
||||
|
||||
enquete= enqueteRepository.save(enquete);
|
||||
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enquete rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
public EnquetePayLoadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad.getIdBackend() == null) {
|
||||
throw new BadRequestException("Impossible de rejeter une enquête ayant un id null.");
|
||||
}
|
||||
@@ -361,38 +387,43 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
if (!optionalEnquete.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez rejeter.");
|
||||
}
|
||||
if(optionalEnquete.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnquete.get().getStatutEnquete()==StatutEnquete.VALIDE ){
|
||||
throw new NotAcceptableException("Impossible de rejeter : Le statut actuel "+optionalEnquete.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
Enquete enquete = optionalEnquete.get();
|
||||
enquete.setDateRejet(LocalDate.now());
|
||||
enquete.setDescriptionMotifRejet(enqueteTraitementPayLoad.getMotifRejet());
|
||||
enquete.setStatutEnquete(StatutEnquete.REJETE);
|
||||
enquete.setSynchronise(false);
|
||||
return enqueteRepository.save(enquete);
|
||||
enquete= enqueteRepository.save(enquete);
|
||||
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Enquete> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<Enquete> enquetes = new ArrayList<>();
|
||||
public List<EnquetePayLoadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnquetePayLoadWeb> enquetePayLoadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enquetes.add(validerEnquete(enqueteTraitementPayLoad));
|
||||
enquetePayLoadWebs.add(validerEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enquetes.add(null);
|
||||
enquetePayLoadWebs.add(null);
|
||||
}
|
||||
return enquetes;
|
||||
return enquetePayLoadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Enquete> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<Enquete> enquetes = new ArrayList<>();
|
||||
public List<EnquetePayLoadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnquetePayLoadWeb> enquetePayLoadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enquetes.add(rejeterEnquete(enqueteTraitementPayLoad));
|
||||
enquetePayLoadWebs.add(rejeterEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enquetes.add(null);
|
||||
enquetePayLoadWebs.add(null);
|
||||
}
|
||||
return enquetes;
|
||||
return enquetePayLoadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -541,4 +572,36 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int cloturerEnqueteParcelleBatimentUniteLogementByUserIdAndExerciceId(Long userId,Long exerciceId) {
|
||||
Optional<User> optionalUser= userRepository.findById(userId);
|
||||
int nbreEnquete=0;
|
||||
if(optionalUser.isPresent() && optionalUser.get().getStructure()!=null){
|
||||
Long structureId=optionalUser.get().getStructure().getId();
|
||||
nbreEnquete=cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(structureId,exerciceId);
|
||||
}
|
||||
return nbreEnquete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EnquetePayLoadWeb> getEnqueteListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
|
||||
return enqueteRepository.findAllEnqueteByQuartierByStatutToDtoPageable(quartierId,secteurIds,statutEnquete,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(Long structureId,Long exerciceId) {
|
||||
Integer nombreParcelleImpacte=enqueteRepository.clotureEnqueteParcelle(structureId,exerciceId);
|
||||
Integer nombreBatiment=enqueteBatimentRepository.clotureEnqueteBatiment(structureId,exerciceId);
|
||||
Integer nombreUniteLogement=enqueteUniteLogementRepository.clotureEnqueteUniteLogement(structureId,exerciceId);
|
||||
return nombreParcelleImpacte;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.ParcelleGeomService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParcelleGeomPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.response.EnqueteCheckResponse;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleGeomRepository;
|
||||
@@ -79,6 +80,7 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
private Upload saveGeoJsonUpload(MultipartFile file,String reference,String desc) {
|
||||
Upload upload = new Upload();
|
||||
String fileName = fileStorageService.storeFile(file);
|
||||
@@ -176,6 +178,16 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
return parcelleGeomRepository.findAllByQuartier_Code(codeQuartier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleGeomPaylaodWeb> getParcelleGeomListByQuatierId(Long quartierId) {
|
||||
return parcelleGeomRepository.findAllByQuartierId(quartierId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ParcelleGeomPaylaodWeb> getParcelleGeomListByQuatierIdPaged(Long quartierId, Pageable pageable) {
|
||||
return parcelleGeomRepository.findAllByQuartierIdPageable(quartierId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleGeom> getParcelleGeomListUnArrondissement(String codeArrondissement) {
|
||||
return parcelleGeomRepository.findAllByQuartier_Arrondissement_Code(codeArrondissement);
|
||||
@@ -262,4 +274,9 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int createParcelleGeomFromGeoJsonApi() throws BadRequestException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ package io.gmss.fiscad.implementations.infocad.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.EnqueteFiltreResponse;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Rue;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.TypeDomaine;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
@@ -19,9 +21,12 @@ import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.RueRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.NatureDomaineRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.SituationGeographiqueRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypeDomaineRepository;
|
||||
import io.gmss.fiscad.persistence.specification.ParcelleSpecification;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import io.gmss.fiscad.service.GeometryService;
|
||||
import jakarta.persistence.Query;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -38,6 +43,8 @@ public class ParcelleServiceImpl implements ParcelleService {
|
||||
private final RueRepository rueRepository;
|
||||
private final GeometryService geometryService;
|
||||
private final SecteurService secteurService;
|
||||
private final TypeDomaineRepository typeDomaineRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
// @Value("${infocad.geom.srid}")
|
||||
// private String defaultSrid32631;
|
||||
@@ -57,36 +64,29 @@ public class ParcelleServiceImpl implements ParcelleService {
|
||||
if (!optionalQuartier.isPresent()) {
|
||||
throw new BadRequestException("Impossible d'enregistrer une parcelle avec un quartier/village inexistant");
|
||||
}
|
||||
|
||||
Optional<TypeDomaine> optionalTypeDomaine = typeDomaineRepository.findById(parcellePayLoadWeb.getTypeDomaineId());
|
||||
if (!optionalTypeDomaine.isPresent()) {
|
||||
throw new BadRequestException("Veuillez préciser le type de domaine");
|
||||
}
|
||||
|
||||
Parcelle parcelle = new Parcelle();
|
||||
parcelle.setNatureDomaine(optionalNatureDomaine.orElse(null));
|
||||
parcelle.setQuartier(optionalQuartier.orElse(null));
|
||||
parcelle = getParcelleFromPayload(parcelle, parcellePayLoadWeb);
|
||||
parcelle = entityFromPayLoadService.getParcelleFromPayload(parcellePayLoadWeb);
|
||||
parcelle= parcelleRepository.save(parcelle);
|
||||
return parcelleRepository.findParcelleToDtoById(parcelle.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParcellePayLoadWeb updateParcelle(Long id, ParcellePayLoadWeb parcellePayLoadWeb) throws NotFoundException {
|
||||
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(parcellePayLoadWeb.getId());
|
||||
if (!optionalParcelle.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver la parcelle que vous désirer modifier");
|
||||
}
|
||||
Optional<NatureDomaine> optionalNatureDomaine = natureDomaineRepository.findById(parcellePayLoadWeb.getNatureDomaineId());
|
||||
if (!optionalNatureDomaine.isPresent()) {
|
||||
throw new BadRequestException("Impossible d'enregistrer une parcelle avec une nature de domaine inexistante");
|
||||
}
|
||||
Optional<Quartier> optionalQuartier = quartierRepository.findById(parcellePayLoadWeb.getQuartierId());
|
||||
if (!optionalQuartier.isPresent()) {
|
||||
throw new BadRequestException("Impossible d'enregistrer une parcelle avec un quartier/village inexistant");
|
||||
}
|
||||
// Optional<SituationGeographique> optionalSituationGeographique = situationGeographiqueRepository.findById(parcellePayLoadWeb.getSituationGeographiqueId());
|
||||
// if (!optionalSituationGeographique.isPresent()) {
|
||||
// throw new BadRequestException("Impossible d'enregistrer une parcelle avec une situation géographique inexistant");
|
||||
// }
|
||||
Parcelle parcelle=optionalParcelle.get();
|
||||
parcelle.setNatureDomaine(optionalNatureDomaine.orElse(null));
|
||||
parcelle.setQuartier(optionalQuartier.orElse(null));
|
||||
parcelle = getParcelleFromPayload(optionalParcelle.get(), parcellePayLoadWeb);
|
||||
if(parcellePayLoadWeb.getId()!=null) {
|
||||
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(parcellePayLoadWeb.getId());
|
||||
if (!optionalParcelle.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver la parcelle que vous désirer modifier");
|
||||
}
|
||||
}
|
||||
|
||||
Parcelle parcelle = new Parcelle();
|
||||
parcelle = entityFromPayLoadService.getParcelleFromPayload(parcellePayLoadWeb);
|
||||
parcelle= parcelleRepository.save(parcelle);
|
||||
return parcelleRepository.findParcelleToDtoById(parcelle.getId()).orElse(null);
|
||||
}
|
||||
@@ -193,6 +193,13 @@ public class ParcelleServiceImpl implements ParcelleService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Integer majParcelleBatieNonbatie() {
|
||||
return parcelleRepository.updateParcelleBatieTrue()+parcelleRepository.updateParcelleBatieFalse();
|
||||
}
|
||||
|
||||
|
||||
private List<Long> getSecteurIdListForUser(Long userId) {
|
||||
List<Secteur> secteurs = secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
@@ -202,28 +209,6 @@ public class ParcelleServiceImpl implements ParcelleService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Parcelle getParcelleFromPayload(Parcelle parcelle, ParcellePayLoadWeb parcellePayLoadWeb) {
|
||||
if(parcellePayLoadWeb.getRueId()!=null) {
|
||||
Optional<Rue> optionalRue = rueRepository.findById(parcellePayLoadWeb.getRueId());
|
||||
parcelle.setRue(optionalRue.orElse(null));
|
||||
}
|
||||
parcelle.setP(parcellePayLoadWeb.getP());
|
||||
parcelle.setI(parcellePayLoadWeb.getI());
|
||||
parcelle.setQ(parcellePayLoadWeb.getQ());
|
||||
parcelle.setNup(parcellePayLoadWeb.getNup());
|
||||
parcelle.setLatitude(parcellePayLoadWeb.getLatitude());
|
||||
parcelle.setLongitude(parcellePayLoadWeb.getLongitude());
|
||||
parcelle.setAltitude(parcellePayLoadWeb.getAltitude());
|
||||
parcelle.setSituationGeographique(parcellePayLoadWeb.getSituationGeographique());
|
||||
parcelle.setNupProvisoire(parcellePayLoadWeb.getNupProvisoire());
|
||||
parcelle.setAutreNumeroTitreFoncier(parcellePayLoadWeb.getNumTitreFoncier());
|
||||
parcelle.setObservation(parcellePayLoadWeb.getObservation());
|
||||
parcelle.setSuperficie(parcellePayLoadWeb.getSuperficie());
|
||||
|
||||
return parcelle;
|
||||
}
|
||||
|
||||
// private Parcelle getParcelle(Parcelle parcelle, ParcellePayLoadWeb parcellePayLoadWeb, Optional<SituationGeographique> optionalSituationGeographique, Optional<NatureDomaine> optionalNatureDomaine) {
|
||||
// StringBuilder coordonnees = new StringBuilder();
|
||||
// parcelle.setP(parcellePayLoadWeb.getP());
|
||||
|
||||
@@ -253,12 +253,28 @@ public class PersonneServiceImpl implements PersonneService {
|
||||
|
||||
@Override
|
||||
public List<PersonnePayLoadWeb> recherchePersonne(RecherchePersonneResquestBody request) {
|
||||
|
||||
List<PersonnePayLoadWeb> result = new ArrayList<>(
|
||||
recherchePersonneLocal(request)
|
||||
);
|
||||
|
||||
try {
|
||||
|
||||
if(request.getIfu()!=null && !request.getIfu().equals("")){
|
||||
List<PersonnePayLoadWeb> personnePayLoadWebs =personneRepository.findAllPersonneByIfuToDto(request.getIfu());
|
||||
if(!personnePayLoadWebs.isEmpty())
|
||||
return personnePayLoadWebs;
|
||||
}
|
||||
|
||||
if(request.getNpi()!=null && !request.getNpi().equals("")){
|
||||
|
||||
List<PersonnePayLoadWeb> personnePayLoadWebs = personneRepository.findAllPersonneByNpiToDto(request.getNpi());
|
||||
if(!personnePayLoadWebs.isEmpty())
|
||||
return personnePayLoadWebs;
|
||||
}
|
||||
|
||||
List<PersonnePayLoadWeb> result=new ArrayList<>();
|
||||
|
||||
result = recherchePersonneLocal(request);
|
||||
|
||||
if (result != null && !result.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
// Conversion date en String format yyyy-MM-dd
|
||||
String dateNaissance = Optional.ofNullable(request.getDateNaissance())
|
||||
.map(d -> d.format(DateTimeFormatter.ISO_LOCAL_DATE))
|
||||
@@ -301,29 +317,48 @@ public class PersonneServiceImpl implements PersonneService {
|
||||
personne.setEtatIdentificationPersonne(EtatIdentificationPersonne.IFU);
|
||||
result.add(personne);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
// logger.error("Erreur appel IFU EN LIGNE", e);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private List<PersonnePayLoadWeb> recherchePersonneLocal(RecherchePersonneResquestBody recherchePersonneResquestBody) {
|
||||
// private List<PersonnePayLoadWeb> recherchePersonneLocal(RecherchePersonneResquestBody recherchePersonneResquestBody) {
|
||||
// System.out.println("NOUS SOMMES DANS RECHERCHE NOM ET PRENOM :"+recherchePersonneResquestBody.getNom()+" "+recherchePersonneResquestBody.getPrenom());
|
||||
// List<PersonnePayLoadWeb> personnePayLoadWebs=
|
||||
// personneRepository.findByFiltersInBaseIfuNpiCorrecte(
|
||||
// recherchePersonneResquestBody.getNom()==null?null: "%"+recherchePersonneResquestBody.getNom().trim().toUpperCase()+"%",
|
||||
// recherchePersonneResquestBody.getPrenom()==null?null: "%"+recherchePersonneResquestBody.getPrenom().trim().toUpperCase()+"%",
|
||||
// recherchePersonneResquestBody.getRaisonSociale()==null?null: "%"+recherchePersonneResquestBody.getRaisonSociale().trim().toUpperCase()+"%",
|
||||
// recherchePersonneResquestBody.getNomMere()==null?null: "%"+recherchePersonneResquestBody.getNomMere().trim().toUpperCase()+"%"
|
||||
// );
|
||||
// return personnePayLoadWebs ;
|
||||
// }
|
||||
|
||||
List<PersonnePayLoadWeb> personnePayLoadWebs=
|
||||
personneRepository.findByFiltersInBaseIfuNpiCorrecte(
|
||||
recherchePersonneResquestBody.getIfu()==null?null:recherchePersonneResquestBody.getIfu().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getNpi()==null?null:recherchePersonneResquestBody.getNpi().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getNom()==null?null:recherchePersonneResquestBody.getNom().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getPrenom()==null?null:recherchePersonneResquestBody.getPrenom().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getRaisonSociale()==null?null:recherchePersonneResquestBody.getRaisonSociale().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getNomMere()==null?null:recherchePersonneResquestBody.getNomMere().trim().toLowerCase(),
|
||||
recherchePersonneResquestBody.getDateNaissance()
|
||||
);
|
||||
return personnePayLoadWebs ;
|
||||
private List<PersonnePayLoadWeb> recherchePersonneLocal(RecherchePersonneResquestBody request) {
|
||||
String nom = normalizeLikeParam(request.getNom());
|
||||
String prenom = normalizeLikeParam(request.getPrenom());
|
||||
String raisonSociale = normalizeLikeParam(request.getRaisonSociale());
|
||||
String nomMere = normalizeLikeParam(request.getNomMere());
|
||||
|
||||
return personneRepository.findByFiltersInBaseIfuNpiCorrecte(
|
||||
nom,
|
||||
prenom,
|
||||
raisonSociale,
|
||||
nomMere
|
||||
);
|
||||
}
|
||||
private String normalizeLikeParam(String value) {
|
||||
if (value == null) return null;
|
||||
|
||||
String cleaned = value.trim();
|
||||
|
||||
if (cleaned.isEmpty()) return null;
|
||||
|
||||
return "%" + cleaned.toUpperCase() + "%";
|
||||
}
|
||||
private List<PersonnePayLoadWeb> recherchePersonneSigibe(RecherchePersonneResquestBody recherchePersonneResquestBody) {
|
||||
// callAPIService.callGetIfuEnLigneToken();
|
||||
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
package io.gmss.fiscad.implementations.infocad.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.decoupage.Section;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.user.AvoirFonction;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.StructurePaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.response.StructureResponse;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.StructureRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.user.AvoirFonctionRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@AllArgsConstructor
|
||||
@@ -23,6 +28,7 @@ public class StructureServiceImpl implements StructureService {
|
||||
|
||||
private final StructureRepository structureRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final AvoirFonctionRepository avoirFonctionRepository;
|
||||
|
||||
@Override
|
||||
public StructurePaylaodWeb createStructure(StructurePaylaodWeb structurePaylaodWeb) throws BadRequestException {
|
||||
@@ -89,5 +95,29 @@ public class StructureServiceImpl implements StructureService {
|
||||
return structureRepository.findStructureToDtoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Structure> getListStructureUserId(Long userId) {
|
||||
List<AvoirFonction> avoirFonctions= avoirFonctionRepository.findAvoirFonctionByUser_Id(userId);
|
||||
List<Structure> structures = new ArrayList<>();
|
||||
avoirFonctions.stream()
|
||||
.filter(af -> af.getDateFin() == null || af.getDateFin().isAfter(LocalDate.now()))
|
||||
.forEach(avoirFonction -> {
|
||||
if(avoirFonction.getFonction().getStructure()!=null){
|
||||
structures.addAll(List.of(avoirFonction.getFonction().getStructure()));
|
||||
}else if (avoirFonction.getFonction().getDepartement()!=null){
|
||||
structures.addAll(structureRepository.findDistinctByCommune_Departement_Id(avoirFonction.getFonction().getDepartement().getId()));
|
||||
}
|
||||
});
|
||||
return structures;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public List<Long> getStructureIdListForUser(Long userId) {
|
||||
// List<Structure> structures = secteurService.getListSecteurUserId(userId);
|
||||
// List<Long> secteurIds = secteurs.stream()
|
||||
// .map(Secteur::getId)
|
||||
// .toList();
|
||||
// return secteurIds;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.CategorieBatiment;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.BatimentService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BatimentPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CategorieBatimentRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -19,6 +23,8 @@ import java.util.Optional;
|
||||
public class BatimentServiceImpl implements BatimentService {
|
||||
|
||||
private final BatimentRepository batimentRepository;
|
||||
private final ParcelleRepository parcelleRepository;
|
||||
private final CategorieBatimentRepository categorieBatimentRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
|
||||
@@ -27,8 +33,22 @@ public class BatimentServiceImpl implements BatimentService {
|
||||
if (batimentPaylaodWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment ayant un id non null.");
|
||||
}
|
||||
if (batimentPaylaodWeb.getParcelleId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La parcelle doit être précisée.");
|
||||
}else {
|
||||
if(!parcelleRepository.existsById(batimentPaylaodWeb.getParcelleId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La parcelle doit être précisée.");
|
||||
}
|
||||
|
||||
if (batimentPaylaodWeb.getCategorieBatimentId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La catégorie doit être précisée.");
|
||||
}else {
|
||||
if(!categorieBatimentRepository.existsById(batimentPaylaodWeb.getCategorieBatimentId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La catégorie doit être précisée.");
|
||||
}
|
||||
Batiment batiment= entityFromPayLoadService.getBatimentFromPayLoadWeb(batimentPaylaodWeb);
|
||||
batiment= batimentRepository.save(batiment);
|
||||
System.out.println(batiment.getId());
|
||||
return batimentRepository.findBatimentAvecOccupantCourantToDto(batiment.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@@ -40,6 +60,19 @@ public class BatimentServiceImpl implements BatimentService {
|
||||
if (!batimentRepository.existsById(batimentPaylaodWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver le batiment spécifié dans notre base de données.");
|
||||
}
|
||||
if (batimentPaylaodWeb.getParcelleId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La parcelle doit être précisée.");
|
||||
}else {
|
||||
if(!parcelleRepository.existsById(batimentPaylaodWeb.getParcelleId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La parcelle doit être précisée.");
|
||||
}
|
||||
|
||||
if (batimentPaylaodWeb.getCategorieBatimentId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La catégorie doit être précisée.");
|
||||
}else {
|
||||
if(!categorieBatimentRepository.existsById(batimentPaylaodWeb.getCategorieBatimentId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La catégorie doit être précisée.");
|
||||
}
|
||||
Batiment batiment= entityFromPayLoadService.getBatimentFromPayLoadWeb(batimentPaylaodWeb);
|
||||
batiment= batimentRepository.save(batiment);
|
||||
return batimentRepository.findBatimentAvecOccupantCourantToDto(batiment.getId()).orElse(null);
|
||||
@@ -85,4 +118,14 @@ public class BatimentServiceImpl implements BatimentService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<BatimentPaylaodWeb> getBatimentListByquartierPageable(Long quartierId, Pageable pageable) {
|
||||
return batimentRepository.findAllBatimentsAvecOccupantCourantByQuartierToDtoPageble(quartierId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BatimentPaylaodWeb> getBatimentListByquartier(Long quartierId) {
|
||||
return batimentRepository.findAllBatimentsAvecOccupantCourantByQuartierToDto(quartierId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ public class CaracteristiqueBatimentServiceImpl implements CaracteristiqueBatime
|
||||
return caracteristiqueBatimentRepository.findAllCaracteristiqueBatimentToDto();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<CaracteristiqueBatimentPayloadWeb> getCaracteristiqueBatimentToDto(Long id) {
|
||||
if (caracteristiqueBatimentRepository.existsById(id)) {
|
||||
|
||||
@@ -4,9 +4,12 @@ import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.rfu.metier.DonneesImpositionTfu;
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.response.DonneesImpositionTfuResponse;
|
||||
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
@@ -15,6 +18,7 @@ import io.gmss.fiscad.persistence.repositories.rfu.metier.DonneesImpositionTfuRe
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.ImpositionsTfuRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuNonBatiRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.ExerciceRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
@@ -36,6 +40,7 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
private final BaremRfuNonBatiRepository baremRfuNonBatiRepository;
|
||||
private final ExerciceRepository exerciceRepository;
|
||||
private final ArrondissementRepository arrondissementRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
|
||||
|
||||
@@ -91,91 +96,51 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Long genererDonneesFiscales(ImpositionsTfu impositionsTfu) {
|
||||
List<DonneesImpositionTfuResponse> donneesImpositionTfuResponses= donneesImpositionTfuRepository.findAllDonneesImpositionTfu(impositionsTfu.getCommune().getId(),impositionsTfu.getExercice().getAnnee());
|
||||
Long n=0l;
|
||||
for (DonneesImpositionTfuResponse donneesImpositionTfuResponse: donneesImpositionTfuResponses){
|
||||
DonneesImpositionTfu donneesImpositionTfu=new DonneesImpositionTfu();
|
||||
donneesImpositionTfu.setImpositionsTfu(impositionsTfu);
|
||||
donneesImpositionTfu.setZoneRfuId(donneesImpositionTfuResponse.getZoneRfuId());
|
||||
donneesImpositionTfu.setCodeQuartierVillage(donneesImpositionTfuResponse.getCodeQuartierVillage());
|
||||
donneesImpositionTfu.setNomQuartierVillage(donneesImpositionTfuResponse.getNomQuartierVillage());
|
||||
donneesImpositionTfu.setCodeArrondissement(donneesImpositionTfuResponse.getCodeArrondissement());
|
||||
donneesImpositionTfu.setNomArrondissement(donneesImpositionTfuResponse.getNomArrondissement());
|
||||
donneesImpositionTfu.setCodeCommune(donneesImpositionTfuResponse.getCodeCommune());
|
||||
donneesImpositionTfu.setNomCommune(donneesImpositionTfuResponse.getNomCommune());
|
||||
donneesImpositionTfu.setCodeDepartement(donneesImpositionTfuResponse.getCodeDepartement());
|
||||
donneesImpositionTfu.setNomDepartement(donneesImpositionTfuResponse.getNomDepartement());
|
||||
donneesImpositionTfu.setQ(donneesImpositionTfuResponse.getQ());
|
||||
donneesImpositionTfu.setIlot(donneesImpositionTfuResponse.getIlot());
|
||||
donneesImpositionTfu.setParcelle(donneesImpositionTfuResponse.getParcelle());
|
||||
donneesImpositionTfu.setLatitude(donneesImpositionTfuResponse.getLatitude());
|
||||
donneesImpositionTfu.setLongitude(donneesImpositionTfuResponse.getLongitude());
|
||||
donneesImpositionTfu.setNup(donneesImpositionTfuResponse.getNup());
|
||||
donneesImpositionTfu.setNupProvisoire(donneesImpositionTfuResponse.getNupProvisoire());
|
||||
donneesImpositionTfu.setSuperficieParc(donneesImpositionTfuResponse.getSuperficieParc());
|
||||
donneesImpositionTfu.setAdresseProp(donneesImpositionTfuResponse.getAdresseProp());
|
||||
donneesImpositionTfu.setAnnee(donneesImpositionTfuResponse.getAnnee());
|
||||
donneesImpositionTfu.setAdresseSc(donneesImpositionTfuResponse.getAdresseSc());
|
||||
donneesImpositionTfu.setBatieOuiNon(donneesImpositionTfuResponse.getBatieOuiNon());
|
||||
donneesImpositionTfu.setTfuMinimum(donneesImpositionTfuResponse.getTfuMinimum());
|
||||
donneesImpositionTfu.setCategorieBat(donneesImpositionTfuResponse.getCategorieBat());
|
||||
donneesImpositionTfu.setDateEnquete(donneesImpositionTfuResponse.getDateEnquete());
|
||||
donneesImpositionTfu.setEmailProp(donneesImpositionTfuResponse.getEmailProp());
|
||||
donneesImpositionTfu.setEmailSc(donneesImpositionTfuResponse.getEmailSc());
|
||||
donneesImpositionTfu.setMontantLoyerAnnuel(donneesImpositionTfuResponse.getMontantLoyerAnnuel());
|
||||
donneesImpositionTfu.setEnqueteId(donneesImpositionTfuResponse.getEnqueteId());
|
||||
donneesImpositionTfu.setExhonereOuiNon(donneesImpositionTfuResponse.getExhonereOuiNon());
|
||||
donneesImpositionTfu.setIfu(donneesImpositionTfuResponse.getIfu());
|
||||
donneesImpositionTfu.setNombreBat(donneesImpositionTfuResponse.getNombreBat());
|
||||
donneesImpositionTfu.setNombrePiscine(donneesImpositionTfuResponse.getNombrePiscine());
|
||||
donneesImpositionTfu.setNombreUlog(donneesImpositionTfuResponse.getNombreUlog());
|
||||
donneesImpositionTfu.setNomProp(donneesImpositionTfuResponse.getNomProp());
|
||||
donneesImpositionTfu.setNomSc(donneesImpositionTfuResponse.getNomSc());
|
||||
donneesImpositionTfu.setNpi(donneesImpositionTfuResponse.getNpi());
|
||||
donneesImpositionTfu.setNumBatiment(donneesImpositionTfuResponse.getNumBatiment()==null?"":donneesImpositionTfuResponse.getNumBatiment());
|
||||
donneesImpositionTfu.setNumUniteLogement(donneesImpositionTfuResponse.getNumUniteLogement()==null?"":donneesImpositionTfuResponse.getNumUniteLogement());
|
||||
donneesImpositionTfu.setPrenomProp(donneesImpositionTfuResponse.getPrenomProp());
|
||||
donneesImpositionTfu.setPrenomSc(donneesImpositionTfuResponse.getPrenomSc());
|
||||
donneesImpositionTfu.setRaisonSociale(donneesImpositionTfuResponse.getRaisonSociale());
|
||||
donneesImpositionTfu.setSecteurId(donneesImpositionTfuResponse.getSecteurId());
|
||||
donneesImpositionTfu.setStandingBat(donneesImpositionTfuResponse.getStandingBat());
|
||||
donneesImpositionTfu.setStructureId(donneesImpositionTfuResponse.getStructureId());
|
||||
donneesImpositionTfu.setSuperficieAuSolBat(donneesImpositionTfuResponse.getSuperficieAuSolBat());
|
||||
donneesImpositionTfu.setSuperficieAuSolUlog(donneesImpositionTfuResponse.getSuperficieAuSolUlog());
|
||||
donneesImpositionTfu.setTelProp(donneesImpositionTfuResponse.getTelProp());
|
||||
donneesImpositionTfu.setTelSc(donneesImpositionTfuResponse.getTelSc());
|
||||
donneesImpositionTfu.setTfuMetreCarre(donneesImpositionTfuResponse.getTfuMetreCarre());
|
||||
donneesImpositionTfu.setTitreFoncier(donneesImpositionTfuResponse.getTitreFoncier());
|
||||
donneesImpositionTfu.setValeurLocativeAdm(donneesImpositionTfuResponse.getValeurLocativeAdm());
|
||||
donneesImpositionTfu.setBatimentExhonereOuiNon(donneesImpositionTfuResponse.getBatimentExhonereOuiNon());
|
||||
donneesImpositionTfu.setUniteLogementExhonereOuiNon(donneesImpositionTfuResponse.getUniteLogementExhonereOuiNon());
|
||||
try {
|
||||
Optional<BaremRfuNonBati> baremRfuNonBatiOptional=baremRfuNonBatiRepository.findAllByCommune_IdAndZoneRfu_Id(impositionsTfu.getCommune().getId(),donneesImpositionTfu.getZoneRfuId());
|
||||
if(baremRfuNonBatiOptional.isPresent()){
|
||||
donneesImpositionTfu.setValeurAdministrativeParcelleNonBati(baremRfuNonBatiOptional.get().getValeurAdministrative());
|
||||
donneesImpositionTfu.setTauxParcelleNonBati(baremRfuNonBatiOptional.get().getTaux());
|
||||
}
|
||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatie(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId) {
|
||||
Integer nb= donneesImpositionTfuRepository.genererDonneesTfuNonBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
||||
|
||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
impositionsTfu.setStatusAvis(StatusAvis.TFU_FNB_GENERE);
|
||||
|
||||
impositionsTfu.setNombreAvisFnb(nb);
|
||||
|
||||
donneesImpositionTfuRepository.save(donneesImpositionTfu);
|
||||
n++;
|
||||
}catch (DataIntegrityViolationException e) {
|
||||
if (e.getCause() instanceof org.hibernate.exception.ConstraintViolationException constraintEx &&
|
||||
constraintEx.getSQLException().getSQLState().equals("23505")) {
|
||||
System.out.println("Doublon détecté (clé unique) !");
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
impositionsTfuRepository.save(impositionsTfu);
|
||||
return n;
|
||||
|
||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DonneesImpositionTfu> getDonneesFiscalesByImposition(Long impositionsId) {
|
||||
return donneesImpositionTfuRepository.findAllByImpositionsTfu_Id(impositionsId);
|
||||
@Transactional
|
||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleBatie(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId) {
|
||||
|
||||
Integer nbb= donneesImpositionTfuRepository.genererDonneesTfuBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
||||
|
||||
Integer nbulo= donneesImpositionTfuRepository.genererDonneesTfuBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
||||
|
||||
// Integer nbirfbt= donneesImpositionTfuRepository.genererDonneesIrfBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
||||
//
|
||||
// Integer nbirfulo= donneesImpositionTfuRepository.genererDonneesIrfBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
||||
//
|
||||
// Integer nbsrtbbt= donneesImpositionTfuRepository.genererDonneesSrtbBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
||||
//
|
||||
// Integer nbsrtbulo= donneesImpositionTfuRepository.genererDonneesSrtbBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
||||
|
||||
|
||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
impositionsTfu.setStatusAvis(StatusAvis.GENERE);
|
||||
|
||||
impositionsTfu.setNombreAvis(nbb+nbulo+ (impositionsTfu.getNombreAvisFnb()==null?0:impositionsTfu.getNombreAvisFnb()));
|
||||
impositionsTfu.setNombreAvisBatiment(nbb);
|
||||
impositionsTfu.setNombreAvisUniteLog(nbulo);
|
||||
|
||||
impositionsTfuRepository.save(impositionsTfu);
|
||||
|
||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImposition(Long impositionsId) {
|
||||
return donneesImpositionTfuRepository.findAllByImpositionTfuId(impositionsId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,4 +152,59 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdPageable(Long impositionsTfuId, Pageable pageable) {
|
||||
return donneesImpositionTfuRepository.findAllByImpositionTfuIdPageable(impositionsTfuId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdNonBatiePageable(Long impositionsTfuId, Pageable pageable) {
|
||||
return donneesImpositionTfuRepository.findAllByImpositionTfuIdNonBatiePageable(impositionsTfuId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdBatieBatimentPageable(Long impositionsTfuId, Pageable pageable) {
|
||||
return donneesImpositionTfuRepository.findAllByImpositionTfuIdBatieBatimentPageable(impositionsTfuId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdBatieUniteLogPageable(Long impositionsTfuId, Pageable pageable) {
|
||||
return donneesImpositionTfuRepository.findAllByImpositionTfuIdBatieUniteLogPageable(impositionsTfuId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionIrfIdBatieBatimentPageable(Long impositionsTfuId, Pageable pageable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionIrfIdBatieUniteLogPageable(Long impositionsTfuId, Pageable pageable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionSrtbIdBatieBatimentPageable(Long impositionsTfuId, Pageable pageable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionSrtbIdBatieUniteLogPageable(Long impositionsTfuId, Pageable pageable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByExerciceAndStructureIdPageable(Long exerciceId, Long structureId, Pageable pageable) {
|
||||
return donneesImpositionTfuRepository.findAllByExericeIdStructureIdPageable(exerciceId,structureId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByExerciceAndStructureId(Long exerciceId, Long structureId,Long quartierId) {
|
||||
return donneesImpositionTfuRepository.findAllByExericeIdStructureId(exerciceId,structureId,quartierId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByPersonneId(Long personneId) {
|
||||
return donneesImpositionTfuRepository.findAllByPersonneId(personneId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,59 +1,103 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.BatimentService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueBatimentService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteBatimentService;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BaremRfuNonBatiPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BatimentPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.NotAcceptableException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
|
||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||
private final BatimentService batimentService;
|
||||
private final EnqueteRepository enqueteRepository;
|
||||
private final PersonneRepository personneRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final CaracteristiqueBatimentService caracteristiqueBatimentService;
|
||||
private final UploadRepository uploadRepository;
|
||||
private final BatimentRepository batimentRepository;
|
||||
private final BatimentService batimentService;
|
||||
private final SecteurService secteurService;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public EnqueteBatimentPayloadWeb createEnqueteBatiment(EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) throws BadRequestException {
|
||||
EnqueteBatiment enqueteBatiment=new EnqueteBatiment();
|
||||
if (!batimentRepository.existsById(enqueteBatimentPayloadWeb.getBatimentId())) {
|
||||
throw new NotFoundException("Impossible d'enregistrer sans le batiment.");
|
||||
|
||||
if(enqueteBatimentPayloadWeb.getBatimentId()!=null) {
|
||||
if (!batimentRepository.existsById(enqueteBatimentPayloadWeb.getBatimentId())) {
|
||||
throw new NotFoundException("Impossible d'enregistrer sans le batiment.");
|
||||
}
|
||||
}
|
||||
BatimentPaylaodWeb batimentPaylaodWeb= getBatimentPayloadFromEnqueteBat(enqueteBatimentPayloadWeb);
|
||||
|
||||
if(batimentPaylaodWeb.getId()==null){
|
||||
batimentPaylaodWeb=batimentService.createBatiment(batimentPaylaodWeb);
|
||||
}else{
|
||||
batimentPaylaodWeb=batimentService.updateBatiment(batimentPaylaodWeb.getId(),batimentPaylaodWeb);
|
||||
}
|
||||
|
||||
enqueteBatimentPayloadWeb.setBatimentId(batimentPaylaodWeb.getId());
|
||||
|
||||
enqueteBatiment = entityFromPayLoadService.getEnqueteBatimentFromPayLoadWeb(enqueteBatimentPayloadWeb);
|
||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||
enqueteBatimentPayloadWeb= enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||
return enqueteBatimentPayloadWeb ;
|
||||
}
|
||||
|
||||
private BatimentPaylaodWeb getBatimentPayloadFromEnqueteBat(EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) {
|
||||
BatimentPaylaodWeb batimentPaylaodWeb= new BatimentPaylaodWeb();
|
||||
batimentPaylaodWeb.setId(enqueteBatimentPayloadWeb.getBatimentId());
|
||||
batimentPaylaodWeb.setNub(enqueteBatimentPayloadWeb.getNub());
|
||||
batimentPaylaodWeb.setCode(enqueteBatimentPayloadWeb.getCode());
|
||||
batimentPaylaodWeb.setDateConstruction(enqueteBatimentPayloadWeb.getDateConstruction());
|
||||
batimentPaylaodWeb.setParcelleId(enqueteBatimentPayloadWeb.getParcelleId());
|
||||
batimentPaylaodWeb.setPersonneId(enqueteBatimentPayloadWeb.getPersonneId());
|
||||
batimentPaylaodWeb.setSuperficieAuSol(enqueteBatimentPayloadWeb.getSuperficieAuSol());
|
||||
batimentPaylaodWeb.setSuperficieLouee(enqueteBatimentPayloadWeb.getSuperficieLouee());
|
||||
batimentPaylaodWeb.setCategorieBatimentId(enqueteBatimentPayloadWeb.getCategorieBatimentId());
|
||||
batimentPaylaodWeb.setNombrePiscine(enqueteBatimentPayloadWeb.getNombrePiscine());
|
||||
batimentPaylaodWeb.setMontantLocatifAnnuelDeclare(enqueteBatimentPayloadWeb.getMontantLocatifAnnuelDeclare());
|
||||
batimentPaylaodWeb.setMontantLocatifAnnuelEstime(enqueteBatimentPayloadWeb.getMontantLocatifAnnuelEstime());
|
||||
batimentPaylaodWeb.setValeurBatimentEstime(enqueteBatimentPayloadWeb.getValeurBatimentEstime());
|
||||
batimentPaylaodWeb.setValeurBatimentReel(enqueteBatimentPayloadWeb.getValeurBatimentReel());
|
||||
batimentPaylaodWeb.setMontantMensuelLocation(enqueteBatimentPayloadWeb.getMontantMensuelLocation());
|
||||
batimentPaylaodWeb.setUsageId(enqueteBatimentPayloadWeb.getUsageId());
|
||||
batimentPaylaodWeb.setNbreUniteLogement(enqueteBatimentPayloadWeb.getNbreUniteLogement());
|
||||
return batimentPaylaodWeb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public EnqueteBatimentPayloadWeb updateEnqueteBatiment(Long id, EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) throws NotFoundException {
|
||||
if (enqueteBatimentPayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle enquete de batiment ayant un id null.");
|
||||
@@ -64,6 +108,18 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
if (!batimentRepository.existsById(enqueteBatimentPayloadWeb.getBatimentId())) {
|
||||
throw new NotFoundException("Impossible d'enregistrer sans le batiment.");
|
||||
}
|
||||
|
||||
BatimentPaylaodWeb batimentPaylaodWeb= getBatimentPayloadFromEnqueteBat(enqueteBatimentPayloadWeb);
|
||||
|
||||
if(batimentPaylaodWeb.getId()==null){
|
||||
batimentPaylaodWeb=batimentService.createBatiment(batimentPaylaodWeb);
|
||||
}else{
|
||||
batimentPaylaodWeb=batimentService.updateBatiment(batimentPaylaodWeb.getId(),batimentPaylaodWeb);
|
||||
}
|
||||
|
||||
enqueteBatimentPayloadWeb.setBatimentId(batimentPaylaodWeb.getId());
|
||||
|
||||
|
||||
EnqueteBatiment enqueteBatiment = entityFromPayLoadService.getEnqueteBatimentFromPayLoadWeb(enqueteBatimentPayloadWeb);
|
||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||
enqueteBatimentPayloadWeb= enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||
@@ -110,4 +166,84 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
public List<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentList(Long batimentId) {
|
||||
return enqueteBatimentRepository.findAllByBatimentToDto(batimentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
|
||||
return enqueteBatimentRepository.findAllEnqueteBatimentByQuartierByStatutToDtoPageable(quartierId,secteurIds,statutEnquete,pageable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnqueteBatimentPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
||||
}
|
||||
Optional<EnqueteBatiment> optionalEnqueteBatiment = enqueteBatimentRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnqueteBatiment.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
||||
}
|
||||
if(optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.REJETE ){
|
||||
throw new NotAcceptableException("Impossible de valider : Le statut actuel "+optionalEnqueteBatiment.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
|
||||
EnqueteBatiment enqueteBatiment = optionalEnqueteBatiment.get();
|
||||
enqueteBatiment.setDateValidation(LocalDate.now());
|
||||
enqueteBatiment.setStatutEnquete(StatutEnquete.VALIDE);
|
||||
|
||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||
return enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnqueteBatimentPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
throw new BadRequestException("Impossible de rejeter une enquête ayant un id null.");
|
||||
}
|
||||
Optional<EnqueteBatiment> optionalEnqueteBatiment = enqueteBatimentRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnqueteBatiment.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez rejeter.");
|
||||
}
|
||||
if(optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.VALIDE ){
|
||||
throw new NotAcceptableException("Impossible de rejeter : Le statut actuel "+optionalEnqueteBatiment.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
EnqueteBatiment enqueteBatiment = optionalEnqueteBatiment.get();
|
||||
enqueteBatiment.setDateRejet(LocalDate.now());
|
||||
enqueteBatiment.setDescriptionMotifRejet(enqueteTraitementPayLoad.getMotifRejet());
|
||||
enqueteBatiment.setStatutEnquete(StatutEnquete.REJETE);
|
||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||
return enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteBatimentPayloadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteBatimentPayloadWeb> enqueteBatimentPayloadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enqueteBatimentPayloadWebs.add(validerEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enqueteBatimentPayloadWebs.add(null);
|
||||
}
|
||||
return enqueteBatimentPayloadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteBatimentPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteBatimentPayloadWeb> enqueteBatimentPayloadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enqueteBatimentPayloadWebs.add(rejeterEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enqueteBatimentPayloadWebs.add(null);
|
||||
}
|
||||
return enqueteBatimentPayloadWebs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,36 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.*;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueUniteLogementService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteUniteLogementService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.UniteLogementService;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.UniteLogementPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteUniteLogementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.UniteLogementRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.NotAcceptableException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@AllArgsConstructor
|
||||
@@ -28,31 +38,65 @@ import java.util.Optional;
|
||||
public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementService {
|
||||
|
||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||
private final UniteLogementService uniteLogementService;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService ;
|
||||
private final PersonneRepository personneRepository ;
|
||||
private final EnqueteRepository enqueteRepository ;
|
||||
private final UploadRepository uploadRepository ;
|
||||
private final UniteLogementRepository uniteLogementRepository ;
|
||||
private final CaracteristiqueUniteLogementService caracteristiqueUniteLogementService ;
|
||||
private final UniteLogementService uniteLogementService ;
|
||||
private final SecteurService secteurService ;
|
||||
|
||||
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public EnqueteUniteLogementPayloadWeb createEnqueteUniteLogement(EnqueteUniteLogementPayloadWeb enqueteUniteLogementPayloadWeb) throws BadRequestException {
|
||||
EnqueteUniteLogement enqueteUniteLogement=new EnqueteUniteLogement();
|
||||
Optional<UniteLogement> optionalUniteLogement= Optional.empty();
|
||||
|
||||
if (enqueteUniteLogementPayloadWeb.getUniteLogementId() == null) {
|
||||
throw new BadRequestException("Impossible d'enregistrer une nouvelle enquete d'unité de logement sans l'unité de logement.");
|
||||
if(enqueteUniteLogementPayloadWeb.getUniteLogementId()!=null) {
|
||||
if (!uniteLogementRepository.existsById(enqueteUniteLogementPayloadWeb.getUniteLogementId())) {
|
||||
throw new NotFoundException("Unité de logement inexistant.");
|
||||
}
|
||||
}
|
||||
|
||||
UniteLogementPaylaodWeb uniteLogementPaylaodWeb=getUniteLogementPayloadFromEnqueteUl(enqueteUniteLogementPayloadWeb);
|
||||
|
||||
if(uniteLogementPaylaodWeb.getId()==null){
|
||||
uniteLogementPaylaodWeb= uniteLogementService.createUniteLogement(uniteLogementPaylaodWeb);
|
||||
}else{
|
||||
uniteLogementPaylaodWeb= uniteLogementService.updateUniteLogement(uniteLogementPaylaodWeb.getId(),uniteLogementPaylaodWeb);
|
||||
}
|
||||
enqueteUniteLogementPayloadWeb.setUniteLogementId(uniteLogementPaylaodWeb.getId());
|
||||
|
||||
enqueteUniteLogement = entityFromPayLoadService.getEnqueteUniteLogementFromPayLoadWeb(enqueteUniteLogementPayloadWeb);
|
||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||
enqueteUniteLogementPayloadWeb = enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||
return enqueteUniteLogementPayloadWeb ;
|
||||
}
|
||||
|
||||
private UniteLogementPaylaodWeb getUniteLogementPayloadFromEnqueteUl(EnqueteUniteLogementPayloadWeb enqueteUniteLogementPayloadWeb) {
|
||||
UniteLogementPaylaodWeb uniteLogementPaylaodWeb=new UniteLogementPaylaodWeb();
|
||||
uniteLogementPaylaodWeb.setId(enqueteUniteLogementPayloadWeb.getUniteLogementId());
|
||||
uniteLogementPaylaodWeb.setNul(enqueteUniteLogementPayloadWeb.getNul());
|
||||
uniteLogementPaylaodWeb.setNumeroEtage(enqueteUniteLogementPayloadWeb.getNumeroEtage());
|
||||
uniteLogementPaylaodWeb.setCode(enqueteUniteLogementPayloadWeb.getCode());
|
||||
uniteLogementPaylaodWeb.setBatimentId(enqueteUniteLogementPayloadWeb.getBatimentId());
|
||||
uniteLogementPaylaodWeb.setSuperficieAuSol(enqueteUniteLogementPayloadWeb.getSuperficieAuSol());
|
||||
uniteLogementPaylaodWeb.setSuperficieLouee(enqueteUniteLogementPayloadWeb.getSuperficieLouee());
|
||||
uniteLogementPaylaodWeb.setObservation(enqueteUniteLogementPayloadWeb.getObservation());
|
||||
uniteLogementPaylaodWeb.setDateConstruction(enqueteUniteLogementPayloadWeb.getDateConstruction());
|
||||
uniteLogementPaylaodWeb.setPersonneId(enqueteUniteLogementPayloadWeb.getPersonneId());
|
||||
uniteLogementPaylaodWeb.setCategorieBatimentId(enqueteUniteLogementPayloadWeb.getCategorieBatimentId());
|
||||
uniteLogementPaylaodWeb.setMontantLocatifAnnuelDeclare(enqueteUniteLogementPayloadWeb.getMontantLocatifAnnuelDeclare());
|
||||
uniteLogementPaylaodWeb.setMontantLocatifAnnuelEstime(enqueteUniteLogementPayloadWeb.getMontantLocatifAnnuelEstime());
|
||||
uniteLogementPaylaodWeb.setMontantMensuelLocation(enqueteUniteLogementPayloadWeb.getMontantMensuelLocation());
|
||||
uniteLogementPaylaodWeb.setValeurUniteLogementReel(enqueteUniteLogementPayloadWeb.getValeurUniteLogementReel());
|
||||
uniteLogementPaylaodWeb.setValeurUniteLogementEstime(enqueteUniteLogementPayloadWeb.getValeurUniteLogementEstime());
|
||||
uniteLogementPaylaodWeb.setNombrePiscine(enqueteUniteLogementPayloadWeb.getNombrePiscine());
|
||||
uniteLogementPaylaodWeb.setUsageId(enqueteUniteLogementPayloadWeb.getUsageId());
|
||||
return uniteLogementPaylaodWeb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public EnqueteUniteLogementPayloadWeb updateEnqueteUniteLogement(Long id, EnqueteUniteLogementPayloadWeb enqueteUniteLogementPayloadWeb) throws NotFoundException {
|
||||
if (enqueteUniteLogementPayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle enquete d'unité de logement ayant un id null.");
|
||||
@@ -68,6 +112,16 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
|
||||
EnqueteUniteLogement enqueteUniteLogement= new EnqueteUniteLogement();
|
||||
|
||||
UniteLogementPaylaodWeb uniteLogementPaylaodWeb=getUniteLogementPayloadFromEnqueteUl(enqueteUniteLogementPayloadWeb);
|
||||
|
||||
if(uniteLogementPaylaodWeb.getId()==null){
|
||||
uniteLogementPaylaodWeb= uniteLogementService.createUniteLogement(uniteLogementPaylaodWeb);
|
||||
}else{
|
||||
uniteLogementPaylaodWeb= uniteLogementService.updateUniteLogement(uniteLogementPaylaodWeb.getId(),uniteLogementPaylaodWeb);
|
||||
}
|
||||
enqueteUniteLogementPayloadWeb.setUniteLogementId(uniteLogementPaylaodWeb.getId());
|
||||
|
||||
|
||||
enqueteUniteLogement = entityFromPayLoadService.getEnqueteUniteLogementFromPayLoadWeb(enqueteUniteLogementPayloadWeb);
|
||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||
enqueteUniteLogementPayloadWeb = enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||
@@ -114,4 +168,84 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
|
||||
return enqueteUniteLogementRepository.findAllEnqueteUniteLogementByQuartierByStatutToDtoPageable(quartierId,secteurIds,statutEnquete,pageable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnqueteUniteLogementPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
||||
}
|
||||
Optional<EnqueteUniteLogement> optionalEnqueteUniteLogement = enqueteUniteLogementRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnqueteUniteLogement.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
||||
}
|
||||
if(optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.REJETE ){
|
||||
throw new NotAcceptableException("Impossible de valider : Le statut actuel "+optionalEnqueteUniteLogement.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
|
||||
EnqueteUniteLogement enqueteUniteLogement = optionalEnqueteUniteLogement.get();
|
||||
enqueteUniteLogement.setDateValidation(LocalDate.now());
|
||||
enqueteUniteLogement.setStatutEnquete(StatutEnquete.VALIDE);
|
||||
|
||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||
return enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnqueteUniteLogementPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
throw new BadRequestException("Impossible de rejeter une enquête ayant un id null.");
|
||||
}
|
||||
Optional<EnqueteUniteLogement> optionalEnqueteUniteLogement = enqueteUniteLogementRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnqueteUniteLogement.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez rejeter.");
|
||||
}
|
||||
if(optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.VALIDE ){
|
||||
throw new NotAcceptableException("Impossible de rejeter : Le statut actuel "+optionalEnqueteUniteLogement.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
EnqueteUniteLogement enqueteUniteLogement = optionalEnqueteUniteLogement.get();
|
||||
enqueteUniteLogement.setDateRejet(LocalDate.now());
|
||||
enqueteUniteLogement.setDescriptionMotifRejet(enqueteTraitementPayLoad.getMotifRejet());
|
||||
enqueteUniteLogement.setStatutEnquete(StatutEnquete.REJETE);
|
||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||
return enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteUniteLogementPayloadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteUniteLogementPayloadWeb> enqueteUniteLogementPayloadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enqueteUniteLogementPayloadWebs.add(validerEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enqueteUniteLogementPayloadWebs.add(null);
|
||||
}
|
||||
return enqueteUniteLogementPayloadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteUniteLogementPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteUniteLogementPayloadWeb> enqueteUniteLogementPayloadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enqueteUniteLogementPayloadWebs.add(rejeterEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enqueteUniteLogementPayloadWebs.add(null);
|
||||
}
|
||||
return enqueteUniteLogementPayloadWebs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,81 +1,154 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.ImpositionsTfuRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.NotAcceptableException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class ImpositionsTfuServiceImpl implements ImpositionsTfuService {
|
||||
|
||||
private final ImpositionsTfuRepository impositionsTfuRepository;
|
||||
private final StructureService structureService;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final EnqueteService enqueteService;
|
||||
|
||||
public ImpositionsTfuServiceImpl(ImpositionsTfuRepository impositionsTfuRepository) {
|
||||
this.impositionsTfuRepository = impositionsTfuRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permet de créer pour un centre la synthèse de l'imposition de l'année en prélude de la
|
||||
* génération des avis d'imposition
|
||||
* @param impositionsTfuPaylaodWeb
|
||||
* @return
|
||||
* @throws BadRequestException
|
||||
*/
|
||||
@Override
|
||||
public ImpositionsTfu createImpositionsTfu(ImpositionsTfu impositionsTfu) throws BadRequestException {
|
||||
if (impositionsTfu.getId() != null) {
|
||||
@Transactional
|
||||
public ImpositionsTfuPaylaodWeb createImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException {
|
||||
if (impositionsTfuPaylaodWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle unité de logement ayant un id non null.");
|
||||
}
|
||||
List<ImpositionsTfu> impositionsTfus=impositionsTfuRepository.getImpositionsTfuByCommuneAndExercice(impositionsTfu.getCommune().getCode(),impositionsTfu.getExercice().getAnnee());
|
||||
List<ImpositionsTfu> impositionsTfus=impositionsTfuRepository.getImpositionsTfuByStructureAndExercice(impositionsTfuPaylaodWeb.getStructureId(), impositionsTfuPaylaodWeb.getExerciceId());
|
||||
if (!impositionsTfus.isEmpty()) {
|
||||
throw new BadRequestException("Une Imposition non annulée existe déjà");
|
||||
}
|
||||
impositionsTfu.setStatusAvis(StatusAvis.CREE);
|
||||
impositionsTfu.setDateGeneration(LocalDate.now());
|
||||
return impositionsTfuRepository.save(impositionsTfu);
|
||||
List<StatusAvis> statusAvis= new ArrayList<>();
|
||||
statusAvis.add(StatusAvis.EN_COURS);
|
||||
statusAvis.add(StatusAvis.CLOTURE);
|
||||
statusAvis.add(StatusAvis.GENERATION_AUTORISE);
|
||||
|
||||
Optional<ImpositionsTfu> optionalImpositionsTfu= impositionsTfuRepository.findDistinctByStructure_IdAndExercice_IdAndStatusAvisIn(impositionsTfuPaylaodWeb.getStructureId(),impositionsTfuPaylaodWeb.getExerciceId(),statusAvis);
|
||||
|
||||
if(optionalImpositionsTfu.isPresent()){
|
||||
throw new BadRequestException("Une Imposition est déjà dans le workflow");
|
||||
}
|
||||
|
||||
ImpositionsTfu impositionsTfu=entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
|
||||
impositionsTfu.setStatusAvis(StatusAvis.EN_COURS);
|
||||
|
||||
impositionsTfu =impositionsTfuRepository.save(impositionsTfu);
|
||||
|
||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImpositionsTfu annulerImpositionsTfu(ImpositionsTfu impositionsTfu) throws BadRequestException {
|
||||
if (impositionsTfu.getId() == null) {
|
||||
public ImpositionsTfuPaylaodWeb rejeterImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException {
|
||||
if (impositionsTfuPaylaodWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible d'annuler une imposition ayant un id null.");
|
||||
}
|
||||
if (!impositionsTfuRepository.existsById(impositionsTfu.getId())) {
|
||||
if (!impositionsTfuRepository.existsById(impositionsTfuPaylaodWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans notre base de données.");
|
||||
}
|
||||
impositionsTfu.setStatusAvis(StatusAvis.ANNULE);
|
||||
return impositionsTfuRepository.save(impositionsTfu);
|
||||
ImpositionsTfu impositionsTfu= entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
if(!impositionsTfu.getStatusAvis().equals(StatusAvis.CLOTURE)){
|
||||
throw new NotAcceptableException("L'état actuel :"+impositionsTfu.getStatusAvis()+"Ne permet pas de passer au l'état rejete");
|
||||
}
|
||||
|
||||
impositionsTfu.setStatusAvis(StatusAvis.REJETE);
|
||||
impositionsTfu =impositionsTfuRepository.save(impositionsTfu);
|
||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public ImpositionsTfuPaylaodWeb cloturerImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException {
|
||||
if (impositionsTfuPaylaodWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de cloturer une imposition ayant un id null.");
|
||||
}
|
||||
if (!impositionsTfuRepository.existsById(impositionsTfuPaylaodWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver l'imposition spécifiée dans notre base de données.");
|
||||
}
|
||||
|
||||
ImpositionsTfu impositionsTfu= entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
|
||||
if(!impositionsTfu.getStatusAvis().equals(StatusAvis.EN_COURS) && !impositionsTfu.getStatusAvis().equals(StatusAvis.REJETE)){
|
||||
throw new NotAcceptableException("L'état actuel :"+impositionsTfu.getStatusAvis()+"Ne permet pas de passer au l'état rejete");
|
||||
}
|
||||
|
||||
impositionsTfu.setDateCloture(LocalDate.now());
|
||||
enqueteService.cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(impositionsTfu.getStructure().getId(),impositionsTfu.getExercice().getId());
|
||||
impositionsTfu.setStatusAvis(StatusAvis.CLOTURE);
|
||||
impositionsTfu =impositionsTfuRepository.save(impositionsTfu);
|
||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImpositionsTfu validerImpositionsTfu(ImpositionsTfu impositionsTfu) throws BadRequestException {
|
||||
if (impositionsTfu.getId() == null) {
|
||||
public ImpositionsTfuPaylaodWeb autoriserGenerationImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException {
|
||||
if (impositionsTfuPaylaodWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de valider une imposition ayant un id null.");
|
||||
}
|
||||
if (!impositionsTfuRepository.existsById(impositionsTfu.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans notre base de données.");
|
||||
if (!impositionsTfuRepository.existsById(impositionsTfuPaylaodWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver l'imposition spécifiée dans notre base de données.");
|
||||
}
|
||||
impositionsTfu.setStatusAvis(StatusAvis.VALIDE);
|
||||
return impositionsTfuRepository.save(impositionsTfu);
|
||||
|
||||
ImpositionsTfu impositionsTfu= entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||
|
||||
if(!impositionsTfu.getStatusAvis().equals(StatusAvis.CLOTURE)){
|
||||
throw new NotFoundException("L'état actuel : "+impositionsTfu.getStatusAvis()+ " ne permet pas de passer à l'état Autorisé");
|
||||
}
|
||||
impositionsTfu.setDateGeneration(LocalDate.now());
|
||||
impositionsTfu.setStatusAvis(StatusAvis.GENERATION_AUTORISE);
|
||||
impositionsTfu =impositionsTfuRepository.save(impositionsTfu);
|
||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImpositionsTfu updateImpositionsTfu(Long id, ImpositionsTfu impositionsTfu) throws NotFoundException {
|
||||
if (impositionsTfu.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle unité de logement ayant un id null.");
|
||||
}
|
||||
if (!impositionsTfuRepository.existsById(impositionsTfu.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans notre base de données.");
|
||||
}
|
||||
return impositionsTfuRepository.save(impositionsTfu);
|
||||
public ImpositionsTfuPaylaodWeb updateImpositionsTfu(Long id, ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws NotFoundException {
|
||||
// if (impositionsTfu.getId() == null) {
|
||||
// throw new BadRequestException("Impossible de mettre à jour une nouvelle unité de logement ayant un id null.");
|
||||
// }
|
||||
// if (!impositionsTfuRepository.existsById(impositionsTfu.getId())) {
|
||||
// throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans notre base de données.");
|
||||
// }
|
||||
return null; // impositionsTfuRepository.save(impositionsTfu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteImpositionsTfu(Long id) throws NotFoundException {
|
||||
Optional<ImpositionsTfu> impositionsTfuOptional = impositionsTfuRepository.findById(id);
|
||||
if (impositionsTfuOptional.isPresent()) {
|
||||
if(!impositionsTfuOptional.get().getStatusAvis().equals(StatusAvis.EN_COURS)){
|
||||
throw new NotFoundException("L'état actuel : "+impositionsTfuOptional.get().getStatusAvis()+ " ne permet pas de supprimer");
|
||||
}
|
||||
impositionsTfuRepository.deleteById(impositionsTfuOptional.get().getId());
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans notre base de données.");
|
||||
@@ -94,11 +167,22 @@ public class ImpositionsTfuServiceImpl implements ImpositionsTfuService {
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<ImpositionsTfu> getImpositionsTfuById(Long id) {
|
||||
public Optional<ImpositionsTfuPaylaodWeb> getImpositionsTfuById(Long id) {
|
||||
if (impositionsTfuRepository.existsById(id)) {
|
||||
return impositionsTfuRepository.findById(id);
|
||||
return impositionsTfuRepository.findByIdToDto(id);
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans la base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByUserIdIds(Long userId) {
|
||||
System.out.println(userId);
|
||||
List<Structure> structures = structureService.getListStructureUserId(userId);
|
||||
List<Long> structureIds = structures.stream()
|
||||
.map(Structure::getId)
|
||||
.toList();
|
||||
System.out.println(structureIds.get(0));
|
||||
return impositionsTfuRepository.findByStructureIdsToDto(structureIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.UniteLogementService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.UniteLogementPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.UniteLogementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuNonBatiRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CategorieBatimentRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -20,6 +23,8 @@ public class UniteLogementServiceImpl implements UniteLogementService {
|
||||
|
||||
private final UniteLogementRepository uniteLogementRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final BatimentRepository batimentRepository;
|
||||
private final CategorieBatimentRepository categorieBatimentRepository;
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +33,21 @@ public class UniteLogementServiceImpl implements UniteLogementService {
|
||||
if (uniteLogementPaylaodWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle unité de logement ayant un id non null.");
|
||||
}
|
||||
|
||||
if (uniteLogementPaylaodWeb.getBatimentId() == null) {
|
||||
throw new BadRequestException("Impossible de créer l'unité de logement: Le batiment doit être précisé.");
|
||||
}else {
|
||||
if(!batimentRepository.existsById(uniteLogementPaylaodWeb.getBatimentId()))
|
||||
throw new BadRequestException("Impossible de créer l'unite de logement: L'unité de logement doit être précisée.");
|
||||
}
|
||||
|
||||
if (uniteLogementPaylaodWeb.getCategorieBatimentId() == null) {
|
||||
throw new BadRequestException("Impossible de créer l'unite de logement: La catégorie doit être précisée.");
|
||||
}else {
|
||||
if(!categorieBatimentRepository.existsById(uniteLogementPaylaodWeb.getCategorieBatimentId()))
|
||||
throw new BadRequestException("Impossible de créer l'unite de logement: La catégorie doit être précisée.");
|
||||
}
|
||||
|
||||
UniteLogement uniteLogement = entityFromPayLoadService.getUniteLogementFromPayLoadWeb(uniteLogementPaylaodWeb);
|
||||
uniteLogement = uniteLogementRepository.save(uniteLogement);
|
||||
return uniteLogementRepository.findUniteLogementAvecOccupantCourantToDto(uniteLogement.getId()).orElse(null);
|
||||
@@ -91,4 +111,14 @@ public class UniteLogementServiceImpl implements UniteLogementService {
|
||||
public List<UniteLogementPaylaodWeb> getUniteLogementListByParcelle(Long parcelleId) {
|
||||
return uniteLogementRepository.findAllUnitesLogementAvecOccupantCourantByParcelleToDto(parcelleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<UniteLogementPaylaodWeb> getUniteLogementListByQuartierPageable(Long quartierId, Pageable pageable) {
|
||||
return uniteLogementRepository.findUnitesLogementAvecOccupantCourantByQuartierToDtoPageable(quartierId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UniteLogementPaylaodWeb> getUniteLogementListByQuartier(Long quartierId) {
|
||||
return uniteLogementRepository.findUnitesLogementAvecOccupantCourantByQuartierToDto(quartierId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuBati;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuBatiService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BaremRfuBatiPayloadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class BaremRfuBatiServiceImpl implements BaremRfuBatiService {
|
||||
private final BaremRfuRepository baremRfuRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public BaremRfuBatiPayloadWeb createBaremRfu(BaremRfuBatiPayloadWeb baremRfuBatiPayloadWeb) throws BadRequestException {
|
||||
if (baremRfuBatiPayloadWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer un nouvel bareme rfu ayant un id non null.");
|
||||
}
|
||||
BaremRfuBati baremRfuBati = entityFromPayLoadService.getBaremRfuBatiFromPayLoadWeb(baremRfuBatiPayloadWeb);
|
||||
baremRfuBati = baremRfuRepository.save(baremRfuBati);
|
||||
return baremRfuRepository.findByBaremRfuBatieId(baremRfuBati.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaremRfuBatiPayloadWeb updateBaremRfu(Long id, BaremRfuBatiPayloadWeb baremRfuBatiPayloadWeb) throws NotFoundException {
|
||||
if (baremRfuBatiPayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvel bareme rfu ayant un id null.");
|
||||
}
|
||||
if (!baremRfuRepository.existsById(baremRfuBatiPayloadWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver le bareme spécifiée dans notre base de données.");
|
||||
}
|
||||
BaremRfuBati baremRfuBati = entityFromPayLoadService.getBaremRfuBatiFromPayLoadWeb(baremRfuBatiPayloadWeb);
|
||||
baremRfuBati = baremRfuRepository.save(baremRfuBati);
|
||||
return baremRfuRepository.findByBaremRfuBatieId(baremRfuBati.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBaremRfu(Long id) throws NotFoundException {
|
||||
Optional<BaremRfuBati> baremRfuOptional = baremRfuRepository.findById(id);
|
||||
if (baremRfuOptional.isPresent()) {
|
||||
baremRfuRepository.deleteById(baremRfuOptional.get().getId());
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver le Bareme spécifié dans notre base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<BaremRfuBatiPayloadWeb> getBaremRfuList(Pageable pageable) {
|
||||
return baremRfuRepository.findAllPayloadPaged(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaremRfuBatiPayloadWeb> getBaremRfuList() {
|
||||
return baremRfuRepository.findAllPayload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaremRfuBatiPayloadWeb> getBaremRfuByCategorieBatiment(Long idCategorieBatiment) {
|
||||
return baremRfuRepository.findByCategorieBatiment(idCategorieBatiment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaremRfuBatiPayloadWeb> getBaremRfuByArrondissement(Long idArrondissement) {
|
||||
return baremRfuRepository.findByArrondissementId(idArrondissement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaremRfuBatiPayloadWeb> getBaremRfuByArrondissementAndCategorieBatiment(Long IdArrondissement, Long IdCategorieBatiment) {
|
||||
return baremRfuRepository.findByArrondissementAndCategorieBatiment(IdArrondissement,IdCategorieBatiment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaremRfuBatiPayloadWeb> getBaremRfuByQuartierAndCategorieBatiment(Long idQuartier, Long IdCategorieBatiment) {
|
||||
return baremRfuRepository.findByQuartierAndCategorieBatiment(idQuartier,IdCategorieBatiment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaremRfuBatiPayloadWeb getBaremRfuById(Long id) {
|
||||
return baremRfuRepository.findByBaremRfuBatieId(id).orElse(null);
|
||||
}
|
||||
}
|
||||
@@ -4,38 +4,42 @@ import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuNonBatiService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BaremRfuNonBatiPayloadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuNonBatiRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class BaremRfuNonBatiServiceImpl implements BaremRfuNonBatiService {
|
||||
private final BaremRfuNonBatiRepository baremRfuNonBatiRepository;
|
||||
|
||||
public BaremRfuNonBatiServiceImpl(BaremRfuNonBatiRepository baremRfuNonBatiRepository) {
|
||||
this.baremRfuNonBatiRepository = baremRfuNonBatiRepository;
|
||||
}
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
@Override
|
||||
public BaremRfuNonBati createBaremRfuNonBati(BaremRfuNonBati baremRfuNonBati) throws BadRequestException {
|
||||
if (baremRfuNonBati.getId() != null) {
|
||||
public BaremRfuNonBatiPayloadWeb createBaremRfuNonBati(BaremRfuNonBatiPayloadWeb baremRfuNonBatiPayloadWeb) throws BadRequestException {
|
||||
if (baremRfuNonBatiPayloadWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null.");
|
||||
}
|
||||
return baremRfuNonBatiRepository.save(baremRfuNonBati);
|
||||
BaremRfuNonBati baremRfuNonBati= entityFromPayLoadService.getBaremRfuNonBatiFromPayLoadWeb(baremRfuNonBatiPayloadWeb);
|
||||
baremRfuNonBati=baremRfuNonBatiRepository.save(baremRfuNonBati);
|
||||
return baremRfuNonBatiRepository.findByIdToDto(baremRfuNonBati.getId()).orElse(null);
|
||||
}
|
||||
@Override
|
||||
public BaremRfuNonBati updateBaremRfuNonBati(Long id, BaremRfuNonBati baremRfuNonBati) throws NotFoundException {
|
||||
if (baremRfuNonBati.getId() == null) {
|
||||
public BaremRfuNonBatiPayloadWeb updateBaremRfuNonBati(Long id, BaremRfuNonBatiPayloadWeb baremRfuNonBatiPayloadWeb) throws NotFoundException {
|
||||
if (baremRfuNonBatiPayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle baremRfuNonBati ayant un id null.");
|
||||
}
|
||||
if (!baremRfuNonBatiRepository.existsById(baremRfuNonBati.getId())) {
|
||||
if (!baremRfuNonBatiRepository.existsById(baremRfuNonBatiPayloadWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la baremRfuNonBati spécifiée dans notre base de données.");
|
||||
}
|
||||
return baremRfuNonBatiRepository.save(baremRfuNonBati);
|
||||
BaremRfuNonBati baremRfuNonBati= entityFromPayLoadService.getBaremRfuNonBatiFromPayLoadWeb(baremRfuNonBatiPayloadWeb);
|
||||
baremRfuNonBati=baremRfuNonBatiRepository.save(baremRfuNonBati);
|
||||
return baremRfuNonBatiRepository.findByIdToDto(baremRfuNonBati.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,20 +52,27 @@ public class BaremRfuNonBatiServiceImpl implements BaremRfuNonBatiService {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Page<BaremRfuNonBati> getBaremRfuNonBatiList(Pageable pageable) {
|
||||
return baremRfuNonBatiRepository.findAll(pageable);
|
||||
public Page<BaremRfuNonBatiPayloadWeb> getBaremRfuNonBatiList(Pageable pageable) {
|
||||
return baremRfuNonBatiRepository.findAllPayloadToDtoPaged(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaremRfuNonBati> getBaremRfuNonBatiList() {
|
||||
return baremRfuNonBatiRepository.findAll();
|
||||
public List<BaremRfuNonBatiPayloadWeb> getBaremRfuNonBatiList() {
|
||||
return baremRfuNonBatiRepository.findAllPayloadToDto();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<BaremRfuNonBati> getBaremRfuNonBatiById(Long id) {
|
||||
return baremRfuNonBatiRepository.findById(id);
|
||||
public Optional<BaremRfuNonBatiPayloadWeb> getBaremRfuNonBatiById(Long id) {
|
||||
return baremRfuNonBatiRepository.findByIdToDto(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<BaremRfuNonBatiPayloadWeb> getBaremRfuNonBatiByCommuneAndZoneId(Long communeId,Long zoneId) {
|
||||
return baremRfuNonBatiRepository.findByCommuneAndZoneToDto(communeId,zoneId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuBati;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuService;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuRepository;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@Service
|
||||
public class BaremRfuServiceImpl implements BaremRfuService {
|
||||
private final BaremRfuRepository baremRfuRepository;
|
||||
|
||||
public BaremRfuServiceImpl(BaremRfuRepository baremRfuRepository) {
|
||||
this.baremRfuRepository = baremRfuRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaremRfuBati createBaremRfu(BaremRfuBati baremRfuBati) throws BadRequestException {
|
||||
if (baremRfuBati.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer un nouvel bareme rfu ayant un id non null.");
|
||||
}
|
||||
return baremRfuRepository.save(baremRfuBati);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaremRfuBati updateBaremRfu(Long id, BaremRfuBati baremRfuBati) throws NotFoundException {
|
||||
if (baremRfuBati.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvel bareme rfu ayant un id null.");
|
||||
}
|
||||
if (!baremRfuRepository.existsById(baremRfuBati.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver le bareme spécifiée dans notre base de données.");
|
||||
}
|
||||
return baremRfuRepository.save(baremRfuBati);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBaremRfu(Long id) throws NotFoundException {
|
||||
Optional<BaremRfuBati> baremRfuOptional = baremRfuRepository.findById(id);
|
||||
if (baremRfuOptional.isPresent()) {
|
||||
baremRfuRepository.deleteById(baremRfuOptional.get().getId());
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver le Bareme spécifié dans notre base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<BaremRfuBati> getBaremRfuList(Pageable pageable) {
|
||||
return baremRfuRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaremRfuBati> getBaremRfuList() {
|
||||
return baremRfuRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaremRfuBati> getBaremRfuByType(Long idCategorieBatiment) {
|
||||
return baremRfuRepository.findAllByCategorieBatiment_Id(idCategorieBatiment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<BaremRfuBati> getBaremRfuById(Long id) {
|
||||
return baremRfuRepository.findById(id);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,23 @@
|
||||
package io.gmss.fiscad.implementations.statistiques;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
|
||||
import io.gmss.fiscad.interfaces.user.UserService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.statistique.*;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteUniteLogementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.UniteLogementRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -18,21 +27,27 @@ import java.util.List;
|
||||
|
||||
@Service
|
||||
public class StatistiquesServiceImpl implements StatistiquesService {
|
||||
private Authentication authentication;
|
||||
private Authentication authentication;
|
||||
private final UserService userService;
|
||||
private final EnqueteRepository enqueteRepository;
|
||||
private final ParcelleRepository parcelleRepository;
|
||||
private final BatimentRepository batimentRepository;
|
||||
private final UniteLogementRepository uniteLogementRepository;
|
||||
private final PersonneRepository personneRepository;
|
||||
private final SecteurService secteurService;
|
||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||
|
||||
public StatistiquesServiceImpl(UserService userService, EnqueteRepository enqueteRepository, ParcelleRepository parcelleRepository, BatimentRepository batimentRepository, UniteLogementRepository uniteLogementRepository, PersonneRepository personneRepository) {
|
||||
public StatistiquesServiceImpl(UserService userService, EnqueteRepository enqueteRepository, ParcelleRepository parcelleRepository, BatimentRepository batimentRepository, UniteLogementRepository uniteLogementRepository, PersonneRepository personneRepository, SecteurService secteurService, EnqueteBatimentRepository enqueteBatimentRepository, EnqueteUniteLogementRepository enqueteUniteLogementRepository) {
|
||||
this.userService = userService;
|
||||
this.enqueteRepository = enqueteRepository;
|
||||
this.parcelleRepository = parcelleRepository;
|
||||
this.batimentRepository = batimentRepository;
|
||||
this.uniteLogementRepository = uniteLogementRepository;
|
||||
this.personneRepository = personneRepository;
|
||||
this.secteurService = secteurService;
|
||||
this.enqueteBatimentRepository = enqueteBatimentRepository;
|
||||
this.enqueteUniteLogementRepository = enqueteUniteLogementRepository;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,4 +113,20 @@ public class StatistiquesServiceImpl implements StatistiquesService {
|
||||
public List<StatistiqueTypeNombreResponse> getStatNombrePersonneParCategorie() {
|
||||
return personneRepository.getNombrePersonnesResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NombreEnquetesParObjet getStatNombreEnqueteParObjetUserConnect(Long userId, String statutEnquete) {
|
||||
NombreEnquetesParObjet nombreEnquetesParObjet= new NombreEnquetesParObjet();
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
|
||||
nombreEnquetesParObjet.setNombreEnqueteUniteLogement(enqueteUniteLogementRepository.getNombreEnqueteUniteLogementByUserConnecte(secteurIds,statutEnquete));
|
||||
nombreEnquetesParObjet.setNombreEnqueteParcelle(enqueteRepository.getNombreEnqueteByUserConnecte(secteurIds,statutEnquete));
|
||||
nombreEnquetesParObjet.setNombreEnqueteBatiment(enqueteBatimentRepository.getNombreEnqueteBatimentByUserConnecte(secteurIds,statutEnquete));
|
||||
|
||||
return nombreEnquetesParObjet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.gmss.fiscad.interfaces.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
||||
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -33,4 +33,7 @@ public interface SecteurDecoupageService {
|
||||
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageUnSecteur(Long secteurId) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageByUserId(Long userId) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteDecoupageByUserId(Long userId, String statutEnquete) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteBatimentDecoupageByUserId(Long userId, String statutEnquete) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteUniteLogementDecoupageByUserId(Long userId, String statutEnquete) ;
|
||||
}
|
||||
@@ -4,8 +4,6 @@ import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.synchronisation.SecteurPayload;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -32,4 +30,5 @@ public interface SecteurService {
|
||||
Optional<SecteurPaylaodWeb> getSecteurById(Long id);
|
||||
|
||||
List<Secteur> getListSecteurUserId(Long userId) ;
|
||||
List<Secteur> getListSecteurByDepartementId(Long departementId) ;
|
||||
}
|
||||
@@ -2,11 +2,13 @@ package io.gmss.fiscad.interfaces.infocad.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.EnqueteFiltreResponse;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.synchronisation.EnqueteNonSyncResponse;
|
||||
import io.gmss.fiscad.paylaods.response.EnqueteResponse;
|
||||
import io.gmss.fiscad.paylaods.response.FicheResponse.FicheEnqueteResponse;
|
||||
@@ -38,13 +40,13 @@ public interface EnqueteService {
|
||||
|
||||
Optional<EnquetePayLoadWeb> getEnqueteById(Long id);
|
||||
|
||||
Enquete validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
EnquetePayLoadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
Enquete rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
EnquetePayLoadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
List<Enquete> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
List<EnquetePayLoadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
List<Enquete> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
List<EnquetePayLoadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
Enquete finaliserEnquete(Long enqueteId);
|
||||
|
||||
@@ -58,5 +60,10 @@ public interface EnqueteService {
|
||||
|
||||
public List<EnqueteNonSyncResponse> getEnqueteValideNonSynch(Long terminalId);
|
||||
|
||||
int cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(Long strucutreId,Long exerciceId);
|
||||
int cloturerEnqueteParcelleBatimentUniteLogementByUserIdAndExerciceId(Long userId,Long exerciceId);
|
||||
|
||||
|
||||
Page<EnquetePayLoadWeb> getEnqueteListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.gmss.fiscad.entities.infocad.metier.ParcelleGeom;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParcelleGeomPaylaodWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -15,12 +16,15 @@ import java.util.Optional;
|
||||
|
||||
public interface ParcelleGeomService {
|
||||
int createParcelleFromGeoJsonFile(MultipartFile file,String reference,String description) throws BadRequestException;
|
||||
int createParcelleGeomFromGeoJsonApi() throws BadRequestException;
|
||||
ParcelleGeom createOnParcelleFromGeoJson(JsonNode jsonNode, Upload upload) throws BadRequestException;
|
||||
ParcelleGeom updateParcelleGeom(MultipartFile file) throws NotFoundException;
|
||||
void deleteParcelle(Long id) throws NotFoundException;
|
||||
Page<ParcelleGeom> getParcelleGeomList(Pageable pageable);
|
||||
List<ParcelleGeom> getParcelleGeomList();
|
||||
List<ParcelleGeom> getParcelleGeomListUnQuatier(String codeQuartier);
|
||||
List<ParcelleGeomPaylaodWeb> getParcelleGeomListByQuatierId(Long quartierId);
|
||||
Page<ParcelleGeomPaylaodWeb> getParcelleGeomListByQuatierIdPaged(Long quartierId,Pageable pageable);
|
||||
public List<ParcelleGeom> getParcelleGeomListUnArrondissement(String codeArrondissement);
|
||||
|
||||
Optional<ParcelleGeom> getParcelleGeomById(Long id);
|
||||
|
||||
@@ -4,10 +4,7 @@ import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.FiltreParcelle;
|
||||
import io.gmss.fiscad.paylaods.request.FiltreParcellePayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.dataTableResponse.ParcelleDataTableResponse;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -35,4 +32,5 @@ public interface ParcelleService {
|
||||
Page<ParcellePayLoadWeb> getParcelleListByRuePageableToDto(Long userId,Long rueId,Pageable pageable);
|
||||
|
||||
Page<ParcellePayLoadWeb> getParcelleByMultiFiltre(Long userId, FiltreParcelle filtreParcelle, Pageable pageable);
|
||||
Integer majParcelleBatieNonbatie();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package io.gmss.fiscad.interfaces.infocad.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.user.AvoirFonction;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.StructurePaylaodWeb;
|
||||
@@ -8,6 +10,8 @@ import io.gmss.fiscad.paylaods.response.StructureResponse;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -31,4 +35,6 @@ public interface StructureService {
|
||||
//List<StructureResponse> getStructuresByArrondissement(Long arrondissementID);
|
||||
|
||||
|
||||
public List<Structure> getListStructureUserId(Long userId) ;
|
||||
|
||||
}
|
||||
|
||||
@@ -27,4 +27,10 @@ public interface BatimentService {
|
||||
List<BatimentPaylaodWeb> getBatimentListByParcelle(Long parcelleId);
|
||||
|
||||
Optional<BatimentPaylaodWeb> getBatimentById(Long id);
|
||||
|
||||
|
||||
Page<BatimentPaylaodWeb> getBatimentListByquartierPageable(Long quartierId, Pageable pageable);
|
||||
|
||||
List<BatimentPaylaodWeb> getBatimentListByquartier(Long quartierId);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import io.gmss.fiscad.entities.rfu.metier.DonneesImpositionTfu;
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -11,8 +13,6 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface DonneesImpositionTfuService {
|
||||
|
||||
|
||||
DonneesImpositionTfu createDonneesImpositionTfu(DonneesImpositionTfu donneesImpositionTfu) throws BadRequestException;
|
||||
|
||||
DonneesImpositionTfu updateDonneesImpositionTfu(Long id, DonneesImpositionTfu donneesImpositionTfu) throws NotFoundException;
|
||||
@@ -25,7 +25,27 @@ public interface DonneesImpositionTfuService {
|
||||
|
||||
Optional<DonneesImpositionTfu> getDonneesImpositionTfuById(Long id);
|
||||
|
||||
Long genererDonneesFiscales(ImpositionsTfu impositionsTfu);
|
||||
List<DonneesImpositionTfu> getDonneesFiscalesByImposition(Long impositionsId);
|
||||
ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleBatie(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,Long userId);
|
||||
ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatie(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,Long userId);
|
||||
List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImposition(Long impositionsId);
|
||||
List<DonneesImpositionTfu> getDonneesFiscalesByImpositionArrondissement(Long impositionsId,Long arrondissementId);
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdPageable(Long impositionsTfuId, Pageable pageable);
|
||||
|
||||
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdNonBatiePageable(Long impositionsTfuId, Pageable pageable);
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdBatieBatimentPageable(Long impositionsTfuId, Pageable pageable);
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdBatieUniteLogPageable(Long impositionsTfuId, Pageable pageable);
|
||||
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionIrfIdBatieBatimentPageable(Long impositionsTfuId, Pageable pageable);
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionIrfIdBatieUniteLogPageable(Long impositionsTfuId, Pageable pageable);
|
||||
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionSrtbIdBatieBatimentPageable(Long impositionsTfuId, Pageable pageable);
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionSrtbIdBatieUniteLogPageable(Long impositionsTfuId, Pageable pageable);
|
||||
|
||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByExerciceAndStructureIdPageable(Long exerciceId, Long structureId, Pageable pageable);
|
||||
List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByExerciceAndStructureId(Long exerciceId, Long structureId,Long quartierId);
|
||||
|
||||
List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByPersonneId(Long personneId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package io.gmss.fiscad.interfaces.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -26,4 +29,15 @@ public interface EnqueteBatimentService {
|
||||
Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentListPageable(Long batimentId, Pageable pageable);
|
||||
|
||||
List<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentList(Long batimentId);
|
||||
|
||||
Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable);
|
||||
|
||||
EnqueteBatimentPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
EnqueteBatimentPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
List<EnqueteBatimentPayloadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
List<EnqueteBatimentPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package io.gmss.fiscad.interfaces.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -27,4 +30,14 @@ public interface EnqueteUniteLogementService {
|
||||
List<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementUniteLogementList(Long uniteLogementId);
|
||||
|
||||
Optional<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementById(Long enqueteUniteLogement);
|
||||
|
||||
Page<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable);
|
||||
|
||||
EnqueteUniteLogementPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
EnqueteUniteLogementPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
List<EnqueteUniteLogementPayloadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
List<EnqueteUniteLogementPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.interfaces.rfu.metier;
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -11,11 +12,12 @@ import java.util.Optional;
|
||||
|
||||
public interface ImpositionsTfuService {
|
||||
|
||||
ImpositionsTfu createImpositionsTfu(ImpositionsTfu impositionsTfu) throws BadRequestException;
|
||||
ImpositionsTfu annulerImpositionsTfu(ImpositionsTfu impositionsTfu) throws BadRequestException;
|
||||
ImpositionsTfu validerImpositionsTfu(ImpositionsTfu impositionsTfu) throws BadRequestException;
|
||||
ImpositionsTfuPaylaodWeb createImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException;
|
||||
ImpositionsTfuPaylaodWeb rejeterImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException;
|
||||
ImpositionsTfuPaylaodWeb cloturerImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException;
|
||||
ImpositionsTfuPaylaodWeb autoriserGenerationImpositionsTfu(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws BadRequestException;
|
||||
|
||||
ImpositionsTfu updateImpositionsTfu(Long id, ImpositionsTfu impositionsTfu) throws NotFoundException;
|
||||
ImpositionsTfuPaylaodWeb updateImpositionsTfu(Long id, ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb) throws NotFoundException;
|
||||
|
||||
void deleteImpositionsTfu(Long id) throws NotFoundException;
|
||||
|
||||
@@ -23,5 +25,6 @@ public interface ImpositionsTfuService {
|
||||
|
||||
List<ImpositionsTfu> getImpositionsTfuList();
|
||||
|
||||
Optional<ImpositionsTfu> getImpositionsTfuById(Long id);
|
||||
Optional<ImpositionsTfuPaylaodWeb> getImpositionsTfuById(Long id);
|
||||
List<ImpositionsTfuPaylaodWeb> getImpositionsTfuByUserIdIds(Long userId);
|
||||
}
|
||||
|
||||
@@ -30,4 +30,9 @@ public interface UniteLogementService {
|
||||
List<UniteLogementPaylaodWeb> getUniteLogementListByBatiment(Long batimentId);
|
||||
|
||||
List<UniteLogementPaylaodWeb> getUniteLogementListByParcelle(Long parcelleId);
|
||||
|
||||
Page<UniteLogementPaylaodWeb> getUniteLogementListByQuartierPageable(Long quartierId, Pageable pageable);
|
||||
|
||||
List<UniteLogementPaylaodWeb> getUniteLogementListByQuartier(Long quartierId);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.gmss.fiscad.interfaces.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuBati;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BaremRfuBatiPayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface BaremRfuBatiService {
|
||||
|
||||
BaremRfuBatiPayloadWeb createBaremRfu(BaremRfuBatiPayloadWeb baremRfuBati) throws BadRequestException;
|
||||
|
||||
BaremRfuBatiPayloadWeb updateBaremRfu(Long id, BaremRfuBatiPayloadWeb baremRfuBati) throws NotFoundException;
|
||||
|
||||
void deleteBaremRfu(Long id) throws NotFoundException;
|
||||
|
||||
Page<BaremRfuBatiPayloadWeb> getBaremRfuList(Pageable pageable);
|
||||
|
||||
List<BaremRfuBatiPayloadWeb> getBaremRfuList();
|
||||
|
||||
List<BaremRfuBatiPayloadWeb> getBaremRfuByCategorieBatiment(Long IdCategorieBatiment);
|
||||
List<BaremRfuBatiPayloadWeb> getBaremRfuByArrondissement(Long IdArrondissement);
|
||||
List<BaremRfuBatiPayloadWeb> getBaremRfuByArrondissementAndCategorieBatiment(Long IdArrondissement,Long IdCategorieBatiment);
|
||||
List<BaremRfuBatiPayloadWeb> getBaremRfuByQuartierAndCategorieBatiment(Long idQuartier,Long IdCategorieBatiment);
|
||||
|
||||
BaremRfuBatiPayloadWeb getBaremRfuById(Long id);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.interfaces.rfu.parametre;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BaremRfuNonBatiPayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -11,17 +12,18 @@ import java.util.Optional;
|
||||
|
||||
public interface BaremRfuNonBatiService {
|
||||
|
||||
BaremRfuNonBati createBaremRfuNonBati(BaremRfuNonBati baremRfuNonBati) throws BadRequestException;
|
||||
BaremRfuNonBatiPayloadWeb createBaremRfuNonBati(BaremRfuNonBatiPayloadWeb baremRfuNonBatiPayloadWeb) throws BadRequestException;
|
||||
|
||||
BaremRfuNonBati updateBaremRfuNonBati(Long id, BaremRfuNonBati baremRfuNonBati) throws NotFoundException;
|
||||
BaremRfuNonBatiPayloadWeb updateBaremRfuNonBati(Long id, BaremRfuNonBatiPayloadWeb baremRfuNonBatiPayloadWeb) throws NotFoundException;
|
||||
|
||||
void deleteBaremRfuNonBati(Long id) throws NotFoundException;
|
||||
|
||||
Page<BaremRfuNonBati> getBaremRfuNonBatiList(Pageable pageable);
|
||||
Page<BaremRfuNonBatiPayloadWeb> getBaremRfuNonBatiList(Pageable pageable);
|
||||
|
||||
List<BaremRfuNonBati> getBaremRfuNonBatiList();
|
||||
List<BaremRfuNonBatiPayloadWeb> getBaremRfuNonBatiList();
|
||||
|
||||
|
||||
Optional<BaremRfuNonBati> getBaremRfuNonBatiById(Long id);
|
||||
Optional<BaremRfuNonBatiPayloadWeb> getBaremRfuNonBatiById(Long id);
|
||||
Optional<BaremRfuNonBatiPayloadWeb> getBaremRfuNonBatiByCommuneAndZoneId(Long communeId,Long zoneId);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package io.gmss.fiscad.interfaces.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuBati;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface BaremRfuService {
|
||||
|
||||
BaremRfuBati createBaremRfu(BaremRfuBati baremRfuBati) throws BadRequestException;
|
||||
|
||||
BaremRfuBati updateBaremRfu(Long id, BaremRfuBati baremRfuBati) throws NotFoundException;
|
||||
|
||||
void deleteBaremRfu(Long id) throws NotFoundException;
|
||||
|
||||
Page<BaremRfuBati> getBaremRfuList(Pageable pageable);
|
||||
|
||||
List<BaremRfuBati> getBaremRfuList();
|
||||
|
||||
List<BaremRfuBati> getBaremRfuByType(Long IdCategorieBatiment);
|
||||
|
||||
Optional<BaremRfuBati> getBaremRfuById(Long id);
|
||||
}
|
||||
|
||||
@@ -11,4 +11,5 @@ public interface StatistiquesService {
|
||||
List<StatEnqueteParBlocResponse> getStatBloc();
|
||||
StatNombreTotalObjet getStatNombreTotalObjet(String codeDecoupageAdmin);
|
||||
List<StatistiqueTypeNombreResponse> getStatNombrePersonneParCategorie();
|
||||
NombreEnquetesParObjet getStatNombreEnqueteParObjetUserConnect(Long userId, String statutEnquete);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.CategorieBatiment;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class BaremRfuBatiPayloadWeb {
|
||||
private Long id;
|
||||
private Long valeurLocative;
|
||||
private Double tfuMetreCarre;
|
||||
private Long tfuMinimum;
|
||||
private Long categorieBatimentId;
|
||||
private String categorieBatimentNom;
|
||||
private String categorieBatimentStanding;
|
||||
private Long arrondissementId;
|
||||
private String arrondissementCode;
|
||||
private String arrondissementNom;
|
||||
|
||||
private Long quartierId;
|
||||
private String quartierCode;
|
||||
private String quartierNom;
|
||||
|
||||
private Long communeId;
|
||||
private String communeCode;
|
||||
private String communeNom;
|
||||
|
||||
public BaremRfuBatiPayloadWeb(Long id, Long valeurLocative, Double tfuMetreCarre, Long tfuMinimum, Long categorieBatimentId, String categorieBatimentNom, String categorieBatimentStanding, Long arrondissementId, String arrondissementCode, String arrondissementNom,
|
||||
Long quartierId,
|
||||
String quartierCode,
|
||||
String quartierNom,
|
||||
Long communeId,
|
||||
String communeCode,
|
||||
String communeNom
|
||||
) {
|
||||
this.id = id;
|
||||
this.valeurLocative = valeurLocative;
|
||||
this.tfuMetreCarre = tfuMetreCarre;
|
||||
this.tfuMinimum = tfuMinimum;
|
||||
this.categorieBatimentId = categorieBatimentId;
|
||||
this.categorieBatimentNom = categorieBatimentNom;
|
||||
this.categorieBatimentStanding = categorieBatimentStanding;
|
||||
this.arrondissementId = arrondissementId;
|
||||
this.arrondissementCode = arrondissementCode;
|
||||
this.arrondissementNom = arrondissementNom;
|
||||
this.quartierId = quartierId;
|
||||
this.quartierCode = quartierCode;
|
||||
this.quartierNom = quartierNom;
|
||||
this.communeId = communeId;
|
||||
this.communeCode = communeCode;
|
||||
this.communeNom = communeNom;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.ZoneRfu;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class BaremRfuNonBatiPayloadWeb {
|
||||
private Long id;
|
||||
private Long valeurAdministrative;
|
||||
private float taux;
|
||||
private Long communeId;
|
||||
private String communeCode;
|
||||
private String communeNom;
|
||||
private Long zoneRfuId;
|
||||
private String zoneRfuCode;
|
||||
private String zoneRfuNom;
|
||||
private Long valeurAdministrativeMetreCarre;
|
||||
private Boolean auMetreCarre;
|
||||
|
||||
public BaremRfuNonBatiPayloadWeb(Long id,
|
||||
Long valeurAdministrative,
|
||||
Float taux,
|
||||
Long communeId,
|
||||
String communeCode,
|
||||
String communeNom,
|
||||
Long zoneRfuId,
|
||||
String zoneRfuCode,
|
||||
String zoneRfuNom,
|
||||
Long valeurAdministrativeMetreCarre,
|
||||
Boolean auMetreCarre) {
|
||||
this.id = id;
|
||||
this.valeurAdministrative = valeurAdministrative;
|
||||
this.taux = taux;
|
||||
this.communeId = communeId;
|
||||
this.communeCode = communeCode;
|
||||
this.communeNom = communeNom;
|
||||
this.zoneRfuId = zoneRfuId;
|
||||
this.zoneRfuCode = zoneRfuCode;
|
||||
this.zoneRfuNom = zoneRfuNom;
|
||||
this.valeurAdministrativeMetreCarre = valeurAdministrativeMetreCarre;
|
||||
this.auMetreCarre = auMetreCarre;
|
||||
}
|
||||
}
|
||||
@@ -29,11 +29,14 @@ public class BatimentPaylaodWeb {
|
||||
private Integer nombrePiscine;
|
||||
private Long montantLocatifAnnuelDeclare;
|
||||
private Long montantLocatifAnnuelCalcule;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long valeurBatimentEstime;
|
||||
private Long valeurBatimentReel;
|
||||
private Long valeurBatimentCalcule;
|
||||
private Long montantMensuelLocation;
|
||||
private Long usageId;
|
||||
private String usageNom;
|
||||
private Integer nbreUniteLogement;
|
||||
|
||||
public BatimentPaylaodWeb(Long id,
|
||||
String nub,
|
||||
@@ -61,7 +64,11 @@ public class BatimentPaylaodWeb {
|
||||
Long valeurBatimentReel,
|
||||
Long montantMensuelLocation,
|
||||
Long usageId,
|
||||
String usageNom) {
|
||||
String usageNom,
|
||||
Long montantLocatifAnnuelEstime,
|
||||
Long valeurBatimentCalcule,
|
||||
Integer nbreUniteLogement
|
||||
) {
|
||||
this.id = id;
|
||||
this.nub = nub;
|
||||
this.code = code;
|
||||
@@ -89,5 +96,9 @@ public class BatimentPaylaodWeb {
|
||||
this.montantMensuelLocation = montantMensuelLocation ;
|
||||
this.usageId = usageId ;
|
||||
this.usageNom = usageNom ;
|
||||
this.montantLocatifAnnuelEstime = montantLocatifAnnuelEstime ;
|
||||
this.valeurBatimentCalcule = valeurBatimentCalcule ;
|
||||
this.nbreUniteLogement = nbreUniteLogement ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.gmss.fiscad.enums.NatureImpot;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.time.LocalDate;
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class DonneesImpositionPaylaodWeb {
|
||||
private Long id;
|
||||
private Long annee;
|
||||
private String codeDepartement;
|
||||
private String nomDepartement;
|
||||
private String codeCommune;
|
||||
private String nomCommune;
|
||||
private String codeArrondissement;
|
||||
private String nomArrondissement;
|
||||
private String codeQuartierVillage;
|
||||
private String nomQuartierVillage;
|
||||
private String q;
|
||||
private String ilot;
|
||||
private String parcelle;
|
||||
private String nup;
|
||||
private String titreFoncier;
|
||||
private String numBatiment;
|
||||
private String numUniteLogement;
|
||||
private String ifu;
|
||||
private String npi;
|
||||
private String telProp;
|
||||
private String emailProp;
|
||||
private String nomProp;
|
||||
private String prenomProp;
|
||||
private String raisonSociale;
|
||||
private String adresseProp;
|
||||
private String telRep;
|
||||
private String emailRep;
|
||||
private String nomRep;
|
||||
private String prenomRep;
|
||||
private String adresseRep;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private Integer superficieParc;
|
||||
private Long superficieAuSolBat;
|
||||
private Long superficieAuSolUlog;
|
||||
private Boolean batie;
|
||||
private Boolean exonere;
|
||||
private Boolean batimentExonere;
|
||||
private Boolean uniteLogementExonere;
|
||||
private Long valeurLocativeAdm;
|
||||
private Long valeurBatiment;
|
||||
private Long valeurParcelle;
|
||||
private Long montantLoyerAnnuel;
|
||||
private Long tfuMetreCarre;
|
||||
private Long tfuMinimum;
|
||||
private String standingBat;
|
||||
private String categorieBat;
|
||||
private Long nombrePiscine;
|
||||
private Long nombreUlog;
|
||||
private Long nombreBat;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dateEnquete;
|
||||
private Long serviceId;
|
||||
private String serviceCode;
|
||||
private Long zoneRfuId;
|
||||
private String zoneRfuNom;
|
||||
private Float tauxTfu;
|
||||
private Long valeurAdminParcelleNb;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private NatureImpot natureImpot;
|
||||
private Long valeurLocativeAdmMetreCarre;
|
||||
private Long valeurAdminParcelleNbMetreCarre;
|
||||
private Float montantTaxe;
|
||||
|
||||
public DonneesImpositionPaylaodWeb(Long id,
|
||||
Long annee,
|
||||
String codeDepartement,
|
||||
String nomDepartement,
|
||||
String codeCommune,
|
||||
String nomCommune,
|
||||
String codeArrondissement,
|
||||
String nomArrondissement,
|
||||
String codeQuartierVillage,
|
||||
String nomQuartierVillage,
|
||||
String q, String ilot,
|
||||
String parcelle,
|
||||
String nup,
|
||||
String titreFoncier,
|
||||
String numBatiment,
|
||||
String numUniteLogement,
|
||||
String ifu,
|
||||
String npi,
|
||||
String telProp,
|
||||
String emailProp,
|
||||
String nomProp,
|
||||
String prenomProp,
|
||||
String raisonSociale,
|
||||
String adresseProp,
|
||||
String telRep,
|
||||
String emailRep,
|
||||
String nomRep,
|
||||
String prenomRep,
|
||||
String adresseRep,
|
||||
String longitude,
|
||||
String latitude,
|
||||
Integer superficieParc,
|
||||
Long superficieAuSolBat,
|
||||
Long superficieAuSolUlog,
|
||||
Boolean batie,
|
||||
Boolean exonere,
|
||||
Boolean batimentExonere,
|
||||
Boolean uniteLogementExonere,
|
||||
Long valeurLocativeAdm,
|
||||
Long montantLoyerAnnuel,
|
||||
Long tfuMetreCarre,
|
||||
Long tfuMinimum,
|
||||
String standingBat,
|
||||
String categorieBat,
|
||||
Long nombrePiscine,
|
||||
Long nombreUlog,
|
||||
Long nombreBat,
|
||||
LocalDate dateEnquete,
|
||||
Long serviceId,
|
||||
Long zoneRfuId,
|
||||
Long valeurAdministrativeParcelleNonBati,
|
||||
NatureImpot natureImpot,
|
||||
String serviceCode,
|
||||
String zoneRfuNom,
|
||||
Long valeurBatiment,
|
||||
Long valeurParcelle,
|
||||
Long valeurLocativeAdmMetreCarre,
|
||||
Long valeurAdministrativeParcelleNonBatiAuMetreCarre,
|
||||
Float montantTaxe
|
||||
) {
|
||||
this.id = id;
|
||||
this.annee = annee;
|
||||
this.codeDepartement = codeDepartement;
|
||||
this.nomDepartement = nomDepartement;
|
||||
this.codeCommune = codeCommune;
|
||||
this.nomCommune = nomCommune;
|
||||
this.codeArrondissement = codeArrondissement;
|
||||
this.nomArrondissement = nomArrondissement;
|
||||
this.codeQuartierVillage = codeQuartierVillage;
|
||||
this.nomQuartierVillage = nomQuartierVillage;
|
||||
this.q = q;
|
||||
this.ilot = ilot;
|
||||
this.parcelle = parcelle;
|
||||
this.nup = nup;
|
||||
this.titreFoncier = titreFoncier;
|
||||
this.numBatiment = numBatiment;
|
||||
this.numUniteLogement = numUniteLogement;
|
||||
this.ifu = ifu;
|
||||
this.npi = npi;
|
||||
this.telProp = telProp;
|
||||
this.emailProp = emailProp;
|
||||
this.nomProp = nomProp;
|
||||
this.prenomProp = prenomProp;
|
||||
this.raisonSociale = raisonSociale;
|
||||
this.adresseProp = adresseProp;
|
||||
this.telRep = telRep;
|
||||
this.emailRep = emailRep;
|
||||
this.nomRep = nomRep;
|
||||
this.prenomRep = prenomRep;
|
||||
this.adresseRep = adresseRep;
|
||||
this.longitude = longitude;
|
||||
this.latitude = latitude;
|
||||
this.superficieParc = superficieParc;
|
||||
this.superficieAuSolBat = superficieAuSolBat;
|
||||
this.superficieAuSolUlog = superficieAuSolUlog;
|
||||
this.batie = batie;
|
||||
this.exonere = exonere;
|
||||
this.batimentExonere = batimentExonere;
|
||||
this.uniteLogementExonere = uniteLogementExonere;
|
||||
this.valeurLocativeAdm = valeurLocativeAdm;
|
||||
this.montantLoyerAnnuel = montantLoyerAnnuel;
|
||||
this.tfuMetreCarre = tfuMetreCarre;
|
||||
this.tfuMinimum = tfuMinimum;
|
||||
this.standingBat = standingBat;
|
||||
this.categorieBat = categorieBat;
|
||||
this.nombrePiscine = nombrePiscine;
|
||||
this.nombreUlog = nombreUlog;
|
||||
this.nombreBat = nombreBat;
|
||||
this.dateEnquete = dateEnquete;
|
||||
this.serviceId = serviceId;
|
||||
this.zoneRfuId = zoneRfuId;
|
||||
this.valeurAdminParcelleNb = valeurAdministrativeParcelleNonBati;
|
||||
this.natureImpot = natureImpot;
|
||||
this.serviceCode = serviceCode;
|
||||
this.zoneRfuNom = zoneRfuNom;
|
||||
this.valeurBatiment = valeurBatiment;
|
||||
this.valeurParcelle = valeurParcelle;
|
||||
this.valeurLocativeAdmMetreCarre = valeurLocativeAdmMetreCarre;
|
||||
this.valeurAdminParcelleNbMetreCarre = valeurAdministrativeParcelleNonBatiAuMetreCarre;
|
||||
this.montantTaxe = montantTaxe;
|
||||
}
|
||||
}
|
||||
@@ -15,9 +15,6 @@ import java.util.List;
|
||||
@Data
|
||||
public class EnqueteBatimentPayloadWeb {
|
||||
private Long id;
|
||||
// private BatimentPaylaodWeb batimentPaylaodWeb ;
|
||||
// private List<CaracteristiqueBatimentPayloadWeb> caracteristiqueBatimentPayloadWebs;
|
||||
// private List<UploadPayLoadWeb> uploadPayLoadWebs;
|
||||
private String observation;
|
||||
private String autreMenuisierie;
|
||||
private String autreMur;
|
||||
@@ -52,7 +49,6 @@ public class EnqueteBatimentPayloadWeb {
|
||||
private String enqueteurNom;
|
||||
private String enqueteurPrenom;
|
||||
@Enumerated(EnumType.STRING)
|
||||
// @JsonIgnore
|
||||
private StatutEnquete statutEnquete;
|
||||
private Long exerciceId;
|
||||
private Integer exerciceAnnee;
|
||||
@@ -68,6 +64,18 @@ public class EnqueteBatimentPayloadWeb {
|
||||
private Long usageId;
|
||||
private String usageNom;
|
||||
|
||||
private String nub;
|
||||
private String code;
|
||||
private LocalDate dateConstruction;
|
||||
private Long parcelleId;
|
||||
private String parcelleNup;
|
||||
private String parcelleQ;
|
||||
private String parcelleI;
|
||||
private String parcelleP;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long valeurBatimentCalcule;
|
||||
private Integer nbreUniteLogement;
|
||||
|
||||
public EnqueteBatimentPayloadWeb(Long id, String observation, String autreMenuisierie, String autreMur, boolean sbee, String numCompteurSbee, boolean soneb, String numCompteurSoneb, int nbreLotUnite, int nbreUniteLocation, Float superficieLouee, Float superficieAuSol, LocalDate dateEnquete, int nbreMenage, int nbreHabitant, Long montantMensuelLocation, Long montantLocatifAnnuelDeclare, Long nbreEtage, Long valeurBatimentEstime, Long valeurBatimentReel, int nbreMoisLocation, String autreCaracteristiquePhysique, LocalDate dateDebutExcemption, LocalDate dateFinExcemption, Long batimentId, String batimentNub, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, Long enqueteurId, String enqueteurNom, String enqueteurPrenom,
|
||||
StatutEnquete statutEnquete,
|
||||
Long exerciceId,
|
||||
@@ -82,7 +90,18 @@ public class EnqueteBatimentPayloadWeb {
|
||||
Integer nombrePiscine,
|
||||
Long montantLocatifAnnuelCalcule,
|
||||
Long usageId,
|
||||
String usageNom
|
||||
String usageNom,
|
||||
String nub,
|
||||
String code,
|
||||
LocalDate dateConstruction,
|
||||
Long parcelleId,
|
||||
String parcelleNup,
|
||||
String parcelleQ,
|
||||
String parcelleI,
|
||||
String parcelleP,
|
||||
Long montantLocatifAnnuelEstime,
|
||||
Long valeurBatimentCalcule,
|
||||
Integer nbreUniteLogement
|
||||
) {
|
||||
this.id = id;
|
||||
this.observation = observation;
|
||||
@@ -131,5 +150,16 @@ public class EnqueteBatimentPayloadWeb {
|
||||
this.montantLocatifAnnuelCalcule = montantLocatifAnnuelCalcule;
|
||||
this.usageId = usageId ;
|
||||
this.usageNom = usageNom ;
|
||||
this.nub=nub;
|
||||
this.code=code;
|
||||
this.dateConstruction=dateConstruction;
|
||||
this.parcelleId=parcelleId;
|
||||
this.parcelleNup=parcelleNup;
|
||||
this.parcelleQ=parcelleQ;
|
||||
this.parcelleI=parcelleI;
|
||||
this.parcelleP=parcelleP;
|
||||
this.montantLocatifAnnuelEstime=montantLocatifAnnuelEstime;
|
||||
this.valeurBatimentCalcule=valeurBatimentCalcule;
|
||||
this.nbreUniteLogement=nbreUniteLogement;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,19 +15,10 @@ public class EnquetePayLoadWeb {
|
||||
private LocalDate dateEnquete;
|
||||
private LocalDate dateFinalisation;
|
||||
private Boolean litige;
|
||||
// private ParcellePayLoadWeb parcellePayLoadWeb;
|
||||
// private List<CaracteristiqueParcellePayloadWeb> caracteristiqueParcellePayloadWebs;
|
||||
// private List<DeclarationNcPayloadWeb> declarationNcPayloadWebs;
|
||||
// private List<PiecePayLoadWeb> piecePayLoadWebs;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatutEnquete statutEnquete;
|
||||
private String descriptionMotifRejet;
|
||||
private String observation;
|
||||
private String numeroTitreFoncier;
|
||||
private LocalDate dateTitreFoncier;
|
||||
private String numEntreeParcelle;
|
||||
private String numRue;
|
||||
private String nomRue;
|
||||
private Float precision;
|
||||
private Integer nbreCoProprietaire;
|
||||
private Integer nbreIndivisiaire;
|
||||
@@ -51,11 +42,6 @@ public class EnquetePayLoadWeb {
|
||||
private Long enqueteurId;
|
||||
private String enqueteurNom;
|
||||
private String enqueteurPrenom;
|
||||
private Long parcelleId;
|
||||
private String parcelleNup;
|
||||
private String parcelleQ;
|
||||
private String parcelleI;
|
||||
private String parcelleP;
|
||||
private Long exerciceId;
|
||||
private Integer exerciceAnnee;
|
||||
private Long modeAcquisitionId;
|
||||
@@ -65,12 +51,54 @@ public class EnquetePayLoadWeb {
|
||||
private String representantTel;
|
||||
private String representantNpi;
|
||||
|
||||
private Long parcelleId;
|
||||
private String parcelleNup;
|
||||
private String parcelleQ;
|
||||
private String parcelleI;
|
||||
private String parcelleP;
|
||||
|
||||
private String numeroTitreFoncier;
|
||||
private LocalDate dateTitreFoncier;
|
||||
private String numEntreeParcelle;
|
||||
private String numRue;
|
||||
private String nomRue;
|
||||
|
||||
private String nupProvisoire;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private String altitude;
|
||||
private String situationGeographique;
|
||||
private Long quartierId;
|
||||
private String quartierCode;
|
||||
private String quartierNom;
|
||||
private Long natureDomaineId;
|
||||
private String natureDomaineLibelle;
|
||||
private Long typeDomaineId;
|
||||
private String typeDomaineLibelle;
|
||||
private Long rueId;
|
||||
|
||||
|
||||
public EnquetePayLoadWeb(Long id, LocalDate dateEnquete, LocalDate dateFinalisation, Boolean litige, StatutEnquete statutEnquete, String descriptionMotifRejet, String observation, String numeroTitreFoncier, LocalDate dateTitreFoncier, String numEntreeParcelle, String numRue, String nomRue, Float precision, Integer nbreCoProprietaire, Integer nbreIndivisiaire, String autreAdresse, Float superficie, Integer nbreBatiment, Integer nbrePiscine, LocalDate dateDebutExemption, LocalDate dateFinExemption, String autreNumeroTitreFoncier, Long montantMensuelleLocation, Long montantAnnuelleLocation, Long valeurParcelleEstime, Long valeurParcelleReel, Long zoneRfuId, String zoneRfuNom, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, Long enqueteurId, String enqueteurNom, String enqueteurPrenom,Long parcelleId, String parcelleNup, String parcelleQ, String parcelleI, String parcelleP, Long exerciceId, Integer exerciceAnnee,
|
||||
Long modeAcquisitionId,String modeAcquisitionLibelle,
|
||||
String representantNom,
|
||||
Long modeAcquisitionId,
|
||||
String modeAcquisitionLibelle,
|
||||
String representantNom,
|
||||
String representantPrenom,
|
||||
String representantTel,
|
||||
String representantNpi) {
|
||||
String representantNpi,
|
||||
String nupProvisoire,
|
||||
String longitude,
|
||||
String latitude,
|
||||
String altitude,
|
||||
String situationGeographique,
|
||||
Long quartierId,
|
||||
String quartierCode,
|
||||
String quartierNom,
|
||||
Long natureDomaineId,
|
||||
String natureDomaineLibelle,
|
||||
Long typeDomaineId,
|
||||
String typeDomaineLibelle,
|
||||
Long rueId
|
||||
) {
|
||||
this.id = id;
|
||||
this.dateEnquete = dateEnquete;
|
||||
this.dateFinalisation = dateFinalisation;
|
||||
@@ -119,5 +147,18 @@ public class EnquetePayLoadWeb {
|
||||
this.representantTel = representantTel;
|
||||
this.representantPrenom = representantPrenom;
|
||||
this.representantNpi = representantNpi;
|
||||
this.nupProvisoire=nupProvisoire;
|
||||
this.longitude=longitude;
|
||||
this.latitude=latitude;
|
||||
this.altitude=altitude;
|
||||
this.situationGeographique=situationGeographique;
|
||||
this.quartierId=quartierId;
|
||||
this.quartierCode=quartierCode;
|
||||
this.quartierNom=quartierNom;
|
||||
this.natureDomaineId=natureDomaineId;
|
||||
this.natureDomaineLibelle=natureDomaineLibelle;
|
||||
this.typeDomaineId=typeDomaineId;
|
||||
this.typeDomaineLibelle=typeDomaineLibelle;
|
||||
this.rueId=rueId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,17 @@ public class EnqueteUniteLogementPayloadWeb {
|
||||
private Integer nombrePiscine;
|
||||
private Long usageId;
|
||||
private String usageNom;
|
||||
|
||||
|
||||
private String nul;
|
||||
private String numeroEtage;
|
||||
private String code;
|
||||
private Long batimentId;
|
||||
private String batimentNub;
|
||||
private LocalDate dateConstruction;
|
||||
private Long enqueteUniteLogementCourantId;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long valeurUniteLogementCalcule;
|
||||
public EnqueteUniteLogementPayloadWeb(Long id, String observation, Integer nbrePiece, Integer nbreHabitant, Integer nbreMenage, Boolean enLocation, Integer nbreMoisLocation, Long montantMensuelLocation, Long montantLocatifAnnuelDeclare, Long valeurUniteLogementEstime, Long valeurUniteLogementReel, Float superficieLouee, Float superficieAuSol, LocalDate dateEnquete, Boolean sbee, Boolean soneb, String numCompteurSbee, String numCompteurSoneb, LocalDate dateDebutExemption, LocalDate dateFinExemption, Long uniteLogementId, String uniteLogementNumeroEtage, String uniteLogementNul, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, Long enqueteurId, String enqueteurNom, String enqueteurPrenom, Long exerciceId, Integer exerciceAnnee,
|
||||
StatutEnquete statutEnquete,
|
||||
String representantNom,
|
||||
@@ -68,7 +79,15 @@ public class EnqueteUniteLogementPayloadWeb {
|
||||
Integer nombrePiscine,
|
||||
Long montantLocatifAnnuelCalcule,
|
||||
Long usageId,
|
||||
String usageNom
|
||||
String usageNom,
|
||||
String nul,
|
||||
String numeroEtage,
|
||||
String code,
|
||||
Long batimentId,
|
||||
String batimentNub,
|
||||
LocalDate dateConstruction,
|
||||
Long montantLocatifAnnuelEstime,
|
||||
Long valeurUniteLogementCalcule
|
||||
) {
|
||||
this.id = id;
|
||||
this.observation = observation;
|
||||
@@ -114,5 +133,14 @@ public class EnqueteUniteLogementPayloadWeb {
|
||||
this.montantLocatifAnnuelCalcule = montantLocatifAnnuelCalcule;
|
||||
this.usageId = usageId ;
|
||||
this.usageNom = usageNom ;
|
||||
|
||||
this.nul=nul;
|
||||
this.numeroEtage=numeroEtage;
|
||||
this.code=code;
|
||||
this.batimentId=batimentId;
|
||||
this.batimentNub=batimentNub;
|
||||
this.dateConstruction=dateConstruction;
|
||||
this.montantLocatifAnnuelEstime=montantLocatifAnnuelEstime;
|
||||
this.valeurUniteLogementCalcule=valeurUniteLogementCalcule;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.enums.NatureImpot;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ImpositionsTfuPaylaodWeb {
|
||||
private Long id;
|
||||
private LocalDate dateGeneration;
|
||||
private LocalDate dateCloture;
|
||||
private String referencePieceAdmin;
|
||||
private String datePieceAdmin;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatusAvis statusAvis;
|
||||
private Integer nombreAvis;
|
||||
private Integer nombreAvisFnb;
|
||||
private Integer nombreAvisBatiment;
|
||||
private Integer nombreAvisUniteLog;
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String motif;
|
||||
private Long exerciceId;
|
||||
private Integer exerciceAnnee;
|
||||
private Long communeId;
|
||||
private String communeCode;
|
||||
private String communeNom;
|
||||
private Long structureId ;
|
||||
private String structureNom ;
|
||||
public ImpositionsTfuPaylaodWeb(Long id, LocalDate dateGeneration, LocalDate dateCloture, String referencePieceAdmin, String datePieceAdmin, StatusAvis statusAvis, Integer nombreAvis, String motif, Long exerciceId, Integer exerciceAnnee, Long communeId, String communeCode, String communeNom, Long structureId, String structureNom,
|
||||
Integer nombreAvisFnb,
|
||||
Integer nombreAvisBatiment,
|
||||
Integer nombreAvisUniteLog
|
||||
) {
|
||||
this.id = id;
|
||||
this.dateGeneration = dateGeneration;
|
||||
this.dateCloture = dateCloture;
|
||||
this.referencePieceAdmin = referencePieceAdmin;
|
||||
this.datePieceAdmin = datePieceAdmin;
|
||||
this.statusAvis = statusAvis;
|
||||
this.nombreAvis = nombreAvis;
|
||||
this.motif = motif;
|
||||
this.exerciceId = exerciceId;
|
||||
this.exerciceAnnee = exerciceAnnee;
|
||||
this.communeId = communeId;
|
||||
this.communeCode = communeCode;
|
||||
this.communeNom = communeNom;
|
||||
this.structureId = structureId;
|
||||
this.structureNom = structureNom;
|
||||
this.nombreAvisFnb = nombreAvisFnb;
|
||||
this.nombreAvisBatiment = nombreAvisBatiment;
|
||||
this.nombreAvisUniteLog = nombreAvisUniteLog;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.decoupage.Departement;
|
||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.enums.SourceDonnee;
|
||||
import io.gmss.fiscad.enums.StatutParcelle;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.n52.jackson.datatype.jts.GeometryDeserializer;
|
||||
import org.n52.jackson.datatype.jts.GeometrySerializer;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class ParcelleGeomPaylaodWeb {
|
||||
private Long id;
|
||||
private String nup;
|
||||
private String nupProvisoire;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private String numeroRue;
|
||||
private String numeroEntreePorte;
|
||||
|
||||
private String codeInstad;
|
||||
private String numeroEtatLieux;
|
||||
private String numeroTitreFoncier;
|
||||
private LocalDate dateTitreFoncier;
|
||||
private Boolean batie ;
|
||||
|
||||
private String npi;
|
||||
private String ifu;
|
||||
private String nom;
|
||||
private String prenom;
|
||||
private String raisonSociale;
|
||||
private String nomEtPrenoms;
|
||||
private String telephone;
|
||||
private String adresse;
|
||||
|
||||
private String nomRepresentant;
|
||||
private String prenomRepresentant;
|
||||
private String raisonSocialeRepresentant;
|
||||
private String nomEtPrenomsRepresentant;
|
||||
private String telephoneRepresentant;
|
||||
private String adresseRepresentant;
|
||||
|
||||
private String q;
|
||||
private String zone;
|
||||
private String ilot;
|
||||
private String p;
|
||||
|
||||
private String qLotissement;
|
||||
private String ilotLotissement;
|
||||
private String pLotissement;
|
||||
|
||||
private String pointsPolygone;
|
||||
private Integer superficie;
|
||||
|
||||
private String dateCollecte;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private SourceDonnee sourceDonnees;
|
||||
private String observations;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatutParcelle statutParcelle;
|
||||
|
||||
private Long departementId;
|
||||
private String departementCode;
|
||||
private String departementNom;
|
||||
|
||||
private Long communeId;
|
||||
private String communeCode;
|
||||
private String communeNom;
|
||||
|
||||
private Long arrondissementId;
|
||||
private String arrondissementCode;
|
||||
private String arrondissementNom;
|
||||
|
||||
|
||||
private Long quartierId ;
|
||||
private String quartierCode ;
|
||||
private String quartierNom ;
|
||||
|
||||
private Integer geomSrid;
|
||||
@JsonSerialize(using = GeometrySerializer.class)
|
||||
@JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
||||
//@Column(name = "geometry",columnDefinition = "geometry(Polygon,32631)")
|
||||
private Polygon geometry;
|
||||
//@Column(columnDefinition = "TEXT")
|
||||
private String geometryString;
|
||||
|
||||
private Long parcelleId;
|
||||
|
||||
public ParcelleGeomPaylaodWeb(Long id, String nup, String nupProvisoire, String longitude, String latitude, String numeroRue, String numeroEntreePorte, String codeInstad, String numeroEtatLieux, String numeroTitreFoncier, LocalDate dateTitreFoncier, Boolean batie, String npi, String ifu, String nom, String prenom, String raisonSociale, String nomEtPrenoms, String telephone, String adresse, String nomRepresentant, String prenomRepresentant, String raisonSocialeRepresentant, String nomEtPrenomsRepresentant, String telephoneRepresentant, String adresseRepresentant, String q, String zone, String ilot, String p, String qLotissement, String ilotLotissement, String pLotissement, String pointsPolygone, Integer superficie, String dateCollecte, SourceDonnee sourceDonnees, String observations, StatutParcelle statutParcelle, Long departementId, String departementCode, String departementNom, Long communeId, String communeCode, String communeNom, Long arrondissementId, String arrondissementCode, String arrondissementNom, Long quartierId, String quartierCode, String quartierNom, Integer geomSrid, Polygon geometry, String geometryString, Long parcelleId) {
|
||||
this.id = id;
|
||||
this.nup = nup;
|
||||
this.nupProvisoire = nupProvisoire;
|
||||
this.longitude = longitude;
|
||||
this.latitude = latitude;
|
||||
this.numeroRue = numeroRue;
|
||||
this.numeroEntreePorte = numeroEntreePorte;
|
||||
this.codeInstad = codeInstad;
|
||||
this.numeroEtatLieux = numeroEtatLieux;
|
||||
this.numeroTitreFoncier = numeroTitreFoncier;
|
||||
this.dateTitreFoncier = dateTitreFoncier;
|
||||
this.batie = batie;
|
||||
this.npi = npi;
|
||||
this.ifu = ifu;
|
||||
this.nom = nom;
|
||||
this.prenom = prenom;
|
||||
this.raisonSociale = raisonSociale;
|
||||
this.nomEtPrenoms = nomEtPrenoms;
|
||||
this.telephone = telephone;
|
||||
this.adresse = adresse;
|
||||
this.nomRepresentant = nomRepresentant;
|
||||
this.prenomRepresentant = prenomRepresentant;
|
||||
this.raisonSocialeRepresentant = raisonSocialeRepresentant;
|
||||
this.nomEtPrenomsRepresentant = nomEtPrenomsRepresentant;
|
||||
this.telephoneRepresentant = telephoneRepresentant;
|
||||
this.adresseRepresentant = adresseRepresentant;
|
||||
this.q = q;
|
||||
this.zone = zone;
|
||||
this.ilot = ilot;
|
||||
this.p = p;
|
||||
this.qLotissement = qLotissement;
|
||||
this.ilotLotissement = ilotLotissement;
|
||||
this.pLotissement = pLotissement;
|
||||
this.pointsPolygone = pointsPolygone;
|
||||
this.superficie = superficie;
|
||||
this.dateCollecte = dateCollecte;
|
||||
this.sourceDonnees = sourceDonnees;
|
||||
this.observations = observations;
|
||||
this.statutParcelle = statutParcelle;
|
||||
this.departementId = departementId;
|
||||
this.departementCode = departementCode;
|
||||
this.departementNom = departementNom;
|
||||
this.communeId = communeId;
|
||||
this.communeCode = communeCode;
|
||||
this.communeNom = communeNom;
|
||||
this.arrondissementId = arrondissementId;
|
||||
this.arrondissementCode = arrondissementCode;
|
||||
this.arrondissementNom = arrondissementNom;
|
||||
this.quartierId = quartierId;
|
||||
this.quartierCode = quartierCode;
|
||||
this.quartierNom = quartierNom;
|
||||
this.geomSrid = geomSrid;
|
||||
this.geometry = geometry;
|
||||
this.geometryString = geometryString;
|
||||
this.parcelleId = parcelleId;
|
||||
}
|
||||
}
|
||||
@@ -27,10 +27,11 @@ public class PiecePayLoadWeb {
|
||||
private Long enqueteId;
|
||||
private Long enqueteBatimentId;
|
||||
private Long enqueteUniteLogementId;
|
||||
//private List<UploadPayLoadWeb> uploadPayLoadWebs;
|
||||
private Long nombreFichier;
|
||||
|
||||
public PiecePayLoadWeb(Long id, LocalDate dateExpiration, LocalDate dateEtablissement, String numeroPiece, String url, Long typePieceId, String typePieceLibelle, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, Long sourceDroitId, String sourceDroitLibelle, Long modeAcquisitionId, String modeAcquisitionLibelle, String observation, Long enqueteId,
|
||||
Long enqueteBatimentId,Long enqueteUniteLogementId) {
|
||||
Long enqueteBatimentId,Long enqueteUniteLogementId,
|
||||
Long nombreFichier) {
|
||||
this.id = id;
|
||||
this.dateExpiration = dateExpiration;
|
||||
this.dateEtablissement = dateEtablissement;
|
||||
@@ -50,6 +51,7 @@ public class PiecePayLoadWeb {
|
||||
this.enqueteId = enqueteId;
|
||||
this.enqueteBatimentId = enqueteBatimentId;
|
||||
this.enqueteUniteLogementId = enqueteUniteLogementId;
|
||||
this.nombreFichier = nombreFichier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,10 @@ public class UniteLogementPaylaodWeb {
|
||||
private Long montantMensuelLocation;
|
||||
private Long montantLocatifAnnuelDeclare;
|
||||
private Long montantLocatifAnnuelCalcule;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long valeurUniteLogementEstime;
|
||||
private Long valeurUniteLogementReel;
|
||||
private Long valeurUniteLogementCalcule;
|
||||
private Integer nombrePiscine;
|
||||
private Long usageId;
|
||||
private String usageNom;
|
||||
@@ -45,7 +47,9 @@ public class UniteLogementPaylaodWeb {
|
||||
Long valeurUniteLogementReel,
|
||||
Integer nombrePiscine,
|
||||
Long usageId,
|
||||
String usageNom
|
||||
String usageNom,
|
||||
Long montantLocatifAnnuelEstime,
|
||||
Long valeurUniteLogementCalcule
|
||||
) {
|
||||
this.id = id;
|
||||
this.nul = nul;
|
||||
@@ -73,5 +77,7 @@ public class UniteLogementPaylaodWeb {
|
||||
this.nombrePiscine = nombrePiscine;
|
||||
this.usageId = usageId ;
|
||||
this.usageNom = usageNom ;
|
||||
this.montantLocatifAnnuelEstime = montantLocatifAnnuelEstime ;
|
||||
this.valeurUniteLogementCalcule = valeurUniteLogementCalcule ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ParcellePayLoad {
|
||||
|
||||
/////////////////////////////////
|
||||
private Long typeDomaineId;
|
||||
private Long numeroProvisoire;
|
||||
private String numeroProvisoire;
|
||||
private Long blocId;
|
||||
private String situationGeographique;
|
||||
private String autreNumeroTitreFoncier;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package io.gmss.fiscad.paylaods.response.statistique;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NombreEnquetesParObjet {
|
||||
Integer nombreEnqueteParcelle;
|
||||
Integer nombreEnqueteBatiment;
|
||||
Integer nombreEnqueteUniteLogement;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.gmss.fiscad.paylaods.response.restoration;
|
||||
package io.gmss.fiscad.paylaods.response.statistique;
|
||||
|
||||
public interface ParcelleStatsProjectionUnSecteur {
|
||||
// ================== Département ==================
|
||||
@@ -0,0 +1,285 @@
|
||||
CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_irf_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;
|
||||
v_taux_defaut_sup_sol NUMERIC;
|
||||
v_taux_valeur_locat_prof NUMERIC;
|
||||
v_tfu_piscine_unitaire NUMERIC;
|
||||
v_taux_irf NUMERIC;
|
||||
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;
|
||||
|
||||
|
||||
select value
|
||||
into strict v_taux_defaut_sup_sol
|
||||
from parameters
|
||||
where name ='TAUX_DEFAUT_SUPERFICIE_AU_SOL';
|
||||
|
||||
select value
|
||||
into STRICT v_taux_irf
|
||||
from parameters
|
||||
where name ='TAUX_IRF';
|
||||
|
||||
|
||||
select value
|
||||
into STRICT v_taux_valeur_locat_prof
|
||||
from parameters
|
||||
where name ='TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE';
|
||||
|
||||
select value
|
||||
into STRICT v_tfu_piscine_unitaire
|
||||
from parameters
|
||||
where name ='TFU_PAR_PISCINE';
|
||||
|
||||
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,
|
||||
num_batiment,
|
||||
ifu,
|
||||
npi,
|
||||
tel_prop,
|
||||
email_prop,
|
||||
nom_prop,
|
||||
prenom_prop,
|
||||
raison_sociale,
|
||||
adresse_prop,
|
||||
tel_sc,
|
||||
nom_sc,
|
||||
prenom_sc,
|
||||
longitude,
|
||||
latitude,
|
||||
batie,
|
||||
exonere,
|
||||
batiment_exonere,
|
||||
standing_bat,
|
||||
categorie_bat,
|
||||
nombre_piscine,
|
||||
date_enquete,
|
||||
structure_id,
|
||||
zone_rfu_id,
|
||||
nature_impot,
|
||||
superficie_parc,
|
||||
superficie_au_sol_bat,
|
||||
valeur_batiment,
|
||||
valeur_locative_adm_metre_carre,
|
||||
montant_loyer_annuel,
|
||||
tfu_metre_carre,
|
||||
tfu_minimum,
|
||||
impositions_tfu_id,
|
||||
deleted,
|
||||
created_at ,
|
||||
created_by ,
|
||||
"source",
|
||||
updated_at ,
|
||||
updated_by,
|
||||
categorie_usage,
|
||||
superficie_au_sol_taux_prop_parc, ---70% de la surperficie au sol de la parcelle
|
||||
valeur_locative_adm_taux_prop_parc,
|
||||
tfu_calcule_taux_prop_parc, ----tfu correspondant au 70%
|
||||
valeur_locative_adm_sup_reel,
|
||||
valeur_locative_adm, ----------valeur locative administrative
|
||||
tfu_superficie_au_sol_reel, ----tfu correspondant à la superficie au sol reelle
|
||||
tfu_piscine,
|
||||
montant_taxe, ----tfu finale
|
||||
taux_tfu, ----taux tfu batie
|
||||
parcelle_id,
|
||||
batiment_id,
|
||||
unite_logement_id,
|
||||
superficie_au_sol_loue
|
||||
)
|
||||
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,
|
||||
b.nub,
|
||||
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,
|
||||
TRUE,
|
||||
(
|
||||
CURRENT_DATE >= ep.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(ep.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eb.date_debut_excemption
|
||||
AND CURRENT_DATE <= COALESCE(eb.date_fin_excemption, CURRENT_DATE)
|
||||
),
|
||||
cb.standing,
|
||||
cb.nom,
|
||||
eb.nombre_piscine,
|
||||
eb.date_enquete,
|
||||
st.id,
|
||||
ep.zone_rfu_id,
|
||||
'IRF',
|
||||
p.superficie,
|
||||
eb.superficie_au_sol,
|
||||
case -------valeur_batiment
|
||||
WHEN eb.valeur_batiment_reel IS NOT NULL AND eb.valeur_batiment_reel <> 0 THEN eb.valeur_batiment_reel
|
||||
WHEN eb.valeur_batiment_calcule IS NOT NULL AND eb.valeur_batiment_calcule <> 0 THEN eb.valeur_batiment_calcule
|
||||
WHEN eb.valeur_batiment_estime IS NOT NULL AND eb.valeur_batiment_estime <> 0 THEN eb.valeur_batiment_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.valeur_locative,
|
||||
case ----- montant_loyer_annuel
|
||||
WHEN eb.montant_locatif_annuel_declare IS NOT NULL AND eb.montant_locatif_annuel_declare <> 0 THEN eb.montant_locatif_annuel_declare
|
||||
WHEN eb.montant_locatif_annuel_calcule IS NOT NULL AND eb.montant_locatif_annuel_calcule <> 0 THEN eb.montant_locatif_annuel_calcule
|
||||
WHEN eb.montant_locatif_annuel_estime IS NOT NULL AND eb.montant_locatif_annuel_estime <> 0 THEN eb.montant_locatif_annuel_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.tfu_metre_carre,
|
||||
brb.tfu_minimum,
|
||||
p_impositions_tfu_id,
|
||||
false,
|
||||
current_date ,
|
||||
p_user_id ,
|
||||
'FISCAD',
|
||||
current_date ,
|
||||
p_user_id,
|
||||
eb.categorie_usage,
|
||||
p.superficie*v_taux_defaut_sup_sol/100,---superficie_au_sol_70pour100
|
||||
(p.superficie * v_taux_defaut_sup_sol/100) * brb.valeur_locative,
|
||||
0,
|
||||
eb.superficie_au_sol * brb.valeur_locative,
|
||||
0, ------ valeur_locative_adm : en attente de update
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
v_taux_irf,
|
||||
p.id,
|
||||
b.id,
|
||||
null,
|
||||
eb.superficie_louee
|
||||
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, id 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
|
||||
JOIN secteur_decoupage 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
|
||||
JOIN batiment b ON b.parcelle_id = p.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (batiment_id)
|
||||
batiment_id,
|
||||
superficie_au_sol,
|
||||
nombre_piscine,
|
||||
categorie_batiment_id,
|
||||
date_enquete,
|
||||
montant_locatif_annuel_declare,
|
||||
montant_locatif_annuel_calcule,
|
||||
montant_locatif_annuel_estime,
|
||||
date_debut_excemption,
|
||||
date_fin_excemption,
|
||||
valeur_batiment_reel,
|
||||
valeur_batiment_calcule,
|
||||
valeur_batiment_estime,
|
||||
u.categorie_usage,
|
||||
superficie_louee
|
||||
FROM enquete_batiment eb
|
||||
join usage u on u.id=eb.usage_id
|
||||
where superficie_louee*montant_locatif_annuel_declare>0
|
||||
ORDER BY batiment_id, date_enquete DESC, eb.id DESC
|
||||
) eb ON eb.batiment_id = b.id
|
||||
JOIN categorie_batiment cb
|
||||
ON cb.id = eb.categorie_batiment_id
|
||||
JOIN LATERAL (
|
||||
SELECT *
|
||||
FROM barem_rfu_bati br
|
||||
WHERE br.categorie_batiment_id = cb.id
|
||||
AND br.arrondissement_id = a.id
|
||||
AND (br.quartier_id = q.id OR br.quartier_id IS NULL)
|
||||
ORDER BY br.quartier_id DESC NULLS LAST
|
||||
LIMIT 1
|
||||
) brb ON TRUE
|
||||
WHERE p.batie = TRUE
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = b.id
|
||||
)
|
||||
AND st.id = v_structure_id
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||
|
||||
UPDATE donnees_imposition_tfu dtfu
|
||||
SET
|
||||
valeur_locative_adm=montant_loyer_annuel,
|
||||
montant_taxe = montant_loyer_annuel * v_taux_irf/100
|
||||
WHERE impositions_tfu_id = p_impositions_tfu_id
|
||||
AND batie = TRUE
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = dtfu.batiment_id
|
||||
);
|
||||
RETURN v_rows_inserted;
|
||||
END;
|
||||
$$;
|
||||
@@ -0,0 +1,341 @@
|
||||
CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_irf_batie_unite_logement(
|
||||
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;
|
||||
v_taux_defaut_sup_sol NUMERIC;
|
||||
v_taux_irf NUMERIC;
|
||||
v_taux_valeur_locat_prof NUMERIC;
|
||||
v_tfu_piscine_unitaire NUMERIC;
|
||||
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;
|
||||
|
||||
|
||||
select value
|
||||
into strict v_taux_defaut_sup_sol
|
||||
from parameters
|
||||
where name ='TAUX_DEFAUT_SUPERFICIE_AU_SOL';
|
||||
|
||||
select value
|
||||
into STRICT v_taux_irf
|
||||
from parameters
|
||||
where name ='TAUX_IRF';
|
||||
|
||||
select value
|
||||
into STRICT v_taux_valeur_locat_prof
|
||||
from parameters
|
||||
where name ='TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE';
|
||||
|
||||
select value
|
||||
into STRICT v_tfu_piscine_unitaire
|
||||
from parameters
|
||||
where name ='TFU_PAR_PISCINE';
|
||||
|
||||
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,
|
||||
num_batiment,
|
||||
num_unite_logement,
|
||||
ifu,
|
||||
npi,
|
||||
tel_prop,
|
||||
email_prop,
|
||||
nom_prop,
|
||||
prenom_prop,
|
||||
raison_sociale,
|
||||
adresse_prop,
|
||||
tel_sc,
|
||||
nom_sc,
|
||||
prenom_sc,
|
||||
longitude,
|
||||
latitude,
|
||||
batie,
|
||||
exonere,
|
||||
batiment_exonere,
|
||||
unite_logement_exonere,
|
||||
standing_bat,
|
||||
categorie_bat,
|
||||
nombre_piscine,
|
||||
date_enquete,
|
||||
structure_id,
|
||||
zone_rfu_id,
|
||||
nature_impot,
|
||||
superficie_parc,
|
||||
superficie_au_sol_bat,
|
||||
superficie_au_sol_ulog,
|
||||
valeur_batiment,
|
||||
valeur_locative_adm_metre_carre,
|
||||
montant_loyer_annuel,
|
||||
tfu_metre_carre,
|
||||
tfu_minimum,
|
||||
impositions_tfu_id,
|
||||
deleted,
|
||||
created_at ,
|
||||
created_by ,
|
||||
"source",
|
||||
updated_at ,
|
||||
updated_by,
|
||||
categorie_usage,
|
||||
superficie_au_sol_taux_prop_parc, ---70% de la surperficie au sol de la parcelle
|
||||
valeur_locative_adm_taux_prop_parc,
|
||||
tfu_calcule_taux_prop_parc, ----tfu correspondant au 70%
|
||||
valeur_locative_adm_sup_reel,
|
||||
valeur_locative_adm, ----------valeur locative administrative
|
||||
tfu_superficie_au_sol_reel, ----tfu correspondant à la superficie au sol reelle
|
||||
tfu_piscine,
|
||||
montant_taxe, ----tfu finale
|
||||
taux_tfu, ----taux tfu batie
|
||||
parcelle_id,
|
||||
batiment_id,
|
||||
unite_logement_id,
|
||||
superficie_au_sol_loue
|
||||
)
|
||||
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,
|
||||
b.nub,
|
||||
ul.nul,
|
||||
eul.ifu,
|
||||
eul.npi,
|
||||
eul.tel1,
|
||||
eul.email,
|
||||
eul.nom,
|
||||
eul.prenom,
|
||||
eul.raison_sociale,
|
||||
eul.adresse,
|
||||
eul.representant_tel,
|
||||
eul.representant_nom,
|
||||
eul.representant_prenom,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
TRUE,
|
||||
(
|
||||
CURRENT_DATE >= ep.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(ep.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eb.date_debut_excemption
|
||||
AND CURRENT_DATE <= COALESCE(eb.date_fin_excemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eul.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(eul.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
cb.standing,
|
||||
cb.nom,
|
||||
CASE
|
||||
WHEN eul.nombre_piscine is null then 0
|
||||
else eul.nombre_piscine
|
||||
END,
|
||||
eul.date_enquete,
|
||||
st.id,
|
||||
ep.zone_rfu_id,
|
||||
'IRF',
|
||||
p.superficie,
|
||||
eb.superficie_au_sol,
|
||||
eul.superficie_au_sol,
|
||||
CASE -------valeur_batiment
|
||||
WHEN eul.valeur_unite_logement_reel IS NOT NULL AND eul.valeur_unite_logement_reel <> 0 THEN eul.valeur_unite_logement_reel
|
||||
WHEN eul.valeur_unite_logement_calcule IS NOT NULL AND eul.valeur_unite_logement_calcule <> 0 THEN eul.valeur_unite_logement_calcule
|
||||
WHEN eul.valeur_unite_logement_estime IS NOT NULL AND eul.valeur_unite_logement_estime <> 0 THEN eul.valeur_unite_logement_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.valeur_locative,
|
||||
CASE ----- montant_loyer_annuel
|
||||
WHEN eul.montant_locatif_annuel_declare IS NOT NULL AND eul.montant_locatif_annuel_declare <> 0 THEN eul.montant_locatif_annuel_declare
|
||||
WHEN eul.montant_locatif_annuel_calcule IS NOT NULL AND eul.montant_locatif_annuel_calcule <> 0 THEN eul.montant_locatif_annuel_calcule
|
||||
WHEN eul.montant_locatif_annuel_estime IS NOT NULL AND eul.montant_locatif_annuel_estime <> 0 THEN eul.montant_locatif_annuel_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.tfu_metre_carre,
|
||||
brb.tfu_minimum,
|
||||
p_impositions_tfu_id,
|
||||
false,
|
||||
current_date,
|
||||
p_user_id,
|
||||
'FISCAD',
|
||||
current_date,
|
||||
p_user_id,
|
||||
eul.categorie_usage,
|
||||
p.superficie * v_taux_defaut_sup_sol/100,---superficie_au_sol_70pour100
|
||||
case ----valeur_locative_adm70pour100
|
||||
when eul.categorie_usage = 'HABITATION' then (p.superficie * v_taux_defaut_sup_sol/100) * brb.valeur_locative
|
||||
else 0
|
||||
end,
|
||||
0,
|
||||
eul.superficie_au_sol * brb.valeur_locative,
|
||||
0, ------ valeur_locative_adm : en attente de update
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
v_taux_irf,
|
||||
p.id,
|
||||
b.id,
|
||||
ul.id,
|
||||
eul.superficie_louee
|
||||
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, id 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
|
||||
--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 section ses ON ses.id = sect.section_id
|
||||
JOIN "structure" st ON st.id = ses.structure_id
|
||||
JOIN batiment b ON b.parcelle_id = p.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (batiment_id)
|
||||
batiment_id,
|
||||
superficie_au_sol,
|
||||
nombre_piscine,
|
||||
categorie_batiment_id,
|
||||
date_enquete,
|
||||
montant_locatif_annuel_declare,
|
||||
montant_locatif_annuel_calcule,
|
||||
montant_locatif_annuel_estime,
|
||||
date_debut_excemption,
|
||||
date_fin_excemption,
|
||||
valeur_batiment_reel,
|
||||
valeur_batiment_calcule,
|
||||
valeur_batiment_estime,
|
||||
u.categorie_usage
|
||||
FROM enquete_batiment eb
|
||||
join usage u on u.id=eb.usage_id
|
||||
ORDER BY batiment_id, date_enquete DESC, eb.id DESC
|
||||
) eb ON eb.batiment_id = b.id
|
||||
JOIN unite_logement ul on ul.batiment_id = b.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (eult.unite_logement_id)
|
||||
eult.unite_logement_id,
|
||||
pers1.id,
|
||||
pers1.ifu,
|
||||
pers1.npi,
|
||||
pers1.tel1,
|
||||
pers1.email,
|
||||
pers1.nom,
|
||||
pers1.prenom,
|
||||
pers1.raison_sociale,
|
||||
pers1.adresse,
|
||||
eult.nombre_piscine,
|
||||
eult.categorie_batiment_id,
|
||||
eult.superficie_au_sol,
|
||||
eult.superficie_louee,
|
||||
eult.nbre_piece,
|
||||
eult.date_enquete,
|
||||
eult.montant_locatif_annuel_calcule,
|
||||
eult.montant_locatif_annuel_declare,
|
||||
eult.montant_locatif_annuel_estime,
|
||||
eult.date_debut_exemption,
|
||||
eult.date_fin_exemption,
|
||||
eult.representant_nom,
|
||||
eult.representant_prenom,
|
||||
eult.representant_tel,
|
||||
eult.valeur_unite_logement_reel,
|
||||
eult.valeur_unite_logement_calcule,
|
||||
eult.valeur_unite_logement_estime,
|
||||
u.categorie_usage
|
||||
FROM enquete_unite_logement eult
|
||||
join usage u on u.id=eult.usage_id
|
||||
left join personne pers1 on pers1.id = eult.personne_id
|
||||
where superficie_louee*montant_locatif_annuel_declare>0
|
||||
ORDER BY unite_logement_id, date_enquete DESC, eult.id DESC
|
||||
) eul ON eul.unite_logement_id = ul.id
|
||||
JOIN categorie_batiment cb
|
||||
ON cb.id = eul.categorie_batiment_id
|
||||
JOIN LATERAL (
|
||||
SELECT *
|
||||
FROM barem_rfu_bati br
|
||||
WHERE br.categorie_batiment_id = cb.id
|
||||
AND br.arrondissement_id = a.id
|
||||
AND (br.quartier_id = q.id OR br.quartier_id IS NULL)
|
||||
ORDER BY br.quartier_id DESC NULLS LAST
|
||||
LIMIT 1
|
||||
) brb ON TRUE
|
||||
WHERE p.batie = TRUE
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = b.id
|
||||
)
|
||||
AND st.id = v_structure_id
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||
|
||||
UPDATE donnees_imposition_tfu dtfu
|
||||
SET
|
||||
valeur_locative_adm=montant_loyer_annuel,
|
||||
montant_taxe = montant_loyer_annuel * v_taux_irf/100
|
||||
WHERE impositions_tfu_id = p_impositions_tfu_id
|
||||
AND batie = TRUE
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = dtfu.batiment_id
|
||||
);
|
||||
RETURN v_rows_inserted;
|
||||
END;
|
||||
$$;
|
||||
@@ -0,0 +1,264 @@
|
||||
CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_srtb_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;
|
||||
v_montant_srtb NUMERIC;
|
||||
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;
|
||||
|
||||
|
||||
select value
|
||||
into STRICT v_montant_srtb
|
||||
from parameters
|
||||
where name ='TAXE_SRTB';
|
||||
|
||||
|
||||
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,
|
||||
num_batiment,
|
||||
ifu,
|
||||
npi,
|
||||
tel_prop,
|
||||
email_prop,
|
||||
nom_prop,
|
||||
prenom_prop,
|
||||
raison_sociale,
|
||||
adresse_prop,
|
||||
tel_sc,
|
||||
nom_sc,
|
||||
prenom_sc,
|
||||
longitude,
|
||||
latitude,
|
||||
batie,
|
||||
exonere,
|
||||
batiment_exonere,
|
||||
standing_bat,
|
||||
categorie_bat,
|
||||
nombre_piscine,
|
||||
date_enquete,
|
||||
structure_id,
|
||||
zone_rfu_id,
|
||||
nature_impot,
|
||||
superficie_parc,
|
||||
superficie_au_sol_bat,
|
||||
valeur_batiment,
|
||||
valeur_locative_adm_metre_carre,
|
||||
montant_loyer_annuel,
|
||||
tfu_metre_carre,
|
||||
tfu_minimum,
|
||||
impositions_tfu_id,
|
||||
deleted,
|
||||
created_at ,
|
||||
created_by ,
|
||||
"source",
|
||||
updated_at ,
|
||||
updated_by,
|
||||
categorie_usage,
|
||||
superficie_au_sol_taux_prop_parc, ---70% de la surperficie au sol de la parcelle
|
||||
valeur_locative_adm_taux_prop_parc,
|
||||
tfu_calcule_taux_prop_parc, ----tfu correspondant au 70%
|
||||
valeur_locative_adm_sup_reel,
|
||||
valeur_locative_adm, ----------valeur locative administrative
|
||||
tfu_superficie_au_sol_reel, ----tfu correspondant à la superficie au sol reelle
|
||||
tfu_piscine,
|
||||
montant_taxe, ----tfu finale
|
||||
taux_tfu, ----taux tfu batie
|
||||
parcelle_id,
|
||||
batiment_id,
|
||||
unite_logement_id,
|
||||
superficie_au_sol_loue
|
||||
)
|
||||
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,
|
||||
b.nub,
|
||||
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,
|
||||
TRUE,
|
||||
(
|
||||
CURRENT_DATE >= ep.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(ep.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eb.date_debut_excemption
|
||||
AND CURRENT_DATE <= COALESCE(eb.date_fin_excemption, CURRENT_DATE)
|
||||
),
|
||||
cb.standing,
|
||||
cb.nom,
|
||||
eb.nombre_piscine,
|
||||
eb.date_enquete,
|
||||
st.id,
|
||||
ep.zone_rfu_id,
|
||||
'SRTB',
|
||||
p.superficie,
|
||||
eb.superficie_au_sol,
|
||||
case -------valeur_batiment
|
||||
WHEN eb.valeur_batiment_reel IS NOT NULL AND eb.valeur_batiment_reel <> 0 THEN eb.valeur_batiment_reel
|
||||
WHEN eb.valeur_batiment_calcule IS NOT NULL AND eb.valeur_batiment_calcule <> 0 THEN eb.valeur_batiment_calcule
|
||||
WHEN eb.valeur_batiment_estime IS NOT NULL AND eb.valeur_batiment_estime <> 0 THEN eb.valeur_batiment_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.valeur_locative,
|
||||
case ----- montant_loyer_annuel
|
||||
WHEN eb.montant_locatif_annuel_declare IS NOT NULL AND eb.montant_locatif_annuel_declare <> 0 THEN eb.montant_locatif_annuel_declare
|
||||
WHEN eb.montant_locatif_annuel_calcule IS NOT NULL AND eb.montant_locatif_annuel_calcule <> 0 THEN eb.montant_locatif_annuel_calcule
|
||||
WHEN eb.montant_locatif_annuel_estime IS NOT NULL AND eb.montant_locatif_annuel_estime <> 0 THEN eb.montant_locatif_annuel_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.tfu_metre_carre,
|
||||
brb.tfu_minimum,
|
||||
p_impositions_tfu_id,
|
||||
false,
|
||||
current_date ,
|
||||
p_user_id ,
|
||||
'FISCAD',
|
||||
current_date ,
|
||||
p_user_id,
|
||||
eb.categorie_usage,
|
||||
0,---superficie_au_sol_70pour100
|
||||
0,
|
||||
0,
|
||||
eb.superficie_au_sol * brb.valeur_locative,
|
||||
0, ------ valeur_locative_adm : en attente de update
|
||||
0,
|
||||
0,
|
||||
v_montant_srtb,
|
||||
0,
|
||||
p.id,
|
||||
b.id,
|
||||
null,
|
||||
eb.superficie_louee
|
||||
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, id 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
|
||||
--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 section ses ON ses.id = sect.section_id
|
||||
JOIN "structure" st ON st.id = ses.structure_id
|
||||
JOIN batiment b ON b.parcelle_id = p.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (batiment_id)
|
||||
batiment_id,
|
||||
superficie_au_sol,
|
||||
nombre_piscine,
|
||||
categorie_batiment_id,
|
||||
date_enquete,
|
||||
montant_locatif_annuel_declare,
|
||||
montant_locatif_annuel_calcule,
|
||||
montant_locatif_annuel_estime,
|
||||
date_debut_excemption,
|
||||
date_fin_excemption,
|
||||
valeur_batiment_reel,
|
||||
valeur_batiment_calcule,
|
||||
valeur_batiment_estime,
|
||||
u.categorie_usage,
|
||||
superficie_louee
|
||||
FROM enquete_batiment eb
|
||||
join usage u on u.id=eb.usage_id
|
||||
ORDER BY batiment_id, date_enquete DESC, eb.id DESC
|
||||
) eb ON eb.batiment_id = b.id
|
||||
JOIN categorie_batiment cb
|
||||
ON cb.id = eb.categorie_batiment_id
|
||||
JOIN LATERAL (
|
||||
SELECT *
|
||||
FROM barem_rfu_bati br
|
||||
WHERE br.categorie_batiment_id = cb.id
|
||||
AND br.arrondissement_id = a.id
|
||||
AND (br.quartier_id = q.id OR br.quartier_id IS NULL)
|
||||
ORDER BY br.quartier_id DESC NULLS LAST
|
||||
LIMIT 1
|
||||
) brb ON TRUE
|
||||
WHERE p.batie = TRUE
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = b.id
|
||||
)
|
||||
AND st.id = v_structure_id
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||
|
||||
RETURN v_rows_inserted;
|
||||
END;
|
||||
$$;
|
||||
|
||||
|
||||
@@ -0,0 +1,311 @@
|
||||
CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_srtb_batie_unite_logement(
|
||||
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;
|
||||
v_montant_srtb NUMERIC;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
select value
|
||||
into STRICT v_montant_srtb
|
||||
from parameters
|
||||
where name ='TAXE_SRTB';
|
||||
|
||||
|
||||
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,
|
||||
num_batiment,
|
||||
num_unite_logement,
|
||||
ifu,
|
||||
npi,
|
||||
tel_prop,
|
||||
email_prop,
|
||||
nom_prop,
|
||||
prenom_prop,
|
||||
raison_sociale,
|
||||
adresse_prop,
|
||||
tel_sc,
|
||||
nom_sc,
|
||||
prenom_sc,
|
||||
longitude,
|
||||
latitude,
|
||||
batie,
|
||||
exonere,
|
||||
batiment_exonere,
|
||||
unite_logement_exonere,
|
||||
standing_bat,
|
||||
categorie_bat,
|
||||
nombre_piscine,
|
||||
date_enquete,
|
||||
structure_id,
|
||||
zone_rfu_id,
|
||||
nature_impot,
|
||||
superficie_parc,
|
||||
superficie_au_sol_bat,
|
||||
superficie_au_sol_ulog,
|
||||
valeur_batiment,
|
||||
valeur_locative_adm_metre_carre,
|
||||
montant_loyer_annuel,
|
||||
tfu_metre_carre,
|
||||
tfu_minimum,
|
||||
impositions_tfu_id,
|
||||
deleted,
|
||||
created_at ,
|
||||
created_by ,
|
||||
"source",
|
||||
updated_at ,
|
||||
updated_by,
|
||||
categorie_usage,
|
||||
superficie_au_sol_taux_prop_parc, ---70% de la surperficie au sol de la parcelle
|
||||
valeur_locative_adm_taux_prop_parc,
|
||||
tfu_calcule_taux_prop_parc, ----tfu correspondant au 70%
|
||||
valeur_locative_adm_sup_reel,
|
||||
valeur_locative_adm, ----------valeur locative administrative
|
||||
tfu_superficie_au_sol_reel, ----tfu correspondant à la superficie au sol reelle
|
||||
tfu_piscine,
|
||||
montant_taxe, ----tfu finale
|
||||
taux_tfu, ----taux tfu batie
|
||||
parcelle_id,
|
||||
batiment_id,
|
||||
unite_logement_id,
|
||||
superficie_au_sol_loue
|
||||
)
|
||||
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,
|
||||
b.nub,
|
||||
ul.nul,
|
||||
eul.ifu,
|
||||
eul.npi,
|
||||
eul.tel1,
|
||||
eul.email,
|
||||
eul.nom,
|
||||
eul.prenom,
|
||||
eul.raison_sociale,
|
||||
eul.adresse,
|
||||
eul.representant_tel,
|
||||
eul.representant_nom,
|
||||
eul.representant_prenom,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
TRUE,
|
||||
(
|
||||
CURRENT_DATE >= ep.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(ep.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eb.date_debut_excemption
|
||||
AND CURRENT_DATE <= COALESCE(eb.date_fin_excemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eul.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(eul.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
cb.standing,
|
||||
cb.nom,
|
||||
CASE
|
||||
WHEN eul.nombre_piscine is null then 0
|
||||
else eul.nombre_piscine
|
||||
END,
|
||||
eul.date_enquete,
|
||||
st.id,
|
||||
ep.zone_rfu_id,
|
||||
'IRF',
|
||||
p.superficie,
|
||||
eb.superficie_au_sol,
|
||||
eul.superficie_au_sol,
|
||||
CASE -------valeur_batiment
|
||||
WHEN eul.valeur_unite_logement_reel IS NOT NULL AND eul.valeur_unite_logement_reel <> 0 THEN eul.valeur_unite_logement_reel
|
||||
WHEN eul.valeur_unite_logement_calcule IS NOT NULL AND eul.valeur_unite_logement_calcule <> 0 THEN eul.valeur_unite_logement_calcule
|
||||
WHEN eul.valeur_unite_logement_estime IS NOT NULL AND eul.valeur_unite_logement_estime <> 0 THEN eul.valeur_unite_logement_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.valeur_locative,
|
||||
CASE ----- montant_loyer_annuel
|
||||
WHEN eul.montant_locatif_annuel_declare IS NOT NULL AND eul.montant_locatif_annuel_declare <> 0 THEN eul.montant_locatif_annuel_declare
|
||||
WHEN eul.montant_locatif_annuel_calcule IS NOT NULL AND eul.montant_locatif_annuel_calcule <> 0 THEN eul.montant_locatif_annuel_calcule
|
||||
WHEN eul.montant_locatif_annuel_estime IS NOT NULL AND eul.montant_locatif_annuel_estime <> 0 THEN eul.montant_locatif_annuel_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.tfu_metre_carre,
|
||||
brb.tfu_minimum,
|
||||
p_impositions_tfu_id,
|
||||
false,
|
||||
current_date,
|
||||
p_user_id,
|
||||
'FISCAD',
|
||||
current_date,
|
||||
p_user_id,
|
||||
eul.categorie_usage,
|
||||
0,---superficie_au_sol_70pour100
|
||||
0,
|
||||
0,
|
||||
eul.superficie_au_sol * brb.valeur_locative,
|
||||
0, ------ valeur_locative_adm : en attente de update
|
||||
0,
|
||||
0,
|
||||
v_montant_srtb,
|
||||
0,
|
||||
p.id,
|
||||
b.id,
|
||||
ul.id,
|
||||
eul.superficie_louee
|
||||
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, id 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
|
||||
--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 section ses ON ses.id = sect.section_id
|
||||
JOIN "structure" st ON st.id = ses.structure_id
|
||||
JOIN batiment b ON b.parcelle_id = p.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (batiment_id)
|
||||
batiment_id,
|
||||
superficie_au_sol,
|
||||
nombre_piscine,
|
||||
categorie_batiment_id,
|
||||
date_enquete,
|
||||
montant_locatif_annuel_declare,
|
||||
montant_locatif_annuel_calcule,
|
||||
montant_locatif_annuel_estime,
|
||||
date_debut_excemption,
|
||||
date_fin_excemption,
|
||||
valeur_batiment_reel,
|
||||
valeur_batiment_calcule,
|
||||
valeur_batiment_estime,
|
||||
u.categorie_usage
|
||||
FROM enquete_batiment eb
|
||||
join usage u on u.id=eb.usage_id
|
||||
ORDER BY batiment_id, date_enquete DESC, eb.id DESC
|
||||
) eb ON eb.batiment_id = b.id
|
||||
JOIN unite_logement ul on ul.batiment_id = b.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (eult.unite_logement_id)
|
||||
eult.unite_logement_id,
|
||||
pers1.id,
|
||||
pers1.ifu,
|
||||
pers1.npi,
|
||||
pers1.tel1,
|
||||
pers1.email,
|
||||
pers1.nom,
|
||||
pers1.prenom,
|
||||
pers1.raison_sociale,
|
||||
pers1.adresse,
|
||||
eult.nombre_piscine,
|
||||
eult.categorie_batiment_id,
|
||||
eult.superficie_au_sol,
|
||||
eult.superficie_louee,
|
||||
eult.nbre_piece,
|
||||
eult.date_enquete,
|
||||
eult.montant_locatif_annuel_calcule,
|
||||
eult.montant_locatif_annuel_declare,
|
||||
eult.montant_locatif_annuel_estime,
|
||||
eult.date_debut_exemption,
|
||||
eult.date_fin_exemption,
|
||||
eult.representant_nom,
|
||||
eult.representant_prenom,
|
||||
eult.representant_tel,
|
||||
eult.valeur_unite_logement_reel,
|
||||
eult.valeur_unite_logement_calcule,
|
||||
eult.valeur_unite_logement_estime,
|
||||
u.categorie_usage
|
||||
FROM enquete_unite_logement eult
|
||||
join usage u on u.id=eult.usage_id
|
||||
left join personne pers1 on pers1.id = eult.personne_id
|
||||
ORDER BY unite_logement_id, date_enquete DESC, eult.id DESC
|
||||
) eul ON eul.unite_logement_id = ul.id
|
||||
JOIN categorie_batiment cb
|
||||
ON cb.id = eul.categorie_batiment_id
|
||||
JOIN LATERAL (
|
||||
SELECT *
|
||||
FROM barem_rfu_bati br
|
||||
WHERE br.categorie_batiment_id = cb.id
|
||||
AND br.arrondissement_id = a.id
|
||||
AND (br.quartier_id = q.id OR br.quartier_id IS NULL)
|
||||
ORDER BY br.quartier_id DESC NULLS LAST
|
||||
LIMIT 1
|
||||
) brb ON TRUE
|
||||
WHERE p.batie = TRUE
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = b.id
|
||||
)
|
||||
AND st.id = v_structure_id
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||
|
||||
RETURN v_rows_inserted;
|
||||
END;
|
||||
$$;
|
||||
|
||||
@@ -0,0 +1,756 @@
|
||||
/*CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_tfu_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;
|
||||
v_taux_defaut_sup_sol NUMERIC;
|
||||
v_taux_tfu NUMERIC;
|
||||
v_taux_valeur_locat_prof NUMERIC;
|
||||
v_tfu_piscine_unitaire NUMERIC;
|
||||
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;
|
||||
|
||||
|
||||
select value
|
||||
into strict v_taux_defaut_sup_sol
|
||||
from parameters
|
||||
where name ='TAUX_DEFAUT_SUPERFICIE_AU_SOL';
|
||||
|
||||
select value
|
||||
into STRICT v_taux_tfu
|
||||
from parameters
|
||||
where name ='TAUX_TFU';
|
||||
|
||||
|
||||
select value
|
||||
into STRICT v_taux_valeur_locat_prof
|
||||
from parameters
|
||||
where name ='TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE';
|
||||
|
||||
select value
|
||||
into STRICT v_tfu_piscine_unitaire
|
||||
from parameters
|
||||
where name ='TFU_PAR_PISCINE';
|
||||
|
||||
|
||||
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,
|
||||
num_batiment,
|
||||
ifu,
|
||||
npi,
|
||||
tel_prop,
|
||||
email_prop,
|
||||
nom_prop,
|
||||
prenom_prop,
|
||||
raison_sociale,
|
||||
adresse_prop,
|
||||
tel_sc,
|
||||
nom_sc,
|
||||
prenom_sc,
|
||||
longitude,
|
||||
latitude,
|
||||
batie,
|
||||
exonere,
|
||||
batiment_exonere,
|
||||
standing_bat,
|
||||
categorie_bat,
|
||||
nombre_piscine,
|
||||
date_enquete,
|
||||
structure_id,
|
||||
zone_rfu_id,
|
||||
nature_impot,
|
||||
superficie_parc,
|
||||
superficie_au_sol_bat,
|
||||
valeur_batiment,
|
||||
valeur_locative_adm_metre_carre,
|
||||
montant_loyer_annuel,
|
||||
tfu_metre_carre,
|
||||
tfu_minimum,
|
||||
impositions_tfu_id,
|
||||
deleted,
|
||||
created_at ,
|
||||
created_by ,
|
||||
"source",
|
||||
updated_at ,
|
||||
updated_by,
|
||||
categorie_usage,
|
||||
superficie_au_sol_taux_prop_parc, ---70% de la surperficie au sol de la parcelle
|
||||
valeur_locative_adm_taux_prop_parc,
|
||||
tfu_calcule_taux_prop_parc, ----tfu correspondant au 70%
|
||||
valeur_locative_adm_sup_reel,
|
||||
valeur_locative_adm, ----------valeur locative administrative
|
||||
tfu_superficie_au_sol_reel, ----tfu correspondant à la superficie au sol reelle
|
||||
tfu_piscine,
|
||||
montant_taxe, ----tfu finale
|
||||
taux_tfu, ----taux tfu batie
|
||||
parcelle_id,
|
||||
batiment_id,
|
||||
unite_logement_id
|
||||
)
|
||||
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,
|
||||
b.nub,
|
||||
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,
|
||||
TRUE,
|
||||
(
|
||||
CURRENT_DATE >= ep.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(ep.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eb.date_debut_excemption
|
||||
AND CURRENT_DATE <= COALESCE(eb.date_fin_excemption, CURRENT_DATE)
|
||||
),
|
||||
cb.standing,
|
||||
cb.nom,
|
||||
eb.nombre_piscine,
|
||||
eb.date_enquete,
|
||||
st.id,
|
||||
ep.zone_rfu_id,
|
||||
'TFU',
|
||||
p.superficie,
|
||||
eb.superficie_au_sol,
|
||||
COALESCE(
|
||||
NULLIF(eb.valeur_batiment_reel, 0),
|
||||
NULLIF(eb.valeur_batiment_calcule, 0),
|
||||
NULLIF(eb.valeur_batiment_estime, 0),
|
||||
0
|
||||
),
|
||||
brb.valeur_locative,
|
||||
COALESCE(
|
||||
NULLIF(eb.montant_locatif_annuel_declare, 0),
|
||||
NULLIF(eb.montant_locatif_annuel_calcule, 0),
|
||||
NULLIF(eb.montant_locatif_annuel_estime, 0),
|
||||
0
|
||||
),
|
||||
brb.tfu_metre_carre,
|
||||
brb.tfu_minimum,
|
||||
p_impositions_tfu_id,
|
||||
false,
|
||||
current_date ,
|
||||
p_user_id ,
|
||||
'FISCAD',
|
||||
current_date ,
|
||||
p_user_id,
|
||||
eb.categorie_usage,
|
||||
p.superficie*v_taux_defaut_sup_sol/100,---superficie_au_sol_70pour100
|
||||
case ----valeur_locative_adm70pour100
|
||||
when eb.categorie_usage = 'HABITATION' then (p.superficie * v_taux_defaut_sup_sol/100) * brb.valeur_locative
|
||||
else 0
|
||||
end,
|
||||
case ----tfu calcule 70 pour 100 superficie parcelle
|
||||
when eb.categorie_usage= 'HABITATION' then (p.superficie * v_taux_defaut_sup_sol/100) * brb.valeur_locative * v_taux_tfu/100
|
||||
else 0
|
||||
end,
|
||||
case -----valeur_locative_adm_sup_reel
|
||||
when eb.categorie_usage='HABITATION' then eb.superficie_au_sol * brb.valeur_locative
|
||||
else 0
|
||||
end,
|
||||
0, ------ valeur_locative_adm : en attente de update
|
||||
case -----tfu_superficie_au_sol_reel
|
||||
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
|
||||
end,
|
||||
eb.nombre_piscine * v_tfu_piscine_unitaire,
|
||||
0,
|
||||
v_taux_tfu,
|
||||
p.id,
|
||||
b.id,
|
||||
null
|
||||
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, id 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
|
||||
--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 section ses ON ses.id = sect.section_id
|
||||
JOIN "structure" st ON st.id = ses.structure_id
|
||||
JOIN batiment b ON b.parcelle_id = p.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (batiment_id)
|
||||
batiment_id,
|
||||
superficie_au_sol,
|
||||
nombre_piscine,
|
||||
categorie_batiment_id,
|
||||
date_enquete,
|
||||
montant_locatif_annuel_declare,
|
||||
montant_locatif_annuel_calcule,
|
||||
montant_locatif_annuel_estime,
|
||||
date_debut_excemption,
|
||||
date_fin_excemption,
|
||||
valeur_batiment_reel,
|
||||
valeur_batiment_calcule,
|
||||
valeur_batiment_estime,
|
||||
u.categorie_usage
|
||||
FROM enquete_batiment eb
|
||||
join usage u on u.id=eb.usage_id
|
||||
ORDER BY batiment_id, date_enquete DESC, eb.id DESC
|
||||
) eb ON eb.batiment_id = b.id
|
||||
|
||||
JOIN categorie_batiment cb
|
||||
ON cb.id = eb.categorie_batiment_id
|
||||
JOIN LATERAL (
|
||||
SELECT *
|
||||
FROM barem_rfu_bati br
|
||||
WHERE br.categorie_batiment_id = cb.id
|
||||
AND br.arrondissement_id = a.id
|
||||
AND (br.quartier_id = q.id OR br.quartier_id IS NULL)
|
||||
ORDER BY br.quartier_id DESC NULLS LAST
|
||||
LIMIT 1
|
||||
) brb ON TRUE
|
||||
WHERE p.batie = TRUE
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = b.id
|
||||
)
|
||||
AND st.id = v_structure_id
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||
|
||||
UPDATE donnees_imposition_tfu dtfu
|
||||
SET
|
||||
valeur_locative_adm =
|
||||
CASE
|
||||
WHEN categorie_usage = 'HABITATION' AND superficie_au_sol_bat <> 0
|
||||
THEN valeur_locative_adm_sup_reel
|
||||
|
||||
WHEN categorie_usage = 'HABITATION' AND superficie_au_sol_bat = 0
|
||||
THEN valeur_locative_adm_taux_prop_parc
|
||||
|
||||
WHEN categorie_usage IN ('PROFESSIONNELLE','MIXTE') AND valeur_batiment <> 0
|
||||
THEN valeur_batiment * (v_taux_valeur_locat_prof/100)
|
||||
|
||||
WHEN categorie_usage IN ('PROFESSIONNELLE','MIXTE') AND valeur_batiment = 0
|
||||
THEN montant_loyer_annuel
|
||||
END,
|
||||
|
||||
montant_taxe =
|
||||
CASE
|
||||
WHEN categorie_usage = 'HABITATION' AND superficie_au_sol_bat <> 0 THEN
|
||||
CASE
|
||||
WHEN tfu_minimum < valeur_locative_adm_sup_reel * (v_taux_tfu/100) + tfu_piscine
|
||||
THEN valeur_locative_adm_sup_reel * (v_taux_tfu/100) + tfu_piscine
|
||||
ELSE tfu_minimum
|
||||
END
|
||||
|
||||
WHEN categorie_usage = 'HABITATION' AND superficie_au_sol_bat = 0 THEN
|
||||
CASE
|
||||
WHEN tfu_minimum < valeur_locative_adm_taux_prop_parc * (v_taux_tfu/100) + tfu_piscine
|
||||
THEN valeur_locative_adm_taux_prop_parc * (v_taux_tfu/100) + tfu_piscine
|
||||
ELSE tfu_minimum
|
||||
END
|
||||
|
||||
WHEN categorie_usage IN ('PROFESSIONNELLE','MIXTE') AND valeur_batiment <> 0 THEN
|
||||
CASE
|
||||
WHEN tfu_minimum < valeur_batiment * (v_taux_valeur_locat_prof/100) * (v_taux_tfu/100)
|
||||
THEN valeur_batiment * (v_taux_valeur_locat_prof/100) * (v_taux_tfu/100)
|
||||
ELSE tfu_minimum
|
||||
END
|
||||
|
||||
WHEN categorie_usage IN ('PROFESSIONNELLE','MIXTE') AND valeur_batiment = 0 THEN
|
||||
CASE
|
||||
WHEN tfu_minimum < montant_loyer_annuel * (v_taux_tfu/100)
|
||||
THEN montant_loyer_annuel * (v_taux_tfu/100)
|
||||
ELSE tfu_minimum
|
||||
END
|
||||
END
|
||||
WHERE impositions_tfu_id = p_impositions_tfu_id
|
||||
AND batie = TRUE
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = dtfu.batiment_id
|
||||
);
|
||||
RETURN v_rows_inserted;
|
||||
END;
|
||||
$$;*/
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_tfu_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;
|
||||
v_taux_defaut_sup_sol NUMERIC;
|
||||
v_taux_tfu NUMERIC;
|
||||
v_taux_tfu_ratio NUMERIC; -- v_taux_tfu / 100 (pré-calculé)
|
||||
v_taux_valeur_locat_prof NUMERIC;
|
||||
v_taux_vlp_ratio NUMERIC; -- v_taux_valeur_locat_prof / 100 (pré-calculé)
|
||||
v_tfu_piscine_unitaire NUMERIC;
|
||||
v_today DATE;
|
||||
BEGIN
|
||||
|
||||
v_today := CURRENT_DATE;
|
||||
|
||||
-- -------------------------------------------------------------------------
|
||||
-- 1. Récupération de l'année et de la structure (inchangé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;
|
||||
|
||||
-- -------------------------------------------------------------------------
|
||||
-- 2. Récupération des 4 paramètres en UNE seule requête
|
||||
-- (évite 4 accès séquentiels à la table parameters)
|
||||
-- -------------------------------------------------------------------------
|
||||
SELECT
|
||||
MAX(value) FILTER (WHERE name = 'TAUX_DEFAUT_SUPERFICIE_AU_SOL'),
|
||||
MAX(value) FILTER (WHERE name = 'TAUX_TFU'),
|
||||
MAX(value) FILTER (WHERE name = 'TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE'),
|
||||
MAX(value) FILTER (WHERE name = 'TFU_PAR_PISCINE')
|
||||
INTO STRICT
|
||||
v_taux_defaut_sup_sol,
|
||||
v_taux_tfu,
|
||||
v_taux_valeur_locat_prof,
|
||||
v_tfu_piscine_unitaire
|
||||
FROM parameters
|
||||
WHERE name IN (
|
||||
'TAUX_DEFAUT_SUPERFICIE_AU_SOL',
|
||||
'TAUX_TFU',
|
||||
'TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE',
|
||||
'TFU_PAR_PISCINE'
|
||||
);
|
||||
|
||||
-- Ratios pré-calculés pour éviter la division répétée dans le SELECT
|
||||
v_taux_tfu_ratio := v_taux_tfu / 100.0;
|
||||
v_taux_vlp_ratio := v_taux_valeur_locat_prof / 100.0;
|
||||
|
||||
-- -------------------------------------------------------------------------
|
||||
-- 3. INSERT avec calcul complet de valeur_locative_adm et montant_taxe
|
||||
-- → supprime l'UPDATE post-INSERT (économie d'un second scan de table)
|
||||
-- -------------------------------------------------------------------------
|
||||
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,
|
||||
num_batiment,
|
||||
ifu,
|
||||
npi,
|
||||
tel_prop,
|
||||
email_prop,
|
||||
nom_prop,
|
||||
prenom_prop,
|
||||
raison_sociale,
|
||||
adresse_prop,
|
||||
tel_sc,
|
||||
nom_sc,
|
||||
prenom_sc,
|
||||
longitude,
|
||||
latitude,
|
||||
batie,
|
||||
exonere,
|
||||
batiment_exonere,
|
||||
standing_bat,
|
||||
categorie_bat,
|
||||
nombre_piscine,
|
||||
date_enquete,
|
||||
structure_id,
|
||||
zone_rfu_id,
|
||||
nature_impot,
|
||||
superficie_parc,
|
||||
superficie_au_sol_bat,
|
||||
valeur_batiment,
|
||||
valeur_locative_adm_metre_carre,
|
||||
montant_loyer_annuel,
|
||||
tfu_metre_carre,
|
||||
tfu_minimum,
|
||||
impositions_tfu_id,
|
||||
deleted,
|
||||
created_at,
|
||||
created_by,
|
||||
"source",
|
||||
updated_at,
|
||||
updated_by,
|
||||
categorie_usage,
|
||||
superficie_au_sol_taux_prop_parc, -- 70 % superficie parcelle
|
||||
valeur_locative_adm_taux_prop_parc,
|
||||
tfu_calcule_taux_prop_parc, -- TFU à 70 %
|
||||
valeur_locative_adm_sup_reel,
|
||||
valeur_locative_adm, -- valeur locative administrative finale
|
||||
tfu_superficie_au_sol_reel,
|
||||
tfu_piscine,
|
||||
montant_taxe, -- TFU finale
|
||||
taux_tfu,
|
||||
parcelle_id,
|
||||
batiment_id,
|
||||
unite_logement_id,
|
||||
personne_id
|
||||
)
|
||||
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,
|
||||
b.nub,
|
||||
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,
|
||||
TRUE,
|
||||
-- exonere parcelle
|
||||
(v_today BETWEEN ep.date_debut_exemption
|
||||
AND COALESCE(ep.date_fin_exemption, v_today)),
|
||||
-- exonere batiment
|
||||
(v_today BETWEEN eb.date_debut_excemption
|
||||
AND COALESCE(eb.date_fin_excemption, v_today)),
|
||||
cb.standing,
|
||||
cb.nom,
|
||||
eb.nombre_piscine,
|
||||
eb.date_enquete,
|
||||
st.id,
|
||||
ep.zone_rfu_id,
|
||||
'TFU',
|
||||
p.superficie,
|
||||
eb.superficie_au_sol,
|
||||
-- valeur_batiment : première valeur non nulle non zéro
|
||||
COALESCE(
|
||||
NULLIF(eb.valeur_batiment_reel, 0),
|
||||
NULLIF(eb.valeur_batiment_calcule, 0),
|
||||
NULLIF(eb.valeur_batiment_estime, 0),
|
||||
0
|
||||
),
|
||||
brb.valeur_locative,
|
||||
-- montant_loyer_annuel
|
||||
COALESCE(
|
||||
NULLIF(eb.montant_locatif_annuel_declare, 0),
|
||||
NULLIF(eb.montant_locatif_annuel_calcule, 0),
|
||||
NULLIF(eb.montant_locatif_annuel_estime, 0),
|
||||
0
|
||||
),
|
||||
brb.tfu_metre_carre,
|
||||
brb.tfu_minimum,
|
||||
p_impositions_tfu_id,
|
||||
FALSE,
|
||||
v_today,
|
||||
p_user_id,
|
||||
'FISCAD',
|
||||
v_today,
|
||||
p_user_id,
|
||||
eb.categorie_usage,
|
||||
|
||||
-- superficie_au_sol_taux_prop_parc (70 % parcelle)
|
||||
p.superficie * v_taux_defaut_sup_sol / 100.0,
|
||||
|
||||
-- valeur_locative_adm_taux_prop_parc
|
||||
CASE WHEN eb.categorie_usage = 'HABITATION'
|
||||
THEN (p.superficie * v_taux_defaut_sup_sol / 100.0) * brb.valeur_locative
|
||||
ELSE 0
|
||||
END,
|
||||
|
||||
-- tfu_calcule_taux_prop_parc
|
||||
CASE WHEN eb.categorie_usage = 'HABITATION'
|
||||
THEN (p.superficie * v_taux_defaut_sup_sol / 100.0) * brb.valeur_locative * v_taux_tfu_ratio
|
||||
ELSE 0
|
||||
END,
|
||||
|
||||
-- valeur_locative_adm_sup_reel
|
||||
CASE WHEN eb.categorie_usage = 'HABITATION'
|
||||
THEN eb.superficie_au_sol * brb.valeur_locative
|
||||
ELSE 0
|
||||
END,
|
||||
|
||||
-- ---------------------------------------------------------------
|
||||
-- 🔧 CORRECTION : valeur_locative_adm avec tests explicites
|
||||
-- ---------------------------------------------------------------
|
||||
CASE
|
||||
WHEN eb.categorie_usage = 'HABITATION'
|
||||
AND eb.superficie_au_sol <> 0
|
||||
THEN eb.superficie_au_sol * brb.valeur_locative
|
||||
|
||||
WHEN eb.categorie_usage = 'HABITATION'
|
||||
AND eb.superficie_au_sol = 0
|
||||
THEN (p.superficie * v_taux_defaut_sup_sol / 100.0) * brb.valeur_locative
|
||||
|
||||
-- ✅ Test explicite : valeur_batiment <> 0
|
||||
WHEN eb.categorie_usage IN ('PROFESSIONNELLE', 'MIXTE')
|
||||
AND COALESCE(NULLIF(eb.valeur_batiment_reel, 0),
|
||||
NULLIF(eb.valeur_batiment_calcule, 0),
|
||||
NULLIF(eb.valeur_batiment_estime, 0), 0) <> 0
|
||||
THEN COALESCE(NULLIF(eb.valeur_batiment_reel, 0),
|
||||
NULLIF(eb.valeur_batiment_calcule, 0),
|
||||
NULLIF(eb.valeur_batiment_estime, 0), 0)
|
||||
* v_taux_vlp_ratio
|
||||
|
||||
-- ✅ Test explicite : valeur_batiment = 0
|
||||
WHEN eb.categorie_usage IN ('PROFESSIONNELLE', 'MIXTE')
|
||||
AND COALESCE(NULLIF(eb.valeur_batiment_reel, 0),
|
||||
NULLIF(eb.valeur_batiment_calcule, 0),
|
||||
NULLIF(eb.valeur_batiment_estime, 0), 0) = 0
|
||||
THEN COALESCE(NULLIF(eb.montant_locatif_annuel_declare, 0),
|
||||
NULLIF(eb.montant_locatif_annuel_calcule, 0),
|
||||
NULLIF(eb.montant_locatif_annuel_estime, 0), 0)
|
||||
|
||||
ELSE 0
|
||||
END,
|
||||
|
||||
-- tfu_superficie_au_sol_reel
|
||||
CASE WHEN eb.categorie_usage = 'HABITATION'
|
||||
THEN eb.superficie_au_sol * brb.valeur_locative * v_taux_tfu_ratio
|
||||
ELSE 0
|
||||
END,
|
||||
|
||||
-- tfu_piscine
|
||||
eb.nombre_piscine * v_tfu_piscine_unitaire,
|
||||
|
||||
-- ---------------------------------------------------------------
|
||||
-- montant_taxe ← calculé directement (plus d'UPDATE)
|
||||
-- Utilise des CTE inline via expression pour éviter la redondance
|
||||
-- ---------------------------------------------------------------
|
||||
(
|
||||
-- On matérialise valeur_batiment et valeur_locative une seule fois
|
||||
WITH calc AS (
|
||||
SELECT
|
||||
COALESCE(NULLIF(eb.valeur_batiment_reel, 0),
|
||||
NULLIF(eb.valeur_batiment_calcule, 0),
|
||||
NULLIF(eb.valeur_batiment_estime, 0), 0) AS vb,
|
||||
COALESCE(NULLIF(eb.montant_locatif_annuel_declare, 0),
|
||||
NULLIF(eb.montant_locatif_annuel_calcule, 0),
|
||||
NULLIF(eb.montant_locatif_annuel_estime, 0), 0) AS loyer,
|
||||
eb.superficie_au_sol * brb.valeur_locative AS vla_reel,
|
||||
(p.superficie * v_taux_defaut_sup_sol / 100.0)
|
||||
* brb.valeur_locative AS vla_70
|
||||
)
|
||||
SELECT
|
||||
CASE
|
||||
WHEN eb.categorie_usage = 'HABITATION'
|
||||
AND eb.superficie_au_sol <> 0
|
||||
THEN GREATEST(brb.tfu_minimum,
|
||||
calc.vla_reel * v_taux_tfu_ratio
|
||||
+ eb.nombre_piscine * v_tfu_piscine_unitaire)
|
||||
|
||||
WHEN eb.categorie_usage = 'HABITATION'
|
||||
AND eb.superficie_au_sol = 0
|
||||
THEN GREATEST(brb.tfu_minimum,
|
||||
calc.vla_70 * v_taux_tfu_ratio
|
||||
+ eb.nombre_piscine * v_tfu_piscine_unitaire)
|
||||
|
||||
WHEN eb.categorie_usage IN ('PROFESSIONNELLE', 'MIXTE')
|
||||
AND calc.vb <> 0
|
||||
THEN GREATEST(brb.tfu_minimum,
|
||||
calc.vb * v_taux_vlp_ratio * v_taux_tfu_ratio)
|
||||
|
||||
WHEN eb.categorie_usage IN ('PROFESSIONNELLE', 'MIXTE')
|
||||
AND calc.vb = 0
|
||||
THEN GREATEST(brb.tfu_minimum,
|
||||
calc.loyer * v_taux_tfu_ratio)
|
||||
|
||||
ELSE brb.tfu_minimum
|
||||
END
|
||||
FROM calc
|
||||
),
|
||||
|
||||
v_taux_tfu,
|
||||
p.id,
|
||||
b.id,
|
||||
NULL,
|
||||
ep.personne_id
|
||||
FROM parcelle p
|
||||
|
||||
-- Dernière enquête parcelle
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT
|
||||
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
|
||||
WHERE parcelle_id = p.id
|
||||
ORDER BY date_enquete DESC, id DESC
|
||||
LIMIT 1
|
||||
) ep ON TRUE
|
||||
|
||||
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
|
||||
|
||||
-- Rattachement structure via secteur (DISTINCT ON → LATERAL plus lisible)
|
||||
JOIN LATERAL (
|
||||
SELECT secteur_id
|
||||
FROM secteur_decoupage
|
||||
WHERE quartier_id = q.id
|
||||
ORDER BY quartier_id
|
||||
LIMIT 1
|
||||
) sd ON TRUE
|
||||
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
|
||||
|
||||
-- Bâtiments sans unités logement (anti-join via LEFT JOIN … IS NULL)
|
||||
JOIN batiment b ON b.parcelle_id = p.id
|
||||
LEFT JOIN unite_logement ul_filter ON ul_filter.batiment_id = b.id
|
||||
|
||||
-- Dernière enquête bâtiment
|
||||
JOIN LATERAL (
|
||||
SELECT
|
||||
eb2.batiment_id,
|
||||
eb2.superficie_au_sol,
|
||||
eb2.nombre_piscine,
|
||||
eb2.categorie_batiment_id,
|
||||
eb2.date_enquete,
|
||||
eb2.montant_locatif_annuel_declare,
|
||||
eb2.montant_locatif_annuel_calcule,
|
||||
eb2.montant_locatif_annuel_estime,
|
||||
eb2.date_debut_excemption,
|
||||
eb2.date_fin_excemption,
|
||||
eb2.valeur_batiment_reel,
|
||||
eb2.valeur_batiment_calcule,
|
||||
eb2.valeur_batiment_estime,
|
||||
u.categorie_usage
|
||||
FROM enquete_batiment eb2
|
||||
JOIN usage u ON u.id = eb2.usage_id
|
||||
WHERE eb2.batiment_id = b.id
|
||||
ORDER BY eb2.date_enquete DESC, eb2.id DESC
|
||||
LIMIT 1
|
||||
) eb ON TRUE
|
||||
|
||||
JOIN categorie_batiment cb ON cb.id = eb.categorie_batiment_id
|
||||
|
||||
-- Barème RFU bâti (inchangé)
|
||||
JOIN LATERAL (
|
||||
SELECT *
|
||||
FROM barem_rfu_bati br
|
||||
WHERE br.categorie_batiment_id = cb.id
|
||||
AND br.arrondissement_id = a.id
|
||||
AND (br.quartier_id = q.id OR br.quartier_id IS NULL)
|
||||
ORDER BY br.quartier_id DESC NULLS LAST
|
||||
LIMIT 1
|
||||
) brb ON TRUE
|
||||
|
||||
WHERE p.batie = TRUE
|
||||
AND ul_filter.batiment_id IS NULL -- anti-join : pas d'unité logement
|
||||
AND st.id = v_structure_id
|
||||
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||
|
||||
RETURN v_rows_inserted;
|
||||
END;
|
||||
$$;
|
||||
@@ -0,0 +1,395 @@
|
||||
CREATE OR REPLACE FUNCTION public.generer_donnees_imposition_tfu_batie_unite_logement(
|
||||
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;
|
||||
v_taux_defaut_sup_sol NUMERIC;
|
||||
v_taux_tfu NUMERIC;
|
||||
v_taux_valeur_locat_prof NUMERIC;
|
||||
v_tfu_piscine_unitaire NUMERIC;
|
||||
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;
|
||||
|
||||
|
||||
select value
|
||||
into strict v_taux_defaut_sup_sol
|
||||
from parameters
|
||||
where name ='TAUX_DEFAUT_SUPERFICIE_AU_SOL';
|
||||
|
||||
select value
|
||||
into STRICT v_taux_tfu
|
||||
from parameters
|
||||
where name ='TAUX_TFU';
|
||||
|
||||
RAISE NOTICE 'v_taux_tfu = %', v_taux_tfu;
|
||||
|
||||
select value
|
||||
into STRICT v_taux_valeur_locat_prof
|
||||
from parameters
|
||||
where name ='TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE';
|
||||
|
||||
select value
|
||||
into STRICT v_tfu_piscine_unitaire
|
||||
from parameters
|
||||
where name ='TFU_PAR_PISCINE';
|
||||
|
||||
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,
|
||||
num_batiment,
|
||||
num_unite_logement,
|
||||
ifu,
|
||||
npi,
|
||||
tel_prop,
|
||||
email_prop,
|
||||
nom_prop,
|
||||
prenom_prop,
|
||||
raison_sociale,
|
||||
adresse_prop,
|
||||
tel_sc,
|
||||
nom_sc,
|
||||
prenom_sc,
|
||||
longitude,
|
||||
latitude,
|
||||
batie,
|
||||
exonere,
|
||||
batiment_exonere,
|
||||
unite_logement_exonere,
|
||||
standing_bat,
|
||||
categorie_bat,
|
||||
nombre_piscine,
|
||||
date_enquete,
|
||||
structure_id,
|
||||
zone_rfu_id,
|
||||
nature_impot,
|
||||
superficie_parc,
|
||||
superficie_au_sol_bat,
|
||||
superficie_au_sol_ulog,
|
||||
valeur_batiment,
|
||||
valeur_locative_adm_metre_carre,
|
||||
montant_loyer_annuel,
|
||||
tfu_metre_carre,
|
||||
tfu_minimum,
|
||||
impositions_tfu_id,
|
||||
deleted,
|
||||
created_at ,
|
||||
created_by ,
|
||||
"source",
|
||||
updated_at ,
|
||||
updated_by,
|
||||
categorie_usage,
|
||||
superficie_au_sol_taux_prop_parc, ---70% de la surperficie au sol de la parcelle
|
||||
valeur_locative_adm_taux_prop_parc,
|
||||
tfu_calcule_taux_prop_parc, ----tfu correspondant au 70%
|
||||
valeur_locative_adm_sup_reel,
|
||||
valeur_locative_adm, ----------valeur locative administrative
|
||||
tfu_superficie_au_sol_reel, ----tfu correspondant à la superficie au sol reelle
|
||||
tfu_piscine,
|
||||
montant_taxe, ----tfu finale
|
||||
taux_tfu, ----taux tfu batie
|
||||
parcelle_id,
|
||||
batiment_id,
|
||||
unite_logement_id
|
||||
)
|
||||
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,
|
||||
b.nub,
|
||||
ul.nul,
|
||||
eul.ifu,
|
||||
eul.npi,
|
||||
eul.tel1,
|
||||
eul.email,
|
||||
eul.nom,
|
||||
eul.prenom,
|
||||
eul.raison_sociale,
|
||||
eul.adresse,
|
||||
eul.representant_tel,
|
||||
eul.representant_nom,
|
||||
eul.representant_prenom,
|
||||
p.longitude,
|
||||
p.latitude,
|
||||
TRUE,
|
||||
(
|
||||
CURRENT_DATE >= ep.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(ep.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eb.date_debut_excemption
|
||||
AND CURRENT_DATE <= COALESCE(eb.date_fin_excemption, CURRENT_DATE)
|
||||
),
|
||||
(
|
||||
CURRENT_DATE >= eul.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(eul.date_fin_exemption, CURRENT_DATE)
|
||||
),
|
||||
cb.standing,
|
||||
cb.nom,
|
||||
CASE
|
||||
WHEN eul.nombre_piscine is null then 0
|
||||
else eul.nombre_piscine
|
||||
END,
|
||||
eul.date_enquete,
|
||||
st.id,
|
||||
ep.zone_rfu_id,
|
||||
'TFU',
|
||||
p.superficie,
|
||||
eb.superficie_au_sol,
|
||||
eul.superficie_au_sol,
|
||||
CASE -------valeur_batiment
|
||||
WHEN eul.valeur_unite_logement_reel IS NOT NULL AND eul.valeur_unite_logement_reel <> 0 THEN eul.valeur_unite_logement_reel
|
||||
WHEN eul.valeur_unite_logement_calcule IS NOT NULL AND eul.valeur_unite_logement_calcule <> 0 THEN eul.valeur_unite_logement_calcule
|
||||
WHEN eul.valeur_unite_logement_estime IS NOT NULL AND eul.valeur_unite_logement_estime <> 0 THEN eul.valeur_unite_logement_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.valeur_locative,
|
||||
CASE ----- montant_loyer_annuel
|
||||
WHEN eul.montant_locatif_annuel_declare IS NOT NULL AND eul.montant_locatif_annuel_declare <> 0 THEN eul.montant_locatif_annuel_declare
|
||||
WHEN eul.montant_locatif_annuel_calcule IS NOT NULL AND eul.montant_locatif_annuel_calcule <> 0 THEN eul.montant_locatif_annuel_calcule
|
||||
WHEN eul.montant_locatif_annuel_estime IS NOT NULL AND eul.montant_locatif_annuel_estime <> 0 THEN eul.montant_locatif_annuel_estime
|
||||
ELSE 0
|
||||
END,
|
||||
brb.tfu_metre_carre,
|
||||
brb.tfu_minimum,
|
||||
p_impositions_tfu_id,
|
||||
false,
|
||||
current_date,
|
||||
p_user_id,
|
||||
'FISCAD',
|
||||
current_date,
|
||||
p_user_id,
|
||||
eul.categorie_usage,
|
||||
p.superficie * v_taux_defaut_sup_sol/100,---superficie_au_sol_70pour100
|
||||
case ----valeur_locative_adm70pour100
|
||||
when eul.categorie_usage = 'HABITATION' then (p.superficie * v_taux_defaut_sup_sol/100) * brb.valeur_locative
|
||||
else 0
|
||||
end,
|
||||
case ----tfu calcule 70 pour 100 superficie parcelle
|
||||
when eul.categorie_usage= 'HABITATION' then (p.superficie * v_taux_defaut_sup_sol/100) * brb.valeur_locative * v_taux_tfu/100
|
||||
else 0
|
||||
end,
|
||||
case -----valeur_locative_adm_sup_reel
|
||||
when eul.categorie_usage='HABITATION' then eul.superficie_au_sol * brb.valeur_locative
|
||||
else 0
|
||||
end,
|
||||
0, ------ valeur_locative_adm : en attente de update
|
||||
case -----tfu_superficie_au_sol_reel
|
||||
when eul.categorie_usage='HABITATION' then eul.superficie_au_sol * brb.valeur_locative * 6/100
|
||||
else 0
|
||||
end,
|
||||
CASE
|
||||
WHEN eul.nombre_piscine is null then 0
|
||||
else eul.nombre_piscine * v_tfu_piscine_unitaire
|
||||
END,
|
||||
0,
|
||||
v_taux_tfu,
|
||||
p.id,
|
||||
b.id,
|
||||
ul.id
|
||||
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, id 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
|
||||
--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 section ses ON ses.id = sect.section_id
|
||||
JOIN "structure" st ON st.id = ses.structure_id
|
||||
JOIN batiment b ON b.parcelle_id = p.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (batiment_id)
|
||||
batiment_id,
|
||||
superficie_au_sol,
|
||||
nombre_piscine,
|
||||
categorie_batiment_id,
|
||||
date_enquete,
|
||||
montant_locatif_annuel_declare,
|
||||
montant_locatif_annuel_calcule,
|
||||
montant_locatif_annuel_estime,
|
||||
date_debut_excemption,
|
||||
date_fin_excemption,
|
||||
valeur_batiment_reel,
|
||||
valeur_batiment_calcule,
|
||||
valeur_batiment_estime,
|
||||
u.categorie_usage
|
||||
FROM enquete_batiment eb
|
||||
join usage u on u.id=eb.usage_id
|
||||
ORDER BY batiment_id, date_enquete DESC, eb.id DESC
|
||||
) eb ON eb.batiment_id = b.id
|
||||
JOIN unite_logement ul on ul.batiment_id = b.id
|
||||
JOIN (
|
||||
SELECT DISTINCT ON (eult.unite_logement_id)
|
||||
eult.unite_logement_id,
|
||||
pers1.id,
|
||||
pers1.ifu,
|
||||
pers1.npi,
|
||||
pers1.tel1,
|
||||
pers1.email,
|
||||
pers1.nom,
|
||||
pers1.prenom,
|
||||
pers1.raison_sociale,
|
||||
pers1.adresse,
|
||||
eult.nombre_piscine,
|
||||
eult.categorie_batiment_id,
|
||||
eult.superficie_au_sol,
|
||||
eult.superficie_louee,
|
||||
eult.nbre_piece,
|
||||
eult.date_enquete,
|
||||
eult.montant_locatif_annuel_calcule,
|
||||
eult.montant_locatif_annuel_declare,
|
||||
eult.montant_locatif_annuel_estime,
|
||||
eult.date_debut_exemption,
|
||||
eult.date_fin_exemption,
|
||||
eult.representant_nom,
|
||||
eult.representant_prenom,
|
||||
eult.representant_tel,
|
||||
eult.valeur_unite_logement_reel,
|
||||
eult.valeur_unite_logement_calcule,
|
||||
eult.valeur_unite_logement_estime,
|
||||
u.categorie_usage
|
||||
FROM enquete_unite_logement eult
|
||||
join usage u on u.id=eult.usage_id
|
||||
left join personne pers1 on pers1.id = eult.personne_id
|
||||
ORDER BY unite_logement_id, date_enquete DESC, eult.id DESC
|
||||
) eul ON eul.unite_logement_id = ul.id
|
||||
JOIN categorie_batiment cb
|
||||
ON cb.id = eul.categorie_batiment_id
|
||||
JOIN LATERAL (
|
||||
SELECT *
|
||||
FROM barem_rfu_bati br
|
||||
WHERE br.categorie_batiment_id = cb.id
|
||||
AND br.arrondissement_id = a.id
|
||||
AND (br.quartier_id = q.id OR br.quartier_id IS NULL)
|
||||
ORDER BY br.quartier_id DESC NULLS LAST
|
||||
LIMIT 1
|
||||
) brb ON TRUE
|
||||
WHERE p.batie = TRUE
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = b.id
|
||||
)
|
||||
AND st.id = v_structure_id
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
GET DIAGNOSTICS v_rows_inserted = ROW_COUNT;
|
||||
|
||||
UPDATE donnees_imposition_tfu dtfu
|
||||
SET
|
||||
valeur_locative_adm =
|
||||
CASE
|
||||
WHEN categorie_usage = 'HABITATION' AND superficie_au_sol_ulog <> 0
|
||||
THEN valeur_locative_adm_sup_reel
|
||||
|
||||
WHEN categorie_usage = 'HABITATION' AND superficie_au_sol_ulog = 0
|
||||
THEN valeur_locative_adm_taux_prop_parc
|
||||
|
||||
WHEN categorie_usage IN ('PROFESSIONNELLE','MIXTE') AND valeur_batiment <> 0
|
||||
THEN valeur_batiment * (v_taux_valeur_locat_prof/100)
|
||||
|
||||
WHEN categorie_usage IN ('PROFESSIONNELLE','MIXTE') AND valeur_batiment = 0
|
||||
THEN montant_loyer_annuel
|
||||
END,
|
||||
|
||||
montant_taxe =
|
||||
CASE
|
||||
WHEN categorie_usage = 'HABITATION' AND superficie_au_sol_ulog <> 0 THEN
|
||||
CASE
|
||||
WHEN tfu_minimum < valeur_locative_adm_sup_reel * (v_taux_tfu/100) + tfu_piscine
|
||||
THEN valeur_locative_adm_sup_reel * (v_taux_tfu/100) + tfu_piscine
|
||||
ELSE tfu_minimum
|
||||
END
|
||||
|
||||
WHEN categorie_usage = 'HABITATION' AND superficie_au_sol_ulog = 0 THEN
|
||||
CASE
|
||||
WHEN tfu_minimum < valeur_locative_adm_taux_prop_parc * (v_taux_tfu/100) + tfu_piscine
|
||||
THEN valeur_locative_adm_taux_prop_parc * (v_taux_tfu/100) + tfu_piscine
|
||||
ELSE tfu_minimum
|
||||
END
|
||||
|
||||
WHEN categorie_usage IN ('PROFESSIONNELLE','MIXTE') AND valeur_batiment <> 0 THEN
|
||||
CASE
|
||||
WHEN tfu_minimum < valeur_batiment * (v_taux_valeur_locat_prof/100) * (v_taux_tfu/100)
|
||||
THEN valeur_batiment * (v_taux_valeur_locat_prof/100) * (v_taux_tfu/100)
|
||||
ELSE tfu_minimum
|
||||
END
|
||||
|
||||
WHEN categorie_usage IN ('PROFESSIONNELLE','MIXTE') AND valeur_batiment = 0 THEN
|
||||
CASE
|
||||
WHEN tfu_minimum < montant_loyer_annuel * (v_taux_tfu/100)
|
||||
THEN montant_loyer_annuel * (v_taux_tfu/100)
|
||||
ELSE tfu_minimum
|
||||
END
|
||||
END
|
||||
WHERE impositions_tfu_id = p_impositions_tfu_id
|
||||
AND batie = TRUE
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM unite_logement ul
|
||||
WHERE ul.batiment_id = dtfu.batiment_id
|
||||
);
|
||||
RETURN v_rows_inserted;
|
||||
END;
|
||||
$$;
|
||||
@@ -0,0 +1,347 @@
|
||||
/*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 batie,
|
||||
(
|
||||
CURRENT_DATE >= ep.date_debut_exemption
|
||||
AND CURRENT_DATE <= COALESCE(ep.date_fin_exemption, CURRENT_DATE)
|
||||
) exonere,
|
||||
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 brnb.au_metre_carre
|
||||
when true then brnb.valeur_administrative_metre_carre * ep.superficie
|
||||
else brnb.valeur_administrative
|
||||
end as valeur_administrative,
|
||||
brnb.valeur_administrative_metre_carre,
|
||||
case brnb.au_metre_carre
|
||||
when true then brnb.valeur_administrative_metre_carre * ep.superficie*brnb.taux/100
|
||||
else brnb.valeur_administrative*brnb.taux/100
|
||||
end as montant_taxe
|
||||
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
|
||||
JOIN secteur_decoupage 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;
|
||||
$$;*/
|
||||
|
||||
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,
|
||||
parcelle_id,
|
||||
personne_id
|
||||
)
|
||||
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,
|
||||
p.id,
|
||||
ep.personne_id
|
||||
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;
|
||||
$$;
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
CREATE OR REPLACE PROCEDURE public.import_batiment_and_enquetebati_from_rfu(nombreLimit integer)
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
l_count numeric := 0;
|
||||
batiment_rfu record;
|
||||
l_batiment_id_parent bigint;
|
||||
l_parcelle_id_parent bigint ;
|
||||
BEGIN
|
||||
|
||||
FOR batiment_rfu IN (
|
||||
SELECT
|
||||
c.n0bat,
|
||||
--dtconst,
|
||||
CASE
|
||||
WHEN c.dtconst IS NULL OR c.dtconst = '' THEN NULL
|
||||
-- format incorrect (pas exactement 8 chiffres)
|
||||
WHEN c.dtconst !~ '^[0-9]{8}$' THEN NULL
|
||||
-- date invalide réelle
|
||||
WHEN to_char(to_date(c.dtconst, 'YYYYMMDD'), 'YYYYMMDD') <> c.dtconst THEN NULL
|
||||
ELSE to_date(c.dtconst, 'YYYYMMDD')
|
||||
end as dtconst,
|
||||
c.quartier,
|
||||
c.n0_ilot,
|
||||
c.n0_parcel,
|
||||
--c.surfsol,
|
||||
CASE
|
||||
WHEN replace(trim(c.surfsol), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.surfsol, ',', '.')::numeric
|
||||
end as surfsol,
|
||||
--c.surfacelo,
|
||||
CASE
|
||||
WHEN replace(trim(c.surfacelo), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.surfacelo, ',', '.')::numeric
|
||||
end as surfacelo,
|
||||
--c.vllcalcule,
|
||||
CASE
|
||||
WHEN replace(trim(c.vllcalcule), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.vllcalcule, ',', '.')::numeric
|
||||
end as vllcalcule,
|
||||
--c.bail,
|
||||
CASE
|
||||
WHEN replace(trim(c.bail), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.bail, ',', '.')::numeric
|
||||
end as bail,
|
||||
--c.valloest,
|
||||
CASE
|
||||
WHEN replace(trim(c.valloest), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.valloest, ',', '.')::numeric
|
||||
end as valloest,
|
||||
--c.nbetage,
|
||||
CASE
|
||||
WHEN replace(trim(c.nbetage), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.nbetage, ',', '.')::numeric
|
||||
end as nbetage,
|
||||
--c.vlcalcule,
|
||||
CASE
|
||||
WHEN replace(trim(c.vlcalcule), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.vlcalcule, ',', '.')::numeric
|
||||
end as vlcalcule,
|
||||
--c.utilisat,
|
||||
CASE
|
||||
WHEN replace(trim(c.utilisat), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.utilisat, ',', '.')::numeric
|
||||
end as utilisat,
|
||||
--c.finexempt,
|
||||
CASE
|
||||
WHEN c.finexempt IS NULL OR c.finexempt = '' THEN NULL
|
||||
-- format incorrect (pas exactement 8 chiffres)
|
||||
WHEN c.finexempt !~ '^[0-9]{8}$' THEN NULL
|
||||
-- date invalide réelle
|
||||
WHEN to_char(to_date(c.finexempt, 'YYYYMMDD'), 'YYYYMMDD') <> c.finexempt THEN NULL
|
||||
ELSE to_date(c.finexempt, 'YYYYMMDD')
|
||||
end as finexempt,
|
||||
--c.nbunitlo,
|
||||
CASE
|
||||
WHEN replace(trim(c.nbunitlo), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.nbunitlo, ',', '.')::numeric
|
||||
end as nbunitlo,
|
||||
--c.toit
|
||||
CASE
|
||||
WHEN replace(trim(c.toit), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.toit, ',', '.')::numeric
|
||||
end as toit,
|
||||
--nbhabit,
|
||||
CASE
|
||||
WHEN replace(trim(c.nbhabit), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.nbhabit, ',', '.')::numeric
|
||||
end as nbhabit,
|
||||
--nbmenage,
|
||||
CASE
|
||||
WHEN replace(trim(c.nbmenage), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.nbmenage, ',', '.')::numeric
|
||||
end as nbmenage,
|
||||
--nbmois,
|
||||
CASE
|
||||
WHEN replace(trim(c.nbmois), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.nbmois, ',', '.')::numeric
|
||||
end as nbmois,
|
||||
--electric,
|
||||
CASE
|
||||
WHEN trim(c.electric)='Non'
|
||||
THEN false
|
||||
else
|
||||
true
|
||||
end as electric,
|
||||
--eau,
|
||||
CASE
|
||||
WHEN trim(c.eau)='Non'
|
||||
THEN false
|
||||
else
|
||||
true
|
||||
end as eau,
|
||||
--nbpiece,
|
||||
CASE
|
||||
WHEN replace(trim(c.nbpiece), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.nbpiece, ',', '.')::numeric
|
||||
end as nbpiece,
|
||||
--nbunite
|
||||
CASE
|
||||
WHEN replace(trim(c.nbunite), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.nbunite, ',', '.')::numeric
|
||||
end as nbunite,
|
||||
CASE
|
||||
WHEN c.mdate IS NULL OR c.mdate = '' THEN NULL
|
||||
-- format incorrect (pas exactement 8 chiffres)
|
||||
WHEN c.mdate !~ '^[0-9]{8}$' THEN NULL
|
||||
-- date invalide réelle
|
||||
WHEN to_char(to_date(c.mdate, 'YYYYMMDD'), 'YYYYMMDD') <> c.mdate THEN NULL
|
||||
ELSE to_date(c.mdate, 'YYYYMMDD')
|
||||
end as mdate,
|
||||
--c.murs,
|
||||
CASE
|
||||
WHEN replace(trim(c.murs), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.murs, ',', '.')::numeric
|
||||
end as murs,
|
||||
--standing
|
||||
CASE
|
||||
WHEN replace(trim(c.standing), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(c.standing, ',', '.')::numeric
|
||||
end as standing
|
||||
FROM dblink(
|
||||
'connexion_rfu',
|
||||
$db$
|
||||
SELECT
|
||||
b.n0bat,
|
||||
b.dtconst,
|
||||
b.quartier,
|
||||
b.n0_ilot,
|
||||
b.n0_parcel,
|
||||
b.surfsol,
|
||||
b.surfacelo,
|
||||
b.vllcalcule,
|
||||
b.bail,
|
||||
b.valloest,
|
||||
b.nbetage,
|
||||
b.vlcalcule,
|
||||
b.utilisat,
|
||||
b.finexempt,
|
||||
b.nbunitlo,
|
||||
b.toit,
|
||||
b.nbhabit,
|
||||
b.nbmenage,
|
||||
b.nbmois,
|
||||
b.electric,
|
||||
b.eau,
|
||||
b.nbpiece,
|
||||
b.nbunite,
|
||||
b.mdate,
|
||||
b.murs,
|
||||
b.standing
|
||||
FROM stemichel.batiment b
|
||||
$db$
|
||||
) AS c (
|
||||
n0bat varchar,
|
||||
dtconst varchar,
|
||||
quartier varchar,
|
||||
n0_ilot varchar,
|
||||
n0_parcel varchar,
|
||||
surfsol varchar,
|
||||
surfacelo varchar,
|
||||
vllcalcule varchar,
|
||||
bail varchar,
|
||||
valloest varchar,
|
||||
nbetage varchar,
|
||||
vlcalcule varchar,
|
||||
utilisat varchar,
|
||||
finexempt varchar,
|
||||
nbunitlo varchar,
|
||||
toit varchar,
|
||||
nbhabit varchar,
|
||||
nbmenage varchar,
|
||||
nbmois varchar,
|
||||
electric varchar,
|
||||
eau varchar,
|
||||
nbpiece varchar,
|
||||
nbunite varchar,
|
||||
mdate varchar,
|
||||
murs varchar,
|
||||
standing varchar
|
||||
|
||||
)
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM public.batiment b
|
||||
WHERE b.code =
|
||||
trim(c.quartier)||'-'||trim(c.n0_ilot)||'-'||trim(c.n0_parcel)||'-'||trim(c.n0bat)
|
||||
)
|
||||
limit nombreLimit
|
||||
)
|
||||
LOOP
|
||||
-- Récupération ID parcelle locale
|
||||
SELECT p.id
|
||||
INTO l_parcelle_id_parent
|
||||
FROM public.parcelle p
|
||||
WHERE p.numero_parcelle =
|
||||
trim(batiment_rfu.quartier)||'-'||trim(batiment_rfu.n0_ilot)||'-'||trim(batiment_rfu.n0_parcel)
|
||||
LIMIT 1;
|
||||
|
||||
|
||||
-- Insertion bâtiment local
|
||||
INSERT INTO public.batiment (
|
||||
created_at,
|
||||
created_by,
|
||||
deleted,
|
||||
updated_at,
|
||||
updated_by,
|
||||
code,
|
||||
nub,
|
||||
date_construction,
|
||||
parcelle_id,
|
||||
source,
|
||||
superficie_au_sol,
|
||||
superficie_louee,
|
||||
categorie_batiment_id,
|
||||
montant_locatif_annuel_calcule,
|
||||
montant_locatif_annuel_declare,
|
||||
montant_locatif_annuel_estime,
|
||||
nombre_etage,
|
||||
valeur_batiment_calcule,
|
||||
usage_id,
|
||||
date_fin_exemption,
|
||||
nbre_unite_logement,
|
||||
id_toit_rfu
|
||||
)
|
||||
VALUES (
|
||||
now(),
|
||||
35,
|
||||
false,
|
||||
now(),
|
||||
35,
|
||||
trim(batiment_rfu.quartier)||'-'||trim(batiment_rfu.n0_ilot)||'-'||trim(batiment_rfu.n0_parcel)||'-'||trim(batiment_rfu.n0bat),
|
||||
batiment_rfu.n0bat,
|
||||
batiment_rfu.dtconst,
|
||||
l_parcelle_id_parent,
|
||||
'RFU',
|
||||
batiment_rfu.surfsol,
|
||||
batiment_rfu.surfacelo,
|
||||
ProcedureRecupCategorieRFU(batiment_rfu.nbetage::integer,batiment_rfu.toit::integer),
|
||||
batiment_rfu.vllcalcule,
|
||||
batiment_rfu.bail,
|
||||
batiment_rfu.valloest,
|
||||
batiment_rfu.nbetage,
|
||||
batiment_rfu.vlcalcule,
|
||||
--------- batiment_rfu.utilisat,
|
||||
CASE batiment_rfu.utilisat
|
||||
WHEN 1 THEN 8
|
||||
WHEN 2 THEN 14
|
||||
WHEN 3 THEN 9
|
||||
END,
|
||||
batiment_rfu.finexempt,
|
||||
batiment_rfu.nbunitlo,
|
||||
batiment_rfu.toit
|
||||
)
|
||||
|
||||
RETURNING id INTO l_batiment_id_parent ;
|
||||
|
||||
call public.import_enquetebati_from_rfu_cipe(batiment_rfu,l_batiment_id_parent);
|
||||
|
||||
l_count := l_count + 1;
|
||||
|
||||
END LOOP;
|
||||
|
||||
RAISE NOTICE 'Nombre de bâtiments insérés : %', l_count;
|
||||
|
||||
END;
|
||||
$$;
|
||||
@@ -0,0 +1,158 @@
|
||||
CREATE OR REPLACE PROCEDURE public.import_enquetebati_from_rfu_cipe(
|
||||
IN batiment_rfu record,
|
||||
IN batiment_id_param numeric
|
||||
)
|
||||
LANGUAGE plpgsql
|
||||
AS $procedure$
|
||||
DECLARE
|
||||
enquete_batiment_id_parent bigint;
|
||||
BEGIN
|
||||
INSERT INTO enquete_batiment (
|
||||
created_at,
|
||||
created_by,
|
||||
deleted,
|
||||
updated_at,
|
||||
updated_by,
|
||||
date_fin_excemption,
|
||||
nbre_habitant,
|
||||
nbre_menage,
|
||||
nbre_mois_location,
|
||||
nbre_unite_location,
|
||||
sbee,
|
||||
soneb,
|
||||
batiment_id,
|
||||
personne_id,
|
||||
user_id,
|
||||
montant_locatif_annuel_declare,
|
||||
nbre_etage,
|
||||
source,
|
||||
date_enquete,
|
||||
observation,
|
||||
superficie_au_sol,
|
||||
superficie_louee,
|
||||
statut_enquete,
|
||||
categorie_batiment_id,
|
||||
montant_locatif_annuel_calcule,
|
||||
usage_id,
|
||||
montant_locatif_annuel_estime,
|
||||
nbre_piece,
|
||||
nbre_unite_logement,
|
||||
valeur_batiment_calcule,
|
||||
nbre_lot_unite
|
||||
) select
|
||||
now(),
|
||||
35,
|
||||
false,
|
||||
now(),
|
||||
35,
|
||||
batiment_rfu.finexempt,
|
||||
batiment_rfu.nbhabit,
|
||||
batiment_rfu.nbmenage,
|
||||
batiment_rfu.nbmois,
|
||||
batiment_rfu.nbunitlo,
|
||||
batiment_rfu.electric,
|
||||
batiment_rfu.eau,
|
||||
batiment_id_param,
|
||||
e.personne_id,
|
||||
35,
|
||||
batiment_rfu.bail,
|
||||
batiment_rfu.nbetage,
|
||||
'RFU',
|
||||
batiment_rfu.mdate,
|
||||
'MIGRATION',
|
||||
batiment_rfu.surfsol,
|
||||
batiment_rfu.surfacelo,
|
||||
'CLOTURE',
|
||||
ProcedureRecupCategorieRFU(batiment_rfu.nbetage::integer,batiment_rfu.toit::integer),
|
||||
batiment_rfu.vllcalcule,
|
||||
--batiment_rfu.utilisat,
|
||||
CASE batiment_rfu.utilisat
|
||||
WHEN 1 THEN 8
|
||||
WHEN 2 THEN 14
|
||||
WHEN 3 THEN 9
|
||||
end,
|
||||
batiment_rfu.valloest,
|
||||
batiment_rfu.nbpiece,
|
||||
batiment_rfu.nbunite,
|
||||
batiment_rfu.vlcalcule,
|
||||
batiment_rfu.nbunitlo
|
||||
from batiment b
|
||||
left join parcelle p on p.id=b.parcelle_id
|
||||
left join enquete e on e.parcelle_id=p.id
|
||||
where b.id = batiment_id_param
|
||||
and not exists (
|
||||
select 1
|
||||
from enquete_batiment eb
|
||||
where eb.batiment_id = b.id
|
||||
)
|
||||
|
||||
RETURNING id INTO enquete_batiment_id_parent ;
|
||||
|
||||
----------MAJ Caractéristique parcelle
|
||||
INSERT INTO caracteristique_batiment (
|
||||
created_by,
|
||||
created_at,
|
||||
updated_by,
|
||||
updated_at,
|
||||
deleted,
|
||||
caracteristique_id,
|
||||
enquete_batiment_id
|
||||
)
|
||||
SELECT 35, now(), 35, now(),false,
|
||||
CASE batiment_rfu.toit
|
||||
WHEN 1 THEN 55
|
||||
WHEN 2 THEN 56
|
||||
WHEN 3 THEN 57
|
||||
WHEN 4 THEN 58
|
||||
WHEN 5 THEN 59
|
||||
WHEN 6 THEN 60
|
||||
END,
|
||||
enquete_batiment_id_parent
|
||||
WHERE batiment_rfu.toit IS NOT NULL
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT 35, now(), 35, now(),false,
|
||||
CASE batiment_rfu.murs
|
||||
WHEN 1 THEN 49
|
||||
WHEN 2 THEN 50
|
||||
WHEN 3 THEN 51
|
||||
WHEN 4 THEN 52
|
||||
WHEN 5 THEN 53
|
||||
else
|
||||
54
|
||||
END,
|
||||
enquete_batiment_id_parent
|
||||
WHERE batiment_rfu.murs IS NOT null
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT 35, now(), 35, now(),false,
|
||||
CASE batiment_rfu.standing
|
||||
WHEN 1 THEN 81
|
||||
WHEN 2 THEN 82
|
||||
WHEN 3 THEN 83
|
||||
WHEN 4 THEN 84
|
||||
END,
|
||||
enquete_batiment_id_parent
|
||||
WHERE batiment_rfu.standing IS NOT null
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT 35, now(), 35, now(),false,
|
||||
CASE batiment_rfu.utilisat
|
||||
WHEN 1 THEN 35
|
||||
WHEN 2 THEN 36
|
||||
WHEN 3 THEN 37
|
||||
END,
|
||||
enquete_batiment_id_parent
|
||||
WHERE batiment_rfu.utilisat IS NOT null;
|
||||
|
||||
------MAJ Exercice
|
||||
UPDATE enquete_batiment eb
|
||||
SET exercice_id = e.id
|
||||
FROM exercice e
|
||||
WHERE e.annee = 2025
|
||||
AND eb.id = enquete_batiment_id_parent;
|
||||
END;
|
||||
$procedure$;
|
||||
@@ -0,0 +1,153 @@
|
||||
CREATE OR REPLACE PROCEDURE public.import_enqueteparc_from_rfu_cipe(
|
||||
IN parcelle_rfu record,
|
||||
IN p_parcelle_id numeric
|
||||
)
|
||||
LANGUAGE plpgsql
|
||||
AS $procedure$
|
||||
DECLARE
|
||||
enquete_id_parent bigint;
|
||||
BEGIN
|
||||
INSERT INTO enquete (
|
||||
created_at,
|
||||
created_by,
|
||||
deleted,
|
||||
updated_at,
|
||||
updated_by,
|
||||
date_enquete,
|
||||
litige,
|
||||
parcelle_id,
|
||||
user_id,
|
||||
date_finalisation,
|
||||
date_synchronisation,
|
||||
date_validation,
|
||||
status_enquete,
|
||||
synchronise,
|
||||
code_parcelle,
|
||||
nbre_batiment,
|
||||
nbre_co_proprietaire,
|
||||
nom_rue,
|
||||
num_enter_parcelle,
|
||||
num_rue,
|
||||
superficie,
|
||||
equipe_id,
|
||||
zone_rfu_id,
|
||||
campagne_id,
|
||||
origine_enquete,
|
||||
nc_proprietaire,
|
||||
source
|
||||
) select
|
||||
now(),
|
||||
35,
|
||||
false,
|
||||
now(),
|
||||
35,
|
||||
now(),
|
||||
false,
|
||||
p_parcelle_id,
|
||||
35,
|
||||
now(),
|
||||
now(),
|
||||
now(),
|
||||
'CLOTURE',
|
||||
true,
|
||||
parcelle_rfu.numero_parcelle,
|
||||
CASE
|
||||
WHEN trim(parcelle_rfu.nb_bat) ~ '^[0-9]+$'
|
||||
THEN parcelle_rfu.nb_bat::integer
|
||||
ELSE NULL
|
||||
END,
|
||||
CASE
|
||||
WHEN trim(parcelle_rfu.nb_prop) ~ '^[0-9]+$'
|
||||
THEN parcelle_rfu.nb_prop::integer
|
||||
ELSE NULL
|
||||
END,
|
||||
parcelle_rfu.numero_rue,
|
||||
parcelle_rfu.num_entree_parcelle,
|
||||
parcelle_rfu.numero_rue,
|
||||
CASE
|
||||
WHEN trim(parcelle_rfu.surface) ~ '^[0-9]+$'
|
||||
THEN parcelle_rfu.surface::float
|
||||
ELSE NULL
|
||||
END,
|
||||
1,
|
||||
CASE parcelle_rfu.zones
|
||||
WHEN '1' THEN 1
|
||||
WHEN '2' THEN 2
|
||||
WHEN '3' THEN 3
|
||||
WHEN '4' THEN 4
|
||||
ELSE NULL
|
||||
END,
|
||||
1,
|
||||
'RFU',
|
||||
parcelle_rfu.n0_contrib,
|
||||
'RFU'
|
||||
--from parcelle p
|
||||
where not exists (
|
||||
select 1
|
||||
from enquete e
|
||||
where e.parcelle_id= p_parcelle_id
|
||||
)
|
||||
|
||||
RETURNING id INTO enquete_id_parent ;
|
||||
|
||||
----------MAJ Caractéristique parcelle
|
||||
INSERT INTO caracteristique_parcelle (
|
||||
created_by,
|
||||
created_at,
|
||||
updated_by,
|
||||
updated_at,
|
||||
deleted,
|
||||
caracteristique_id,
|
||||
enquete_id
|
||||
)
|
||||
SELECT 35, now(), 35, now(), false,
|
||||
CASE parcelle_rfu.acces
|
||||
WHEN '1' THEN 31
|
||||
WHEN '2' THEN 32
|
||||
WHEN '3' THEN 33
|
||||
WHEN '4' THEN 34
|
||||
END,
|
||||
enquete_id_parent
|
||||
WHERE parcelle_rfu.acces IS NOT NULL
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT 35, now(), 35, now(),false,
|
||||
CASE parcelle_rfu.cloture
|
||||
WHEN '1' THEN 28
|
||||
WHEN '2' THEN 29
|
||||
WHEN '3' THEN 30
|
||||
END,
|
||||
enquete_id_parent
|
||||
WHERE parcelle_rfu.cloture IS NOT NULL;
|
||||
|
||||
------MAJ Exercice
|
||||
UPDATE enquete q
|
||||
SET exercice_id = e.id
|
||||
FROM exercice e
|
||||
WHERE e.annee = 2025
|
||||
AND q.id = enquete_id_parent;
|
||||
|
||||
------MAJ prietaire
|
||||
UPDATE enquete q
|
||||
SET personne_id = p.id,
|
||||
proprietaire_id = p.id,
|
||||
nom_proprietaire_parcelle = coalesce (trim(p.raison_sociale), trim(p.nom) || ' '|| trim(p.prenom) )
|
||||
FROM personne p
|
||||
WHERE p.nc = parcelle_rfu.n0_contrib
|
||||
AND q.id = enquete_id_parent;
|
||||
|
||||
--quartier_id --commune_id --departement_id --arrondissement_id
|
||||
UPDATE enquete e
|
||||
SET quartier_id = q.id,
|
||||
commune_id=c.id,
|
||||
departement_id=c.departement_id,
|
||||
arrondissement_id= a.id
|
||||
FROM parcelle p
|
||||
inner join quartier q on q.id = p.quartier_id
|
||||
inner join arrondissement a on a.id = q.arrondissement_id
|
||||
inner join commune c on c.id = a.commune_id
|
||||
WHERE p.id = p_parcelle_id
|
||||
AND e.id = enquete_id_parent;
|
||||
END;
|
||||
$procedure$;
|
||||
@@ -0,0 +1,156 @@
|
||||
CREATE OR REPLACE PROCEDURE public.import_enqueteUnitLog_from_rfu_cipe(
|
||||
IN uniteLogement_rfu record,
|
||||
IN uniteLogement_id_param numeric,
|
||||
IN l_personne_id_parent numeric
|
||||
)
|
||||
LANGUAGE plpgsql
|
||||
AS $procedure$
|
||||
DECLARE
|
||||
enquete_uniteLogement_id_parent bigint;
|
||||
BEGIN
|
||||
INSERT INTO enquete_unite_logement (
|
||||
created_at,
|
||||
created_by,
|
||||
deleted,
|
||||
updated_at,
|
||||
updated_by,
|
||||
en_location,
|
||||
montant_locatif_annuel_declare,
|
||||
nbre_habitant,
|
||||
nbre_menage,
|
||||
nbre_piece,
|
||||
sbee,
|
||||
soneb,
|
||||
personne_id,
|
||||
unite_logement_id,
|
||||
user_id,
|
||||
nbre_mois_location,
|
||||
valeur_unite_logement_estime,
|
||||
source,
|
||||
date_enquete,
|
||||
observation,
|
||||
date_fin_exemption,
|
||||
superficie_au_sol,
|
||||
superficie_louee,
|
||||
statut_enquete,
|
||||
categorie_batiment_id,
|
||||
montant_locatif_annuel_calcule,
|
||||
montant_mensuel_location,
|
||||
usage_id,
|
||||
valeur_unite_logement_calcule
|
||||
)select
|
||||
now(),
|
||||
35,
|
||||
false,
|
||||
now(),
|
||||
35,
|
||||
case
|
||||
when uniteLogement_rfu.nbmois=0 then false
|
||||
else true
|
||||
end,
|
||||
uniteLogement_rfu.montmenl*12,
|
||||
uniteLogement_rfu.nbhabit,
|
||||
uniteLogement_rfu.nbmenage,
|
||||
uniteLogement_rfu.nbpiece,
|
||||
uniteLogement_rfu.electric,
|
||||
uniteLogement_rfu.eau,
|
||||
l_personne_id_parent,
|
||||
uniteLogement_id_param,
|
||||
35,
|
||||
uniteLogement_rfu.nbmois,
|
||||
uniteLogement_rfu.vlcalcule,
|
||||
'RFU',
|
||||
uniteLogement_rfu.mdate,
|
||||
'MIGRATION',
|
||||
uniteLogement_rfu.finexempt,
|
||||
uniteLogement_rfu.surfsol,
|
||||
uniteLogement_rfu.surfacelo,
|
||||
'CLOTURE',
|
||||
ProcedureRecupCategorieRFU(uniteLogement_rfu.n0etage::integer,uniteLogement_rfu.toit::integer),
|
||||
uniteLogement_rfu.vllcalcule,
|
||||
uniteLogement_rfu.montmenl,
|
||||
CASE uniteLogement_rfu.utilisat
|
||||
WHEN 1 THEN 8
|
||||
WHEN 2 THEN 14
|
||||
WHEN 3 THEN 9
|
||||
END,
|
||||
uniteLogement_rfu.vlcalcule
|
||||
from unite_logement ul
|
||||
where ul.id = uniteLogement_id_param
|
||||
and not exists (
|
||||
select 1
|
||||
from enquete_unite_logement eul
|
||||
where eul.unite_logement_id = ul.id
|
||||
)
|
||||
|
||||
RETURNING id INTO enquete_uniteLogement_id_parent ;
|
||||
|
||||
----------MAJ Caractéristique Unite de logement
|
||||
INSERT INTO caracteristique_unite_logement (
|
||||
created_by,
|
||||
created_at,
|
||||
updated_by,
|
||||
updated_at,
|
||||
deleted,
|
||||
caracteristique_id,
|
||||
enquete_unite_logement_id
|
||||
)
|
||||
SELECT 35, now(), 35, now(),false,
|
||||
CASE uniteLogement_rfu.toit
|
||||
WHEN 1 THEN 55
|
||||
WHEN 2 THEN 56
|
||||
WHEN 3 THEN 57
|
||||
WHEN 4 THEN 58
|
||||
WHEN 5 THEN 59
|
||||
WHEN 6 THEN 60
|
||||
END,
|
||||
enquete_uniteLogement_id_parent
|
||||
WHERE uniteLogement_rfu.toit IS NOT NULL
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT 35, now(), 35, now(),false,
|
||||
CASE uniteLogement_rfu.murs
|
||||
WHEN 1 THEN 49
|
||||
WHEN 2 THEN 50
|
||||
WHEN 3 THEN 51
|
||||
WHEN 4 THEN 52
|
||||
WHEN 5 THEN 53
|
||||
else
|
||||
54
|
||||
END,
|
||||
enquete_uniteLogement_id_parent
|
||||
WHERE uniteLogement_rfu.murs IS NOT null
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT 35, now(), 35, now(),false,
|
||||
CASE uniteLogement_rfu.standing
|
||||
WHEN 1 THEN 81
|
||||
WHEN 2 THEN 82
|
||||
WHEN 3 THEN 83
|
||||
WHEN 4 THEN 84
|
||||
END,
|
||||
enquete_uniteLogement_id_parent
|
||||
WHERE uniteLogement_rfu.standing IS NOT null
|
||||
|
||||
UNION ALL
|
||||
|
||||
|
||||
SELECT 35, now(), 35, now(),false,
|
||||
CASE uniteLogement_rfu.utilisat
|
||||
WHEN 1 THEN 35
|
||||
WHEN 2 THEN 36
|
||||
WHEN 3 THEN 37
|
||||
END,
|
||||
enquete_uniteLogement_id_parent
|
||||
WHERE uniteLogement_rfu.standing IS NOT null;
|
||||
|
||||
------MAJ Exercice
|
||||
UPDATE enquete_unite_logement eul
|
||||
SET exercice_id = e.id
|
||||
FROM exercice e
|
||||
WHERE e.annee = 2025
|
||||
AND eul.id = enquete_uniteLogement_id_parent;
|
||||
END;
|
||||
$procedure$;
|
||||
@@ -0,0 +1,250 @@
|
||||
CREATE OR REPLACE PROCEDURE public.import_parcelle_and_enqueteparc_from_rfu_cipe(in nombreLimit numeric)
|
||||
LANGUAGE plpgsql
|
||||
AS $procedure$
|
||||
DECLARE
|
||||
l_count numeric := 0;
|
||||
parcelle_rfu record;
|
||||
l_parcelle_id_parent bigint;
|
||||
l_code_quartier varchar(20);
|
||||
BEGIN
|
||||
FOR parcelle_rfu IN (
|
||||
SELECT
|
||||
trim(quartier)||'-'||trim(n0_ilot)||'-'||trim(n0_parcel) AS numero_parcelle,
|
||||
terrain,
|
||||
trim(n0_ilot) AS i,
|
||||
trim(n0_parcel) AS p,
|
||||
trim(quartier) AS q,
|
||||
hauteur,
|
||||
rue AS numero_rue,
|
||||
entree AS num_entree_parcelle,
|
||||
surface,
|
||||
vlcalcule,
|
||||
vllcalcule,
|
||||
loue,
|
||||
zones,
|
||||
acces,
|
||||
cloture,
|
||||
inonde,
|
||||
finexempt,
|
||||
habite,
|
||||
ordures,
|
||||
"usage",
|
||||
wc,
|
||||
choix,
|
||||
occupant,
|
||||
nb_bat,
|
||||
nb_prop,
|
||||
nb_log,
|
||||
nb_unit,
|
||||
nb_mena,
|
||||
nb_habit,
|
||||
nb_act,
|
||||
nb_contrib,
|
||||
typeparc,
|
||||
prixm2ne,
|
||||
ifu,
|
||||
n0_contrib,
|
||||
secteur,
|
||||
cipe
|
||||
FROM dblink(
|
||||
'connexion_rfu',
|
||||
$db$
|
||||
SELECT
|
||||
terrain,
|
||||
n0_ilot,
|
||||
n0_parcel,
|
||||
quartier,
|
||||
hauteur,
|
||||
rue,
|
||||
entree,
|
||||
vlcalcule,
|
||||
vllcalcule,
|
||||
loue,
|
||||
zones,
|
||||
acces,
|
||||
cloture,
|
||||
inonde,
|
||||
finexempt,
|
||||
habite,
|
||||
ordures,
|
||||
surface,
|
||||
"usage",
|
||||
wc,
|
||||
choix,
|
||||
occupant,
|
||||
nb_bat,
|
||||
nb_prop,
|
||||
nb_log,
|
||||
nb_unit,
|
||||
nb_mena,
|
||||
nb_habit,
|
||||
nb_act,
|
||||
nb_contrib,
|
||||
typeparc,
|
||||
prixm2ne,
|
||||
ifu,
|
||||
n0_contrib,
|
||||
secteur,
|
||||
cipe
|
||||
FROM stemichel.parcelle
|
||||
$db$
|
||||
) AS c (
|
||||
terrain varchar,
|
||||
n0_ilot varchar,
|
||||
n0_parcel varchar,
|
||||
quartier varchar,
|
||||
hauteur varchar,
|
||||
rue varchar,
|
||||
entree varchar,
|
||||
vlcalcule varchar,
|
||||
vllcalcule varchar,
|
||||
loue varchar,
|
||||
zones varchar,
|
||||
acces varchar,
|
||||
cloture varchar,
|
||||
inonde varchar,
|
||||
finexempt varchar,
|
||||
habite varchar,
|
||||
ordures varchar,
|
||||
surface varchar,
|
||||
"usage" varchar,
|
||||
wc varchar,
|
||||
choix varchar,
|
||||
occupant varchar,
|
||||
nb_bat varchar,
|
||||
nb_prop varchar,
|
||||
nb_log varchar,
|
||||
nb_unit varchar,
|
||||
nb_mena varchar,
|
||||
nb_habit varchar,
|
||||
nb_act varchar,
|
||||
nb_contrib varchar,
|
||||
typeparc varchar,
|
||||
prixm2ne varchar,
|
||||
ifu varchar,
|
||||
n0_contrib varchar,
|
||||
secteur varchar,
|
||||
cipe varchar
|
||||
)
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM public.parcelle p
|
||||
WHERE p.numero_parcelle =
|
||||
trim(c.quartier)||'-'||trim(c.n0_ilot)||'-'||trim(c.n0_parcel)
|
||||
) and exists (
|
||||
select 1
|
||||
from public.ref_rfu_q_quartier_cotonou rq
|
||||
where rq.rfu_q = trim(c.quartier)
|
||||
)
|
||||
limit nombreLimit
|
||||
) LOOP
|
||||
BEGIN
|
||||
INSERT INTO parcelle (
|
||||
created_at,
|
||||
created_by,
|
||||
deleted,
|
||||
updated_at,
|
||||
updated_by,
|
||||
numero_parcelle,
|
||||
qip,
|
||||
type_domaine_id,
|
||||
i,
|
||||
p,
|
||||
q,
|
||||
code_quartier,
|
||||
nature_domaine_id,
|
||||
superficie,
|
||||
altitude,
|
||||
num_entree_parcelle,
|
||||
numero_rue,
|
||||
usage_id,
|
||||
source
|
||||
)
|
||||
SELECT
|
||||
now(),
|
||||
35,
|
||||
false,
|
||||
now(),
|
||||
35,
|
||||
parcelle_rfu.numero_parcelle,
|
||||
parcelle_rfu.numero_parcelle,
|
||||
CASE parcelle_rfu.terrain
|
||||
WHEN '1' THEN 2
|
||||
WHEN '2' THEN 5
|
||||
WHEN '3' THEN 4
|
||||
END,
|
||||
parcelle_rfu.i,
|
||||
parcelle_rfu.p,
|
||||
parcelle_rfu.q,
|
||||
rq.code_quartier,
|
||||
CASE parcelle_rfu.typeparc
|
||||
WHEN '1' THEN 23
|
||||
WHEN '2' THEN 27
|
||||
WHEN '3' THEN 28
|
||||
WHEN '4' THEN 29
|
||||
END,
|
||||
CASE
|
||||
WHEN replace(trim(parcelle_rfu.surface), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(parcelle_rfu.surface, ',', '.')::numeric
|
||||
END,
|
||||
CASE
|
||||
WHEN replace(trim(parcelle_rfu.hauteur), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||
THEN replace(parcelle_rfu.hauteur, ',', '.')::numeric
|
||||
END,
|
||||
parcelle_rfu.num_entree_parcelle,
|
||||
parcelle_rfu.numero_rue,
|
||||
case parcelle_rfu.usage
|
||||
WHEN '01' THEN 3
|
||||
WHEN '02' THEN 4
|
||||
WHEN '03' THEN 5
|
||||
WHEN '04' THEN 6
|
||||
WHEN '05' THEN 7
|
||||
WHEN '11' THEN 8
|
||||
WHEN '12' THEN 9
|
||||
WHEN '13' THEN 10
|
||||
WHEN '14' THEN 11
|
||||
WHEN '21' THEN 12
|
||||
WHEN '22' THEN 13
|
||||
WHEN '23' THEN 14
|
||||
WHEN '24' THEN 15
|
||||
WHEN '25' THEN 16
|
||||
END,
|
||||
'RFU'
|
||||
FROM ref_rfu_q_quartier_cotonou rq
|
||||
WHERE rq.rfu_q = parcelle_rfu.q
|
||||
RETURNING id, code_quartier
|
||||
INTO l_parcelle_id_parent, l_code_quartier;
|
||||
EXCEPTION WHEN NO_DATA_FOUND THEN
|
||||
RAISE NOTICE 'Quartier RFU non trouvé pour %', parcelle_rfu.q;
|
||||
CONTINUE;
|
||||
--RAISE NOTICE 'Parcelle insérée : %, %', l_parcelle_id_parent, parcelle_rfu.q;
|
||||
END;
|
||||
------------------------------appel de enquete_parcelle------------------
|
||||
CALL import_enqueteparc_from_rfu_cipe(parcelle_rfu, l_parcelle_id_parent);
|
||||
|
||||
INSERT INTO secteur_decoupage (
|
||||
created_at, created_by, deleted, updated_at, updated_by,
|
||||
date_debut, quartier_id, secteur_id, arrondissement_id, source
|
||||
)
|
||||
SELECT
|
||||
now(), 35, false, now(), 35,
|
||||
now(), q.id, s.id,a.id, 'RFU'
|
||||
FROM ref_cipe_secteur_rfu_cotonou rcs
|
||||
JOIN secteur s ON s.code= rcs.code_secteur
|
||||
JOIN quartier q ON q.code = l_code_quartier
|
||||
left join arrondissement a on a.id=q.arrondissement_id
|
||||
WHERE rcs.cipe = parcelle_rfu.cipe
|
||||
AND rcs.secteur = parcelle_rfu.secteur
|
||||
ON CONFLICT (quartier_id, secteur_id) DO NOTHING;
|
||||
|
||||
l_count := l_count + 1;
|
||||
END LOOP;
|
||||
|
||||
UPDATE parcelle p
|
||||
SET quartier_id = q.id
|
||||
FROM quartier q
|
||||
WHERE q.code = p.code_quartier;
|
||||
|
||||
RAISE NOTICE 'Nombre de parcelles migrées : %', l_count;
|
||||
END;
|
||||
$procedure$;
|
||||
@@ -0,0 +1,128 @@
|
||||
|
||||
SELECT dblink_connect(
|
||||
'connexion_rfu',
|
||||
'host=10.4.6.103 port=5432 dbname=rfu user=postgres password=Rfu@dm1N2@25TeMp0'
|
||||
);
|
||||
|
||||
--SELECT dblink_disconnect('connexion_rfu');
|
||||
|
||||
CREATE OR REPLACE PROCEDURE public.import_personne_from_rfu()
|
||||
LANGUAGE plpgsql
|
||||
AS $procedure$
|
||||
BEGIN
|
||||
INSERT INTO public.personne (
|
||||
date_naissance_ou_consti,
|
||||
ifu,
|
||||
lieu_naissance,
|
||||
nom,
|
||||
prenom,
|
||||
raison_sociale,
|
||||
npi,
|
||||
num_ravip,
|
||||
tel1,
|
||||
tel2,
|
||||
adresse,
|
||||
created_at,
|
||||
created_by,
|
||||
deleted,
|
||||
updated_at,
|
||||
updated_by,
|
||||
nc,
|
||||
sexe,
|
||||
profession,
|
||||
source
|
||||
)
|
||||
SELECT
|
||||
CASE
|
||||
WHEN c.date_nais IS NULL OR c.date_nais = '' THEN NULL
|
||||
|
||||
-- format incorrect (pas exactement 8 chiffres)
|
||||
WHEN c.date_nais !~ '^[0-9]{8}$' THEN NULL
|
||||
|
||||
-- date invalide réelle
|
||||
WHEN to_char(to_date(c.date_nais, 'YYYYMMDD'), 'YYYYMMDD') <> c.date_nais THEN NULL
|
||||
|
||||
ELSE to_date(c.date_nais, 'YYYYMMDD')
|
||||
END,
|
||||
c.ifu,
|
||||
c.lieu_nais,
|
||||
case
|
||||
when (trim(c.nom_c)<>'' and trim(c.prenoms_c)<>'') then c.nom_c
|
||||
when (trim(c.nom_c)='' and trim(c.prenoms_c)='' and trim(c.prenoms)<>'') then c.nom
|
||||
end as nom,
|
||||
case
|
||||
when (trim(c.nom_c)<>'' and trim(c.prenoms_c)<>'') then c.prenoms_c
|
||||
when (trim(c.nom_c)='' and trim(c.prenoms_c)='' and trim(c.prenoms)<>'') then c.prenoms
|
||||
end as prenom,
|
||||
case
|
||||
when (trim(c.nom_c)='' and trim(c.prenoms_c)='' and trim(c.prenoms)='') then c.nom
|
||||
when (trim(c.nom_c)<>'' and trim(c.prenoms_c)<>'' and trim(c.prenoms)='') then c.nom
|
||||
end as raison_sociale,
|
||||
--c.nom,
|
||||
NULL::varchar,
|
||||
NULL::varchar,
|
||||
--c.prenoms,
|
||||
c.autradr1,
|
||||
c.autradr2,
|
||||
COALESCE(c.quartier_c, '') || '_' ||
|
||||
COALESCE(c.ilot_c, '') || '_' ||
|
||||
COALESCE(c.parcel_c, ''),
|
||||
now(),
|
||||
NULL::bigint,
|
||||
false,
|
||||
now(),
|
||||
NULL::bigint,
|
||||
c.n0_contrib,
|
||||
CASE c.sexe
|
||||
WHEN '1' THEN 'MASCULIN'
|
||||
WHEN '2' THEN 'FEMININ'
|
||||
ELSE NULL
|
||||
END,
|
||||
c.profession,
|
||||
'RFU'
|
||||
FROM dblink(
|
||||
'connexion_rfu',
|
||||
$db$
|
||||
SELECT
|
||||
date_nais,
|
||||
ifu,
|
||||
lieu_nais,
|
||||
nom,
|
||||
prenoms,
|
||||
nom_c,
|
||||
prenoms_c,
|
||||
autradr1,
|
||||
autradr2,
|
||||
quartier_c,
|
||||
ilot_c,
|
||||
parcel_c,
|
||||
n0_contrib,
|
||||
sexe,
|
||||
profession
|
||||
FROM stemichel.contrib
|
||||
-- WHERE ifu IS NOT NULL
|
||||
$db$
|
||||
) AS c (
|
||||
date_nais varchar,
|
||||
ifu varchar,
|
||||
lieu_nais varchar,
|
||||
nom varchar,
|
||||
prenoms varchar,
|
||||
nom_c varchar,
|
||||
prenoms_c varchar,
|
||||
autradr1 varchar,
|
||||
autradr2 varchar,
|
||||
quartier_c varchar,
|
||||
ilot_c varchar,
|
||||
parcel_c varchar,
|
||||
n0_contrib varchar,
|
||||
sexe varchar,
|
||||
profession varchar
|
||||
)
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM public.personne p
|
||||
WHERE p.nc = c.n0_contrib
|
||||
);
|
||||
END;
|
||||
$procedure$;
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
SELECT dblink_connect(
|
||||
'connexion_rfu',
|
||||
'host=10.4.6.103 port=5432 dbname=rfu user=postgres password=Rfu@dm1N2@25TeMp0'
|
||||
);
|
||||
|
||||
--SELECT dblink_disconnect('connexion_rfu');
|
||||
|
||||
SELECT dblink_connect(
|
||||
'connexion_sigibe_lecture',
|
||||
'host=10.4.80.71 port=5433 dbname=sigibe user=sigibe_lecture password=lec243R6Khsg'
|
||||
);
|
||||
|
||||
CREATE OR REPLACE PROCEDURE public.maj_personne_from_sigibe()
|
||||
LANGUAGE plpgsql
|
||||
AS $procedure$
|
||||
DECLARE
|
||||
|
||||
BEGIN
|
||||
UPDATE personne p
|
||||
SET
|
||||
nom = CASE
|
||||
WHEN s.nom IS NOT NULL THEN s.nom
|
||||
ELSE p.nom
|
||||
END,
|
||||
prenom = CASE
|
||||
WHEN s.prenom IS NOT NULL THEN s.prenom
|
||||
ELSE p.prenom
|
||||
END,
|
||||
raison_sociale = CASE
|
||||
WHEN s.id_tiers_type = 'PM'
|
||||
AND s.l_contribuable IS NOT NULL
|
||||
THEN s.l_contribuable
|
||||
ELSE p.raison_sociale
|
||||
END,
|
||||
tel1 = s.telephone,
|
||||
numero_rccm = s.numero_rccm,
|
||||
date_rccm = CASE
|
||||
WHEN s.date_rccm IS NOT NULL
|
||||
AND trim(s.date_rccm) <> ''
|
||||
THEN s.date_rccm::date
|
||||
ELSE p.date_rccm
|
||||
END,
|
||||
email = s.email,
|
||||
npi = s.numero_piece_identite,
|
||||
etat_identification_personne = 'IFU'
|
||||
FROM (
|
||||
SELECT *
|
||||
FROM dblink(
|
||||
'connexion_sigibe_lecture',
|
||||
'
|
||||
SELECT
|
||||
c.r_contribuable,
|
||||
t.nom,
|
||||
t.prenom,
|
||||
t.id_tiers_type,
|
||||
t.telephone,
|
||||
t.numero_rccm,
|
||||
t.date_rccm,
|
||||
t.email,
|
||||
t.numero_piece_identite,
|
||||
c.l_contribuable
|
||||
FROM t_contribuable c
|
||||
JOIN t_tiers t ON t.id_tiers = c.id_tiers
|
||||
'
|
||||
)
|
||||
AS s(
|
||||
r_contribuable varchar,
|
||||
nom varchar,
|
||||
prenom varchar,
|
||||
id_tiers_type varchar,
|
||||
telephone varchar,
|
||||
numero_rccm varchar,
|
||||
date_rccm varchar,
|
||||
email varchar,
|
||||
numero_piece_identite varchar,
|
||||
l_contribuable varchar
|
||||
)
|
||||
) s
|
||||
WHERE trim(p.ifu) = s.r_contribuable;
|
||||
END;
|
||||
$procedure$;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user