Compare commits
34 Commits
698b7e7c99
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d519855a7 | |||
| 44827030be | |||
| 8bcae0751a | |||
| 14ca79d49e | |||
| 34d1502334 | |||
| aec566935c | |||
| e2468328fd | |||
| d06d6336de | |||
| 41e55da1df | |||
| 16dd68c72c | |||
| 705af14b4e | |||
| bfe7b319c2 | |||
| 9063162c33 | |||
| 4997fd32c1 | |||
| 3f9cdcdad3 | |||
| d85b622acf | |||
| e58e338123 | |||
| db8b38b1c0 | |||
| afc44b95fb | |||
| 253332bbd3 | |||
| faf2ccdb8f | |||
| 6dcd549889 | |||
| 04ca166db4 | |||
| 6ba1365148 | |||
| 0d27aaebac | |||
| 0d5f7bba1c | |||
| afbf525af5 | |||
| 81bd7d9034 | |||
| 8ee2f7c9b0 | |||
| cec02e24ae | |||
| 6bdfa3ad1e | |||
| dae64dc079 | |||
| b8ba15c6fb | |||
| 9de2564108 |
@@ -1,6 +1,7 @@
|
|||||||
package io.gmss.fiscad.controllers.decoupage;
|
package io.gmss.fiscad.controllers.decoupage;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
||||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.controllers.infocad.metier;
|
|||||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||||
import io.gmss.fiscad.entities.user.User;
|
import io.gmss.fiscad.entities.user.User;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
@@ -67,7 +68,8 @@ public class EnqueteController {
|
|||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} 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);
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,6 +124,7 @@ public class EnqueteController {
|
|||||||
@PutMapping("/rejet")
|
@PutMapping("/rejet")
|
||||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectuée avec succès."),
|
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectuée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
@@ -483,8 +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();
|
Long userId = currentUser.getUser().getId();
|
||||||
return new ResponseEntity<>(
|
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
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
|||||||
@@ -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);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class DonneesImpositionTfuController {
|
|||||||
public ResponseEntity<?> getAllDonneesImpositionTfuList() {
|
public ResponseEntity<?> getAllDonneesImpositionTfuList() {
|
||||||
try {
|
try {
|
||||||
return new ResponseEntity<>(
|
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
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
@@ -144,7 +144,7 @@ public class DonneesImpositionTfuController {
|
|||||||
try {
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
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
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
@@ -169,7 +169,80 @@ public class DonneesImpositionTfuController {
|
|||||||
try {
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByImpositionTfuIdPageable(impositionId, pageable), "Liste des caractéristiques chargée avec succès."),
|
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
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
@@ -361,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);
|
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.entities.rfu.metier.EnqueteBatiment;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteBatimentService;
|
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteBatimentService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
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.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.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
@@ -20,6 +24,8 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "api/enquete-batiment", produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "api/enquete-batiment", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@@ -51,6 +57,7 @@ public class EnqueteBatimentController {
|
|||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} 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);
|
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.entities.rfu.metier.EnqueteUniteLogement;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteUniteLogementService;
|
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteUniteLogementService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
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.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.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
@@ -20,6 +24,8 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "api/enquete-unite-logement", produces = MediaType.APPLICATION_JSON_VALUE)
|
@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);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package io.gmss.fiscad.controllers.statistique;
|
package io.gmss.fiscad.controllers.statistique;
|
||||||
|
|
||||||
import io.gmss.fiscad.enums.NiveauDecoupage;
|
import io.gmss.fiscad.enums.NiveauDecoupage;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
|
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
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);
|
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
|
@ManyToOne
|
||||||
private Arrondissement arrondissement;
|
private Arrondissement arrondissement;
|
||||||
|
|
||||||
|
private String longitude;
|
||||||
|
private String latitude;
|
||||||
// @JsonIgnore
|
// @JsonIgnore
|
||||||
// @OneToOne(mappedBy = "quartier")
|
// @OneToOne(mappedBy = "quartier")
|
||||||
// private Bloc bloc;
|
// private Bloc bloc;
|
||||||
|
|||||||
@@ -99,9 +99,9 @@ public class Enquete extends BaseEntity implements Serializable {
|
|||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Campagne campagne;
|
private Campagne campagne;
|
||||||
|
|
||||||
@JsonIgnore
|
// @JsonIgnore
|
||||||
@ManyToOne
|
// @ManyToOne
|
||||||
private Equipe equipe;
|
// private Equipe equipe;
|
||||||
|
|
||||||
// @JsonIgnore
|
// @JsonIgnore
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class Parcelle extends BaseEntity implements Serializable {
|
|||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Tpe terminal;
|
private Tpe terminal;
|
||||||
private String autreNumeroTitreFoncier;
|
private String autreNumeroTitreFoncier;
|
||||||
private Long numeroProvisoire;
|
private String numeroProvisoire;
|
||||||
private Long blocId;
|
private Long blocId;
|
||||||
@ColumnDefault("false")
|
@ColumnDefault("false")
|
||||||
private boolean synchronise;
|
private boolean synchronise;
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class ParcelleGeom extends BaseEntity implements Serializable {
|
|||||||
private Quartier quartier ;
|
private Quartier quartier ;
|
||||||
|
|
||||||
@ColumnDefault("0")
|
@ColumnDefault("0")
|
||||||
private int geomSrid;
|
private Integer geomSrid;
|
||||||
@JsonSerialize(using = GeometrySerializer.class)
|
@JsonSerialize(using = GeometrySerializer.class)
|
||||||
@JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
@JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
||||||
@Column(name = "geometry",columnDefinition = "geometry(Polygon,32631)")
|
@Column(name = "geometry",columnDefinition = "geometry(Polygon,32631)")
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.hibernate.annotations.Where;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@@ -88,7 +89,7 @@ public class Piece extends BaseEntity implements Serializable {
|
|||||||
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "piece")
|
@OneToMany(mappedBy = "piece")
|
||||||
private List<Upload> uploads;
|
private List<Upload> uploads=new ArrayList<>();
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@@ -103,4 +104,9 @@ public class Piece extends BaseEntity implements Serializable {
|
|||||||
private boolean synchronise;
|
private boolean synchronise;
|
||||||
private String observation;
|
private String observation;
|
||||||
|
|
||||||
|
private Long nombreFichier;
|
||||||
|
|
||||||
|
public Long getNombreFichier() {
|
||||||
|
return uploads==null? 0l:uploads.size() ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import io.gmss.fiscad.entities.BaseEntity;
|
|||||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
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.infocad.parametre.Structure;
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.ZoneRfu;
|
import io.gmss.fiscad.entities.rfu.parametre.ZoneRfu;
|
||||||
import io.gmss.fiscad.enums.NatureImpot;
|
import io.gmss.fiscad.enums.NatureImpot;
|
||||||
@@ -73,22 +74,22 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
|||||||
private String latitude;
|
private String latitude;
|
||||||
private int superficieParc;
|
private int superficieParc;
|
||||||
private Long superficieAuSolBat;
|
private Long superficieAuSolBat;
|
||||||
|
private Long superficieAuSolLoue;
|
||||||
private Long superficieAuSolUlog;
|
private Long superficieAuSolUlog;
|
||||||
//private String batieOuiNon;
|
|
||||||
//private String exhonereOuiNon;
|
|
||||||
//private String batimentExhonereOuiNon;
|
|
||||||
//private String uniteLogementExhonereOuiNon;
|
|
||||||
private Boolean batie;
|
private Boolean batie;
|
||||||
private Boolean exonere;
|
private Boolean exonere;
|
||||||
private Boolean batimentExonere;
|
private Boolean batimentExonere;
|
||||||
private Boolean uniteLogementExonere;
|
private Boolean uniteLogementExonere;
|
||||||
private Long valeurLocativeAdm;
|
private Long valeurLocativeAdm;
|
||||||
private Long valeurLocativeAdm70Pour100;
|
private Long valeurLocativeAdmTauxPropParc;
|
||||||
|
private Long valeurLocativeAdmSupReel;
|
||||||
|
private Long superficieAuSolTauxPropParc;
|
||||||
private Long valeurLocativeAdmMetreCarre;
|
private Long valeurLocativeAdmMetreCarre;
|
||||||
private Long montantLoyerAnnuel;
|
private Long montantLoyerAnnuel;
|
||||||
private Long tfuMetreCarre;
|
private Long tfuMetreCarre;
|
||||||
private Long tfuMinimum;
|
private Long tfuMinimum;
|
||||||
private String standingBat;
|
private String standingBat;
|
||||||
|
private String categorieUsage;
|
||||||
private String categorieBat;
|
private String categorieBat;
|
||||||
private Long nombrePiscine;
|
private Long nombrePiscine;
|
||||||
private Long nombreUlog;
|
private Long nombreUlog;
|
||||||
@@ -97,15 +98,13 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
|||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||||
private LocalDate dateEnquete;
|
private LocalDate dateEnquete;
|
||||||
private Long enqueteId;
|
private Long enqueteId;
|
||||||
//private Long structureId;
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "structure_id")
|
@JoinColumn(name = "structure_id")
|
||||||
private Structure structure ;
|
private Structure structure ;
|
||||||
|
|
||||||
private Long secteurId;
|
private Long secteurId;
|
||||||
|
|
||||||
//private Long zoneRfuId;
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "zone_rfu_id")
|
@JoinColumn(name = "zone_rfu_id")
|
||||||
private ZoneRfu zoneRfu ;
|
private ZoneRfu zoneRfu ;
|
||||||
@@ -113,7 +112,10 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
|||||||
@ColumnDefault("0")
|
@ColumnDefault("0")
|
||||||
private Long valeurAdminParcelleNb;
|
private Long valeurAdminParcelleNb;
|
||||||
private Float tauxTfu;
|
private Float tauxTfu;
|
||||||
|
private Long tfuPiscine;
|
||||||
private Float montantTaxe;
|
private Float montantTaxe;
|
||||||
|
private Float tfuCalculeTauxPropParc;
|
||||||
|
private Float tfuSuperficieAuSolReel;
|
||||||
private Long valeurAdminParcelleNbMetreCarre;
|
private Long valeurAdminParcelleNbMetreCarre;
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@@ -123,4 +125,26 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
|||||||
private NatureImpot natureImpot;
|
private NatureImpot natureImpot;
|
||||||
private Long valeurBatiment;
|
private Long valeurBatiment;
|
||||||
private Long valeurParcelle;
|
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 ;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,14 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
|
|||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||||
private LocalDate dateEnquete;
|
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
|
@ManyToOne
|
||||||
private Exercice exercice;
|
private Exercice exercice;
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,15 @@ public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
|||||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||||
private LocalDate dateEnquete;
|
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 String observation;
|
||||||
private Long uniteLogementExternalKey;
|
private Long uniteLogementExternalKey;
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public class UniteLogement extends BaseEntity implements Serializable {
|
|||||||
private Long montantLocatifAnnuelDeclare;
|
private Long montantLocatifAnnuelDeclare;
|
||||||
private Long montantLocatifAnnuelCalcule;
|
private Long montantLocatifAnnuelCalcule;
|
||||||
private Long valeurUniteLogementEstime;
|
private Long valeurUniteLogementEstime;
|
||||||
|
private Long montantLocatifAnnuelEstime;
|
||||||
private Long valeurUniteLogementReel;
|
private Long valeurUniteLogementReel;
|
||||||
private Long valeurUniteLogementCalcule;
|
private Long valeurUniteLogementCalcule;
|
||||||
private Integer nombrePiscine;
|
private Integer nombrePiscine;
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ package io.gmss.fiscad.enums;
|
|||||||
|
|
||||||
public enum NatureImpot {
|
public enum NatureImpot {
|
||||||
TFU,
|
TFU,
|
||||||
IRF
|
IRF,
|
||||||
|
SRTB
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ public enum ParametersType {
|
|||||||
OBJET_CREATE_ACCOUNT,
|
OBJET_CREATE_ACCOUNT,
|
||||||
CORPS_CREATE_ACCOUNT,
|
CORPS_CREATE_ACCOUNT,
|
||||||
TOKEN_IFU_EN_LIGNE,
|
TOKEN_IFU_EN_LIGNE,
|
||||||
TAUX_TFU_HABITATION,
|
TAUX_TFU,
|
||||||
TAUX_TFU_PROFESSIONNELLE,
|
TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE,
|
||||||
TAUX_DEFAUT_SUPERFICIE_AU_SOL;
|
TAUX_DEFAUT_SUPERFICIE_AU_SOL,
|
||||||
|
TAUX_IRF,
|
||||||
|
TAXE_SRTB,
|
||||||
|
TFU_PAR_PISCINE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package io.gmss.fiscad.enums;
|
|||||||
|
|
||||||
public enum StatusAvis {
|
public enum StatusAvis {
|
||||||
EN_COURS,
|
EN_COURS,
|
||||||
|
|
||||||
CLOTURE,
|
CLOTURE,
|
||||||
GENERATION_AUTORISE,
|
GENERATION_AUTORISE,
|
||||||
|
|
||||||
REJETE,
|
REJETE,
|
||||||
TFU_FNB_GENERE,
|
TFU_FNB_GENERE,
|
||||||
GENERE
|
GENERE
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package io.gmss.fiscad.enums;
|
|||||||
|
|
||||||
public enum StatutEnquete {
|
public enum StatutEnquete {
|
||||||
EN_COURS,
|
EN_COURS,
|
||||||
// DECLARATION,
|
|
||||||
FINALISE,
|
FINALISE,
|
||||||
REJETE,
|
REJETE,
|
||||||
VALIDE,
|
VALIDE,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package io.gmss.fiscad.enums;
|
package io.gmss.fiscad.enums;
|
||||||
|
|
||||||
public enum StatutParcelle {
|
public enum StatutParcelle {
|
||||||
NON_ENQUETER,
|
NON_ENQUETE,
|
||||||
AJOUR,
|
AJOUR,
|
||||||
NON_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.Secteur;
|
||||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
||||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
|
import io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
|
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
|
||||||
import io.gmss.fiscad.persistence.repositories.decoupage.SecteurDecoupageRepository;
|
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.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 io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -26,6 +29,9 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
|||||||
private final SecteurDecoupageRepository secteurDecoupageRepository;
|
private final SecteurDecoupageRepository secteurDecoupageRepository;
|
||||||
private final SecteurService secteurService;
|
private final SecteurService secteurService;
|
||||||
private final ParcelleRepository parcelleRepository;
|
private final ParcelleRepository parcelleRepository;
|
||||||
|
private final EnqueteRepository enqueteRepository;
|
||||||
|
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||||
|
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||||
|
|
||||||
|
|
||||||
@@ -112,4 +118,35 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
|||||||
|
|
||||||
return parcelleStatsProjectionUnSecteurs ;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.gmss.fiscad.implementations.infocad.metier;
|
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.metier.*;
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueParcelle;
|
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.ApplicationException;
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
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.EnqueteService;
|
||||||
|
import io.gmss.fiscad.interfaces.infocad.metier.ParcelleService;
|
||||||
import io.gmss.fiscad.interfaces.infocad.metier.PieceService;
|
import io.gmss.fiscad.interfaces.infocad.metier.PieceService;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueParcelleService;
|
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueParcelleService;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.DeclarationNcService;
|
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.EnqueteTraitementPayLoad;
|
||||||
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
|
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
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.* ;
|
||||||
import io.gmss.fiscad.paylaods.response.FicheResponse.* ;
|
import io.gmss.fiscad.paylaods.response.FicheResponse.* ;
|
||||||
import io.gmss.fiscad.paylaods.response.synchronisation.EnqueteNonSyncResponse;
|
import io.gmss.fiscad.paylaods.response.synchronisation.EnqueteNonSyncResponse;
|
||||||
@@ -44,6 +48,7 @@ import jakarta.persistence.EntityManager;
|
|||||||
import jakarta.persistence.PersistenceContext;
|
import jakarta.persistence.PersistenceContext;
|
||||||
import jakarta.persistence.Query;
|
import jakarta.persistence.Query;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
|
import jakarta.ws.rs.NotAcceptableException;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.modelmapper.ModelMapper;
|
import org.modelmapper.ModelMapper;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -78,13 +83,9 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
private final ParcelleServiceImpl parcelleService;
|
private final ParcelleServiceImpl parcelleService;
|
||||||
private final PersonneRepository personneRepository;
|
private final PersonneRepository personneRepository;
|
||||||
private final ZoneRfuRepository zoneRfuRepository ;
|
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 EntityFromPayLoadService entityFromPayLoadService ;
|
||||||
|
private final SecteurService secteurService ;
|
||||||
|
;
|
||||||
|
|
||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
private final EntityManager em;
|
private final EntityManager em;
|
||||||
@@ -92,69 +93,75 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public EnquetePayLoadWeb createEnquete(EnquetePayLoadWeb enquetePayLoadWeb) throws BadRequestException {
|
public EnquetePayLoadWeb createEnquete(EnquetePayLoadWeb enquetePayLoadWeb) throws BadRequestException {
|
||||||
|
|
||||||
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
||||||
if (!optionalUser.isPresent()) {
|
if (!optionalUser.isPresent()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : Enquêteur inexistant");
|
throw new BadRequestException("Echec de l'enregistrement : Enquêteur inexistant");
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<Personne> optionalPersonne = personneRepository.findById(enquetePayLoadWeb.getPersonneId());
|
Optional<Personne> optionalPersonne = personneRepository.findById(enquetePayLoadWeb.getPersonneId());
|
||||||
if (!optionalPersonne.isPresent()) {
|
if (!optionalPersonne.isPresent()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : Propriétaire inexistant");
|
throw new BadRequestException("Echec de l'enregistrement : Propriétaire inexistant");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(enquetePayLoadWeb.getParcelleId()!=null) {
|
||||||
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(enquetePayLoadWeb.getParcelleId());
|
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(enquetePayLoadWeb.getParcelleId());
|
||||||
if (!optionalParcelle.isPresent()) {
|
if (!optionalParcelle.isPresent()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : Parcelle inexistante");
|
throw new BadRequestException("Echec de l'enregistrement : Parcelle inexistante");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Optional<ZoneRfu> optionalZoneRfu = zoneRfuRepository.findById(enquetePayLoadWeb.getZoneRfuId());
|
Optional<ZoneRfu> optionalZoneRfu = zoneRfuRepository.findById(enquetePayLoadWeb.getZoneRfuId());
|
||||||
if (!optionalZoneRfu.isPresent()) {
|
if (!optionalZoneRfu.isPresent()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
|
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enquetePayLoadWeb.getParcelleId() == null) {
|
ParcellePayLoadWeb parcellePayLoadWeb= getParcellePayloadFromEnquetePl(enquetePayLoadWeb);
|
||||||
throw new ApplicationException("Echec de l'enregistrement : La parcelle non renseignée.");
|
|
||||||
|
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 enquete = entityFromPayLoadService.getEnqueteFromPayLoadWeb(enquetePayLoadWeb);
|
||||||
////enregistrement de l'enquete
|
////enregistrement de l'enquete
|
||||||
|
|
||||||
enquete=enqueteRepository.save(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);
|
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
|
@Override
|
||||||
public EnquetePayLoadWeb updateEnquete(Long id,EnquetePayLoadWeb enquetePayLoadWeb) throws NotFoundException {
|
public EnquetePayLoadWeb updateEnquete(Long id,EnquetePayLoadWeb enquetePayLoadWeb) throws NotFoundException {
|
||||||
if (enquetePayLoadWeb.getId() == null) {
|
if (enquetePayLoadWeb.getId() == null) {
|
||||||
@@ -168,8 +175,6 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
throw new BadRequestException("Impossible d'enregistrer une enquête avec une parcelle inexistante");
|
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());
|
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
||||||
if (!optionalUser.isPresent()) {
|
if (!optionalUser.isPresent()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : Enquêteur inexistant");
|
throw new BadRequestException("Echec de l'enregistrement : Enquêteur inexistant");
|
||||||
@@ -183,12 +188,25 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
if (!optionalZoneRfu.isPresent()) {
|
if (!optionalZoneRfu.isPresent()) {
|
||||||
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
|
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
|
||||||
}
|
}
|
||||||
///enregistrement de la pacelle
|
|
||||||
if (enquetePayLoadWeb.getParcelleId() == null) {
|
if(enquetePayLoadWeb.getParcelleId()!=null) {
|
||||||
throw new ApplicationException("Echec de l'enregistrement : La parcelle non renseignée.");
|
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(enquetePayLoadWeb.getParcelleId());
|
||||||
} else {
|
if (!optionalParcelle.isPresent()) {
|
||||||
optionalParcelle = parcelleService.getParcelleById(enquetePayLoadWeb.getParcelleId());
|
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 enquete = entityFromPayLoadService.getEnqueteFromPayLoadWeb(enquetePayLoadWeb);
|
||||||
enquete=enqueteRepository.save(enquete);
|
enquete=enqueteRepository.save(enquete);
|
||||||
@@ -338,7 +356,7 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enquete validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
public EnquetePayLoadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||||
if (enqueteTraitementPayLoad == null) {
|
if (enqueteTraitementPayLoad == null) {
|
||||||
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
||||||
}
|
}
|
||||||
@@ -346,15 +364,22 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
if (!optionalEnquete.isPresent()) {
|
if (!optionalEnquete.isPresent()) {
|
||||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
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 enquete = optionalEnquete.get();
|
||||||
enquete.setDateValidation(LocalDate.now());
|
enquete.setDateValidation(LocalDate.now());
|
||||||
enquete.setStatutEnquete(StatutEnquete.VALIDE);
|
enquete.setStatutEnquete(StatutEnquete.VALIDE);
|
||||||
enquete.setSynchronise(true);
|
enquete.setSynchronise(true);
|
||||||
return enqueteRepository.save(enquete);
|
|
||||||
|
enquete= enqueteRepository.save(enquete);
|
||||||
|
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enquete rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
public EnquetePayLoadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||||
if (enqueteTraitementPayLoad.getIdBackend() == null) {
|
if (enqueteTraitementPayLoad.getIdBackend() == null) {
|
||||||
throw new BadRequestException("Impossible de rejeter une enquête ayant un id null.");
|
throw new BadRequestException("Impossible de rejeter une enquête ayant un id null.");
|
||||||
}
|
}
|
||||||
@@ -362,38 +387,43 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
if (!optionalEnquete.isPresent()) {
|
if (!optionalEnquete.isPresent()) {
|
||||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez rejeter.");
|
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 enquete = optionalEnquete.get();
|
||||||
enquete.setDateRejet(LocalDate.now());
|
enquete.setDateRejet(LocalDate.now());
|
||||||
enquete.setDescriptionMotifRejet(enqueteTraitementPayLoad.getMotifRejet());
|
enquete.setDescriptionMotifRejet(enqueteTraitementPayLoad.getMotifRejet());
|
||||||
enquete.setStatutEnquete(StatutEnquete.REJETE);
|
enquete.setStatutEnquete(StatutEnquete.REJETE);
|
||||||
enquete.setSynchronise(false);
|
enquete.setSynchronise(false);
|
||||||
return enqueteRepository.save(enquete);
|
enquete= enqueteRepository.save(enquete);
|
||||||
|
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Enquete> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
public List<EnquetePayLoadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||||
List<Enquete> enquetes = new ArrayList<>();
|
List<EnquetePayLoadWeb> enquetePayLoadWebs = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||||
enquetes.add(validerEnquete(enqueteTraitementPayLoad));
|
enquetePayLoadWebs.add(validerEnquete(enqueteTraitementPayLoad));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
enquetes.add(null);
|
enquetePayLoadWebs.add(null);
|
||||||
}
|
}
|
||||||
return enquetes;
|
return enquetePayLoadWebs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Enquete> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
public List<EnquetePayLoadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||||
List<Enquete> enquetes = new ArrayList<>();
|
List<EnquetePayLoadWeb> enquetePayLoadWebs = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||||
enquetes.add(rejeterEnquete(enqueteTraitementPayLoad));
|
enquetePayLoadWebs.add(rejeterEnquete(enqueteTraitementPayLoad));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
enquetes.add(null);
|
enquetePayLoadWebs.add(null);
|
||||||
}
|
}
|
||||||
return enquetes;
|
return enquetePayLoadWebs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -554,6 +584,16 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
return nbreEnquete;
|
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
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(Long structureId,Long exerciceId) {
|
public int cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(Long structureId,Long exerciceId) {
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package io.gmss.fiscad.implementations.infocad.metier;
|
|||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
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.EnqueteFiltreResponse;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Rue;
|
import io.gmss.fiscad.entities.infocad.metier.Rue;
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
|
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.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||||
@@ -19,7 +21,9 @@ 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.metier.RueRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.NatureDomaineRepository;
|
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.SituationGeographiqueRepository;
|
||||||
|
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypeDomaineRepository;
|
||||||
import io.gmss.fiscad.persistence.specification.ParcelleSpecification;
|
import io.gmss.fiscad.persistence.specification.ParcelleSpecification;
|
||||||
|
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||||
import io.gmss.fiscad.service.GeometryService;
|
import io.gmss.fiscad.service.GeometryService;
|
||||||
import jakarta.persistence.Query;
|
import jakarta.persistence.Query;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
@@ -39,6 +43,8 @@ public class ParcelleServiceImpl implements ParcelleService {
|
|||||||
private final RueRepository rueRepository;
|
private final RueRepository rueRepository;
|
||||||
private final GeometryService geometryService;
|
private final GeometryService geometryService;
|
||||||
private final SecteurService secteurService;
|
private final SecteurService secteurService;
|
||||||
|
private final TypeDomaineRepository typeDomaineRepository;
|
||||||
|
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||||
|
|
||||||
// @Value("${infocad.geom.srid}")
|
// @Value("${infocad.geom.srid}")
|
||||||
// private String defaultSrid32631;
|
// private String defaultSrid32631;
|
||||||
@@ -58,36 +64,29 @@ public class ParcelleServiceImpl implements ParcelleService {
|
|||||||
if (!optionalQuartier.isPresent()) {
|
if (!optionalQuartier.isPresent()) {
|
||||||
throw new BadRequestException("Impossible d'enregistrer une parcelle avec un quartier/village inexistant");
|
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 parcelle = new Parcelle();
|
||||||
parcelle.setNatureDomaine(optionalNatureDomaine.orElse(null));
|
parcelle = entityFromPayLoadService.getParcelleFromPayload(parcellePayLoadWeb);
|
||||||
parcelle.setQuartier(optionalQuartier.orElse(null));
|
|
||||||
parcelle = getParcelleFromPayload(parcelle, parcellePayLoadWeb);
|
|
||||||
parcelle= parcelleRepository.save(parcelle);
|
parcelle= parcelleRepository.save(parcelle);
|
||||||
return parcelleRepository.findParcelleToDtoById(parcelle.getId()).orElse(null);
|
return parcelleRepository.findParcelleToDtoById(parcelle.getId()).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ParcellePayLoadWeb updateParcelle(Long id, ParcellePayLoadWeb parcellePayLoadWeb) throws NotFoundException {
|
public ParcellePayLoadWeb updateParcelle(Long id, ParcellePayLoadWeb parcellePayLoadWeb) throws NotFoundException {
|
||||||
|
if(parcellePayLoadWeb.getId()!=null) {
|
||||||
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(parcellePayLoadWeb.getId());
|
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(parcellePayLoadWeb.getId());
|
||||||
if (!optionalParcelle.isPresent()) {
|
if (!optionalParcelle.isPresent()) {
|
||||||
throw new NotFoundException("Impossible de trouver la parcelle que vous désirer modifier");
|
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()) {
|
Parcelle parcelle = new Parcelle();
|
||||||
throw new BadRequestException("Impossible d'enregistrer une parcelle avec un quartier/village inexistant");
|
parcelle = entityFromPayLoadService.getParcelleFromPayload(parcellePayLoadWeb);
|
||||||
}
|
|
||||||
// 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);
|
|
||||||
parcelle= parcelleRepository.save(parcelle);
|
parcelle= parcelleRepository.save(parcelle);
|
||||||
return parcelleRepository.findParcelleToDtoById(parcelle.getId()).orElse(null);
|
return parcelleRepository.findParcelleToDtoById(parcelle.getId()).orElse(null);
|
||||||
}
|
}
|
||||||
@@ -210,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) {
|
// private Parcelle getParcelle(Parcelle parcelle, ParcellePayLoadWeb parcellePayLoadWeb, Optional<SituationGeographique> optionalSituationGeographique, Optional<NatureDomaine> optionalNatureDomaine) {
|
||||||
// StringBuilder coordonnees = new StringBuilder();
|
// StringBuilder coordonnees = new StringBuilder();
|
||||||
// parcelle.setP(parcellePayLoadWeb.getP());
|
// parcelle.setP(parcellePayLoadWeb.getP());
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package io.gmss.fiscad.implementations.rfu.metier;
|
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.metier.Batiment;
|
||||||
|
import io.gmss.fiscad.entities.rfu.parametre.CategorieBatiment;
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.BatimentService;
|
import io.gmss.fiscad.interfaces.rfu.metier.BatimentService;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.BatimentPaylaodWeb;
|
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.metier.BatimentRepository;
|
||||||
|
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CategorieBatimentRepository;
|
||||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -19,6 +23,8 @@ import java.util.Optional;
|
|||||||
public class BatimentServiceImpl implements BatimentService {
|
public class BatimentServiceImpl implements BatimentService {
|
||||||
|
|
||||||
private final BatimentRepository batimentRepository;
|
private final BatimentRepository batimentRepository;
|
||||||
|
private final ParcelleRepository parcelleRepository;
|
||||||
|
private final CategorieBatimentRepository categorieBatimentRepository;
|
||||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||||
|
|
||||||
|
|
||||||
@@ -27,8 +33,22 @@ public class BatimentServiceImpl implements BatimentService {
|
|||||||
if (batimentPaylaodWeb.getId() != null) {
|
if (batimentPaylaodWeb.getId() != null) {
|
||||||
throw new BadRequestException("Impossible de créer un nouveau batiment ayant un id non 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 batiment= entityFromPayLoadService.getBatimentFromPayLoadWeb(batimentPaylaodWeb);
|
||||||
batiment= batimentRepository.save(batiment);
|
batiment= batimentRepository.save(batiment);
|
||||||
|
System.out.println(batiment.getId());
|
||||||
return batimentRepository.findBatimentAvecOccupantCourantToDto(batiment.getId()).orElse(null);
|
return batimentRepository.findBatimentAvecOccupantCourantToDto(batiment.getId()).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,6 +60,19 @@ public class BatimentServiceImpl implements BatimentService {
|
|||||||
if (!batimentRepository.existsById(batimentPaylaodWeb.getId())) {
|
if (!batimentRepository.existsById(batimentPaylaodWeb.getId())) {
|
||||||
throw new NotFoundException("Impossible de trouver le batiment spécifié dans notre base de données.");
|
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 batiment= entityFromPayLoadService.getBatimentFromPayLoadWeb(batimentPaylaodWeb);
|
||||||
batiment= batimentRepository.save(batiment);
|
batiment= batimentRepository.save(batiment);
|
||||||
return batimentRepository.findBatimentAvecOccupantCourantToDto(batiment.getId()).orElse(null);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatie(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId) {
|
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatie(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId) {
|
||||||
Integer nb= donneesImpositionTfuRepository.genererDonneesTfuNonBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
Integer nb= donneesImpositionTfuRepository.genererDonneesTfuNonBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
||||||
|
|
||||||
|
|
||||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||||
impositionsTfu.setStatusAvis(StatusAvis.TFU_FNB_GENERE);
|
impositionsTfu.setStatusAvis(StatusAvis.TFU_FNB_GENERE);
|
||||||
|
|
||||||
@@ -118,6 +117,14 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
|
|
||||||
Integer nbulo= donneesImpositionTfuRepository.genererDonneesTfuBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
Integer nbulo= donneesImpositionTfuRepository.genererDonneesTfuBatieUniteLogement(impositionsTfuPaylaodWeb.getId(),userId);
|
||||||
|
|
||||||
|
// Integer nbirfbt= donneesImpositionTfuRepository.genererDonneesIrfBatie(impositionsTfuPaylaodWeb.getId(),userId);
|
||||||
|
//
|
||||||
|
// Integer 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 impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||||
impositionsTfu.setStatusAvis(StatusAvis.GENERE);
|
impositionsTfu.setStatusAvis(StatusAvis.GENERE);
|
||||||
@@ -132,8 +139,8 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DonneesImpositionTfu> getDonneesFiscalesByImposition(Long impositionsId) {
|
public List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImposition(Long impositionsId) {
|
||||||
return donneesImpositionTfuRepository.findAllByImpositionsTfu_Id(impositionsId);
|
return donneesImpositionTfuRepository.findAllByImpositionTfuId(impositionsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -150,4 +157,54 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdPageable(Long impositionsTfuId, Pageable pageable) {
|
public Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdPageable(Long impositionsTfuId, Pageable pageable) {
|
||||||
return donneesImpositionTfuRepository.findAllByImpositionTfuIdPageable(impositionsTfuId,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;
|
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.Enquete;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment;
|
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
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.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
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.BatimentService;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueBatimentService;
|
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueBatimentService;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteBatimentService;
|
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.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.EnqueteRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
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.BatimentRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
|
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
|
||||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import jakarta.ws.rs.NotAcceptableException;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||||
|
|
||||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||||
private final BatimentService batimentService;
|
|
||||||
private final EnqueteRepository enqueteRepository;
|
|
||||||
private final PersonneRepository personneRepository;
|
|
||||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||||
private final CaracteristiqueBatimentService caracteristiqueBatimentService;
|
|
||||||
private final UploadRepository uploadRepository;
|
|
||||||
private final BatimentRepository batimentRepository;
|
private final BatimentRepository batimentRepository;
|
||||||
|
private final BatimentService batimentService;
|
||||||
|
private final SecteurService secteurService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public EnqueteBatimentPayloadWeb createEnqueteBatiment(EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) throws BadRequestException {
|
public EnqueteBatimentPayloadWeb createEnqueteBatiment(EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) throws BadRequestException {
|
||||||
EnqueteBatiment enqueteBatiment=new EnqueteBatiment();
|
EnqueteBatiment enqueteBatiment=new EnqueteBatiment();
|
||||||
|
|
||||||
|
if(enqueteBatimentPayloadWeb.getBatimentId()!=null) {
|
||||||
if (!batimentRepository.existsById(enqueteBatimentPayloadWeb.getBatimentId())) {
|
if (!batimentRepository.existsById(enqueteBatimentPayloadWeb.getBatimentId())) {
|
||||||
throw new NotFoundException("Impossible d'enregistrer sans le batiment.");
|
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 = entityFromPayLoadService.getEnqueteBatimentFromPayLoadWeb(enqueteBatimentPayloadWeb);
|
||||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||||
enqueteBatimentPayloadWeb= enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
enqueteBatimentPayloadWeb= enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||||
return enqueteBatimentPayloadWeb ;
|
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
|
@Override
|
||||||
|
@Transactional
|
||||||
public EnqueteBatimentPayloadWeb updateEnqueteBatiment(Long id, EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) throws NotFoundException {
|
public EnqueteBatimentPayloadWeb updateEnqueteBatiment(Long id, EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) throws NotFoundException {
|
||||||
if (enqueteBatimentPayloadWeb.getId() == null) {
|
if (enqueteBatimentPayloadWeb.getId() == null) {
|
||||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle enquete de batiment ayant un id 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())) {
|
if (!batimentRepository.existsById(enqueteBatimentPayloadWeb.getBatimentId())) {
|
||||||
throw new NotFoundException("Impossible d'enregistrer sans le batiment.");
|
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 enqueteBatiment = entityFromPayLoadService.getEnqueteBatimentFromPayLoadWeb(enqueteBatimentPayloadWeb);
|
||||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||||
enqueteBatimentPayloadWeb= enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
enqueteBatimentPayloadWeb= enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||||
@@ -110,4 +166,84 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
|||||||
public List<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentList(Long batimentId) {
|
public List<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentList(Long batimentId) {
|
||||||
return enqueteBatimentRepository.findAllByBatimentToDto(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;
|
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.Enquete;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.*;
|
import io.gmss.fiscad.entities.rfu.metier.*;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
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.CaracteristiqueUniteLogementService;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteUniteLogementService;
|
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteUniteLogementService;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.UniteLogementService;
|
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.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.EnqueteRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
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.EnqueteUniteLogementRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.UniteLogementRepository;
|
import io.gmss.fiscad.persistence.repositories.rfu.metier.UniteLogementRepository;
|
||||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
import jakarta.ws.rs.NotAcceptableException;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -28,31 +38,65 @@ import java.util.Optional;
|
|||||||
public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementService {
|
public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementService {
|
||||||
|
|
||||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||||
private final UniteLogementService uniteLogementService;
|
|
||||||
private final EntityFromPayLoadService entityFromPayLoadService ;
|
private final EntityFromPayLoadService entityFromPayLoadService ;
|
||||||
private final PersonneRepository personneRepository ;
|
|
||||||
private final EnqueteRepository enqueteRepository ;
|
|
||||||
private final UploadRepository uploadRepository ;
|
|
||||||
private final UniteLogementRepository uniteLogementRepository ;
|
private final UniteLogementRepository uniteLogementRepository ;
|
||||||
private final CaracteristiqueUniteLogementService caracteristiqueUniteLogementService ;
|
private final UniteLogementService uniteLogementService ;
|
||||||
|
private final SecteurService secteurService ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public EnqueteUniteLogementPayloadWeb createEnqueteUniteLogement(EnqueteUniteLogementPayloadWeb enqueteUniteLogementPayloadWeb) throws BadRequestException {
|
public EnqueteUniteLogementPayloadWeb createEnqueteUniteLogement(EnqueteUniteLogementPayloadWeb enqueteUniteLogementPayloadWeb) throws BadRequestException {
|
||||||
EnqueteUniteLogement enqueteUniteLogement=new EnqueteUniteLogement();
|
EnqueteUniteLogement enqueteUniteLogement=new EnqueteUniteLogement();
|
||||||
Optional<UniteLogement> optionalUniteLogement= Optional.empty();
|
Optional<UniteLogement> optionalUniteLogement= Optional.empty();
|
||||||
|
|
||||||
if (enqueteUniteLogementPayloadWeb.getUniteLogementId() == null) {
|
if(enqueteUniteLogementPayloadWeb.getUniteLogementId()!=null) {
|
||||||
throw new BadRequestException("Impossible d'enregistrer une nouvelle enquete d'unité de logement sans l'unité de logement.");
|
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 = entityFromPayLoadService.getEnqueteUniteLogementFromPayLoadWeb(enqueteUniteLogementPayloadWeb);
|
||||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||||
enqueteUniteLogementPayloadWeb = enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
enqueteUniteLogementPayloadWeb = enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||||
return enqueteUniteLogementPayloadWeb ;
|
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
|
@Override
|
||||||
|
@Transactional
|
||||||
public EnqueteUniteLogementPayloadWeb updateEnqueteUniteLogement(Long id, EnqueteUniteLogementPayloadWeb enqueteUniteLogementPayloadWeb) throws NotFoundException {
|
public EnqueteUniteLogementPayloadWeb updateEnqueteUniteLogement(Long id, EnqueteUniteLogementPayloadWeb enqueteUniteLogementPayloadWeb) throws NotFoundException {
|
||||||
if (enqueteUniteLogementPayloadWeb.getId() == null) {
|
if (enqueteUniteLogementPayloadWeb.getId() == null) {
|
||||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle enquete d'unité de logement ayant un id 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();
|
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 = entityFromPayLoadService.getEnqueteUniteLogementFromPayLoadWeb(enqueteUniteLogementPayloadWeb);
|
||||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||||
enqueteUniteLogementPayloadWeb = enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ import io.gmss.fiscad.exceptions.BadRequestException;
|
|||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.UniteLogementService;
|
import io.gmss.fiscad.interfaces.rfu.metier.UniteLogementService;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.UniteLogementPaylaodWeb;
|
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.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 io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -20,6 +23,8 @@ public class UniteLogementServiceImpl implements UniteLogementService {
|
|||||||
|
|
||||||
private final UniteLogementRepository uniteLogementRepository;
|
private final UniteLogementRepository uniteLogementRepository;
|
||||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
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) {
|
if (uniteLogementPaylaodWeb.getId() != null) {
|
||||||
throw new BadRequestException("Impossible de créer une nouvelle unité de logement ayant un id non 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 uniteLogement = entityFromPayLoadService.getUniteLogementFromPayLoadWeb(uniteLogementPaylaodWeb);
|
||||||
uniteLogement = uniteLogementRepository.save(uniteLogement);
|
uniteLogement = uniteLogementRepository.save(uniteLogement);
|
||||||
return uniteLogementRepository.findUniteLogementAvecOccupantCourantToDto(uniteLogement.getId()).orElse(null);
|
return uniteLogementRepository.findUniteLogementAvecOccupantCourantToDto(uniteLogement.getId()).orElse(null);
|
||||||
@@ -91,4 +111,14 @@ public class UniteLogementServiceImpl implements UniteLogementService {
|
|||||||
public List<UniteLogementPaylaodWeb> getUniteLogementListByParcelle(Long parcelleId) {
|
public List<UniteLogementPaylaodWeb> getUniteLogementListByParcelle(Long parcelleId) {
|
||||||
return uniteLogementRepository.findAllUnitesLogementAvecOccupantCourantByParcelleToDto(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,23 @@
|
|||||||
package io.gmss.fiscad.implementations.statistiques;
|
package io.gmss.fiscad.implementations.statistiques;
|
||||||
|
|
||||||
|
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||||
import io.gmss.fiscad.entities.user.User;
|
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.statistique.StatistiquesService;
|
||||||
import io.gmss.fiscad.interfaces.user.UserService;
|
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.paylaods.response.statistique.*;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
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.metier.ParcelleRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
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.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 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.Authentication;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -25,14 +34,20 @@ public class StatistiquesServiceImpl implements StatistiquesService {
|
|||||||
private final BatimentRepository batimentRepository;
|
private final BatimentRepository batimentRepository;
|
||||||
private final UniteLogementRepository uniteLogementRepository;
|
private final UniteLogementRepository uniteLogementRepository;
|
||||||
private final PersonneRepository personneRepository;
|
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.userService = userService;
|
||||||
this.enqueteRepository = enqueteRepository;
|
this.enqueteRepository = enqueteRepository;
|
||||||
this.parcelleRepository = parcelleRepository;
|
this.parcelleRepository = parcelleRepository;
|
||||||
this.batimentRepository = batimentRepository;
|
this.batimentRepository = batimentRepository;
|
||||||
this.uniteLogementRepository = uniteLogementRepository;
|
this.uniteLogementRepository = uniteLogementRepository;
|
||||||
this.personneRepository = personneRepository;
|
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() {
|
public List<StatistiqueTypeNombreResponse> getStatNombrePersonneParCategorie() {
|
||||||
return personneRepository.getNombrePersonnesResponse();
|
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;
|
package io.gmss.fiscad.interfaces.decoupage;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
|
import io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
|
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
@@ -33,4 +33,7 @@ public interface SecteurDecoupageService {
|
|||||||
|
|
||||||
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageUnSecteur(Long secteurId) ;
|
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageUnSecteur(Long secteurId) ;
|
||||||
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageByUserId(Long userId) ;
|
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.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
|
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.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
|||||||
@@ -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.Enquete;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.EnqueteFiltreResponse;
|
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.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||||
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
|
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
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.synchronisation.EnqueteNonSyncResponse;
|
||||||
import io.gmss.fiscad.paylaods.response.EnqueteResponse;
|
import io.gmss.fiscad.paylaods.response.EnqueteResponse;
|
||||||
import io.gmss.fiscad.paylaods.response.FicheResponse.FicheEnqueteResponse;
|
import io.gmss.fiscad.paylaods.response.FicheResponse.FicheEnqueteResponse;
|
||||||
@@ -38,13 +40,13 @@ public interface EnqueteService {
|
|||||||
|
|
||||||
Optional<EnquetePayLoadWeb> getEnqueteById(Long id);
|
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);
|
Enquete finaliserEnquete(Long enqueteId);
|
||||||
|
|
||||||
@@ -60,4 +62,8 @@ public interface EnqueteService {
|
|||||||
|
|
||||||
int cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(Long strucutreId,Long exerciceId);
|
int cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(Long strucutreId,Long exerciceId);
|
||||||
int cloturerEnqueteParcelleBatimentUniteLogementByUserIdAndExerciceId(Long userId,Long exerciceId);
|
int cloturerEnqueteParcelleBatimentUniteLogementByUserIdAndExerciceId(Long userId,Long exerciceId);
|
||||||
|
|
||||||
|
|
||||||
|
Page<EnquetePayLoadWeb> getEnqueteListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
|||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.paylaods.FiltreParcelle;
|
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.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.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
|||||||
@@ -27,4 +27,10 @@ public interface BatimentService {
|
|||||||
List<BatimentPaylaodWeb> getBatimentListByParcelle(Long parcelleId);
|
List<BatimentPaylaodWeb> getBatimentListByParcelle(Long parcelleId);
|
||||||
|
|
||||||
Optional<BatimentPaylaodWeb> getBatimentById(Long id);
|
Optional<BatimentPaylaodWeb> getBatimentById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
Page<BatimentPaylaodWeb> getBatimentListByquartierPageable(Long quartierId, Pageable pageable);
|
||||||
|
|
||||||
|
List<BatimentPaylaodWeb> getBatimentListByquartier(Long quartierId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface DonneesImpositionTfuService {
|
public interface DonneesImpositionTfuService {
|
||||||
|
|
||||||
|
|
||||||
DonneesImpositionTfu createDonneesImpositionTfu(DonneesImpositionTfu donneesImpositionTfu) throws BadRequestException;
|
DonneesImpositionTfu createDonneesImpositionTfu(DonneesImpositionTfu donneesImpositionTfu) throws BadRequestException;
|
||||||
|
|
||||||
DonneesImpositionTfu updateDonneesImpositionTfu(Long id, DonneesImpositionTfu donneesImpositionTfu) throws NotFoundException;
|
DonneesImpositionTfu updateDonneesImpositionTfu(Long id, DonneesImpositionTfu donneesImpositionTfu) throws NotFoundException;
|
||||||
@@ -29,7 +27,25 @@ public interface DonneesImpositionTfuService {
|
|||||||
|
|
||||||
ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleBatie(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,Long userId);
|
ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleBatie(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,Long userId);
|
||||||
ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatie(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,Long userId);
|
ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatie(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,Long userId);
|
||||||
List<DonneesImpositionTfu> getDonneesFiscalesByImposition(Long impositionsId);
|
List<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImposition(Long impositionsId);
|
||||||
List<DonneesImpositionTfu> getDonneesFiscalesByImpositionArrondissement(Long impositionsId,Long arrondissementId);
|
List<DonneesImpositionTfu> getDonneesFiscalesByImpositionArrondissement(Long impositionsId,Long arrondissementId);
|
||||||
Page<DonneesImpositionPaylaodWeb> getDonneesFiscalesByImpositionTfuIdPageable(Long impositionsTfuId, Pageable pageable);
|
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;
|
package io.gmss.fiscad.interfaces.rfu.metier;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
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.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
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.EnqueteBatimentPayloadWeb;
|
||||||
|
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
@@ -26,4 +29,15 @@ public interface EnqueteBatimentService {
|
|||||||
Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentListPageable(Long batimentId, Pageable pageable);
|
Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentListPageable(Long batimentId, Pageable pageable);
|
||||||
|
|
||||||
List<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentList(Long batimentId);
|
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;
|
package io.gmss.fiscad.interfaces.rfu.metier;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
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.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
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 io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -27,4 +30,14 @@ public interface EnqueteUniteLogementService {
|
|||||||
List<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementUniteLogementList(Long uniteLogementId);
|
List<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementUniteLogementList(Long uniteLogementId);
|
||||||
|
|
||||||
Optional<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementById(Long enqueteUniteLogement);
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,4 +30,9 @@ public interface UniteLogementService {
|
|||||||
List<UniteLogementPaylaodWeb> getUniteLogementListByBatiment(Long batimentId);
|
List<UniteLogementPaylaodWeb> getUniteLogementListByBatiment(Long batimentId);
|
||||||
|
|
||||||
List<UniteLogementPaylaodWeb> getUniteLogementListByParcelle(Long parcelleId);
|
List<UniteLogementPaylaodWeb> getUniteLogementListByParcelle(Long parcelleId);
|
||||||
|
|
||||||
|
Page<UniteLogementPaylaodWeb> getUniteLogementListByQuartierPageable(Long quartierId, Pageable pageable);
|
||||||
|
|
||||||
|
List<UniteLogementPaylaodWeb> getUniteLogementListByQuartier(Long quartierId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ public interface StatistiquesService {
|
|||||||
List<StatEnqueteParBlocResponse> getStatBloc();
|
List<StatEnqueteParBlocResponse> getStatBloc();
|
||||||
StatNombreTotalObjet getStatNombreTotalObjet(String codeDecoupageAdmin);
|
StatNombreTotalObjet getStatNombreTotalObjet(String codeDecoupageAdmin);
|
||||||
List<StatistiqueTypeNombreResponse> getStatNombrePersonneParCategorie();
|
List<StatistiqueTypeNombreResponse> getStatNombrePersonneParCategorie();
|
||||||
|
NombreEnquetesParObjet getStatNombreEnqueteParObjetUserConnect(Long userId, String statutEnquete);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
public class EnqueteBatimentPayloadWeb {
|
public class EnqueteBatimentPayloadWeb {
|
||||||
private Long id;
|
private Long id;
|
||||||
// private BatimentPaylaodWeb batimentPaylaodWeb ;
|
|
||||||
// private List<CaracteristiqueBatimentPayloadWeb> caracteristiqueBatimentPayloadWebs;
|
|
||||||
// private List<UploadPayLoadWeb> uploadPayLoadWebs;
|
|
||||||
private String observation;
|
private String observation;
|
||||||
private String autreMenuisierie;
|
private String autreMenuisierie;
|
||||||
private String autreMur;
|
private String autreMur;
|
||||||
@@ -52,7 +49,6 @@ public class EnqueteBatimentPayloadWeb {
|
|||||||
private String enqueteurNom;
|
private String enqueteurNom;
|
||||||
private String enqueteurPrenom;
|
private String enqueteurPrenom;
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
// @JsonIgnore
|
|
||||||
private StatutEnquete statutEnquete;
|
private StatutEnquete statutEnquete;
|
||||||
private Long exerciceId;
|
private Long exerciceId;
|
||||||
private Integer exerciceAnnee;
|
private Integer exerciceAnnee;
|
||||||
@@ -68,6 +64,18 @@ public class EnqueteBatimentPayloadWeb {
|
|||||||
private Long usageId;
|
private Long usageId;
|
||||||
private String usageNom;
|
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,
|
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,
|
StatutEnquete statutEnquete,
|
||||||
Long exerciceId,
|
Long exerciceId,
|
||||||
@@ -82,7 +90,18 @@ public class EnqueteBatimentPayloadWeb {
|
|||||||
Integer nombrePiscine,
|
Integer nombrePiscine,
|
||||||
Long montantLocatifAnnuelCalcule,
|
Long montantLocatifAnnuelCalcule,
|
||||||
Long usageId,
|
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.id = id;
|
||||||
this.observation = observation;
|
this.observation = observation;
|
||||||
@@ -131,5 +150,16 @@ public class EnqueteBatimentPayloadWeb {
|
|||||||
this.montantLocatifAnnuelCalcule = montantLocatifAnnuelCalcule;
|
this.montantLocatifAnnuelCalcule = montantLocatifAnnuelCalcule;
|
||||||
this.usageId = usageId ;
|
this.usageId = usageId ;
|
||||||
this.usageNom = usageNom ;
|
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 dateEnquete;
|
||||||
private LocalDate dateFinalisation;
|
private LocalDate dateFinalisation;
|
||||||
private Boolean litige;
|
private Boolean litige;
|
||||||
// private ParcellePayLoadWeb parcellePayLoadWeb;
|
|
||||||
// private List<CaracteristiqueParcellePayloadWeb> caracteristiqueParcellePayloadWebs;
|
|
||||||
// private List<DeclarationNcPayloadWeb> declarationNcPayloadWebs;
|
|
||||||
// private List<PiecePayLoadWeb> piecePayLoadWebs;
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private StatutEnquete statutEnquete;
|
private StatutEnquete statutEnquete;
|
||||||
private String descriptionMotifRejet;
|
private String descriptionMotifRejet;
|
||||||
private String observation;
|
private String observation;
|
||||||
private String numeroTitreFoncier;
|
|
||||||
private LocalDate dateTitreFoncier;
|
|
||||||
private String numEntreeParcelle;
|
|
||||||
private String numRue;
|
|
||||||
private String nomRue;
|
|
||||||
private Float precision;
|
private Float precision;
|
||||||
private Integer nbreCoProprietaire;
|
private Integer nbreCoProprietaire;
|
||||||
private Integer nbreIndivisiaire;
|
private Integer nbreIndivisiaire;
|
||||||
@@ -51,11 +42,6 @@ public class EnquetePayLoadWeb {
|
|||||||
private Long enqueteurId;
|
private Long enqueteurId;
|
||||||
private String enqueteurNom;
|
private String enqueteurNom;
|
||||||
private String enqueteurPrenom;
|
private String enqueteurPrenom;
|
||||||
private Long parcelleId;
|
|
||||||
private String parcelleNup;
|
|
||||||
private String parcelleQ;
|
|
||||||
private String parcelleI;
|
|
||||||
private String parcelleP;
|
|
||||||
private Long exerciceId;
|
private Long exerciceId;
|
||||||
private Integer exerciceAnnee;
|
private Integer exerciceAnnee;
|
||||||
private Long modeAcquisitionId;
|
private Long modeAcquisitionId;
|
||||||
@@ -65,12 +51,54 @@ public class EnquetePayLoadWeb {
|
|||||||
private String representantTel;
|
private String representantTel;
|
||||||
private String representantNpi;
|
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,
|
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,
|
Long modeAcquisitionId,
|
||||||
|
String modeAcquisitionLibelle,
|
||||||
String representantNom,
|
String representantNom,
|
||||||
String representantPrenom,
|
String representantPrenom,
|
||||||
String representantTel,
|
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.id = id;
|
||||||
this.dateEnquete = dateEnquete;
|
this.dateEnquete = dateEnquete;
|
||||||
this.dateFinalisation = dateFinalisation;
|
this.dateFinalisation = dateFinalisation;
|
||||||
@@ -119,5 +147,18 @@ public class EnquetePayLoadWeb {
|
|||||||
this.representantTel = representantTel;
|
this.representantTel = representantTel;
|
||||||
this.representantPrenom = representantPrenom;
|
this.representantPrenom = representantPrenom;
|
||||||
this.representantNpi = representantNpi;
|
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 Integer nombrePiscine;
|
||||||
private Long usageId;
|
private Long usageId;
|
||||||
private String usageNom;
|
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,
|
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,
|
StatutEnquete statutEnquete,
|
||||||
String representantNom,
|
String representantNom,
|
||||||
@@ -68,7 +79,15 @@ public class EnqueteUniteLogementPayloadWeb {
|
|||||||
Integer nombrePiscine,
|
Integer nombrePiscine,
|
||||||
Long montantLocatifAnnuelCalcule,
|
Long montantLocatifAnnuelCalcule,
|
||||||
Long usageId,
|
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.id = id;
|
||||||
this.observation = observation;
|
this.observation = observation;
|
||||||
@@ -114,5 +133,14 @@ public class EnqueteUniteLogementPayloadWeb {
|
|||||||
this.montantLocatifAnnuelCalcule = montantLocatifAnnuelCalcule;
|
this.montantLocatifAnnuelCalcule = montantLocatifAnnuelCalcule;
|
||||||
this.usageId = usageId ;
|
this.usageId = usageId ;
|
||||||
this.usageNom = usageNom ;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class ParcelleGeomPaylaodWeb {
|
|||||||
private String quartierCode ;
|
private String quartierCode ;
|
||||||
private String quartierNom ;
|
private String quartierNom ;
|
||||||
|
|
||||||
private int geomSrid;
|
private Integer geomSrid;
|
||||||
@JsonSerialize(using = GeometrySerializer.class)
|
@JsonSerialize(using = GeometrySerializer.class)
|
||||||
@JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
@JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
||||||
//@Column(name = "geometry",columnDefinition = "geometry(Polygon,32631)")
|
//@Column(name = "geometry",columnDefinition = "geometry(Polygon,32631)")
|
||||||
@@ -100,7 +100,7 @@ public class ParcelleGeomPaylaodWeb {
|
|||||||
|
|
||||||
private Long parcelleId;
|
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, int geomSrid, Polygon geometry, String geometryString, 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.id = id;
|
||||||
this.nup = nup;
|
this.nup = nup;
|
||||||
this.nupProvisoire = nupProvisoire;
|
this.nupProvisoire = nupProvisoire;
|
||||||
|
|||||||
@@ -27,10 +27,11 @@ public class PiecePayLoadWeb {
|
|||||||
private Long enqueteId;
|
private Long enqueteId;
|
||||||
private Long enqueteBatimentId;
|
private Long enqueteBatimentId;
|
||||||
private Long enqueteUniteLogementId;
|
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,
|
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.id = id;
|
||||||
this.dateExpiration = dateExpiration;
|
this.dateExpiration = dateExpiration;
|
||||||
this.dateEtablissement = dateEtablissement;
|
this.dateEtablissement = dateEtablissement;
|
||||||
@@ -50,6 +51,7 @@ public class PiecePayLoadWeb {
|
|||||||
this.enqueteId = enqueteId;
|
this.enqueteId = enqueteId;
|
||||||
this.enqueteBatimentId = enqueteBatimentId;
|
this.enqueteBatimentId = enqueteBatimentId;
|
||||||
this.enqueteUniteLogementId = enqueteUniteLogementId;
|
this.enqueteUniteLogementId = enqueteUniteLogementId;
|
||||||
|
this.nombreFichier = nombreFichier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ParcellePayLoad {
|
|||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private Long typeDomaineId;
|
private Long typeDomaineId;
|
||||||
private Long numeroProvisoire;
|
private String numeroProvisoire;
|
||||||
private Long blocId;
|
private Long blocId;
|
||||||
private String situationGeographique;
|
private String situationGeographique;
|
||||||
private String autreNumeroTitreFoncier;
|
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 {
|
public interface ParcelleStatsProjectionUnSecteur {
|
||||||
// ================== Département ==================
|
// ================== 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$;
|
||||||
@@ -0,0 +1,297 @@
|
|||||||
|
CREATE OR REPLACE PROCEDURE public.import_uniteLogement_and_enqueteUnitLog_from_rfu(nombreLimit integer)
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $procedure$
|
||||||
|
DECLARE
|
||||||
|
l_count numeric := 0;
|
||||||
|
uniteLogement_rfu record;
|
||||||
|
l_uniteLogement_id_parent bigint;
|
||||||
|
l_batiment_id_parent bigint ;
|
||||||
|
l_personne_id_parent bigint ;
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
FOR uniteLogement_rfu IN (
|
||||||
|
SELECT
|
||||||
|
c.n0bat,
|
||||||
|
c.n0ul,
|
||||||
|
--c.n0etage,
|
||||||
|
CASE
|
||||||
|
WHEN replace(trim(c.n0etage), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||||
|
THEN replace(c.n0etage, ',', '.')::numeric
|
||||||
|
end as n0etage,
|
||||||
|
c.quartier,
|
||||||
|
c.n0_ilot,
|
||||||
|
c.n0_parcel,
|
||||||
|
c.n0_contrib,
|
||||||
|
--c.montmenl,
|
||||||
|
CASE
|
||||||
|
WHEN replace(trim(c.montmenl), ',', '.') ~ '^[0-9]+(\.[0-9]+)?$'
|
||||||
|
THEN replace(c.montmenl, ',', '.')::numeric
|
||||||
|
end as montmenl,
|
||||||
|
--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.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.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 distinct
|
||||||
|
ul.n0bat,
|
||||||
|
ul.n0ul,
|
||||||
|
ul.n0etage,
|
||||||
|
ul.quartier,
|
||||||
|
ul.n0_ilot,
|
||||||
|
ul.n0_parcel,
|
||||||
|
ul.n0_contrib,
|
||||||
|
ul.montmenl,
|
||||||
|
ul.surfsol,
|
||||||
|
ul.surfacelo,
|
||||||
|
ul.vllcalcule,
|
||||||
|
ul.bail,
|
||||||
|
--ul.valloest,
|
||||||
|
ul.nbetage,
|
||||||
|
ul.vlcalcule,
|
||||||
|
ul.utilisat,
|
||||||
|
ul.finexempt,
|
||||||
|
ul.nbunitlo,
|
||||||
|
ul.toit,
|
||||||
|
ul.nbhabit,
|
||||||
|
ul.nbmenage,
|
||||||
|
ul.nbmois,
|
||||||
|
ul.electric,
|
||||||
|
ul.eau,
|
||||||
|
ul.nbpiece,
|
||||||
|
ul.nbunite,
|
||||||
|
ul.mdate,
|
||||||
|
ul.murs,
|
||||||
|
ul.standing
|
||||||
|
FROM akpakpa.unitlog ul
|
||||||
|
$db$
|
||||||
|
) AS c (
|
||||||
|
n0bat varchar,
|
||||||
|
n0ul varchar,
|
||||||
|
n0etage varchar,
|
||||||
|
quartier varchar,
|
||||||
|
n0_ilot varchar,
|
||||||
|
n0_parcel varchar,
|
||||||
|
n0_contrib varchar,
|
||||||
|
montmenl 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.unite_logement ul
|
||||||
|
WHERE ul.code =
|
||||||
|
trim(c.quartier)||'-'||trim(c.n0_ilot)||'-'||trim(c.n0_parcel)||'-'||trim(c.n0bat)||'-'||trim(c.n0ul)
|
||||||
|
)
|
||||||
|
limit nombreLimit
|
||||||
|
)
|
||||||
|
LOOP
|
||||||
|
-- Récupération ID batiment locale
|
||||||
|
SELECT b.id
|
||||||
|
INTO l_batiment_id_parent
|
||||||
|
FROM public.batiment b
|
||||||
|
WHERE b.code =
|
||||||
|
trim(uniteLogement_rfu.quartier)||'-'||trim(uniteLogement_rfu.n0_ilot)||'-'||trim(uniteLogement_rfu.n0_parcel)||'-'||trim(uniteLogement_rfu.n0bat)
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
-- Récupération ID personne locale
|
||||||
|
SELECT p.id
|
||||||
|
INTO l_personne_id_parent
|
||||||
|
FROM public.personne p
|
||||||
|
WHERE p.nc =trim(uniteLogement_rfu.n0_contrib)
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
|
||||||
|
-- Insertion unite logement local
|
||||||
|
INSERT INTO public.unite_logement(
|
||||||
|
created_at,
|
||||||
|
created_by,
|
||||||
|
deleted,
|
||||||
|
updated_at,
|
||||||
|
updated_by,
|
||||||
|
code,
|
||||||
|
nul,
|
||||||
|
numero_etage,
|
||||||
|
batiment_id,
|
||||||
|
--personne_id,
|
||||||
|
source,
|
||||||
|
superficie_au_sol,
|
||||||
|
superficie_louee,
|
||||||
|
categorie_batiment_id,
|
||||||
|
montant_locatif_annuel_calcule,
|
||||||
|
montant_locatif_annuel_declare,
|
||||||
|
montant_mensuel_location,
|
||||||
|
valeur_unite_logement_estime,
|
||||||
|
usage_id,
|
||||||
|
date_fin_exemption,
|
||||||
|
id_toit_rfu,
|
||||||
|
valeur_unite_logement_calcule,
|
||||||
|
nombre_etage
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
now(),
|
||||||
|
35,
|
||||||
|
false,
|
||||||
|
now(),
|
||||||
|
35,
|
||||||
|
trim(uniteLogement_rfu.quartier)||'-'||trim(uniteLogement_rfu.n0_ilot)||'-'||trim(uniteLogement_rfu.n0_parcel)||'-'||trim(uniteLogement_rfu.n0bat)||'-'||trim(uniteLogement_rfu.n0ul),
|
||||||
|
uniteLogement_rfu.n0ul,
|
||||||
|
uniteLogement_rfu.n0etage,
|
||||||
|
l_batiment_id_parent,
|
||||||
|
-- l_personne_id_parent,
|
||||||
|
'RFU',
|
||||||
|
uniteLogement_rfu.surfsol,
|
||||||
|
uniteLogement_rfu.surfacelo,
|
||||||
|
ProcedureRecupCategorieRFU(uniteLogement_rfu.nbetage::integer,uniteLogement_rfu.toit::integer),
|
||||||
|
uniteLogement_rfu.vllcalcule,
|
||||||
|
uniteLogement_rfu.bail,
|
||||||
|
uniteLogement_rfu.montmenl,
|
||||||
|
uniteLogement_rfu.vlcalcule,
|
||||||
|
CASE uniteLogement_rfu.utilisat
|
||||||
|
WHEN 1 THEN 8
|
||||||
|
WHEN 2 THEN 14
|
||||||
|
WHEN 3 THEN 9
|
||||||
|
END,
|
||||||
|
uniteLogement_rfu.finexempt,
|
||||||
|
uniteLogement_rfu.toit,
|
||||||
|
uniteLogement_rfu.vlcalcule,
|
||||||
|
uniteLogement_rfu.nbetage
|
||||||
|
)
|
||||||
|
RETURNING id INTO l_uniteLogement_id_parent;
|
||||||
|
|
||||||
|
call public.import_enqueteUnitLog_from_rfu_cipe(
|
||||||
|
uniteLogement_rfu,
|
||||||
|
l_uniteLogement_id_parent,
|
||||||
|
l_personne_id_parent
|
||||||
|
);
|
||||||
|
|
||||||
|
l_count := l_count + 1;
|
||||||
|
|
||||||
|
END LOOP;
|
||||||
|
|
||||||
|
RAISE NOTICE 'Nombre de unité de logement insérés : %', l_count;
|
||||||
|
|
||||||
|
END;
|
||||||
|
$procedure$;
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
WITH src AS (
|
||||||
|
SELECT
|
||||||
|
pcct.*,
|
||||||
|
upper(regexp_replace(quartier_insae_code,'(\d{2})(\d{1})(\d{2})(\d{2})','\1.\2.\3.\4')) AS code_quartier,
|
||||||
|
upper((regexp_match(local_parcel_identification,
|
||||||
|
'Lot:\s*([0-9]+)\s*Parcelle:\s*([A-Za-z0-9]+)'))[1]) AS ilot,
|
||||||
|
upper((regexp_match(local_parcel_identification,
|
||||||
|
'Lot:\s*([0-9]+)\s*Parcelle:\s*([A-Za-z0-9]+)'))[2]) AS p
|
||||||
|
FROM parcelle_cadastre_cotonou_tmp pcct
|
||||||
|
)
|
||||||
|
|
||||||
|
INSERT INTO parcelle_geom
|
||||||
|
(
|
||||||
|
geometry,
|
||||||
|
code_instad,
|
||||||
|
departement_id,
|
||||||
|
commune_id,
|
||||||
|
q,
|
||||||
|
ilot,
|
||||||
|
p,
|
||||||
|
superficie,
|
||||||
|
quartier_id,
|
||||||
|
arrondissement_id,
|
||||||
|
nom_village_quartier,
|
||||||
|
nup
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
s.geom,
|
||||||
|
s.code_quartier,
|
||||||
|
15,
|
||||||
|
70,
|
||||||
|
refq.rfu_q,
|
||||||
|
s.ilot,
|
||||||
|
s.p,
|
||||||
|
s.calculated_area,
|
||||||
|
q.id,
|
||||||
|
a.id,
|
||||||
|
s.quartier_name,
|
||||||
|
s.nup
|
||||||
|
FROM src s
|
||||||
|
LEFT JOIN quartier q
|
||||||
|
ON q.code = s.code_quartier
|
||||||
|
LEFT JOIN arrondissement a
|
||||||
|
ON a.id = q.arrondissement_id
|
||||||
|
LEFT JOIN ref_rfu_q_quartier_cotonou refq
|
||||||
|
ON refq.code_quartier = q.code
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM parcelle_geom pg
|
||||||
|
WHERE (pg.q = refq.rfu_q
|
||||||
|
AND pg.ilot = s.ilot
|
||||||
|
AND pg.p = s.p)
|
||||||
|
OR pg.nup = s.nup
|
||||||
|
);
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION public.ProcedureRecupCategorieRFU(
|
||||||
|
p_nbetage integer,
|
||||||
|
p_toit integer
|
||||||
|
)
|
||||||
|
RETURNS integer
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
-- Sécurisation null
|
||||||
|
IF p_nbetage IS NULL THEN
|
||||||
|
RETURN NULL;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
-- Cas 0 étage
|
||||||
|
IF p_nbetage = 0 THEN
|
||||||
|
IF p_toit IN (2,3,4,5,6) THEN
|
||||||
|
RETURN 1;
|
||||||
|
ELSIF p_toit = 1 THEN
|
||||||
|
RETURN 2;
|
||||||
|
ELSE
|
||||||
|
RETURN 1; -- valeur par défaut si toit inconnu
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
-- 1 ou 2 étages
|
||||||
|
IF p_nbetage IN (1,2) THEN
|
||||||
|
RETURN 3;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
-- 3 ou 4 étages
|
||||||
|
IF p_nbetage IN (3,4) THEN
|
||||||
|
RETURN 4;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
-- > 5 étages
|
||||||
|
IF p_nbetage > 5 THEN
|
||||||
|
RETURN 5;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN NULL;
|
||||||
|
|
||||||
|
END;
|
||||||
|
$$;
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
package io.gmss.fiscad.persistence.repositories.infocad.metier;
|
package io.gmss.fiscad.persistence.repositories.infocad.metier;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
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.*;
|
||||||
import io.gmss.fiscad.paylaods.response.report.EnqueteParBlocResponse;
|
import io.gmss.fiscad.paylaods.response.report.EnqueteParBlocResponse;
|
||||||
import io.gmss.fiscad.paylaods.response.restoration.EnquetePayLoad;
|
import io.gmss.fiscad.paylaods.response.restoration.EnquetePayLoad;
|
||||||
|
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||||
import io.gmss.fiscad.paylaods.response.statistique.StatEnqueteAdminDecoupageResponse;
|
import io.gmss.fiscad.paylaods.response.statistique.StatEnqueteAdminDecoupageResponse;
|
||||||
import io.gmss.fiscad.paylaods.response.statistique.StatEnqueteAdminStructureResponse;
|
import io.gmss.fiscad.paylaods.response.statistique.StatEnqueteAdminStructureResponse;
|
||||||
import io.gmss.fiscad.paylaods.response.statistique.StatEnqueteParBlocResponse;
|
import io.gmss.fiscad.paylaods.response.statistique.StatEnqueteParBlocResponse;
|
||||||
@@ -253,6 +256,53 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
List<Enquete> findAllByParcelle_Id(Long parcelleId);
|
List<Enquete> findAllByParcelle_Id(Long parcelleId);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT DISTINCT
|
||||||
|
d.id AS departement_id,
|
||||||
|
d.code AS departement_code,
|
||||||
|
d.nom AS departement_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY d.id) AS nb_enquetes_departement,
|
||||||
|
|
||||||
|
c.id AS commune_id,
|
||||||
|
c.code AS commune_code,
|
||||||
|
c.nom AS commune_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY c.id) AS nb_enquetes_commune,
|
||||||
|
|
||||||
|
a.id AS arrondissement_id,
|
||||||
|
a.code AS arrondissement_code,
|
||||||
|
a.nom AS arrondissement_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY a.id) AS nb_enquetes_arrondissement,
|
||||||
|
|
||||||
|
q.id AS quartier_id,
|
||||||
|
q.code AS quartier_code,
|
||||||
|
q.nom AS quartier_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY q.id) AS nb_enquetes_quartier
|
||||||
|
|
||||||
|
FROM enquete e
|
||||||
|
JOIN parcelle p ON p.id = e.parcelle_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
|
||||||
|
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM secteur_decoupage sd
|
||||||
|
WHERE sd.quartier_id = q.id
|
||||||
|
AND sd.secteur_id IN (:secteurIds)
|
||||||
|
)
|
||||||
|
AND e.statut_enquete = :statutEnqueteParam
|
||||||
|
|
||||||
|
ORDER BY d.nom, c.nom, a.nom, q.nom;
|
||||||
|
""",
|
||||||
|
nativeQuery = true
|
||||||
|
)
|
||||||
|
List<ParcelleStatsProjectionUnSecteur> findStatsEnqueteBySecteurs(
|
||||||
|
@Param("secteurIds") List<Long> secteurIds,
|
||||||
|
@Param("statutEnqueteParam") String statutEnqueteParam
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb(
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb(
|
||||||
@@ -303,7 +353,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
e.representantNom,
|
e.representantNom,
|
||||||
e.representantPrenom,
|
e.representantPrenom,
|
||||||
e.representantTel,
|
e.representantTel,
|
||||||
e.representantNpi
|
e.representantNpi,
|
||||||
|
pa.numeroProvisoire,
|
||||||
|
pa.longitude,
|
||||||
|
pa.latitude,
|
||||||
|
pa.altitude,
|
||||||
|
pa.situationGeographique,
|
||||||
|
q.id,
|
||||||
|
q.code,
|
||||||
|
q.nom,
|
||||||
|
nd.id,
|
||||||
|
nd.libelle,
|
||||||
|
td.id,
|
||||||
|
td.libelle,
|
||||||
|
r.id
|
||||||
)
|
)
|
||||||
FROM Enquete e
|
FROM Enquete e
|
||||||
LEFT JOIN e.zoneRfu zr
|
LEFT JOIN e.zoneRfu zr
|
||||||
@@ -312,9 +375,12 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
LEFT JOIN e.parcelle pa
|
LEFT JOIN e.parcelle pa
|
||||||
LEFT JOIN e.exercice ex
|
LEFT JOIN e.exercice ex
|
||||||
LEFT JOIN e.modeAcquisition ma
|
LEFT JOIN e.modeAcquisition ma
|
||||||
|
LEFT JOIN pa.quartier q
|
||||||
|
LEFT JOIN pa.natureDomaine nd
|
||||||
|
LEFT JOIN pa.typeDomaine td
|
||||||
|
LEFT JOIN pa.rue r
|
||||||
""")
|
""")
|
||||||
List<EnquetePayLoadWeb> findAllEnquetesToDto();
|
List<EnquetePayLoadWeb> findAllEnquetesToDto();
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb(
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb(
|
||||||
e.id,
|
e.id,
|
||||||
@@ -364,7 +430,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
e.representantNom,
|
e.representantNom,
|
||||||
e.representantPrenom,
|
e.representantPrenom,
|
||||||
e.representantTel,
|
e.representantTel,
|
||||||
e.representantNpi
|
e.representantNpi,
|
||||||
|
pa.numeroProvisoire,
|
||||||
|
pa.longitude,
|
||||||
|
pa.latitude,
|
||||||
|
pa.altitude,
|
||||||
|
pa.situationGeographique,
|
||||||
|
q.id,
|
||||||
|
q.code,
|
||||||
|
q.nom,
|
||||||
|
nd.id,
|
||||||
|
nd.libelle,
|
||||||
|
td.id,
|
||||||
|
td.libelle,
|
||||||
|
r.id
|
||||||
)
|
)
|
||||||
FROM Enquete e
|
FROM Enquete e
|
||||||
LEFT JOIN e.zoneRfu zr
|
LEFT JOIN e.zoneRfu zr
|
||||||
@@ -373,6 +452,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
LEFT JOIN e.parcelle pa
|
LEFT JOIN e.parcelle pa
|
||||||
LEFT JOIN e.exercice ex
|
LEFT JOIN e.exercice ex
|
||||||
LEFT JOIN e.modeAcquisition ma
|
LEFT JOIN e.modeAcquisition ma
|
||||||
|
LEFT JOIN pa.quartier q
|
||||||
|
LEFT JOIN pa.natureDomaine nd
|
||||||
|
LEFT JOIN pa.typeDomaine td
|
||||||
|
LEFT JOIN pa.rue r
|
||||||
WHERE e.id = :enqueteId
|
WHERE e.id = :enqueteId
|
||||||
""")
|
""")
|
||||||
Optional<EnquetePayLoadWeb> findEnqueteToDto(@Param("enqueteId") Long enqueteId);
|
Optional<EnquetePayLoadWeb> findEnqueteToDto(@Param("enqueteId") Long enqueteId);
|
||||||
@@ -427,7 +510,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
e.representantNom,
|
e.representantNom,
|
||||||
e.representantPrenom,
|
e.representantPrenom,
|
||||||
e.representantTel,
|
e.representantTel,
|
||||||
e.representantNpi
|
e.representantNpi,
|
||||||
|
pa.numeroProvisoire,
|
||||||
|
pa.longitude,
|
||||||
|
pa.latitude,
|
||||||
|
pa.altitude,
|
||||||
|
pa.situationGeographique,
|
||||||
|
q.id,
|
||||||
|
q.code,
|
||||||
|
q.nom,
|
||||||
|
nd.id,
|
||||||
|
nd.libelle,
|
||||||
|
td.id,
|
||||||
|
td.libelle,
|
||||||
|
r.id
|
||||||
)
|
)
|
||||||
FROM Enquete e
|
FROM Enquete e
|
||||||
LEFT JOIN e.zoneRfu zr
|
LEFT JOIN e.zoneRfu zr
|
||||||
@@ -436,6 +532,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
LEFT JOIN e.parcelle pa
|
LEFT JOIN e.parcelle pa
|
||||||
LEFT JOIN e.exercice ex
|
LEFT JOIN e.exercice ex
|
||||||
LEFT JOIN e.modeAcquisition ma
|
LEFT JOIN e.modeAcquisition ma
|
||||||
|
LEFT JOIN pa.quartier q
|
||||||
|
LEFT JOIN pa.natureDomaine nd
|
||||||
|
LEFT JOIN pa.typeDomaine td
|
||||||
|
LEFT JOIN pa.rue r
|
||||||
""",
|
""",
|
||||||
countQuery = """
|
countQuery = """
|
||||||
SELECT COUNT(e)
|
SELECT COUNT(e)
|
||||||
@@ -493,7 +593,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
e.representantNom,
|
e.representantNom,
|
||||||
e.representantPrenom,
|
e.representantPrenom,
|
||||||
e.representantTel,
|
e.representantTel,
|
||||||
e.representantNpi
|
e.representantNpi,
|
||||||
|
pa.numeroProvisoire,
|
||||||
|
pa.longitude,
|
||||||
|
pa.latitude,
|
||||||
|
pa.altitude,
|
||||||
|
pa.situationGeographique,
|
||||||
|
q.id,
|
||||||
|
q.code,
|
||||||
|
q.nom,
|
||||||
|
nd.id,
|
||||||
|
nd.libelle,
|
||||||
|
td.id,
|
||||||
|
td.libelle,
|
||||||
|
r.id
|
||||||
)
|
)
|
||||||
FROM Enquete e
|
FROM Enquete e
|
||||||
LEFT JOIN e.zoneRfu zr
|
LEFT JOIN e.zoneRfu zr
|
||||||
@@ -502,7 +615,12 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
LEFT JOIN e.parcelle pa
|
LEFT JOIN e.parcelle pa
|
||||||
LEFT JOIN e.exercice ex
|
LEFT JOIN e.exercice ex
|
||||||
LEFT JOIN e.modeAcquisition ma
|
LEFT JOIN e.modeAcquisition ma
|
||||||
|
LEFT JOIN pa.quartier q
|
||||||
|
LEFT JOIN pa.natureDomaine nd
|
||||||
|
LEFT JOIN pa.typeDomaine td
|
||||||
|
LEFT JOIN pa.rue r
|
||||||
WHERE ex.id = :exerciceId
|
WHERE ex.id = :exerciceId
|
||||||
|
|
||||||
""")
|
""")
|
||||||
List<EnquetePayLoadWeb> findEnquetesByExerciceToDto(
|
List<EnquetePayLoadWeb> findEnquetesByExerciceToDto(
|
||||||
@Param("exerciceId") Long exerciceId
|
@Param("exerciceId") Long exerciceId
|
||||||
@@ -559,7 +677,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
e.representantNom,
|
e.representantNom,
|
||||||
e.representantPrenom,
|
e.representantPrenom,
|
||||||
e.representantTel,
|
e.representantTel,
|
||||||
e.representantNpi
|
e.representantNpi,
|
||||||
|
pa.numeroProvisoire,
|
||||||
|
pa.longitude,
|
||||||
|
pa.latitude,
|
||||||
|
pa.altitude,
|
||||||
|
pa.situationGeographique,
|
||||||
|
q.id,
|
||||||
|
q.code,
|
||||||
|
q.nom,
|
||||||
|
nd.id,
|
||||||
|
nd.libelle,
|
||||||
|
td.id,
|
||||||
|
td.libelle,
|
||||||
|
r.id
|
||||||
)
|
)
|
||||||
FROM Enquete e
|
FROM Enquete e
|
||||||
LEFT JOIN e.zoneRfu zr
|
LEFT JOIN e.zoneRfu zr
|
||||||
@@ -568,6 +699,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
LEFT JOIN e.parcelle pa
|
LEFT JOIN e.parcelle pa
|
||||||
LEFT JOIN e.exercice ex
|
LEFT JOIN e.exercice ex
|
||||||
LEFT JOIN e.modeAcquisition ma
|
LEFT JOIN e.modeAcquisition ma
|
||||||
|
LEFT JOIN pa.quartier q
|
||||||
|
LEFT JOIN pa.natureDomaine nd
|
||||||
|
LEFT JOIN pa.typeDomaine td
|
||||||
|
LEFT JOIN pa.rue r
|
||||||
WHERE ex.id = :exerciceId
|
WHERE ex.id = :exerciceId
|
||||||
""",
|
""",
|
||||||
countQuery = """
|
countQuery = """
|
||||||
@@ -631,7 +766,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
e.representantNom,
|
e.representantNom,
|
||||||
e.representantPrenom,
|
e.representantPrenom,
|
||||||
e.representantTel,
|
e.representantTel,
|
||||||
e.representantNpi
|
e.representantNpi,
|
||||||
|
pa.numeroProvisoire,
|
||||||
|
pa.longitude,
|
||||||
|
pa.latitude,
|
||||||
|
pa.altitude,
|
||||||
|
pa.situationGeographique,
|
||||||
|
q.id,
|
||||||
|
q.code,
|
||||||
|
q.nom,
|
||||||
|
nd.id,
|
||||||
|
nd.libelle,
|
||||||
|
td.id,
|
||||||
|
td.libelle,
|
||||||
|
r.id
|
||||||
)
|
)
|
||||||
FROM Enquete e
|
FROM Enquete e
|
||||||
LEFT JOIN e.zoneRfu zr
|
LEFT JOIN e.zoneRfu zr
|
||||||
@@ -640,6 +788,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
LEFT JOIN e.parcelle pa
|
LEFT JOIN e.parcelle pa
|
||||||
LEFT JOIN e.exercice ex
|
LEFT JOIN e.exercice ex
|
||||||
LEFT JOIN e.modeAcquisition ma
|
LEFT JOIN e.modeAcquisition ma
|
||||||
|
LEFT JOIN pa.quartier q
|
||||||
|
LEFT JOIN pa.natureDomaine nd
|
||||||
|
LEFT JOIN pa.typeDomaine td
|
||||||
|
LEFT JOIN pa.rue r
|
||||||
WHERE pa.id = :parcelleId
|
WHERE pa.id = :parcelleId
|
||||||
""")
|
""")
|
||||||
List<EnquetePayLoadWeb> findAllEnquetesByParcelleToDto(
|
List<EnquetePayLoadWeb> findAllEnquetesByParcelleToDto(
|
||||||
@@ -696,7 +848,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
e.representantNom,
|
e.representantNom,
|
||||||
e.representantPrenom,
|
e.representantPrenom,
|
||||||
e.representantTel,
|
e.representantTel,
|
||||||
e.representantNpi
|
e.representantNpi,
|
||||||
|
pa.numeroProvisoire,
|
||||||
|
pa.longitude,
|
||||||
|
pa.latitude,
|
||||||
|
pa.altitude,
|
||||||
|
pa.situationGeographique,
|
||||||
|
q.id,
|
||||||
|
q.code,
|
||||||
|
q.nom,
|
||||||
|
nd.id,
|
||||||
|
nd.libelle,
|
||||||
|
td.id,
|
||||||
|
td.libelle,
|
||||||
|
r.id
|
||||||
)
|
)
|
||||||
FROM Enquete e
|
FROM Enquete e
|
||||||
LEFT JOIN e.zoneRfu zr
|
LEFT JOIN e.zoneRfu zr
|
||||||
@@ -705,6 +870,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
LEFT JOIN e.parcelle pa
|
LEFT JOIN e.parcelle pa
|
||||||
LEFT JOIN e.exercice ex
|
LEFT JOIN e.exercice ex
|
||||||
LEFT JOIN e.modeAcquisition ma
|
LEFT JOIN e.modeAcquisition ma
|
||||||
|
LEFT JOIN pa.quartier q
|
||||||
|
LEFT JOIN pa.natureDomaine nd
|
||||||
|
LEFT JOIN pa.typeDomaine td
|
||||||
|
LEFT JOIN pa.rue r
|
||||||
WHERE pa.id = :parcelleId
|
WHERE pa.id = :parcelleId
|
||||||
""",
|
""",
|
||||||
countQuery = """
|
countQuery = """
|
||||||
@@ -717,4 +886,124 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
|||||||
@Param("parcelleId") Long parcelleId,
|
@Param("parcelleId") Long parcelleId,
|
||||||
Pageable pageable
|
Pageable pageable
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT distinct new io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb(
|
||||||
|
e.id,
|
||||||
|
e.dateEnquete,
|
||||||
|
e.dateFinalisation,
|
||||||
|
e.litige,
|
||||||
|
e.statutEnquete,
|
||||||
|
e.descriptionMotifRejet,
|
||||||
|
e.observationParticuliere,
|
||||||
|
pa.numeroTitreFoncier,
|
||||||
|
pa.dateTitreFoncier,
|
||||||
|
e.numEntreeParcelle,
|
||||||
|
e.numRue,
|
||||||
|
e.nomRue,
|
||||||
|
e.precision,
|
||||||
|
e.nbreCoProprietaire,
|
||||||
|
e.nbreIndivisiaire,
|
||||||
|
e.autreAdresse,
|
||||||
|
e.superficie,
|
||||||
|
e.nbreBatiment,
|
||||||
|
e.nbrePiscine,
|
||||||
|
e.dateDebutExemption,
|
||||||
|
e.dateFinExemption,
|
||||||
|
pa.autreNumeroTitreFoncier,
|
||||||
|
e.montantMensuelleLocation,
|
||||||
|
e.montantAnnuelleLocation,
|
||||||
|
e.valeurParcelleEstime,
|
||||||
|
e.valeurParcelleReel,
|
||||||
|
zr.id,
|
||||||
|
zr.nom,
|
||||||
|
p.id,
|
||||||
|
p.nom,
|
||||||
|
p.prenom,
|
||||||
|
p.raisonSociale,
|
||||||
|
u.id,
|
||||||
|
u.nom,
|
||||||
|
u.prenom,
|
||||||
|
pa.id,
|
||||||
|
pa.nup,
|
||||||
|
pa.q,
|
||||||
|
pa.i,
|
||||||
|
pa.p,
|
||||||
|
ex.id,
|
||||||
|
ex.annee,
|
||||||
|
ma.id,
|
||||||
|
ma.libelle,
|
||||||
|
e.representantNom,
|
||||||
|
e.representantPrenom,
|
||||||
|
e.representantTel,
|
||||||
|
e.representantNpi,
|
||||||
|
pa.numeroProvisoire,
|
||||||
|
pa.longitude,
|
||||||
|
pa.latitude,
|
||||||
|
pa.altitude,
|
||||||
|
pa.situationGeographique,
|
||||||
|
q.id,
|
||||||
|
q.code,
|
||||||
|
q.nom,
|
||||||
|
nd.id,
|
||||||
|
nd.libelle,
|
||||||
|
td.id,
|
||||||
|
td.libelle,
|
||||||
|
r.id
|
||||||
|
)
|
||||||
|
FROM Enquete e
|
||||||
|
LEFT JOIN e.zoneRfu zr
|
||||||
|
LEFT JOIN e.personne p
|
||||||
|
LEFT JOIN e.user u
|
||||||
|
LEFT JOIN e.parcelle pa
|
||||||
|
LEFT JOIN e.exercice ex
|
||||||
|
LEFT JOIN e.modeAcquisition ma
|
||||||
|
LEFT JOIN pa.quartier q
|
||||||
|
LEFT JOIN pa.natureDomaine nd
|
||||||
|
LEFT JOIN pa.typeDomaine td
|
||||||
|
LEFT JOIN pa.rue r
|
||||||
|
INNER JOIN SecteurDecoupage sd on sd.quartier=q
|
||||||
|
WHERE sd.secteur.id IN (:secteurIds)
|
||||||
|
and q.id = :quartierId
|
||||||
|
and e.statutEnquete = :statutEnquete
|
||||||
|
""",
|
||||||
|
countQuery = """
|
||||||
|
SELECT COUNT(DISTINCT e.id)
|
||||||
|
FROM Enquete e
|
||||||
|
JOIN e.parcelle pa
|
||||||
|
INNER JOIN pa.quartier q
|
||||||
|
INNER JOIN SecteurDecoupage sd on sd.quartier= q
|
||||||
|
WHERE sd.secteur.id IN (:secteurIds)
|
||||||
|
and q.id = :quartierId
|
||||||
|
and e.statutEnquete = :statutEnquete
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
Page<EnquetePayLoadWeb> findAllEnqueteByQuartierByStatutToDtoPageable(
|
||||||
|
@Param("quartierId") Long quartierId,
|
||||||
|
@Param("secteurIds") List<Long> secteurIds,
|
||||||
|
@Param("statutEnquete") StatutEnquete statutEnquete,
|
||||||
|
Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT count(distinct e.*)
|
||||||
|
FROM enquete e
|
||||||
|
JOIN parcelle parc on parc.id=e.parcelle_id
|
||||||
|
JOIN quartier q on q.id=parc.quartier_id
|
||||||
|
JOIN secteur_decoupage sd on sd.quartier_id=q.id
|
||||||
|
WHERE sd.secteur_id IN (:secteurIds)
|
||||||
|
and e.statut_enquete = :statutEnquete
|
||||||
|
""",
|
||||||
|
nativeQuery = true
|
||||||
|
)
|
||||||
|
Integer getNombreEnqueteByUserConnecte(
|
||||||
|
@Param("secteurIds") List<Long> secteurIds,
|
||||||
|
@Param("statutEnquete") String statutEnquete
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,13 +51,13 @@ public interface ParcelleGeomRepository extends JpaRepository<ParcelleGeom, Long
|
|||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional
|
||||||
@Query(value = "update parcelle_geom " +
|
@Query(value = "update parcelle_geom " +
|
||||||
" set statut_parcelle = 'ENQUETER_BATIE' " +
|
" set statut_parcelle = 'ENQUETE_BATIE' " +
|
||||||
" where nup_provisoire= ?1 ",nativeQuery = true)
|
" where nup_provisoire= ?1 ",nativeQuery = true)
|
||||||
void majStatutParcelleGeomBatie(String nupProvisoire);
|
void majStatutParcelleGeomBatie(String nupProvisoire);
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional
|
||||||
@Query(value = "update parcelle_geom " +
|
@Query(value = "update parcelle_geom " +
|
||||||
" set statut_parcelle = 'ENQUETER_NON_BATIE' " +
|
" set statut_parcelle = 'ENQUETE_NON_BATIE' " +
|
||||||
" where nup_provisoire= ?1 ",nativeQuery = true)
|
" where nup_provisoire= ?1 ",nativeQuery = true)
|
||||||
void majStatutParcelleGeomNonBatie(String nupProvisoire);
|
void majStatutParcelleGeomNonBatie(String nupProvisoire);
|
||||||
@Modifying
|
@Modifying
|
||||||
@@ -88,7 +88,7 @@ public interface ParcelleGeomRepository extends JpaRepository<ParcelleGeom, Long
|
|||||||
where upper(p.q)=upper(pg.q)
|
where upper(p.q)=upper(pg.q)
|
||||||
and upper(p.i)=upper(pg.ilot)
|
and upper(p.i)=upper(pg.ilot)
|
||||||
and upper(p.p)=upper(pg.p)
|
and upper(p.p)=upper(pg.p)
|
||||||
and parcelle_is is null;
|
and parcelle_id is null;
|
||||||
""",nativeQuery = true)
|
""",nativeQuery = true)
|
||||||
void majParcelleId();
|
void majParcelleId();
|
||||||
|
|
||||||
@@ -128,9 +128,9 @@ public interface ParcelleGeomRepository extends JpaRepository<ParcelleGeom, Long
|
|||||||
pg.batie,
|
pg.batie,
|
||||||
pg.npi,
|
pg.npi,
|
||||||
pg.ifu,
|
pg.ifu,
|
||||||
pg.nom,
|
pers.nom,
|
||||||
pg.prenom,
|
pers.prenom,
|
||||||
pg.raisonSociale,
|
pers.raisonSociale,
|
||||||
pg.nomEtPrenoms,
|
pg.nomEtPrenoms,
|
||||||
pg.telephone,
|
pg.telephone,
|
||||||
pg.adresse,
|
pg.adresse,
|
||||||
@@ -168,9 +168,18 @@ public interface ParcelleGeomRepository extends JpaRepository<ParcelleGeom, Long
|
|||||||
pg.geomSrid,
|
pg.geomSrid,
|
||||||
pg.geometry,
|
pg.geometry,
|
||||||
pg.geometryString,
|
pg.geometryString,
|
||||||
pg.parcelle.id
|
parc.id
|
||||||
)
|
)
|
||||||
FROM ParcelleGeom pg
|
FROM ParcelleGeom pg
|
||||||
|
LEFT JOIN pg.parcelle parc
|
||||||
|
LEFT JOIN Enquete e
|
||||||
|
ON e.parcelle = parc
|
||||||
|
AND e.dateEnquete = (
|
||||||
|
SELECT MAX(e2.dateEnquete)
|
||||||
|
FROM Enquete e2
|
||||||
|
WHERE e2.parcelle = parc
|
||||||
|
)
|
||||||
|
LEFT JOIN e.personne pers
|
||||||
LEFT JOIN pg.departement d
|
LEFT JOIN pg.departement d
|
||||||
LEFT JOIN pg.commune c
|
LEFT JOIN pg.commune c
|
||||||
LEFT JOIN pg.arrondissement a
|
LEFT JOIN pg.arrondissement a
|
||||||
@@ -196,9 +205,9 @@ public interface ParcelleGeomRepository extends JpaRepository<ParcelleGeom, Long
|
|||||||
pg.batie,
|
pg.batie,
|
||||||
pg.npi,
|
pg.npi,
|
||||||
pg.ifu,
|
pg.ifu,
|
||||||
pg.nom,
|
pers.nom,
|
||||||
pg.prenom,
|
pers.prenom,
|
||||||
pg.raisonSociale,
|
pers.raisonSociale,
|
||||||
pg.nomEtPrenoms,
|
pg.nomEtPrenoms,
|
||||||
pg.telephone,
|
pg.telephone,
|
||||||
pg.adresse,
|
pg.adresse,
|
||||||
@@ -236,9 +245,18 @@ public interface ParcelleGeomRepository extends JpaRepository<ParcelleGeom, Long
|
|||||||
pg.geomSrid,
|
pg.geomSrid,
|
||||||
pg.geometry,
|
pg.geometry,
|
||||||
pg.geometryString,
|
pg.geometryString,
|
||||||
pg.parcelle.id
|
parc.id
|
||||||
)
|
)
|
||||||
FROM ParcelleGeom pg
|
FROM ParcelleGeom pg
|
||||||
|
LEFT JOIN pg.parcelle parc
|
||||||
|
LEFT JOIN Enquete e
|
||||||
|
ON e.parcelle = parc
|
||||||
|
AND e.dateEnquete = (
|
||||||
|
SELECT MAX(e2.dateEnquete)
|
||||||
|
FROM Enquete e2
|
||||||
|
WHERE e2.parcelle = parc
|
||||||
|
)
|
||||||
|
LEFT JOIN e.personne pers
|
||||||
LEFT JOIN pg.departement d
|
LEFT JOIN pg.departement d
|
||||||
LEFT JOIN pg.commune c
|
LEFT JOIN pg.commune c
|
||||||
LEFT JOIN pg.arrondissement a
|
LEFT JOIN pg.arrondissement a
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
|
|||||||
import io.gmss.fiscad.paylaods.response.dataTableResponse.ParcelleDataTableResponse;
|
import io.gmss.fiscad.paylaods.response.dataTableResponse.ParcelleDataTableResponse;
|
||||||
import io.gmss.fiscad.paylaods.response.statistique.StatistiqueTypeNombreResponse;
|
import io.gmss.fiscad.paylaods.response.statistique.StatistiqueTypeNombreResponse;
|
||||||
import io.gmss.fiscad.paylaods.response.restoration.ParcellePayLoadRestor;
|
import io.gmss.fiscad.paylaods.response.restoration.ParcellePayLoadRestor;
|
||||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||||
import io.gmss.fiscad.persistence.customrepository.ParcelleRepositoryCustom;
|
import io.gmss.fiscad.persistence.customrepository.ParcelleRepositoryCustom;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -94,32 +94,39 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
|||||||
|
|
||||||
@Query(
|
@Query(
|
||||||
value = """
|
value = """
|
||||||
SELECT DISTINCT
|
SELECT distinct
|
||||||
d.id AS departement_id,
|
d.id AS departement_id,
|
||||||
d.code AS departement_code,
|
d.code AS departement_code,
|
||||||
d.nom AS departement_nom,
|
d.nom AS departement_nom,
|
||||||
COUNT(p.id) OVER (PARTITION BY d.id) AS nb_parcelles_departement,
|
COUNT(p.id) OVER (PARTITION BY d.id) AS nb_parcelles_departement,
|
||||||
|
|
||||||
c.id AS commune_id,
|
c.id AS commune_id,
|
||||||
c.code AS commune_code,
|
c.code AS commune_code,
|
||||||
c.nom AS commune_nom,
|
c.nom AS commune_nom,
|
||||||
COUNT(p.id) OVER (PARTITION BY c.id) AS nb_parcelles_commune,
|
COUNT(p.id) OVER (PARTITION BY c.id) AS nb_parcelles_commune,
|
||||||
|
|
||||||
a.id AS arrondissement_id,
|
a.id AS arrondissement_id,
|
||||||
a.code AS arrondissement_code,
|
a.code AS arrondissement_code,
|
||||||
a.nom AS arrondissement_nom,
|
a.nom AS arrondissement_nom,
|
||||||
COUNT(p.id) OVER (PARTITION BY a.id) AS nb_parcelles_arrondissement,
|
COUNT(p.id) OVER (PARTITION BY a.id) AS nb_parcelles_arrondissement,
|
||||||
|
|
||||||
q.id AS quartier_id,
|
q.id AS quartier_id,
|
||||||
q.code AS quartier_code,
|
q.code AS quartier_code,
|
||||||
q.nom AS quartier_nom,
|
q.nom AS quartier_nom,
|
||||||
COUNT(p.id) OVER (PARTITION BY q.id) AS nb_parcelles_quartier
|
COUNT(p.id) OVER (PARTITION BY q.id) AS nb_parcelles_quartier
|
||||||
FROM secteur_decoupage sd
|
|
||||||
JOIN quartier q ON q.id = sd.quartier_id
|
FROM quartier q
|
||||||
JOIN arrondissement a ON a.id = q.arrondissement_id
|
JOIN arrondissement a ON a.id = q.arrondissement_id
|
||||||
JOIN commune c ON c.id = a.commune_id
|
JOIN commune c ON c.id = a.commune_id
|
||||||
JOIN departement d ON d.id = c.departement_id
|
JOIN departement d ON d.id = c.departement_id
|
||||||
LEFT JOIN parcelle p ON p.quartier_id = q.id
|
LEFT JOIN parcelle p ON p.quartier_id = q.id
|
||||||
WHERE sd.secteur_id IN (:secteurIds)\s
|
WHERE EXISTS (
|
||||||
ORDER BY
|
SELECT 1
|
||||||
d.nom, c.nom, a.nom, q.nom;
|
FROM secteur_decoupage sd
|
||||||
|
WHERE sd.quartier_id = q.id
|
||||||
|
AND sd.secteur_id IN (:secteurIds)
|
||||||
|
)
|
||||||
|
ORDER BY d.nom, c.nom, a.nom, q.nom;
|
||||||
""",
|
""",
|
||||||
nativeQuery = true
|
nativeQuery = true
|
||||||
)
|
)
|
||||||
@@ -348,7 +355,6 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
|||||||
WHERE e2.parcelle = p
|
WHERE e2.parcelle = p
|
||||||
)
|
)
|
||||||
LEFT JOIN e.personne pers
|
LEFT JOIN e.personne pers
|
||||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
|
||||||
WHERE p.id = :parcelleId
|
WHERE p.id = :parcelleId
|
||||||
""")
|
""")
|
||||||
Optional<ParcellePayLoadWeb> findParcelleToDtoById(
|
Optional<ParcellePayLoadWeb> findParcelleToDtoById(
|
||||||
@@ -358,7 +364,7 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
|||||||
|
|
||||||
@Query(
|
@Query(
|
||||||
value = """
|
value = """
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
SELECT distinct new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||||
p.id,
|
p.id,
|
||||||
p.q,
|
p.q,
|
||||||
p.i,
|
p.i,
|
||||||
@@ -475,7 +481,7 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
|||||||
|
|
||||||
@Query(
|
@Query(
|
||||||
value = """
|
value = """
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
SELECT distinct new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||||
p.id,
|
p.id,
|
||||||
p.q,
|
p.q,
|
||||||
p.i,
|
p.i,
|
||||||
@@ -541,7 +547,7 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
|||||||
|
|
||||||
@Query(
|
@Query(
|
||||||
"""
|
"""
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
SELECT distinct new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||||
p.id,
|
p.id,
|
||||||
p.q,
|
p.q,
|
||||||
p.i,
|
p.i,
|
||||||
@@ -597,7 +603,7 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
|||||||
|
|
||||||
@Query(
|
@Query(
|
||||||
value = """
|
value = """
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
SELECT distinct new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||||
p.id,
|
p.id,
|
||||||
p.q,
|
p.q,
|
||||||
p.i,
|
p.i,
|
||||||
|
|||||||
@@ -76,7 +76,12 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
|||||||
p.observation,
|
p.observation,
|
||||||
e.id,
|
e.id,
|
||||||
p.enqueteBatiment.id,
|
p.enqueteBatiment.id,
|
||||||
p.enqueteUniteLogement.id
|
p.enqueteUniteLogement.id,
|
||||||
|
(
|
||||||
|
SELECT CAST(COUNT(u.id) as Long)
|
||||||
|
FROM Upload u
|
||||||
|
WHERE u.piece.id = p.id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
FROM Piece p
|
FROM Piece p
|
||||||
LEFT JOIN p.typePiece tp
|
LEFT JOIN p.typePiece tp
|
||||||
@@ -109,7 +114,12 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
|||||||
p.observation,
|
p.observation,
|
||||||
e.id,
|
e.id,
|
||||||
p.enqueteBatiment.id,
|
p.enqueteBatiment.id,
|
||||||
p.enqueteUniteLogement.id
|
p.enqueteUniteLogement.id,
|
||||||
|
(
|
||||||
|
SELECT CAST(COUNT(u.id) as Long)
|
||||||
|
FROM Upload u
|
||||||
|
WHERE u.piece.id = p.id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
FROM Piece p
|
FROM Piece p
|
||||||
LEFT JOIN p.typePiece tp
|
LEFT JOIN p.typePiece tp
|
||||||
@@ -141,7 +151,12 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
|||||||
p.observation,
|
p.observation,
|
||||||
e.id,
|
e.id,
|
||||||
p.enqueteBatiment.id,
|
p.enqueteBatiment.id,
|
||||||
p.enqueteUniteLogement.id
|
p.enqueteUniteLogement.id,
|
||||||
|
(
|
||||||
|
SELECT CAST(COUNT(u.id) as Long)
|
||||||
|
FROM Upload u
|
||||||
|
WHERE u.piece.id = p.id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
FROM Piece p
|
FROM Piece p
|
||||||
LEFT JOIN p.typePiece tp
|
LEFT JOIN p.typePiece tp
|
||||||
@@ -180,7 +195,12 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
|||||||
p.observation,
|
p.observation,
|
||||||
e.id,
|
e.id,
|
||||||
p.enqueteBatiment.id,
|
p.enqueteBatiment.id,
|
||||||
p.enqueteUniteLogement.id
|
p.enqueteUniteLogement.id,
|
||||||
|
(
|
||||||
|
SELECT CAST(COUNT(u.id) as Long)
|
||||||
|
FROM Upload u
|
||||||
|
WHERE u.piece.id = p.id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
FROM Piece p
|
FROM Piece p
|
||||||
LEFT JOIN p.typePiece tp
|
LEFT JOIN p.typePiece tp
|
||||||
@@ -249,7 +269,12 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
|||||||
p.observation,
|
p.observation,
|
||||||
e.id,
|
e.id,
|
||||||
p.enqueteBatiment.id,
|
p.enqueteBatiment.id,
|
||||||
p.enqueteUniteLogement.id
|
p.enqueteUniteLogement.id,
|
||||||
|
(
|
||||||
|
SELECT CAST(COUNT(u.id) as Long)
|
||||||
|
FROM Upload u
|
||||||
|
WHERE u.piece.id = p.id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
FROM Piece p
|
FROM Piece p
|
||||||
LEFT JOIN p.typePiece tp
|
LEFT JOIN p.typePiece tp
|
||||||
|
|||||||
@@ -300,4 +300,122 @@ public interface BatimentRepository extends JpaRepository<Batiment, Long> {
|
|||||||
Pageable pageable
|
Pageable pageable
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.BatimentPaylaodWeb(
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
b.code,
|
||||||
|
b.dateConstruction,
|
||||||
|
p.id,
|
||||||
|
p.nup,
|
||||||
|
p.q,
|
||||||
|
p.i,
|
||||||
|
p.p,
|
||||||
|
per.id,
|
||||||
|
per.nom,
|
||||||
|
per.prenom,
|
||||||
|
per.raisonSociale,
|
||||||
|
eb.superficieAuSol,
|
||||||
|
eb.superficieLouee,
|
||||||
|
eb.id,
|
||||||
|
cb.id,
|
||||||
|
cb.code,
|
||||||
|
cb.standing,
|
||||||
|
eb.nombrePiscine,
|
||||||
|
eb.montantLocatifAnnuelDeclare,
|
||||||
|
eb.montantLocatifAnnuelCalcule,
|
||||||
|
eb.valeurBatimentEstime,
|
||||||
|
eb.valeurBatimentReel,
|
||||||
|
eb.montantMensuelLocation,
|
||||||
|
us.id,
|
||||||
|
us.nom ,
|
||||||
|
eb.montantLocatifAnnuelEstime,
|
||||||
|
eb.valeurBatimentCalcule,
|
||||||
|
eb.nbreUniteLogement
|
||||||
|
)
|
||||||
|
FROM Batiment b
|
||||||
|
JOIN b.parcelle p
|
||||||
|
JOIN p.quartier q
|
||||||
|
LEFT JOIN b.categorieBatiment cb
|
||||||
|
LEFT JOIN EnqueteBatiment eb
|
||||||
|
ON eb.batiment = b
|
||||||
|
AND eb.dateEnquete = (
|
||||||
|
SELECT MAX(eb2.dateEnquete)
|
||||||
|
FROM EnqueteBatiment eb2
|
||||||
|
WHERE eb2.batiment = b
|
||||||
|
)
|
||||||
|
LEFT JOIN eb.personne per
|
||||||
|
LEFT JOIN eb.usage us
|
||||||
|
WHERE q.id = :quartierId
|
||||||
|
""",
|
||||||
|
countQuery = """
|
||||||
|
SELECT COUNT(b)
|
||||||
|
FROM Batiment b
|
||||||
|
join b.parcelle p
|
||||||
|
join p.quartier q
|
||||||
|
WHERE q.id = :quartierId
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
Page<BatimentPaylaodWeb> findAllBatimentsAvecOccupantCourantByQuartierToDtoPageble(
|
||||||
|
@Param("quartierId") Long quartierId,
|
||||||
|
Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
"""
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.BatimentPaylaodWeb(
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
b.code,
|
||||||
|
b.dateConstruction,
|
||||||
|
p.id,
|
||||||
|
p.nup,
|
||||||
|
p.q,
|
||||||
|
p.i,
|
||||||
|
p.p,
|
||||||
|
per.id,
|
||||||
|
per.nom,
|
||||||
|
per.prenom,
|
||||||
|
per.raisonSociale,
|
||||||
|
eb.superficieAuSol,
|
||||||
|
eb.superficieLouee,
|
||||||
|
eb.id,
|
||||||
|
cb.id,
|
||||||
|
cb.code,
|
||||||
|
cb.standing,
|
||||||
|
eb.nombrePiscine,
|
||||||
|
eb.montantLocatifAnnuelDeclare,
|
||||||
|
eb.montantLocatifAnnuelCalcule,
|
||||||
|
eb.valeurBatimentEstime,
|
||||||
|
eb.valeurBatimentReel,
|
||||||
|
eb.montantMensuelLocation,
|
||||||
|
us.id,
|
||||||
|
us.nom ,
|
||||||
|
eb.montantLocatifAnnuelEstime,
|
||||||
|
eb.valeurBatimentCalcule,
|
||||||
|
eb.nbreUniteLogement
|
||||||
|
)
|
||||||
|
FROM Batiment b
|
||||||
|
JOIN b.parcelle p
|
||||||
|
JOIN p.quartier q
|
||||||
|
LEFT JOIN b.categorieBatiment cb
|
||||||
|
LEFT JOIN EnqueteBatiment eb
|
||||||
|
ON eb.batiment = b
|
||||||
|
AND eb.dateEnquete = (
|
||||||
|
SELECT MAX(eb2.dateEnquete)
|
||||||
|
FROM EnqueteBatiment eb2
|
||||||
|
WHERE eb2.batiment = b
|
||||||
|
)
|
||||||
|
LEFT JOIN eb.personne per
|
||||||
|
LEFT JOIN eb.usage us
|
||||||
|
WHERE q.id = :quartierId
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
List<BatimentPaylaodWeb> findAllBatimentsAvecOccupantCourantByQuartierToDto(
|
||||||
|
@Param("quartierId") Long quartierId
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ public interface DonneesImpositionTfuRepository extends JpaRepository<DonneesImp
|
|||||||
""", nativeQuery = true)
|
""", nativeQuery = true)
|
||||||
List<DonneesImpositionTfuResponse> findAllDonneesImpositionTfu(Long communeId, int annee);
|
List<DonneesImpositionTfuResponse> findAllDonneesImpositionTfu(Long communeId, int annee);
|
||||||
|
|
||||||
List<DonneesImpositionTfu> findAllByImpositionsTfu_Id(Long impositionId);
|
|
||||||
List<DonneesImpositionTfu> findAllByImpositionsTfu_IdAndCodeArrondissement(Long impositionId,String arrondissementCode);
|
List<DonneesImpositionTfu> findAllByImpositionsTfu_IdAndCodeArrondissement(Long impositionId,String arrondissementCode);
|
||||||
|
|
||||||
|
|
||||||
@@ -195,12 +194,320 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
|||||||
LEFT join d.structure s
|
LEFT join d.structure s
|
||||||
LEFT join d.zoneRfu z
|
LEFT join d.zoneRfu z
|
||||||
WHERE itfu.id = :impositionTfuId
|
WHERE itfu.id = :impositionTfuId
|
||||||
|
order by d.nomProp,d.nomProp asc
|
||||||
|
""")
|
||||||
|
List<DonneesImpositionPaylaodWeb> findAllByImpositionTfuId(
|
||||||
|
Long impositionTfuId
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||||
|
d.id,
|
||||||
|
d.annee,
|
||||||
|
d.codeDepartement,
|
||||||
|
d.nomDepartement,
|
||||||
|
d.codeCommune,
|
||||||
|
d.nomCommune,
|
||||||
|
d.codeArrondissement,
|
||||||
|
d.nomArrondissement,
|
||||||
|
d.codeQuartierVillage,
|
||||||
|
d.nomQuartierVillage,
|
||||||
|
d.q,
|
||||||
|
d.ilot,
|
||||||
|
d.parcelle,
|
||||||
|
d.nup,
|
||||||
|
d.titreFoncier,
|
||||||
|
d.numBatiment,
|
||||||
|
d.numUniteLogement,
|
||||||
|
d.ifu,
|
||||||
|
d.npi,
|
||||||
|
d.telProp,
|
||||||
|
d.emailProp,
|
||||||
|
d.nomProp,
|
||||||
|
d.prenomProp,
|
||||||
|
d.raisonSociale,
|
||||||
|
d.adresseProp,
|
||||||
|
d.telSc,
|
||||||
|
d.emailSc,
|
||||||
|
d.nomSc,
|
||||||
|
d.prenomSc,
|
||||||
|
d.adresseSc,
|
||||||
|
d.longitude,
|
||||||
|
d.latitude,
|
||||||
|
d.superficieParc,
|
||||||
|
d.superficieAuSolBat,
|
||||||
|
d.superficieAuSolUlog,
|
||||||
|
d.batie,
|
||||||
|
d.exonere,
|
||||||
|
d.batimentExonere,
|
||||||
|
d.uniteLogementExonere,
|
||||||
|
d.valeurLocativeAdm,
|
||||||
|
d.montantLoyerAnnuel,
|
||||||
|
d.tfuMetreCarre,
|
||||||
|
d.tfuMinimum,
|
||||||
|
d.standingBat,
|
||||||
|
d.categorieBat,
|
||||||
|
d.nombrePiscine,
|
||||||
|
d.nombreUlog,
|
||||||
|
d.nombreBat,
|
||||||
|
d.dateEnquete,
|
||||||
|
s.id,
|
||||||
|
z.id,
|
||||||
|
d.valeurAdminParcelleNb,
|
||||||
|
d.natureImpot,
|
||||||
|
s.code,
|
||||||
|
z.nom,
|
||||||
|
d.valeurBatiment,
|
||||||
|
d.valeurParcelle,
|
||||||
|
d.valeurLocativeAdmMetreCarre,
|
||||||
|
d.valeurAdminParcelleNbMetreCarre,
|
||||||
|
d.montantTaxe
|
||||||
|
)
|
||||||
|
FROM DonneesImpositionTfu d
|
||||||
|
JOIN d.impositionsTfu itfu
|
||||||
|
LEFT join d.structure s
|
||||||
|
LEFT join d.zoneRfu z
|
||||||
|
WHERE itfu.id = :impositionTfuId
|
||||||
|
order by d.nomProp,d.nomProp asc
|
||||||
""")
|
""")
|
||||||
Page<DonneesImpositionPaylaodWeb> findAllByImpositionTfuIdPageable(
|
Page<DonneesImpositionPaylaodWeb> findAllByImpositionTfuIdPageable(
|
||||||
Long impositionTfuId,
|
Long impositionTfuId,
|
||||||
Pageable pageable
|
Pageable pageable
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||||
|
d.id,
|
||||||
|
d.annee,
|
||||||
|
d.codeDepartement,
|
||||||
|
d.nomDepartement,
|
||||||
|
d.codeCommune,
|
||||||
|
d.nomCommune,
|
||||||
|
d.codeArrondissement,
|
||||||
|
d.nomArrondissement,
|
||||||
|
d.codeQuartierVillage,
|
||||||
|
d.nomQuartierVillage,
|
||||||
|
d.q,
|
||||||
|
d.ilot,
|
||||||
|
d.parcelle,
|
||||||
|
d.nup,
|
||||||
|
d.titreFoncier,
|
||||||
|
d.numBatiment,
|
||||||
|
d.numUniteLogement,
|
||||||
|
d.ifu,
|
||||||
|
d.npi,
|
||||||
|
d.telProp,
|
||||||
|
d.emailProp,
|
||||||
|
d.nomProp,
|
||||||
|
d.prenomProp,
|
||||||
|
d.raisonSociale,
|
||||||
|
d.adresseProp,
|
||||||
|
d.telSc,
|
||||||
|
d.emailSc,
|
||||||
|
d.nomSc,
|
||||||
|
d.prenomSc,
|
||||||
|
d.adresseSc,
|
||||||
|
d.longitude,
|
||||||
|
d.latitude,
|
||||||
|
d.superficieParc,
|
||||||
|
d.superficieAuSolBat,
|
||||||
|
d.superficieAuSolUlog,
|
||||||
|
d.batie,
|
||||||
|
d.exonere,
|
||||||
|
d.batimentExonere,
|
||||||
|
d.uniteLogementExonere,
|
||||||
|
d.valeurLocativeAdm,
|
||||||
|
d.montantLoyerAnnuel,
|
||||||
|
d.tfuMetreCarre,
|
||||||
|
d.tfuMinimum,
|
||||||
|
d.standingBat,
|
||||||
|
d.categorieBat,
|
||||||
|
d.nombrePiscine,
|
||||||
|
d.nombreUlog,
|
||||||
|
d.nombreBat,
|
||||||
|
d.dateEnquete,
|
||||||
|
s.id,
|
||||||
|
z.id,
|
||||||
|
d.valeurAdminParcelleNb,
|
||||||
|
d.natureImpot,
|
||||||
|
s.code,
|
||||||
|
z.nom,
|
||||||
|
d.valeurBatiment,
|
||||||
|
d.valeurParcelle,
|
||||||
|
d.valeurLocativeAdmMetreCarre,
|
||||||
|
d.valeurAdminParcelleNbMetreCarre,
|
||||||
|
d.montantTaxe
|
||||||
|
)
|
||||||
|
FROM DonneesImpositionTfu d
|
||||||
|
JOIN d.impositionsTfu itfu
|
||||||
|
LEFT join d.structure s
|
||||||
|
LEFT join d.zoneRfu z
|
||||||
|
WHERE itfu.id = :impositionTfuId
|
||||||
|
and d.batie is true
|
||||||
|
and d.numUniteLogement is null
|
||||||
|
order by d.nomProp,d.nomProp asc
|
||||||
|
""")
|
||||||
|
Page<DonneesImpositionPaylaodWeb> findAllByImpositionTfuIdBatieBatimentPageable(
|
||||||
|
Long impositionTfuId,
|
||||||
|
Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||||
|
d.id,
|
||||||
|
d.annee,
|
||||||
|
d.codeDepartement,
|
||||||
|
d.nomDepartement,
|
||||||
|
d.codeCommune,
|
||||||
|
d.nomCommune,
|
||||||
|
d.codeArrondissement,
|
||||||
|
d.nomArrondissement,
|
||||||
|
d.codeQuartierVillage,
|
||||||
|
d.nomQuartierVillage,
|
||||||
|
d.q,
|
||||||
|
d.ilot,
|
||||||
|
d.parcelle,
|
||||||
|
d.nup,
|
||||||
|
d.titreFoncier,
|
||||||
|
d.numBatiment,
|
||||||
|
d.numUniteLogement,
|
||||||
|
d.ifu,
|
||||||
|
d.npi,
|
||||||
|
d.telProp,
|
||||||
|
d.emailProp,
|
||||||
|
d.nomProp,
|
||||||
|
d.prenomProp,
|
||||||
|
d.raisonSociale,
|
||||||
|
d.adresseProp,
|
||||||
|
d.telSc,
|
||||||
|
d.emailSc,
|
||||||
|
d.nomSc,
|
||||||
|
d.prenomSc,
|
||||||
|
d.adresseSc,
|
||||||
|
d.longitude,
|
||||||
|
d.latitude,
|
||||||
|
d.superficieParc,
|
||||||
|
d.superficieAuSolBat,
|
||||||
|
d.superficieAuSolUlog,
|
||||||
|
d.batie,
|
||||||
|
d.exonere,
|
||||||
|
d.batimentExonere,
|
||||||
|
d.uniteLogementExonere,
|
||||||
|
d.valeurLocativeAdm,
|
||||||
|
d.montantLoyerAnnuel,
|
||||||
|
d.tfuMetreCarre,
|
||||||
|
d.tfuMinimum,
|
||||||
|
d.standingBat,
|
||||||
|
d.categorieBat,
|
||||||
|
d.nombrePiscine,
|
||||||
|
d.nombreUlog,
|
||||||
|
d.nombreBat,
|
||||||
|
d.dateEnquete,
|
||||||
|
s.id,
|
||||||
|
z.id,
|
||||||
|
d.valeurAdminParcelleNb,
|
||||||
|
d.natureImpot,
|
||||||
|
s.code,
|
||||||
|
z.nom,
|
||||||
|
d.valeurBatiment,
|
||||||
|
d.valeurParcelle,
|
||||||
|
d.valeurLocativeAdmMetreCarre,
|
||||||
|
d.valeurAdminParcelleNbMetreCarre,
|
||||||
|
d.montantTaxe
|
||||||
|
)
|
||||||
|
FROM DonneesImpositionTfu d
|
||||||
|
JOIN d.impositionsTfu itfu
|
||||||
|
LEFT join d.structure s
|
||||||
|
LEFT join d.zoneRfu z
|
||||||
|
WHERE itfu.id = :impositionTfuId
|
||||||
|
and d.batie is true
|
||||||
|
and d.numUniteLogement is not null
|
||||||
|
order by d.nomProp,d.nomProp asc
|
||||||
|
""")
|
||||||
|
Page<DonneesImpositionPaylaodWeb> findAllByImpositionTfuIdBatieUniteLogPageable(
|
||||||
|
Long impositionTfuId,
|
||||||
|
Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||||
|
d.id,
|
||||||
|
d.annee,
|
||||||
|
d.codeDepartement,
|
||||||
|
d.nomDepartement,
|
||||||
|
d.codeCommune,
|
||||||
|
d.nomCommune,
|
||||||
|
d.codeArrondissement,
|
||||||
|
d.nomArrondissement,
|
||||||
|
d.codeQuartierVillage,
|
||||||
|
d.nomQuartierVillage,
|
||||||
|
d.q,
|
||||||
|
d.ilot,
|
||||||
|
d.parcelle,
|
||||||
|
d.nup,
|
||||||
|
d.titreFoncier,
|
||||||
|
d.numBatiment,
|
||||||
|
d.numUniteLogement,
|
||||||
|
d.ifu,
|
||||||
|
d.npi,
|
||||||
|
d.telProp,
|
||||||
|
d.emailProp,
|
||||||
|
d.nomProp,
|
||||||
|
d.prenomProp,
|
||||||
|
d.raisonSociale,
|
||||||
|
d.adresseProp,
|
||||||
|
d.telSc,
|
||||||
|
d.emailSc,
|
||||||
|
d.nomSc,
|
||||||
|
d.prenomSc,
|
||||||
|
d.adresseSc,
|
||||||
|
d.longitude,
|
||||||
|
d.latitude,
|
||||||
|
d.superficieParc,
|
||||||
|
d.superficieAuSolBat,
|
||||||
|
d.superficieAuSolUlog,
|
||||||
|
d.batie,
|
||||||
|
d.exonere,
|
||||||
|
d.batimentExonere,
|
||||||
|
d.uniteLogementExonere,
|
||||||
|
d.valeurLocativeAdm,
|
||||||
|
d.montantLoyerAnnuel,
|
||||||
|
d.tfuMetreCarre,
|
||||||
|
d.tfuMinimum,
|
||||||
|
d.standingBat,
|
||||||
|
d.categorieBat,
|
||||||
|
d.nombrePiscine,
|
||||||
|
d.nombreUlog,
|
||||||
|
d.nombreBat,
|
||||||
|
d.dateEnquete,
|
||||||
|
s.id,
|
||||||
|
z.id,
|
||||||
|
d.valeurAdminParcelleNb,
|
||||||
|
d.natureImpot,
|
||||||
|
s.code,
|
||||||
|
z.nom,
|
||||||
|
d.valeurBatiment,
|
||||||
|
d.valeurParcelle,
|
||||||
|
d.valeurLocativeAdmMetreCarre,
|
||||||
|
d.valeurAdminParcelleNbMetreCarre,
|
||||||
|
d.montantTaxe
|
||||||
|
)
|
||||||
|
FROM DonneesImpositionTfu d
|
||||||
|
JOIN d.impositionsTfu itfu
|
||||||
|
LEFT join d.structure s
|
||||||
|
LEFT join d.zoneRfu z
|
||||||
|
WHERE itfu.id = :impositionTfuId
|
||||||
|
and d.batie is false
|
||||||
|
order by d.nomProp,d.nomProp asc
|
||||||
|
""")
|
||||||
|
Page<DonneesImpositionPaylaodWeb> findAllByImpositionTfuIdNonBatiePageable(
|
||||||
|
Long impositionTfuId,
|
||||||
|
Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
@Query(value = "SELECT generer_donnees_imposition_tfu_batie(:structureId, :impositionId)", nativeQuery = true)
|
@Query(value = "SELECT generer_donnees_imposition_tfu_batie(:structureId, :impositionId)", nativeQuery = true)
|
||||||
Integer genererDonneesTfuBatie(
|
Integer genererDonneesTfuBatie(
|
||||||
@Param("structureId") Long structureId,
|
@Param("structureId") Long structureId,
|
||||||
@@ -221,6 +528,276 @@ SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
|||||||
@Param("impositionId") Long impositionId
|
@Param("impositionId") Long impositionId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@Query(value = "SELECT generer_donnees_imposition_irf_batie(:structureId, :impositionId)", nativeQuery = true)
|
||||||
|
Integer genererDonneesIrfBatie(
|
||||||
|
@Param("structureId") Long structureId,
|
||||||
|
@Param("impositionId") Long impositionId
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query(value = "SELECT generer_donnees_imposition_srtb_batie(:structureId, :impositionId)", nativeQuery = true)
|
||||||
|
Integer genererDonneesSrtbBatie(
|
||||||
|
@Param("structureId") Long structureId,
|
||||||
|
@Param("impositionId") Long impositionId
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query(value = "SELECT generer_donnees_imposition_irf_batie_unite_logement(:structureId, :impositionId)", nativeQuery = true)
|
||||||
|
Integer genererDonneesIrfBatieUniteLogement(
|
||||||
|
@Param("structureId") Long structureId,
|
||||||
|
@Param("impositionId") Long impositionId
|
||||||
|
);
|
||||||
|
|
||||||
|
@Query(value = "SELECT generer_donnees_imposition_srtb_batie_unite_logement(:structureId, :impositionId)", nativeQuery = true)
|
||||||
|
Integer genererDonneesSrtbBatieUniteLogement(
|
||||||
|
@Param("structureId") Long structureId,
|
||||||
|
@Param("impositionId") Long impositionId
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query(value = """
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||||
|
d.id,
|
||||||
|
d.annee,
|
||||||
|
d.codeDepartement,
|
||||||
|
d.nomDepartement,
|
||||||
|
d.codeCommune,
|
||||||
|
d.nomCommune,
|
||||||
|
d.codeArrondissement,
|
||||||
|
d.nomArrondissement,
|
||||||
|
d.codeQuartierVillage,
|
||||||
|
d.nomQuartierVillage,
|
||||||
|
d.q,
|
||||||
|
d.ilot,
|
||||||
|
d.parcelle,
|
||||||
|
d.nup,
|
||||||
|
d.titreFoncier,
|
||||||
|
d.numBatiment,
|
||||||
|
d.numUniteLogement,
|
||||||
|
d.ifu,
|
||||||
|
d.npi,
|
||||||
|
d.telProp,
|
||||||
|
d.emailProp,
|
||||||
|
d.nomProp,
|
||||||
|
d.prenomProp,
|
||||||
|
d.raisonSociale,
|
||||||
|
d.adresseProp,
|
||||||
|
d.telSc,
|
||||||
|
d.emailSc,
|
||||||
|
d.nomSc,
|
||||||
|
d.prenomSc,
|
||||||
|
d.adresseSc,
|
||||||
|
d.longitude,
|
||||||
|
d.latitude,
|
||||||
|
d.superficieParc,
|
||||||
|
d.superficieAuSolBat,
|
||||||
|
d.superficieAuSolUlog,
|
||||||
|
d.batie,
|
||||||
|
d.exonere,
|
||||||
|
d.batimentExonere,
|
||||||
|
d.uniteLogementExonere,
|
||||||
|
d.valeurLocativeAdm,
|
||||||
|
d.montantLoyerAnnuel,
|
||||||
|
d.tfuMetreCarre,
|
||||||
|
d.tfuMinimum,
|
||||||
|
d.standingBat,
|
||||||
|
d.categorieBat,
|
||||||
|
d.nombrePiscine,
|
||||||
|
d.nombreUlog,
|
||||||
|
d.nombreBat,
|
||||||
|
d.dateEnquete,
|
||||||
|
s.id,
|
||||||
|
z.id,
|
||||||
|
d.valeurAdminParcelleNb,
|
||||||
|
d.natureImpot,
|
||||||
|
s.code,
|
||||||
|
z.nom,
|
||||||
|
d.valeurBatiment,
|
||||||
|
d.valeurParcelle,
|
||||||
|
d.valeurLocativeAdmMetreCarre,
|
||||||
|
d.valeurAdminParcelleNbMetreCarre,
|
||||||
|
d.montantTaxe
|
||||||
|
)
|
||||||
|
FROM DonneesImpositionTfu d
|
||||||
|
JOIN d.impositionsTfu itfu
|
||||||
|
LEFT join d.structure s
|
||||||
|
LEFT join d.zoneRfu z
|
||||||
|
WHERE itfu.exercice.id = :exerciceId
|
||||||
|
and s.id= :structureId
|
||||||
|
order by d.nomProp,d.nomProp asc
|
||||||
|
""",
|
||||||
|
countQuery = """
|
||||||
|
select count(*)
|
||||||
|
FROM DonneesImpositionTfu d
|
||||||
|
JOIN d.impositionsTfu itfu
|
||||||
|
LEFT join d.structure s
|
||||||
|
LEFT join d.zoneRfu z
|
||||||
|
WHERE itfu.exercice.id = :exerciceId
|
||||||
|
and s.id= :structureId
|
||||||
|
""")
|
||||||
|
Page<DonneesImpositionPaylaodWeb> findAllByExericeIdStructureIdPageable(
|
||||||
|
Long exerciceId,
|
||||||
|
Long structureId,
|
||||||
|
Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||||
|
d.id,
|
||||||
|
d.annee,
|
||||||
|
d.codeDepartement,
|
||||||
|
d.nomDepartement,
|
||||||
|
d.codeCommune,
|
||||||
|
d.nomCommune,
|
||||||
|
d.codeArrondissement,
|
||||||
|
d.nomArrondissement,
|
||||||
|
d.codeQuartierVillage,
|
||||||
|
d.nomQuartierVillage,
|
||||||
|
d.q,
|
||||||
|
d.ilot,
|
||||||
|
d.parcelle,
|
||||||
|
d.nup,
|
||||||
|
d.titreFoncier,
|
||||||
|
d.numBatiment,
|
||||||
|
d.numUniteLogement,
|
||||||
|
d.ifu,
|
||||||
|
d.npi,
|
||||||
|
d.telProp,
|
||||||
|
d.emailProp,
|
||||||
|
d.nomProp,
|
||||||
|
d.prenomProp,
|
||||||
|
d.raisonSociale,
|
||||||
|
d.adresseProp,
|
||||||
|
d.telSc,
|
||||||
|
d.emailSc,
|
||||||
|
d.nomSc,
|
||||||
|
d.prenomSc,
|
||||||
|
d.adresseSc,
|
||||||
|
d.longitude,
|
||||||
|
d.latitude,
|
||||||
|
d.superficieParc,
|
||||||
|
d.superficieAuSolBat,
|
||||||
|
d.superficieAuSolUlog,
|
||||||
|
d.batie,
|
||||||
|
d.exonere,
|
||||||
|
d.batimentExonere,
|
||||||
|
d.uniteLogementExonere,
|
||||||
|
d.valeurLocativeAdm,
|
||||||
|
d.montantLoyerAnnuel,
|
||||||
|
d.tfuMetreCarre,
|
||||||
|
d.tfuMinimum,
|
||||||
|
d.standingBat,
|
||||||
|
d.categorieBat,
|
||||||
|
d.nombrePiscine,
|
||||||
|
d.nombreUlog,
|
||||||
|
d.nombreBat,
|
||||||
|
d.dateEnquete,
|
||||||
|
s.id,
|
||||||
|
z.id,
|
||||||
|
d.valeurAdminParcelleNb,
|
||||||
|
d.natureImpot,
|
||||||
|
s.code,
|
||||||
|
z.nom,
|
||||||
|
d.valeurBatiment,
|
||||||
|
d.valeurParcelle,
|
||||||
|
d.valeurLocativeAdmMetreCarre,
|
||||||
|
d.valeurAdminParcelleNbMetreCarre,
|
||||||
|
d.montantTaxe
|
||||||
|
)
|
||||||
|
FROM DonneesImpositionTfu d
|
||||||
|
JOIN d.impositionsTfu itfu
|
||||||
|
JOIN d.parcelleImposee parc
|
||||||
|
JOIN parc.quartier quart
|
||||||
|
LEFT join d.structure s
|
||||||
|
LEFT join d.zoneRfu z
|
||||||
|
WHERE itfu.exercice.id = :exerciceId
|
||||||
|
and s.id= :structureId
|
||||||
|
and quart.id= :quartierId
|
||||||
|
order by d.nomProp,d.nomProp asc
|
||||||
|
""")
|
||||||
|
List<DonneesImpositionPaylaodWeb> findAllByExericeIdStructureId(
|
||||||
|
Long exerciceId,
|
||||||
|
Long structureId,
|
||||||
|
Long quartierId
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb(
|
||||||
|
d.id,
|
||||||
|
d.annee,
|
||||||
|
d.codeDepartement,
|
||||||
|
d.nomDepartement,
|
||||||
|
d.codeCommune,
|
||||||
|
d.nomCommune,
|
||||||
|
d.codeArrondissement,
|
||||||
|
d.nomArrondissement,
|
||||||
|
d.codeQuartierVillage,
|
||||||
|
d.nomQuartierVillage,
|
||||||
|
d.q,
|
||||||
|
d.ilot,
|
||||||
|
d.parcelle,
|
||||||
|
d.nup,
|
||||||
|
d.titreFoncier,
|
||||||
|
d.numBatiment,
|
||||||
|
d.numUniteLogement,
|
||||||
|
d.ifu,
|
||||||
|
d.npi,
|
||||||
|
d.telProp,
|
||||||
|
d.emailProp,
|
||||||
|
d.nomProp,
|
||||||
|
d.prenomProp,
|
||||||
|
d.raisonSociale,
|
||||||
|
d.adresseProp,
|
||||||
|
d.telSc,
|
||||||
|
d.emailSc,
|
||||||
|
d.nomSc,
|
||||||
|
d.prenomSc,
|
||||||
|
d.adresseSc,
|
||||||
|
d.longitude,
|
||||||
|
d.latitude,
|
||||||
|
d.superficieParc,
|
||||||
|
d.superficieAuSolBat,
|
||||||
|
d.superficieAuSolUlog,
|
||||||
|
d.batie,
|
||||||
|
d.exonere,
|
||||||
|
d.batimentExonere,
|
||||||
|
d.uniteLogementExonere,
|
||||||
|
d.valeurLocativeAdm,
|
||||||
|
d.montantLoyerAnnuel,
|
||||||
|
d.tfuMetreCarre,
|
||||||
|
d.tfuMinimum,
|
||||||
|
d.standingBat,
|
||||||
|
d.categorieBat,
|
||||||
|
d.nombrePiscine,
|
||||||
|
d.nombreUlog,
|
||||||
|
d.nombreBat,
|
||||||
|
d.dateEnquete,
|
||||||
|
s.id,
|
||||||
|
z.id,
|
||||||
|
d.valeurAdminParcelleNb,
|
||||||
|
d.natureImpot,
|
||||||
|
s.code,
|
||||||
|
z.nom,
|
||||||
|
d.valeurBatiment,
|
||||||
|
d.valeurParcelle,
|
||||||
|
d.valeurLocativeAdmMetreCarre,
|
||||||
|
d.valeurAdminParcelleNbMetreCarre,
|
||||||
|
d.montantTaxe
|
||||||
|
)
|
||||||
|
FROM DonneesImpositionTfu d
|
||||||
|
JOIN d.impositionsTfu itfu
|
||||||
|
JOIN d.parcelleImposee parc
|
||||||
|
JOIN parc.quartier quart
|
||||||
|
LEFT join d.structure s
|
||||||
|
LEFT join d.zoneRfu z
|
||||||
|
WHERE d.personne.id = :personneId
|
||||||
|
order by d.nomProp,d.nomProp asc
|
||||||
|
""")
|
||||||
|
List<DonneesImpositionPaylaodWeb> findAllByPersonneId(
|
||||||
|
@Param("personneId") Long personneId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package io.gmss.fiscad.persistence.repositories.rfu.metier;
|
package io.gmss.fiscad.persistence.repositories.rfu.metier;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||||
|
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||||
import io.gmss.fiscad.paylaods.response.restoration.EnqueteBatimentPayLoadRestor;
|
import io.gmss.fiscad.paylaods.response.restoration.EnqueteBatimentPayLoadRestor;
|
||||||
|
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
@@ -128,10 +131,23 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
|||||||
eb.nombrePiscine,
|
eb.nombrePiscine,
|
||||||
eb.montantLocatifAnnuelCalcule,
|
eb.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
|
||||||
|
b.nub,
|
||||||
|
b.code,
|
||||||
|
b.dateConstruction,
|
||||||
|
parc.id,
|
||||||
|
parc.nup,
|
||||||
|
parc.q,
|
||||||
|
parc.i,
|
||||||
|
parc.p,
|
||||||
|
b.montantLocatifAnnuelEstime,
|
||||||
|
b.valeurBatimentCalcule,
|
||||||
|
b.nbreUniteLogement
|
||||||
)
|
)
|
||||||
FROM EnqueteBatiment eb
|
FROM EnqueteBatiment eb
|
||||||
LEFT JOIN eb.batiment b
|
LEFT JOIN eb.batiment b
|
||||||
|
LEFT JOIN b.parcelle parc
|
||||||
LEFT JOIN eb.personne p
|
LEFT JOIN eb.personne p
|
||||||
LEFT JOIN eb.user u
|
LEFT JOIN eb.user u
|
||||||
LEFT JOIN eb.exercice ex
|
LEFT JOIN eb.exercice ex
|
||||||
@@ -192,10 +208,22 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
|||||||
eb.nombrePiscine,
|
eb.nombrePiscine,
|
||||||
eb.montantLocatifAnnuelCalcule,
|
eb.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
b.nub,
|
||||||
|
b.code,
|
||||||
|
b.dateConstruction,
|
||||||
|
parc.id,
|
||||||
|
parc.nup,
|
||||||
|
parc.q,
|
||||||
|
parc.i,
|
||||||
|
parc.p,
|
||||||
|
b.montantLocatifAnnuelEstime,
|
||||||
|
b.valeurBatimentCalcule,
|
||||||
|
b.nbreUniteLogement
|
||||||
)
|
)
|
||||||
FROM EnqueteBatiment eb
|
FROM EnqueteBatiment eb
|
||||||
LEFT JOIN eb.batiment b
|
LEFT JOIN eb.batiment b
|
||||||
|
LEFT JOIN b.parcelle parc
|
||||||
LEFT JOIN eb.personne p
|
LEFT JOIN eb.personne p
|
||||||
LEFT JOIN eb.user u
|
LEFT JOIN eb.user u
|
||||||
LEFT JOIN eb.exercice ex
|
LEFT JOIN eb.exercice ex
|
||||||
@@ -256,10 +284,22 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
|||||||
eb.nombrePiscine,
|
eb.nombrePiscine,
|
||||||
eb.montantLocatifAnnuelCalcule,
|
eb.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
b.nub,
|
||||||
|
b.code,
|
||||||
|
b.dateConstruction,
|
||||||
|
parc.id,
|
||||||
|
parc.nup,
|
||||||
|
parc.q,
|
||||||
|
parc.i,
|
||||||
|
parc.p,
|
||||||
|
b.montantLocatifAnnuelEstime,
|
||||||
|
b.valeurBatimentCalcule,
|
||||||
|
b.nbreUniteLogement
|
||||||
)
|
)
|
||||||
FROM EnqueteBatiment eb
|
FROM EnqueteBatiment eb
|
||||||
LEFT JOIN eb.batiment b
|
LEFT JOIN eb.batiment b
|
||||||
|
LEFT JOIN b.parcelle parc
|
||||||
LEFT JOIN eb.personne p
|
LEFT JOIN eb.personne p
|
||||||
LEFT JOIN eb.user u
|
LEFT JOIN eb.user u
|
||||||
LEFT JOIN eb.exercice ex
|
LEFT JOIN eb.exercice ex
|
||||||
@@ -326,10 +366,22 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
|||||||
eb.nombrePiscine,
|
eb.nombrePiscine,
|
||||||
eb.montantLocatifAnnuelCalcule,
|
eb.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
b.nub,
|
||||||
|
b.code,
|
||||||
|
b.dateConstruction,
|
||||||
|
parc.id,
|
||||||
|
parc.nup,
|
||||||
|
parc.q,
|
||||||
|
parc.i,
|
||||||
|
parc.p,
|
||||||
|
b.montantLocatifAnnuelEstime,
|
||||||
|
b.valeurBatimentCalcule,
|
||||||
|
b.nbreUniteLogement
|
||||||
)
|
)
|
||||||
FROM EnqueteBatiment eb
|
FROM EnqueteBatiment eb
|
||||||
LEFT JOIN eb.batiment b
|
LEFT JOIN eb.batiment b
|
||||||
|
LEFT JOIN b.parcelle parc
|
||||||
LEFT JOIN eb.personne p
|
LEFT JOIN eb.personne p
|
||||||
LEFT JOIN eb.user u
|
LEFT JOIN eb.user u
|
||||||
LEFT JOIN eb.exercice ex
|
LEFT JOIN eb.exercice ex
|
||||||
@@ -393,10 +445,22 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
|||||||
eb.nombrePiscine,
|
eb.nombrePiscine,
|
||||||
eb.montantLocatifAnnuelCalcule,
|
eb.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
b.nub,
|
||||||
|
b.code,
|
||||||
|
b.dateConstruction,
|
||||||
|
parc.id,
|
||||||
|
parc.nup,
|
||||||
|
parc.q,
|
||||||
|
parc.i,
|
||||||
|
parc.p,
|
||||||
|
b.montantLocatifAnnuelEstime,
|
||||||
|
b.valeurBatimentCalcule,
|
||||||
|
b.nbreUniteLogement
|
||||||
)
|
)
|
||||||
FROM EnqueteBatiment eb
|
FROM EnqueteBatiment eb
|
||||||
LEFT JOIN eb.batiment b
|
LEFT JOIN eb.batiment b
|
||||||
|
LEFT JOIN b.parcelle parc
|
||||||
LEFT JOIN eb.personne p
|
LEFT JOIN eb.personne p
|
||||||
LEFT JOIN eb.user u
|
LEFT JOIN eb.user u
|
||||||
LEFT JOIN eb.exercice ex
|
LEFT JOIN eb.exercice ex
|
||||||
@@ -416,5 +480,172 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT DISTINCT
|
||||||
|
d.id AS departement_id,
|
||||||
|
d.code AS departement_code,
|
||||||
|
d.nom AS departement_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY d.id) AS nb_enquetes_departement,
|
||||||
|
|
||||||
|
c.id AS commune_id,
|
||||||
|
c.code AS commune_code,
|
||||||
|
c.nom AS commune_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY c.id) AS nb_enquetes_commune,
|
||||||
|
|
||||||
|
a.id AS arrondissement_id,
|
||||||
|
a.code AS arrondissement_code,
|
||||||
|
a.nom AS arrondissement_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY a.id) AS nb_enquetes_arrondissement,
|
||||||
|
|
||||||
|
q.id AS quartier_id,
|
||||||
|
q.code AS quartier_code,
|
||||||
|
q.nom AS quartier_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY q.id) AS nb_enquetes_quartier
|
||||||
|
|
||||||
|
FROM enquete_batiment eb
|
||||||
|
JOIN batiment b ON b.id = eb.batiment_id
|
||||||
|
JOIN parcelle p ON p.id = b.parcelle_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
|
||||||
|
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM secteur_decoupage sd
|
||||||
|
WHERE sd.quartier_id = q.id
|
||||||
|
AND sd.secteur_id IN (:secteurIds)
|
||||||
|
)
|
||||||
|
AND e.statut_enquete = :statutEnqueteParam
|
||||||
|
|
||||||
|
ORDER BY d.nom, c.nom, a.nom, q.nom;
|
||||||
|
""",
|
||||||
|
nativeQuery = true
|
||||||
|
)
|
||||||
|
List<ParcelleStatsProjectionUnSecteur> findStatsEnqueteBatimentBySecteurs(
|
||||||
|
@Param("secteurIds") List<Long> secteurIds,
|
||||||
|
@Param("statutEnqueteParam") String statutEnqueteParam
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb(
|
||||||
|
eb.id,
|
||||||
|
eb.observation,
|
||||||
|
eb.autreMenuisierie,
|
||||||
|
eb.autreMur,
|
||||||
|
eb.sbee,
|
||||||
|
eb.numCompteurSbee,
|
||||||
|
eb.soneb,
|
||||||
|
eb.numCompteurSoneb,
|
||||||
|
eb.nbreLotUnite,
|
||||||
|
eb.nbreUniteLocation,
|
||||||
|
eb.superficieLouee,
|
||||||
|
eb.superficieAuSol,
|
||||||
|
eb.dateEnquete,
|
||||||
|
eb.nbreMenage,
|
||||||
|
eb.nbreHabitant,
|
||||||
|
eb.montantMensuelLocation,
|
||||||
|
eb.montantLocatifAnnuelDeclare,
|
||||||
|
eb.nbreEtage,
|
||||||
|
eb.valeurBatimentEstime,
|
||||||
|
eb.valeurBatimentReel,
|
||||||
|
eb.nbreMoisLocation,
|
||||||
|
eb.autreCaracteristiquePhysique,
|
||||||
|
eb.dateDebutExcemption,
|
||||||
|
eb.dateFinExcemption,
|
||||||
|
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
|
||||||
|
p.id,
|
||||||
|
p.nom,
|
||||||
|
p.prenom,
|
||||||
|
p.raisonSociale,
|
||||||
|
|
||||||
|
u.id,
|
||||||
|
u.nom,
|
||||||
|
u.prenom,
|
||||||
|
eb.statutEnquete,
|
||||||
|
ex.id,
|
||||||
|
ex.annee,
|
||||||
|
eb.representantNom,
|
||||||
|
eb.representantPrenom,
|
||||||
|
eb.representantTel,
|
||||||
|
eb.representantNpi,
|
||||||
|
cb.id,
|
||||||
|
cb.code,
|
||||||
|
cb.standing,
|
||||||
|
eb.nombrePiscine,
|
||||||
|
eb.montantLocatifAnnuelCalcule,
|
||||||
|
us.id,
|
||||||
|
us.nom,
|
||||||
|
b.nub,
|
||||||
|
b.code,
|
||||||
|
b.dateConstruction,
|
||||||
|
parc.id,
|
||||||
|
parc.nup,
|
||||||
|
parc.q,
|
||||||
|
parc.i,
|
||||||
|
parc.p,
|
||||||
|
b.montantLocatifAnnuelEstime,
|
||||||
|
b.valeurBatimentCalcule,
|
||||||
|
b.nbreUniteLogement
|
||||||
|
)
|
||||||
|
FROM EnqueteBatiment eb
|
||||||
|
LEFT JOIN eb.batiment b
|
||||||
|
LEFT JOIN b.parcelle parc
|
||||||
|
LEFT JOIN parc.quartier q
|
||||||
|
LEFT JOIN eb.personne p
|
||||||
|
LEFT JOIN eb.user u
|
||||||
|
LEFT JOIN eb.exercice ex
|
||||||
|
LEFT JOIN eb.categorieBatiment cb
|
||||||
|
LEFT JOIN eb.usage us
|
||||||
|
INNER JOIN SecteurDecoupage sd on sd.quartier=q
|
||||||
|
WHERE sd.secteur.id IN (:secteurIds)
|
||||||
|
and q.id = :quartierId
|
||||||
|
and eb.statutEnquete = :statutEnquete
|
||||||
|
""",
|
||||||
|
countQuery = """
|
||||||
|
SELECT COUNT(DISTINCT eb.id)
|
||||||
|
FROM EnqueteBatiment eb
|
||||||
|
LEFT JOIN eb.batiment b
|
||||||
|
LEFT JOIN b.parcelle parc
|
||||||
|
LEFT JOIN parc.quartier q
|
||||||
|
INNER JOIN SecteurDecoupage sd on sd.quartier= q
|
||||||
|
WHERE sd.secteur.id IN (:secteurIds)
|
||||||
|
and q.id = :quartierId
|
||||||
|
and eb.statutEnquete = :statutEnquete
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
Page<EnqueteBatimentPayloadWeb> findAllEnqueteBatimentByQuartierByStatutToDtoPageable(
|
||||||
|
@Param("quartierId") Long quartierId,
|
||||||
|
@Param("secteurIds") List<Long> secteurIds,
|
||||||
|
@Param("statutEnquete") StatutEnquete statutEnquete,
|
||||||
|
Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT count(distinct eb.*)
|
||||||
|
FROM enquete_batiment eb
|
||||||
|
JOIN batiment b on b.id=eb.batiment_id
|
||||||
|
JOIN parcelle parc on parc.id=b.parcelle_id
|
||||||
|
JOIN quartier q on q.id=parc.quartier_id
|
||||||
|
JOIN secteur_decoupage sd on sd.quartier_id=q.id
|
||||||
|
WHERE sd.secteur_id IN (:secteurIds)
|
||||||
|
and eb.statut_enquete = :statutEnquete
|
||||||
|
""",
|
||||||
|
nativeQuery = true
|
||||||
|
)
|
||||||
|
Integer getNombreEnqueteBatimentByUserConnecte(
|
||||||
|
@Param("secteurIds") List<Long> secteurIds,
|
||||||
|
@Param("statutEnquete") String statutEnquete
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package io.gmss.fiscad.persistence.repositories.rfu.metier;
|
package io.gmss.fiscad.persistence.repositories.rfu.metier;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||||
|
import io.gmss.fiscad.enums.StatutEnquete;
|
||||||
|
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb;
|
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb;
|
||||||
import io.gmss.fiscad.paylaods.response.restoration.EnqueteUniteLogementPayLoadRestor;
|
import io.gmss.fiscad.paylaods.response.restoration.EnqueteUniteLogementPayLoadRestor;
|
||||||
|
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
@@ -118,10 +121,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
|||||||
eul.nombrePiscine,
|
eul.nombrePiscine,
|
||||||
eul.montantLocatifAnnuelCalcule,
|
eul.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
ul.nul,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.code,
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
ul.dateConstruction,
|
||||||
|
ul.montantLocatifAnnuelEstime,
|
||||||
|
ul.valeurUniteLogementCalcule
|
||||||
)
|
)
|
||||||
FROM EnqueteUniteLogement eul
|
FROM EnqueteUniteLogement eul
|
||||||
LEFT JOIN eul.uniteLogement ul
|
LEFT JOIN eul.uniteLogement ul
|
||||||
|
LEFT JOIN ul.batiment b
|
||||||
LEFT JOIN eul.personne p
|
LEFT JOIN eul.personne p
|
||||||
LEFT JOIN eul.user u
|
LEFT JOIN eul.user u
|
||||||
LEFT JOIN eul.exercice ex
|
LEFT JOIN eul.exercice ex
|
||||||
@@ -180,10 +192,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
|||||||
eul.nombrePiscine,
|
eul.nombrePiscine,
|
||||||
eul.montantLocatifAnnuelCalcule,
|
eul.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
ul.nul,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.code,
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
ul.dateConstruction,
|
||||||
|
ul.montantLocatifAnnuelEstime,
|
||||||
|
ul.valeurUniteLogementCalcule
|
||||||
)
|
)
|
||||||
FROM EnqueteUniteLogement eul
|
FROM EnqueteUniteLogement eul
|
||||||
LEFT JOIN eul.uniteLogement ul
|
LEFT JOIN eul.uniteLogement ul
|
||||||
|
LEFT JOIN ul.batiment b
|
||||||
LEFT JOIN eul.personne p
|
LEFT JOIN eul.personne p
|
||||||
LEFT JOIN eul.user u
|
LEFT JOIN eul.user u
|
||||||
LEFT JOIN eul.exercice ex
|
LEFT JOIN eul.exercice ex
|
||||||
@@ -243,10 +264,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
|||||||
eul.nombrePiscine,
|
eul.nombrePiscine,
|
||||||
eul.montantLocatifAnnuelCalcule,
|
eul.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
ul.nul,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.code,
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
ul.dateConstruction,
|
||||||
|
ul.montantLocatifAnnuelEstime,
|
||||||
|
ul.valeurUniteLogementCalcule
|
||||||
)
|
)
|
||||||
FROM EnqueteUniteLogement eul
|
FROM EnqueteUniteLogement eul
|
||||||
LEFT JOIN eul.uniteLogement ul
|
LEFT JOIN eul.uniteLogement ul
|
||||||
|
LEFT JOIN ul.batiment b
|
||||||
LEFT JOIN eul.personne p
|
LEFT JOIN eul.personne p
|
||||||
LEFT JOIN eul.user u
|
LEFT JOIN eul.user u
|
||||||
LEFT JOIN eul.exercice ex
|
LEFT JOIN eul.exercice ex
|
||||||
@@ -312,10 +342,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
|||||||
eul.nombrePiscine,
|
eul.nombrePiscine,
|
||||||
eul.montantLocatifAnnuelCalcule,
|
eul.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
ul.nul,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.code,
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
ul.dateConstruction,
|
||||||
|
ul.montantLocatifAnnuelEstime,
|
||||||
|
ul.valeurUniteLogementCalcule
|
||||||
)
|
)
|
||||||
FROM EnqueteUniteLogement eul
|
FROM EnqueteUniteLogement eul
|
||||||
LEFT JOIN eul.uniteLogement ul
|
LEFT JOIN eul.uniteLogement ul
|
||||||
|
LEFT JOIN ul.batiment b
|
||||||
LEFT JOIN eul.personne p
|
LEFT JOIN eul.personne p
|
||||||
LEFT JOIN eul.user u
|
LEFT JOIN eul.user u
|
||||||
LEFT JOIN eul.exercice ex
|
LEFT JOIN eul.exercice ex
|
||||||
@@ -377,10 +416,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
|||||||
eul.nombrePiscine,
|
eul.nombrePiscine,
|
||||||
eul.montantLocatifAnnuelCalcule,
|
eul.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
ul.nul,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.code,
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
ul.dateConstruction,
|
||||||
|
ul.montantLocatifAnnuelEstime,
|
||||||
|
ul.valeurUniteLogementCalcule
|
||||||
)
|
)
|
||||||
FROM EnqueteUniteLogement eul
|
FROM EnqueteUniteLogement eul
|
||||||
LEFT JOIN eul.uniteLogement ul
|
LEFT JOIN eul.uniteLogement ul
|
||||||
|
LEFT JOIN ul.batiment b
|
||||||
LEFT JOIN eul.personne p
|
LEFT JOIN eul.personne p
|
||||||
LEFT JOIN eul.user u
|
LEFT JOIN eul.user u
|
||||||
LEFT JOIN eul.exercice ex
|
LEFT JOIN eul.exercice ex
|
||||||
@@ -448,10 +496,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
|||||||
eul.nombrePiscine,
|
eul.nombrePiscine,
|
||||||
eul.montantLocatifAnnuelCalcule,
|
eul.montantLocatifAnnuelCalcule,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
ul.nul,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.code,
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
ul.dateConstruction,
|
||||||
|
ul.montantLocatifAnnuelEstime,
|
||||||
|
ul.valeurUniteLogementCalcule
|
||||||
)
|
)
|
||||||
FROM EnqueteUniteLogement eul
|
FROM EnqueteUniteLogement eul
|
||||||
LEFT JOIN eul.uniteLogement ul
|
LEFT JOIN eul.uniteLogement ul
|
||||||
|
LEFT JOIN ul.batiment b
|
||||||
LEFT JOIN eul.personne p
|
LEFT JOIN eul.personne p
|
||||||
LEFT JOIN eul.user u
|
LEFT JOIN eul.user u
|
||||||
LEFT JOIN eul.exercice ex
|
LEFT JOIN eul.exercice ex
|
||||||
@@ -513,10 +570,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
|||||||
eul.nombrePiscine,
|
eul.nombrePiscine,
|
||||||
eul.montantLocatifAnnuelCalcule ,
|
eul.montantLocatifAnnuelCalcule ,
|
||||||
us.id,
|
us.id,
|
||||||
us.nom
|
us.nom,
|
||||||
|
ul.nul,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.code,
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
ul.dateConstruction,
|
||||||
|
ul.montantLocatifAnnuelEstime,
|
||||||
|
ul.valeurUniteLogementCalcule
|
||||||
)
|
)
|
||||||
FROM EnqueteUniteLogement eul
|
FROM EnqueteUniteLogement eul
|
||||||
LEFT JOIN eul.uniteLogement ul
|
LEFT JOIN eul.uniteLogement ul
|
||||||
|
LEFT JOIN ul.batiment b
|
||||||
LEFT JOIN eul.personne p
|
LEFT JOIN eul.personne p
|
||||||
LEFT JOIN eul.user u
|
LEFT JOIN eul.user u
|
||||||
LEFT JOIN eul.exercice ex
|
LEFT JOIN eul.exercice ex
|
||||||
@@ -535,4 +601,171 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
|||||||
Pageable pageable
|
Pageable pageable
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT DISTINCT
|
||||||
|
d.id AS departement_id,
|
||||||
|
d.code AS departement_code,
|
||||||
|
d.nom AS departement_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY d.id) AS nb_enquetes_departement,
|
||||||
|
|
||||||
|
c.id AS commune_id,
|
||||||
|
c.code AS commune_code,
|
||||||
|
c.nom AS commune_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY c.id) AS nb_enquetes_commune,
|
||||||
|
|
||||||
|
a.id AS arrondissement_id,
|
||||||
|
a.code AS arrondissement_code,
|
||||||
|
a.nom AS arrondissement_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY a.id) AS nb_enquetes_arrondissement,
|
||||||
|
|
||||||
|
q.id AS quartier_id,
|
||||||
|
q.code AS quartier_code,
|
||||||
|
q.nom AS quartier_nom,
|
||||||
|
COUNT(e.id) OVER (PARTITION BY q.id) AS nb_enquetes_quartier
|
||||||
|
|
||||||
|
FROM enquete_unite_logement eul
|
||||||
|
JOIN unite_logement ul on ul.id = eul.unite_logement_id
|
||||||
|
JOIN batiment b ON b.id = ul.batiment_id
|
||||||
|
JOIN parcelle p ON p.id = b.parcelle_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
|
||||||
|
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM secteur_decoupage sd
|
||||||
|
WHERE sd.quartier_id = q.id
|
||||||
|
AND sd.secteur_id IN (:secteurIds)
|
||||||
|
)
|
||||||
|
AND e.statut_enquete = :statutEnqueteParam
|
||||||
|
|
||||||
|
ORDER BY d.nom, c.nom, a.nom, q.nom;
|
||||||
|
""",
|
||||||
|
nativeQuery = true
|
||||||
|
)
|
||||||
|
List<ParcelleStatsProjectionUnSecteur> findStatsEnqueteBatimentBySecteurs(
|
||||||
|
@Param("secteurIds") List<Long> secteurIds,
|
||||||
|
@Param("statutEnqueteParam") String statutEnqueteParam
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb(
|
||||||
|
eul.id,
|
||||||
|
eul.observation,
|
||||||
|
eul.nbrePiece,
|
||||||
|
eul.nbreHabitant,
|
||||||
|
eul.nbreMenage,
|
||||||
|
eul.enLocation,
|
||||||
|
eul.nbreMoisLocation,
|
||||||
|
eul.montantMensuelLocation,
|
||||||
|
eul.montantLocatifAnnuelDeclare,
|
||||||
|
eul.valeurUniteLogementEstime,
|
||||||
|
eul.valeurUniteLogementReel,
|
||||||
|
eul.superficieLouee,
|
||||||
|
eul.superficieAuSol,
|
||||||
|
eul.dateEnquete,
|
||||||
|
eul.sbee,
|
||||||
|
eul.soneb,
|
||||||
|
eul.numCompteurSbee,
|
||||||
|
eul.numCompteurSoneb,
|
||||||
|
eul.dateDebutExemption,
|
||||||
|
eul.dateFinExemption,
|
||||||
|
|
||||||
|
ul.id,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.nul,
|
||||||
|
|
||||||
|
p.id,
|
||||||
|
p.nom,
|
||||||
|
p.prenom,
|
||||||
|
p.raisonSociale,
|
||||||
|
|
||||||
|
u.id,
|
||||||
|
u.nom,
|
||||||
|
u.prenom,
|
||||||
|
|
||||||
|
ex.id,
|
||||||
|
ex.annee,
|
||||||
|
eul.statutEnquete,
|
||||||
|
eul.representantNom,
|
||||||
|
eul.representantPrenom,
|
||||||
|
eul.representantTel,
|
||||||
|
eul.representantNpi,
|
||||||
|
cb.id,
|
||||||
|
cb.code,
|
||||||
|
cb.standing,
|
||||||
|
eul.nombrePiscine,
|
||||||
|
eul.montantLocatifAnnuelCalcule ,
|
||||||
|
us.id,
|
||||||
|
us.nom,
|
||||||
|
ul.nul,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.code,
|
||||||
|
b.id,
|
||||||
|
b.nub,
|
||||||
|
ul.dateConstruction,
|
||||||
|
ul.montantLocatifAnnuelEstime,
|
||||||
|
ul.valeurUniteLogementCalcule
|
||||||
|
)
|
||||||
|
FROM EnqueteUniteLogement eul
|
||||||
|
JOIN eul.uniteLogement ul
|
||||||
|
JOIN ul.batiment b
|
||||||
|
JOIN b.parcelle parc
|
||||||
|
JOIN parc.quartier q
|
||||||
|
LEFT JOIN eul.personne p
|
||||||
|
LEFT JOIN eul.user u
|
||||||
|
LEFT JOIN eul.exercice ex
|
||||||
|
LEFT JOIN eul.categorieBatiment cb
|
||||||
|
LEFT JOIN eul.usage us
|
||||||
|
INNER JOIN SecteurDecoupage sd on sd.quartier=q
|
||||||
|
WHERE sd.secteur.id IN (:secteurIds)
|
||||||
|
and q.id = :quartierId
|
||||||
|
and eul.statutEnquete = :statutEnquete
|
||||||
|
""",
|
||||||
|
countQuery = """
|
||||||
|
SELECT COUNT(DISTINCT eul.id)
|
||||||
|
FROM EnqueteUniteLogement eul
|
||||||
|
JOIN eul.uniteLogement ul
|
||||||
|
JOIN ul.batiment b
|
||||||
|
JOIN b.parcelle parc
|
||||||
|
JOIN parc.quartier q
|
||||||
|
INNER JOIN SecteurDecoupage sd on sd.quartier= q
|
||||||
|
WHERE sd.secteur.id IN (:secteurIds)
|
||||||
|
and q.id = :quartierId
|
||||||
|
and eul.statutEnquete = :statutEnquete
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
Page<EnqueteUniteLogementPayloadWeb> findAllEnqueteUniteLogementByQuartierByStatutToDtoPageable(
|
||||||
|
@Param("quartierId") Long quartierId,
|
||||||
|
@Param("secteurIds") List<Long> secteurIds,
|
||||||
|
@Param("statutEnquete") StatutEnquete statutEnquete,
|
||||||
|
Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT count(distinct eul.*)
|
||||||
|
FROM enquete_unite_logement eul
|
||||||
|
JOIN unite_logement ul on ul.id=eul.unite_logement_id
|
||||||
|
JOIN batiment b on b.id=ul.batiment_id
|
||||||
|
JOIN parcelle parc on parc.id=b.parcelle_id
|
||||||
|
JOIN quartier q on q.id=parc.quartier_id
|
||||||
|
JOIN secteur_decoupage sd on sd.quartier_id=q.id
|
||||||
|
WHERE sd.secteur_id IN (:secteurIds)
|
||||||
|
and eul.statut_enquete = :statutEnquete
|
||||||
|
""",
|
||||||
|
nativeQuery = true
|
||||||
|
)
|
||||||
|
Integer getNombreEnqueteUniteLogementByUserConnecte(
|
||||||
|
@Param("secteurIds") List<Long> secteurIds,
|
||||||
|
@Param("statutEnquete") String statutEnquete
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,4 +348,125 @@ public interface UniteLogementRepository extends JpaRepository<UniteLogement, Lo
|
|||||||
""")
|
""")
|
||||||
List<UniteLogementPaylaodWeb> findAllUnitesLogementAvecOccupantCourantByParcelleToDto(@Param("parcelleId") Long parcelleId);
|
List<UniteLogementPaylaodWeb> findAllUnitesLogementAvecOccupantCourantByParcelleToDto(@Param("parcelleId") Long parcelleId);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
value = """
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.UniteLogementPaylaodWeb(
|
||||||
|
ul.id,
|
||||||
|
ul.nul,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.code,
|
||||||
|
|
||||||
|
b.id,
|
||||||
|
eul.superficieAuSol,
|
||||||
|
eul.superficieLouee,
|
||||||
|
b.nub,
|
||||||
|
eul.observation,
|
||||||
|
ul.dateConstruction,
|
||||||
|
|
||||||
|
per.id,
|
||||||
|
per.nom,
|
||||||
|
per.prenom,
|
||||||
|
per.raisonSociale,
|
||||||
|
eul.id,
|
||||||
|
cb.id,
|
||||||
|
cb.code,
|
||||||
|
cb.standing,
|
||||||
|
eul.montantMensuelLocation,
|
||||||
|
eul.montantLocatifAnnuelDeclare,
|
||||||
|
eul.montantLocatifAnnuelCalcule,
|
||||||
|
eul.valeurUniteLogementEstime,
|
||||||
|
eul.valeurUniteLogementReel,
|
||||||
|
eul.nombrePiscine ,
|
||||||
|
us.id,
|
||||||
|
us.nom ,
|
||||||
|
eul.montantLocatifAnnuelEstime ,
|
||||||
|
eul.valeurUniteLogementCalcule
|
||||||
|
)
|
||||||
|
FROM UniteLogement ul
|
||||||
|
JOIN ul.batiment b
|
||||||
|
JOIN b.parcelle p
|
||||||
|
JOIN p.quartier q
|
||||||
|
LEFT JOIN ul.categorieBatiment cb
|
||||||
|
LEFT JOIN EnqueteUniteLogement eul
|
||||||
|
ON eul.uniteLogement = ul
|
||||||
|
AND eul.dateEnquete = (
|
||||||
|
SELECT MAX(eul2.dateEnquete)
|
||||||
|
FROM EnqueteUniteLogement eul2
|
||||||
|
WHERE eul2.uniteLogement = ul
|
||||||
|
)
|
||||||
|
LEFT JOIN eul.personne per
|
||||||
|
LEFT JOIN eul.usage us
|
||||||
|
WHERE q.id = :quartierId
|
||||||
|
""",
|
||||||
|
countQuery = """
|
||||||
|
SELECT COUNT(ul)
|
||||||
|
FROM UniteLogement ul
|
||||||
|
JOIN ul.batiment b
|
||||||
|
JOIN b.parcelle p
|
||||||
|
JOIN p.quartier q
|
||||||
|
WHERE q.id = :quartierId
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
Page<UniteLogementPaylaodWeb> findUnitesLogementAvecOccupantCourantByQuartierToDtoPageable(
|
||||||
|
@Param("quartierId") Long quartierId,
|
||||||
|
Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
"""
|
||||||
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.UniteLogementPaylaodWeb(
|
||||||
|
ul.id,
|
||||||
|
ul.nul,
|
||||||
|
ul.numeroEtage,
|
||||||
|
ul.code,
|
||||||
|
|
||||||
|
b.id,
|
||||||
|
eul.superficieAuSol,
|
||||||
|
eul.superficieLouee,
|
||||||
|
b.nub,
|
||||||
|
eul.observation,
|
||||||
|
ul.dateConstruction,
|
||||||
|
|
||||||
|
per.id,
|
||||||
|
per.nom,
|
||||||
|
per.prenom,
|
||||||
|
per.raisonSociale,
|
||||||
|
eul.id,
|
||||||
|
cb.id,
|
||||||
|
cb.code,
|
||||||
|
cb.standing,
|
||||||
|
eul.montantMensuelLocation,
|
||||||
|
eul.montantLocatifAnnuelDeclare,
|
||||||
|
eul.montantLocatifAnnuelCalcule,
|
||||||
|
eul.valeurUniteLogementEstime,
|
||||||
|
eul.valeurUniteLogementReel,
|
||||||
|
eul.nombrePiscine ,
|
||||||
|
us.id,
|
||||||
|
us.nom ,
|
||||||
|
eul.montantLocatifAnnuelEstime ,
|
||||||
|
eul.valeurUniteLogementCalcule
|
||||||
|
)
|
||||||
|
FROM UniteLogement ul
|
||||||
|
JOIN ul.batiment b
|
||||||
|
JOIN b.parcelle p
|
||||||
|
JOIN p.quartier q
|
||||||
|
LEFT JOIN ul.categorieBatiment cb
|
||||||
|
LEFT JOIN EnqueteUniteLogement eul
|
||||||
|
ON eul.uniteLogement = ul
|
||||||
|
AND eul.dateEnquete = (
|
||||||
|
SELECT MAX(eul2.dateEnquete)
|
||||||
|
FROM EnqueteUniteLogement eul2
|
||||||
|
WHERE eul2.uniteLogement = ul
|
||||||
|
)
|
||||||
|
LEFT JOIN eul.personne per
|
||||||
|
LEFT JOIN eul.usage us
|
||||||
|
WHERE q.id = :quartierId
|
||||||
|
"""
|
||||||
|
|
||||||
|
)
|
||||||
|
List<UniteLogementPaylaodWeb> findUnitesLogementAvecOccupantCourantByQuartierToDto(
|
||||||
|
@Param("quartierId") Long quartierId
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ package io.gmss.fiscad.service;
|
|||||||
|
|
||||||
import io.gmss.fiscad.controllers.rfu.metier.ImpositionsTfuController;
|
import io.gmss.fiscad.controllers.rfu.metier.ImpositionsTfuController;
|
||||||
import io.gmss.fiscad.entities.decoupage.*;
|
import io.gmss.fiscad.entities.decoupage.*;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
import io.gmss.fiscad.entities.infocad.metier.*;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Piece;
|
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.*;
|
import io.gmss.fiscad.entities.infocad.parametre.*;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.*;
|
import io.gmss.fiscad.entities.rfu.metier.*;
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.*;
|
import io.gmss.fiscad.entities.rfu.parametre.*;
|
||||||
@@ -18,10 +15,7 @@ import io.gmss.fiscad.exceptions.BadRequestException;
|
|||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.*;
|
import io.gmss.fiscad.paylaods.request.crudweb.*;
|
||||||
import io.gmss.fiscad.persistence.repositories.decoupage.*;
|
import io.gmss.fiscad.persistence.repositories.decoupage.*;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
import io.gmss.fiscad.persistence.repositories.infocad.metier.*;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.PieceRepository;
|
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.*;
|
import io.gmss.fiscad.persistence.repositories.infocad.parametre.*;
|
||||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.*;
|
import io.gmss.fiscad.persistence.repositories.rfu.metier.*;
|
||||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuNonBatiRepository;
|
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuNonBatiRepository;
|
||||||
@@ -77,6 +71,9 @@ public class EntityFromPayLoadService {
|
|||||||
private final BaremRfuRepository baremRfuRepository ;
|
private final BaremRfuRepository baremRfuRepository ;
|
||||||
private final BaremRfuNonBatiRepository baremRfuNonBatiRepository ;
|
private final BaremRfuNonBatiRepository baremRfuNonBatiRepository ;
|
||||||
private final ImpositionsTfuRepository impositionsTfuRepository ;
|
private final ImpositionsTfuRepository impositionsTfuRepository ;
|
||||||
|
private final RueRepository rueRepository ;
|
||||||
|
private final NatureDomaineRepository natureDomaineRepository ;
|
||||||
|
private final TypeDomaineRepository typeDomaineRepository ;
|
||||||
|
|
||||||
|
|
||||||
public CaracteristiqueParcelle getCaracteristiqueParcelleFromPayLoadWeb(CaracteristiqueParcellePayloadWeb caracteristiqueParcellePayloadWeb){
|
public CaracteristiqueParcelle getCaracteristiqueParcelleFromPayLoadWeb(CaracteristiqueParcellePayloadWeb caracteristiqueParcellePayloadWeb){
|
||||||
@@ -860,6 +857,7 @@ public class EntityFromPayLoadService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public BaremRfuBati getBaremRfuBatiFromPayLoadWeb(BaremRfuBatiPayloadWeb baremRfuBatiPayloadWeb){
|
public BaremRfuBati getBaremRfuBatiFromPayLoadWeb(BaremRfuBatiPayloadWeb baremRfuBatiPayloadWeb){
|
||||||
BaremRfuBati baremRfuBati = new BaremRfuBati();
|
BaremRfuBati baremRfuBati = new BaremRfuBati();
|
||||||
if (baremRfuBatiPayloadWeb.getId()!=null)
|
if (baremRfuBatiPayloadWeb.getId()!=null)
|
||||||
@@ -960,4 +958,43 @@ public class EntityFromPayLoadService {
|
|||||||
|
|
||||||
return baremRfuNonBati;
|
return baremRfuNonBati;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Parcelle getParcelleFromPayload(ParcellePayLoadWeb parcellePayLoadWeb) {
|
||||||
|
Parcelle parcelle = new Parcelle();
|
||||||
|
if (parcellePayLoadWeb.getId() != null)
|
||||||
|
parcelle = parcelleRepository.findById(parcellePayLoadWeb.getId()).orElse(new Parcelle());
|
||||||
|
|
||||||
|
if (parcellePayLoadWeb.getRueId() != null) {
|
||||||
|
Optional<Rue> optionalRue = rueRepository.findById(parcellePayLoadWeb.getRueId());
|
||||||
|
parcelle.setRue(optionalRue.orElse(null));
|
||||||
|
}
|
||||||
|
Optional<NatureDomaine> optionalNatureDomaine = natureDomaineRepository.findById(parcellePayLoadWeb.getNatureDomaineId());
|
||||||
|
if (optionalNatureDomaine.isPresent()) {
|
||||||
|
parcelle.setNatureDomaine(optionalNatureDomaine.orElse(null));
|
||||||
|
}
|
||||||
|
Optional<Quartier> optionalQuartier = quartierRepository.findById(parcellePayLoadWeb.getQuartierId());
|
||||||
|
if (!optionalQuartier.isPresent()) {
|
||||||
|
parcelle.setQuartier(optionalQuartier.orElse(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
Optional<TypeDomaine> optionalTypeDomaine = typeDomaineRepository.findById(parcellePayLoadWeb.getTypeDomaineId());
|
||||||
|
if (!optionalTypeDomaine.isPresent()) {
|
||||||
|
parcelle.setTypeDomaine(optionalTypeDomaine.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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user