Compare commits
97 Commits
features/c
...
e58e338123
| Author | SHA1 | Date | |
|---|---|---|---|
| e58e338123 | |||
| db8b38b1c0 | |||
| afc44b95fb | |||
| 253332bbd3 | |||
| faf2ccdb8f | |||
| 6dcd549889 | |||
| 04ca166db4 | |||
| 6ba1365148 | |||
| 0d27aaebac | |||
| 0d5f7bba1c | |||
| afbf525af5 | |||
| 8ee2f7c9b0 | |||
| 6bdfa3ad1e | |||
| b8ba15c6fb | |||
| 698b7e7c99 | |||
| 9e597386f8 | |||
| cb2faeea32 | |||
| 6b3ab8fc43 | |||
| 906a74571f | |||
| 6494fe235e | |||
| 28da361054 | |||
| 3993d28d51 | |||
| 09d8b21909 | |||
| 274b47d116 | |||
| bdb08b88fd | |||
| b86c685cd0 | |||
| d46a14626e | |||
| 920c70c877 | |||
| 2ab5b9299c | |||
| bf19ab6e6a | |||
| 84451d5a15 | |||
| e687a9a904 | |||
| 9685c73513 | |||
| 650470efff | |||
| 9f5cc61726 | |||
| 41175d93f0 | |||
| 1ecaecdee3 | |||
| 122dfcbead | |||
| d168b68d4b | |||
| 2af14dd4cd | |||
| 76f0d34e79 | |||
| 666779ecce | |||
| 7fcd676fc0 | |||
| fffdef7103 | |||
| 95c0dacd1e | |||
| 7ac6b953d3 | |||
| e010100472 | |||
| 177a9c7b56 | |||
| 3054930a86 | |||
| 4397abd041 | |||
| a4b403ca20 | |||
| ff7b88f9f8 | |||
| 37fdba1d85 | |||
| f50ed9aa5f | |||
| 966fd2ca7a | |||
| a10253b2e8 | |||
| 08b68f9e08 | |||
| be487d6a03 | |||
| 3be64e7f44 | |||
| 03a661cdc0 | |||
| a68ec444cc | |||
| 58f517bf31 | |||
| 7f18f22efb | |||
| af3218412f | |||
| f35670c72e | |||
| a77c0e854d | |||
| e75eff4e20 | |||
| 40d078c653 | |||
| 31dd11d017 | |||
| 6dfd12fae8 | |||
| a4ad0a4556 | |||
| 411a6c0c2d | |||
| bed73b2b16 | |||
| 5a0814a0ba | |||
| 126254ea94 | |||
| f9e4681af4 | |||
| 84089d3639 | |||
| 02b0a937b4 | |||
| c0096457fb | |||
| b6062ba4d1 | |||
| 8dc8c974d3 | |||
| 957416df9e | |||
| 8d8af75108 | |||
| 555f13508e | |||
| d92a2b2503 | |||
| 5ccfdb6a3f | |||
| 87b3bfbe83 | |||
| 62f25ea726 | |||
| 6125fcbd0b | |||
| 211af6103a | |||
| d27b622db8 | |||
| c80b40082c | |||
| 4a88af6487 | |||
| 966b0af1c2 | |||
| 58aa088ac3 | |||
| 033b430051 | |||
| b8dbc7f625 |
@@ -1,6 +1,7 @@
|
||||
package io.gmss.fiscad.controllers.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
@@ -248,4 +249,221 @@ public class SecteurDecoupageController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-en-cours/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteEncoursByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteDecoupageByUserId(userId, StatutEnquete.EN_COURS.toString()), "SecteurDecoupage trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-valide/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteValideByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteDecoupageByUserId(userId, StatutEnquete.VALIDE.toString()), "SecteurDecoupage trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-cloture/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteClotureByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteDecoupageByUserId(userId, StatutEnquete.CLOTURE.toString()), "SecteurDecoupage trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-batiment-en-cours/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteBatimentEncoursByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteBatimentDecoupageByUserId(userId, StatutEnquete.EN_COURS.toString()), "SecteurDecoupage trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-batiment-valide/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteBatimentValideByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteBatimentDecoupageByUserId(userId, StatutEnquete.VALIDE.toString()), "SecteurDecoupage trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-batiment-cloture/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteBatimentClotureByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteBatimentDecoupageByUserId(userId, StatutEnquete.CLOTURE.toString()), "SecteurDecoupage trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-unitlog-en-cours/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteUniteLogEncoursByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteUniteLogementDecoupageByUserId(userId, StatutEnquete.EN_COURS.toString()), "SecteurDecoupage trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-unitlog-valide/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteUniteLogValideByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteUniteLogementDecoupageByUserId(userId, StatutEnquete.VALIDE.toString()), "SecteurDecoupage trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/arbre/enquete-unitlog-cloture/user-id/{userId}")
|
||||
public ResponseEntity<?> getArborescenceEnqueteUniteLigClotureByUserId(@PathVariable Long userId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, secteurDecoupageService.getStatEnqueteUniteLogementDecoupageByUserId(userId, StatutEnquete.CLOTURE.toString()), "SecteurDecoupage trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.controllers.infocad.metier;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
@@ -67,7 +68,8 @@ public class EnqueteController {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -122,6 +124,7 @@ public class EnqueteController {
|
||||
@PutMapping("/rejet")
|
||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteBatimentService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -20,6 +24,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/enquete-batiment", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@@ -51,6 +57,7 @@ public class EnqueteBatimentController {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
@@ -223,4 +230,159 @@ public class EnqueteBatimentController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/en-cours/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllEnqueteBatimentEnCoursByQuartierPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentListByQuartierByStatutPageableToDto(userId,quartierId, StatutEnquete.EN_COURS, pageable), "Liste des enquetes en cours chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged/cloture/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllEnqueteBatimentClotureByQuartierPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentListByQuartierByStatutPageableToDto(userId,quartierId, StatutEnquete.CLOTURE, pageable), "Liste des enquetes en cours chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/validation")
|
||||
public ResponseEntity<?> validerEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.validerEnquete(enqueteTraitementPayLoad), "Validation effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet")
|
||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/validation-lot")
|
||||
public ResponseEntity<?> validerEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.validerEnquete(enqueteTraitementPayLoads), "Validation effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet-lot")
|
||||
public ResponseEntity<?> rejeterEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteBatimentService.rejeterEnquete(enqueteTraitementPayLoads), "Rejet effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteUniteLogementService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -20,6 +24,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/enquete-unite-logement", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@@ -223,4 +229,160 @@ public class EnqueteUniteLogementController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/en-cours/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllEnqueteUniteLogementEncoursByQuartierPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementListByQuartierByStatutPageableToDto(userId,quartierId, StatutEnquete.EN_COURS, pageable), "Liste des enquetes en cours chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all-paged/cloture/by-quartier-id/{quartierId}")
|
||||
public ResponseEntity<?> getAllEnqueteUniteLogementClotureByQuartierPaged(@CurrentUser UserPrincipal currentUser, @PathVariable Long quartierId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementListByQuartierByStatutPageableToDto(userId,quartierId, StatutEnquete.CLOTURE, pageable), "Liste des enquetes en cours chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/validation")
|
||||
public ResponseEntity<?> validerEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.validerEnquete(enqueteTraitementPayLoad), "Validation effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet")
|
||||
public ResponseEntity<?> rejeterEnquete(@RequestBody EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
try {
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/validation-lot")
|
||||
public ResponseEntity<?> validerEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.validerEnquete(enqueteTraitementPayLoads), "Validation effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/rejet-lot")
|
||||
public ResponseEntity<?> rejeterEnqueteParLot(@RequestBody List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteUniteLogementService.rejeterEnquete(enqueteTraitementPayLoads), "Rejet effectuée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package io.gmss.fiscad.controllers.statistique;
|
||||
|
||||
import io.gmss.fiscad.enums.NiveauDecoupage;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.security.CurrentUser;
|
||||
import io.gmss.fiscad.security.UserPrincipal;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -174,4 +177,77 @@ public class StatistiqueController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "Statistique des enquetes en cours par object ",
|
||||
description = "Donnes le nombre d'enquetes en coures par objet"
|
||||
)
|
||||
@GetMapping(path = "/nombre-enquete/par-objet/en-cours")
|
||||
public ResponseEntity<?> getStatistiquesEnqueteEnCoursParObjet(@CurrentUser UserPrincipal currentUser) {
|
||||
try {
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, statistiquesService.getStatNombreEnqueteParObjetUserConnect(userId,StatutEnquete.EN_COURS.toString()), "Statistique des personne par type."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "Statistique des enquetes en cours par object ",
|
||||
description = "Donnes le nombre d'enquetes en coures par objet"
|
||||
)
|
||||
@GetMapping(path = "/nombre-enquete/par-objet/cloture")
|
||||
public ResponseEntity<?> getStatistiquesEnqueteClotureParObjet(@CurrentUser UserPrincipal currentUser) {
|
||||
try {
|
||||
if(currentUser==null)
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true,null, "Vous ne pouvez pas accéder à cette ressource"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
Long userId = currentUser.getUser().getId();
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, statistiquesService.getStatNombreEnqueteParObjetUserConnect(userId, StatutEnquete.CLOTURE.toString()), "Statistique des personne par type."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class Parcelle extends BaseEntity implements Serializable {
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
private String autreNumeroTitreFoncier;
|
||||
private Long numeroProvisoire;
|
||||
private String numeroProvisoire;
|
||||
private Long blocId;
|
||||
@ColumnDefault("false")
|
||||
private boolean synchronise;
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -88,7 +89,7 @@ public class Piece extends BaseEntity implements Serializable {
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "piece")
|
||||
private List<Upload> uploads;
|
||||
private List<Upload> uploads=new ArrayList<>();
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@@ -103,4 +104,9 @@ public class Piece extends BaseEntity implements Serializable {
|
||||
private boolean synchronise;
|
||||
private String observation;
|
||||
|
||||
private Long nombreFichier;
|
||||
|
||||
public Long getNombreFichier() {
|
||||
return uploads==null? 0l:uploads.size() ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,21 +74,20 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
private int superficieParc;
|
||||
private Long superficieAuSolBat;
|
||||
private Long superficieAuSolUlog;
|
||||
//private String batieOuiNon;
|
||||
//private String exhonereOuiNon;
|
||||
//private String batimentExhonereOuiNon;
|
||||
//private String uniteLogementExhonereOuiNon;
|
||||
private Boolean batie;
|
||||
private Boolean exonere;
|
||||
private Boolean batimentExonere;
|
||||
private Boolean uniteLogementExonere;
|
||||
private Long valeurLocativeAdm;
|
||||
private Long valeurLocativeAdm70Pour100;
|
||||
private Long valeurLocativeAdmTauxPropParc;
|
||||
private Long valeurLocativeAdmSupReel;
|
||||
private Long superficieAuSolTauxPropParc;
|
||||
private Long valeurLocativeAdmMetreCarre;
|
||||
private Long montantLoyerAnnuel;
|
||||
private Long tfuMetreCarre;
|
||||
private Long tfuMinimum;
|
||||
private String standingBat;
|
||||
private String categorieUsage;
|
||||
private String categorieBat;
|
||||
private Long nombrePiscine;
|
||||
private Long nombreUlog;
|
||||
@@ -97,15 +96,11 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
private Long enqueteId;
|
||||
//private Long structureId;
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "structure_id")
|
||||
private Structure structure ;
|
||||
|
||||
private Long secteurId;
|
||||
|
||||
//private Long zoneRfuId;
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "zone_rfu_id")
|
||||
private ZoneRfu zoneRfu ;
|
||||
@@ -113,7 +108,10 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
@ColumnDefault("0")
|
||||
private Long valeurAdminParcelleNb;
|
||||
private Float tauxTfu;
|
||||
private Long tfuPiscine;
|
||||
private Float montantTaxe;
|
||||
private Float tfuCalculeTauxPropParc;
|
||||
private Float tfuSuperficieAuSolReel;
|
||||
private Long valeurAdminParcelleNbMetreCarre;
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@@ -123,4 +121,19 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
private NatureImpot natureImpot;
|
||||
private Long valeurBatiment;
|
||||
private Long valeurParcelle;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "parcelle_id")
|
||||
private Parcelle parcelleImposee ;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "batiment_id")
|
||||
private Batiment batimentImpose ;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "unite_logement_id")
|
||||
private UniteLogement uniteLogementImposee ;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,14 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateValidation;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateRejet;
|
||||
private String descriptionMotifRejet;
|
||||
@ManyToOne
|
||||
private Exercice exercice;
|
||||
|
||||
|
||||
@@ -73,6 +73,15 @@ public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateValidation;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateRejet;
|
||||
private String descriptionMotifRejet;
|
||||
private String observation;
|
||||
private Long uniteLogementExternalKey;
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public class UniteLogement extends BaseEntity implements Serializable {
|
||||
private Long montantLocatifAnnuelDeclare;
|
||||
private Long montantLocatifAnnuelCalcule;
|
||||
private Long valeurUniteLogementEstime;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long valeurUniteLogementReel;
|
||||
private Long valeurUniteLogementCalcule;
|
||||
private Integer nombrePiscine;
|
||||
|
||||
@@ -13,7 +13,8 @@ public enum ParametersType {
|
||||
OBJET_CREATE_ACCOUNT,
|
||||
CORPS_CREATE_ACCOUNT,
|
||||
TOKEN_IFU_EN_LIGNE,
|
||||
TAUX_TFU_HABITATION,
|
||||
TAUX_TFU_PROFESSIONNELLE,
|
||||
TAUX_DEFAUT_SUPERFICIE_AU_SOL;
|
||||
TAUX_TFU,
|
||||
TAUX_VALEUR_LOCATIVE_PROFESSIONNELLE,
|
||||
TAUX_DEFAUT_SUPERFICIE_AU_SOL,
|
||||
TFU_PAR_PISCINE;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.gmss.fiscad.enums;
|
||||
|
||||
public enum StatutEnquete {
|
||||
EN_COURS,
|
||||
// DECLARATION,
|
||||
FINALISE,
|
||||
REJETE,
|
||||
VALIDE,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum StatutParcelle {
|
||||
NON_ENQUETER,
|
||||
NON_ENQUETE,
|
||||
AJOUR,
|
||||
NON_AJOUR;
|
||||
}
|
||||
|
||||
@@ -2,15 +2,18 @@ package io.gmss.fiscad.implementations.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
||||
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||
import io.gmss.fiscad.persistence.repositories.decoupage.SecteurDecoupageRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteUniteLogementRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -26,6 +29,9 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
||||
private final SecteurDecoupageRepository secteurDecoupageRepository;
|
||||
private final SecteurService secteurService;
|
||||
private final ParcelleRepository parcelleRepository;
|
||||
private final EnqueteRepository enqueteRepository;
|
||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
|
||||
@@ -112,4 +118,35 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
||||
|
||||
return parcelleStatsProjectionUnSecteurs ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteDecoupageByUserId(Long userId, String statutEnquete) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
System.out.println(statutEnquete);
|
||||
return enqueteRepository.findStatsEnqueteBySecteurs(secteurIds,statutEnquete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteBatimentDecoupageByUserId(Long userId, String statutEnquete) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
System.out.println(statutEnquete);
|
||||
return enqueteBatimentRepository.findStatsEnqueteBatimentBySecteurs(secteurIds,statutEnquete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleStatsProjectionUnSecteur> getStatEnqueteUniteLogementDecoupageByUserId(Long userId, String statutEnquete) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
return enqueteUniteLogementRepository.findStatsEnqueteBatimentBySecteurs(secteurIds,statutEnquete);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.implementations.infocad.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.*;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueParcelle;
|
||||
@@ -13,7 +14,9 @@ import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.ApplicationException;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.ParcelleService;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.PieceService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueParcelleService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DeclarationNcService;
|
||||
@@ -23,6 +26,7 @@ import io.gmss.fiscad.interfaces.user.UserService;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.* ;
|
||||
import io.gmss.fiscad.paylaods.response.FicheResponse.* ;
|
||||
import io.gmss.fiscad.paylaods.response.synchronisation.EnqueteNonSyncResponse;
|
||||
@@ -44,6 +48,7 @@ import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.persistence.Query;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.NotAcceptableException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -78,13 +83,9 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
private final ParcelleServiceImpl parcelleService;
|
||||
private final PersonneRepository personneRepository;
|
||||
private final ZoneRfuRepository zoneRfuRepository ;
|
||||
private final EquipeRepository equipeRepository ;
|
||||
private final RueRepository rueRepository ;
|
||||
private final CaracteristiqueParcelleService caracteristiqueParcelleService ;
|
||||
private final PieceService pieceService ;
|
||||
private final UploadRepository uploadRepository ;
|
||||
private final DeclarationNcService declarationNcService ;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService ;
|
||||
private final SecteurService secteurService ;
|
||||
;
|
||||
|
||||
@PersistenceContext
|
||||
private final EntityManager em;
|
||||
@@ -92,7 +93,9 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public EnquetePayLoadWeb createEnquete(EnquetePayLoadWeb enquetePayLoadWeb) throws BadRequestException {
|
||||
|
||||
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
||||
if (!optionalUser.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : Enquêteur inexistant");
|
||||
@@ -102,59 +105,61 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
throw new BadRequestException("Echec de l'enregistrement : Propriétaire inexistant");
|
||||
}
|
||||
|
||||
if(enquetePayLoadWeb.getParcelleId()!=null) {
|
||||
Optional<Parcelle> optionalParcelle = parcelleRepository.findById(enquetePayLoadWeb.getParcelleId());
|
||||
if (!optionalParcelle.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : Parcelle inexistante");
|
||||
}
|
||||
}
|
||||
|
||||
Optional<ZoneRfu> optionalZoneRfu = zoneRfuRepository.findById(enquetePayLoadWeb.getZoneRfuId());
|
||||
if (!optionalZoneRfu.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
|
||||
}
|
||||
|
||||
ParcellePayLoadWeb parcellePayLoadWeb= getParcellePayloadFromEnquetePl(enquetePayLoadWeb);
|
||||
|
||||
if(enquetePayLoadWeb.getParcelleId()==null){
|
||||
throw new ApplicationException("Echec de l'enregistrement : La parcelle non renseignée.");
|
||||
parcellePayLoadWeb=parcelleService.createParcelle(parcellePayLoadWeb);
|
||||
}else{
|
||||
parcellePayLoadWeb=parcelleService.updateParcelle(parcellePayLoadWeb.getId(),parcellePayLoadWeb);
|
||||
}
|
||||
|
||||
enquetePayLoadWeb.setParcelleId(parcellePayLoadWeb.getId());
|
||||
|
||||
Enquete enquete = entityFromPayLoadService.getEnqueteFromPayLoadWeb(enquetePayLoadWeb);
|
||||
////enregistrement de l'enquete
|
||||
|
||||
enquete=enqueteRepository.save(enquete);
|
||||
|
||||
//////Enregistrement des caractéristiques parcelle
|
||||
// enquetePayLoadWeb.getCaracteristiqueParcellePayloadWebs().forEach(caracteristiqueParcellePayloadWeb -> {
|
||||
// caracteristiqueParcellePayloadWeb.setEnqueteId(finalEnquete.getId());
|
||||
// CaracteristiqueParcelle caracteristiqueParcelle=entityFromPayLoadService.getCaracteristiqueParcelleFromPayLoadWeb(caracteristiqueParcellePayloadWeb);
|
||||
// caracteristiqueParcelleService.createCaracteristiqueParcelle(caracteristiqueParcelle);
|
||||
// });
|
||||
|
||||
/////Enregistrement des pièce de parcelles
|
||||
// enquetePayLoadWeb.getPiecePayLoadWebs().forEach(piecePayLoadWeb -> {
|
||||
// piecePayLoadWeb.setEnqueteId(finalEnquete.getId());
|
||||
// //Piece piece=entityFromPayLoadService.getPieceFromPayLoadWeb(piecePayLoadWeb);
|
||||
// Piece piecefinal = pieceService.createPiece(entityFromPayLoadService.getPieceFromPayLoadWeb(piecePayLoadWeb));
|
||||
// piecePayLoadWeb.getUploadPayLoadWebs().forEach(uploadPayLoadWeb -> {
|
||||
// uploadPayLoadWeb.setEnqueteId(finalEnquete.getId());
|
||||
// Upload upload=entityFromPayLoadService.getUploadFromPayLoadWeb(uploadPayLoadWeb);
|
||||
// upload.setPiece(piecefinal);
|
||||
// uploadRepository.save(upload);
|
||||
// });
|
||||
// });
|
||||
|
||||
/////Enregistrement des pièce de parcelles
|
||||
// enquetePayLoadWeb.getDeclarationNcPayloadWebs().forEach(declarationNcPayloadWeb -> {
|
||||
// declarationNcPayloadWeb.setEnqueteId(finalEnquete.getId());
|
||||
// DeclarationNc declarationNcfinal=declarationNcService.createDeclarationNc(entityFromPayLoadService.getDeclarationNcFromPayLoadWeb(declarationNcPayloadWeb));
|
||||
// declarationNcPayloadWeb.getUploadPayLoadWebs().forEach(uploadPayLoadWeb -> {
|
||||
// uploadPayLoadWeb.setEnqueteId(finalEnquete.getId());
|
||||
// Upload upload=entityFromPayLoadService.getUploadFromPayLoadWeb(uploadPayLoadWeb);
|
||||
// upload.setDeclarationNc(declarationNcfinal);
|
||||
// uploadRepository.save(upload);
|
||||
// });
|
||||
// });
|
||||
|
||||
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||
}
|
||||
|
||||
private ParcellePayLoadWeb getParcellePayloadFromEnquetePl(EnquetePayLoadWeb enquetePayLoadWeb) {
|
||||
ParcellePayLoadWeb parcellePayLoadWeb=new ParcellePayLoadWeb();
|
||||
parcellePayLoadWeb.setId(enquetePayLoadWeb.getId());
|
||||
parcellePayLoadWeb.setQ(enquetePayLoadWeb.getParcelleQ());
|
||||
parcellePayLoadWeb.setI(enquetePayLoadWeb.getParcelleI());
|
||||
parcellePayLoadWeb.setP(enquetePayLoadWeb.getParcelleP());
|
||||
parcellePayLoadWeb.setNup(enquetePayLoadWeb.getParcelleNup());
|
||||
parcellePayLoadWeb.setNupProvisoire(enquetePayLoadWeb.getNupProvisoire());
|
||||
parcellePayLoadWeb.setNumTitreFoncier(enquetePayLoadWeb.getNumeroTitreFoncier());
|
||||
parcellePayLoadWeb.setLongitude(enquetePayLoadWeb.getLongitude());
|
||||
parcellePayLoadWeb.setLatitude(enquetePayLoadWeb.getLatitude());
|
||||
parcellePayLoadWeb.setAltitude(enquetePayLoadWeb.getAltitude());
|
||||
parcellePayLoadWeb.setSuperficie(enquetePayLoadWeb.getSuperficie());
|
||||
parcellePayLoadWeb.setObservation(enquetePayLoadWeb.getObservation());
|
||||
parcellePayLoadWeb.setSituationGeographique(enquetePayLoadWeb.getSituationGeographique());
|
||||
parcellePayLoadWeb.setNumEntreeParcelle(enquetePayLoadWeb.getNumEntreeParcelle());
|
||||
parcellePayLoadWeb.setQuartierId(enquetePayLoadWeb.getQuartierId());
|
||||
parcellePayLoadWeb.setNatureDomaineId(enquetePayLoadWeb.getNatureDomaineId());
|
||||
parcellePayLoadWeb.setTypeDomaineId(enquetePayLoadWeb.getTypeDomaineId());
|
||||
parcellePayLoadWeb.setRueId(enquetePayLoadWeb.getRueId());
|
||||
parcellePayLoadWeb.setProprietaireId(enquetePayLoadWeb.getPersonneId());
|
||||
parcellePayLoadWeb.setNatureDomaineId(enquetePayLoadWeb.getNatureDomaineId());
|
||||
parcellePayLoadWeb.setNatureDomaineId(enquetePayLoadWeb.getNatureDomaineId());
|
||||
return parcellePayLoadWeb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnquetePayLoadWeb updateEnquete(Long id,EnquetePayLoadWeb enquetePayLoadWeb) throws NotFoundException {
|
||||
if (enquetePayLoadWeb.getId() == null) {
|
||||
@@ -169,7 +174,6 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
}
|
||||
|
||||
Optional<Parcelle> optionalParcelle=Optional.empty();
|
||||
Long rueId;
|
||||
Optional<User> optionalUser = userRepository.findById(enquetePayLoadWeb.getEnqueteurId());
|
||||
if (!optionalUser.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : Enquêteur inexistant");
|
||||
@@ -183,13 +187,24 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
if (!optionalZoneRfu.isPresent()) {
|
||||
throw new BadRequestException("Echec de l'enregistrement : zone inexistante");
|
||||
}
|
||||
///enregistrement de la pacelle
|
||||
|
||||
if (enquetePayLoadWeb.getParcelleId() == null) {
|
||||
throw new ApplicationException("Echec de l'enregistrement : La parcelle non renseignée.");
|
||||
} else {
|
||||
optionalParcelle = parcelleService.getParcelleById(enquetePayLoadWeb.getParcelleId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
ParcellePayLoadWeb parcellePayLoadWeb= getParcellePayloadFromEnquetePl(enquetePayLoadWeb);
|
||||
|
||||
if(enquetePayLoadWeb.getParcelleId()==null){
|
||||
parcellePayLoadWeb=parcelleService.createParcelle(parcellePayLoadWeb);
|
||||
}else{
|
||||
parcellePayLoadWeb=parcelleService.updateParcelle(parcellePayLoadWeb.getId(),parcellePayLoadWeb);
|
||||
}
|
||||
|
||||
enquetePayLoadWeb.setParcelleId(parcellePayLoadWeb.getId());
|
||||
|
||||
|
||||
Enquete enquete = entityFromPayLoadService.getEnqueteFromPayLoadWeb(enquetePayLoadWeb);
|
||||
enquete=enqueteRepository.save(enquete);
|
||||
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||
@@ -338,7 +353,7 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enquete validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
public EnquetePayLoadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null) {
|
||||
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
||||
}
|
||||
@@ -346,15 +361,22 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
if (!optionalEnquete.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
||||
}
|
||||
if(optionalEnquete.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnquete.get().getStatutEnquete()==StatutEnquete.REJETE ){
|
||||
throw new NotAcceptableException("Impossible de valider : Le statut actuel "+optionalEnquete.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
|
||||
Enquete enquete = optionalEnquete.get();
|
||||
enquete.setDateValidation(LocalDate.now());
|
||||
enquete.setStatutEnquete(StatutEnquete.VALIDE);
|
||||
enquete.setSynchronise(true);
|
||||
return enqueteRepository.save(enquete);
|
||||
|
||||
enquete= enqueteRepository.save(enquete);
|
||||
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enquete rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
public EnquetePayLoadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad.getIdBackend() == null) {
|
||||
throw new BadRequestException("Impossible de rejeter une enquête ayant un id null.");
|
||||
}
|
||||
@@ -362,38 +384,43 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
if (!optionalEnquete.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez rejeter.");
|
||||
}
|
||||
if(optionalEnquete.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnquete.get().getStatutEnquete()==StatutEnquete.VALIDE ){
|
||||
throw new NotAcceptableException("Impossible de rejeter : Le statut actuel "+optionalEnquete.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
Enquete enquete = optionalEnquete.get();
|
||||
enquete.setDateRejet(LocalDate.now());
|
||||
enquete.setDescriptionMotifRejet(enqueteTraitementPayLoad.getMotifRejet());
|
||||
enquete.setStatutEnquete(StatutEnquete.REJETE);
|
||||
enquete.setSynchronise(false);
|
||||
return enqueteRepository.save(enquete);
|
||||
enquete= enqueteRepository.save(enquete);
|
||||
return enqueteRepository.findEnqueteToDto(enquete.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Enquete> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<Enquete> enquetes = new ArrayList<>();
|
||||
public List<EnquetePayLoadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnquetePayLoadWeb> enquetePayLoadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enquetes.add(validerEnquete(enqueteTraitementPayLoad));
|
||||
enquetePayLoadWebs.add(validerEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enquetes.add(null);
|
||||
enquetePayLoadWebs.add(null);
|
||||
}
|
||||
return enquetes;
|
||||
return enquetePayLoadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Enquete> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<Enquete> enquetes = new ArrayList<>();
|
||||
public List<EnquetePayLoadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnquetePayLoadWeb> enquetePayLoadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enquetes.add(rejeterEnquete(enqueteTraitementPayLoad));
|
||||
enquetePayLoadWebs.add(rejeterEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enquetes.add(null);
|
||||
enquetePayLoadWebs.add(null);
|
||||
}
|
||||
return enquetes;
|
||||
return enquetePayLoadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -554,6 +581,16 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
return nbreEnquete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EnquetePayLoadWeb> getEnqueteListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
|
||||
return enqueteRepository.findAllEnqueteByQuartierByStatutToDtoPageable(quartierId,secteurIds,statutEnquete,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(Long structureId,Long exerciceId) {
|
||||
|
||||
@@ -2,10 +2,12 @@ package io.gmss.fiscad.implementations.infocad.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.EnqueteFiltreResponse;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Rue;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.TypeDomaine;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
@@ -19,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.parametre.NatureDomaineRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.SituationGeographiqueRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypeDomaineRepository;
|
||||
import io.gmss.fiscad.persistence.specification.ParcelleSpecification;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import io.gmss.fiscad.service.GeometryService;
|
||||
import jakarta.persistence.Query;
|
||||
import jakarta.transaction.Transactional;
|
||||
@@ -39,6 +43,8 @@ public class ParcelleServiceImpl implements ParcelleService {
|
||||
private final RueRepository rueRepository;
|
||||
private final GeometryService geometryService;
|
||||
private final SecteurService secteurService;
|
||||
private final TypeDomaineRepository typeDomaineRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
// @Value("${infocad.geom.srid}")
|
||||
// private String defaultSrid32631;
|
||||
@@ -58,10 +64,14 @@ public class ParcelleServiceImpl implements ParcelleService {
|
||||
if (!optionalQuartier.isPresent()) {
|
||||
throw new BadRequestException("Impossible d'enregistrer une parcelle avec un quartier/village inexistant");
|
||||
}
|
||||
|
||||
Optional<TypeDomaine> optionalTypeDomaine = typeDomaineRepository.findById(parcellePayLoadWeb.getTypeDomaineId());
|
||||
if (!optionalTypeDomaine.isPresent()) {
|
||||
throw new BadRequestException("Veuillez préciser le type de domaine");
|
||||
}
|
||||
|
||||
Parcelle parcelle = new Parcelle();
|
||||
parcelle.setNatureDomaine(optionalNatureDomaine.orElse(null));
|
||||
parcelle.setQuartier(optionalQuartier.orElse(null));
|
||||
parcelle = getParcelleFromPayload(parcelle, parcellePayLoadWeb);
|
||||
parcelle = entityFromPayLoadService.getParcelleFromPayload(parcellePayLoadWeb);
|
||||
parcelle= parcelleRepository.save(parcelle);
|
||||
return parcelleRepository.findParcelleToDtoById(parcelle.getId()).orElse(null);
|
||||
}
|
||||
@@ -72,22 +82,8 @@ public class ParcelleServiceImpl implements ParcelleService {
|
||||
if (!optionalParcelle.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver la parcelle que vous désirer modifier");
|
||||
}
|
||||
Optional<NatureDomaine> optionalNatureDomaine = natureDomaineRepository.findById(parcellePayLoadWeb.getNatureDomaineId());
|
||||
if (!optionalNatureDomaine.isPresent()) {
|
||||
throw new BadRequestException("Impossible d'enregistrer une parcelle avec une nature de domaine inexistante");
|
||||
}
|
||||
Optional<Quartier> optionalQuartier = quartierRepository.findById(parcellePayLoadWeb.getQuartierId());
|
||||
if (!optionalQuartier.isPresent()) {
|
||||
throw new BadRequestException("Impossible d'enregistrer une parcelle avec un quartier/village inexistant");
|
||||
}
|
||||
// Optional<SituationGeographique> optionalSituationGeographique = situationGeographiqueRepository.findById(parcellePayLoadWeb.getSituationGeographiqueId());
|
||||
// if (!optionalSituationGeographique.isPresent()) {
|
||||
// throw new BadRequestException("Impossible d'enregistrer une parcelle avec une situation géographique inexistant");
|
||||
// }
|
||||
Parcelle parcelle=optionalParcelle.get();
|
||||
parcelle.setNatureDomaine(optionalNatureDomaine.orElse(null));
|
||||
parcelle.setQuartier(optionalQuartier.orElse(null));
|
||||
parcelle = getParcelleFromPayload(optionalParcelle.get(), parcellePayLoadWeb);
|
||||
Parcelle parcelle = new Parcelle();
|
||||
parcelle = entityFromPayLoadService.getParcelleFromPayload(parcellePayLoadWeb);
|
||||
parcelle= parcelleRepository.save(parcelle);
|
||||
return parcelleRepository.findParcelleToDtoById(parcelle.getId()).orElse(null);
|
||||
}
|
||||
@@ -210,28 +206,6 @@ public class ParcelleServiceImpl implements ParcelleService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Parcelle getParcelleFromPayload(Parcelle parcelle, ParcellePayLoadWeb parcellePayLoadWeb) {
|
||||
if(parcellePayLoadWeb.getRueId()!=null) {
|
||||
Optional<Rue> optionalRue = rueRepository.findById(parcellePayLoadWeb.getRueId());
|
||||
parcelle.setRue(optionalRue.orElse(null));
|
||||
}
|
||||
parcelle.setP(parcellePayLoadWeb.getP());
|
||||
parcelle.setI(parcellePayLoadWeb.getI());
|
||||
parcelle.setQ(parcellePayLoadWeb.getQ());
|
||||
parcelle.setNup(parcellePayLoadWeb.getNup());
|
||||
parcelle.setLatitude(parcellePayLoadWeb.getLatitude());
|
||||
parcelle.setLongitude(parcellePayLoadWeb.getLongitude());
|
||||
parcelle.setAltitude(parcellePayLoadWeb.getAltitude());
|
||||
parcelle.setSituationGeographique(parcellePayLoadWeb.getSituationGeographique());
|
||||
parcelle.setNupProvisoire(parcellePayLoadWeb.getNupProvisoire());
|
||||
parcelle.setAutreNumeroTitreFoncier(parcellePayLoadWeb.getNumTitreFoncier());
|
||||
parcelle.setObservation(parcellePayLoadWeb.getObservation());
|
||||
parcelle.setSuperficie(parcellePayLoadWeb.getSuperficie());
|
||||
|
||||
return parcelle;
|
||||
}
|
||||
|
||||
// private Parcelle getParcelle(Parcelle parcelle, ParcellePayLoadWeb parcellePayLoadWeb, Optional<SituationGeographique> optionalSituationGeographique, Optional<NatureDomaine> optionalNatureDomaine) {
|
||||
// StringBuilder coordonnees = new StringBuilder();
|
||||
// parcelle.setP(parcellePayLoadWeb.getP());
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.CategorieBatiment;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.BatimentService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BatimentPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CategorieBatimentRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -19,6 +23,8 @@ import java.util.Optional;
|
||||
public class BatimentServiceImpl implements BatimentService {
|
||||
|
||||
private final BatimentRepository batimentRepository;
|
||||
private final ParcelleRepository parcelleRepository;
|
||||
private final CategorieBatimentRepository categorieBatimentRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
|
||||
@@ -27,8 +33,22 @@ public class BatimentServiceImpl implements BatimentService {
|
||||
if (batimentPaylaodWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment ayant un id non null.");
|
||||
}
|
||||
if (batimentPaylaodWeb.getParcelleId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La parcelle doit être précisée.");
|
||||
}else {
|
||||
if(!parcelleRepository.existsById(batimentPaylaodWeb.getParcelleId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La parcelle doit être précisée.");
|
||||
}
|
||||
|
||||
if (batimentPaylaodWeb.getCategorieBatimentId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La catégorie doit être précisée.");
|
||||
}else {
|
||||
if(!categorieBatimentRepository.existsById(batimentPaylaodWeb.getCategorieBatimentId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La catégorie doit être précisée.");
|
||||
}
|
||||
Batiment batiment= entityFromPayLoadService.getBatimentFromPayLoadWeb(batimentPaylaodWeb);
|
||||
batiment= batimentRepository.save(batiment);
|
||||
System.out.println(batiment.getId());
|
||||
return batimentRepository.findBatimentAvecOccupantCourantToDto(batiment.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@@ -40,6 +60,19 @@ public class BatimentServiceImpl implements BatimentService {
|
||||
if (!batimentRepository.existsById(batimentPaylaodWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver le batiment spécifié dans notre base de données.");
|
||||
}
|
||||
if (batimentPaylaodWeb.getParcelleId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La parcelle doit être précisée.");
|
||||
}else {
|
||||
if(!parcelleRepository.existsById(batimentPaylaodWeb.getParcelleId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La parcelle doit être précisée.");
|
||||
}
|
||||
|
||||
if (batimentPaylaodWeb.getCategorieBatimentId() == null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La catégorie doit être précisée.");
|
||||
}else {
|
||||
if(!categorieBatimentRepository.existsById(batimentPaylaodWeb.getCategorieBatimentId()))
|
||||
throw new BadRequestException("Impossible de créer un nouveau batiment: La catégorie doit être précisée.");
|
||||
}
|
||||
Batiment batiment= entityFromPayLoadService.getBatimentFromPayLoadWeb(batimentPaylaodWeb);
|
||||
batiment= batimentRepository.save(batiment);
|
||||
return batimentRepository.findBatimentAvecOccupantCourantToDto(batiment.getId()).orElse(null);
|
||||
|
||||
@@ -1,59 +1,103 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.BatimentService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueBatimentService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteBatimentService;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BaremRfuNonBatiPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.BatimentPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.NotAcceptableException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
|
||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||
private final BatimentService batimentService;
|
||||
private final EnqueteRepository enqueteRepository;
|
||||
private final PersonneRepository personneRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final CaracteristiqueBatimentService caracteristiqueBatimentService;
|
||||
private final UploadRepository uploadRepository;
|
||||
private final BatimentRepository batimentRepository;
|
||||
private final BatimentService batimentService;
|
||||
private final SecteurService secteurService;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public EnqueteBatimentPayloadWeb createEnqueteBatiment(EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) throws BadRequestException {
|
||||
EnqueteBatiment enqueteBatiment=new EnqueteBatiment();
|
||||
|
||||
if(enqueteBatimentPayloadWeb.getBatimentId()!=null) {
|
||||
if (!batimentRepository.existsById(enqueteBatimentPayloadWeb.getBatimentId())) {
|
||||
throw new NotFoundException("Impossible d'enregistrer sans le batiment.");
|
||||
}
|
||||
}
|
||||
BatimentPaylaodWeb batimentPaylaodWeb= getBatimentPayloadFromEnqueteBat(enqueteBatimentPayloadWeb);
|
||||
|
||||
if(enqueteBatimentPayloadWeb.getBatimentId()==null){
|
||||
batimentPaylaodWeb=batimentService.createBatiment(batimentPaylaodWeb);
|
||||
}else{
|
||||
batimentPaylaodWeb=batimentService.updateBatiment(batimentPaylaodWeb.getId(),batimentPaylaodWeb);
|
||||
}
|
||||
|
||||
enqueteBatimentPayloadWeb.setBatimentId(batimentPaylaodWeb.getId());
|
||||
|
||||
enqueteBatiment = entityFromPayLoadService.getEnqueteBatimentFromPayLoadWeb(enqueteBatimentPayloadWeb);
|
||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||
enqueteBatimentPayloadWeb= enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||
return enqueteBatimentPayloadWeb ;
|
||||
}
|
||||
|
||||
private BatimentPaylaodWeb getBatimentPayloadFromEnqueteBat(EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) {
|
||||
BatimentPaylaodWeb batimentPaylaodWeb= new BatimentPaylaodWeb();
|
||||
batimentPaylaodWeb.setId(enqueteBatimentPayloadWeb.getId());
|
||||
batimentPaylaodWeb.setNub(enqueteBatimentPayloadWeb.getNub());
|
||||
batimentPaylaodWeb.setCode(enqueteBatimentPayloadWeb.getCode());
|
||||
batimentPaylaodWeb.setDateConstruction(enqueteBatimentPayloadWeb.getDateConstruction());
|
||||
batimentPaylaodWeb.setParcelleId(enqueteBatimentPayloadWeb.getParcelleId());
|
||||
batimentPaylaodWeb.setPersonneId(enqueteBatimentPayloadWeb.getPersonneId());
|
||||
batimentPaylaodWeb.setSuperficieAuSol(enqueteBatimentPayloadWeb.getSuperficieAuSol());
|
||||
batimentPaylaodWeb.setSuperficieLouee(enqueteBatimentPayloadWeb.getSuperficieLouee());
|
||||
batimentPaylaodWeb.setCategorieBatimentId(enqueteBatimentPayloadWeb.getCategorieBatimentId());
|
||||
batimentPaylaodWeb.setNombrePiscine(enqueteBatimentPayloadWeb.getNombrePiscine());
|
||||
batimentPaylaodWeb.setMontantLocatifAnnuelDeclare(enqueteBatimentPayloadWeb.getMontantLocatifAnnuelDeclare());
|
||||
batimentPaylaodWeb.setMontantLocatifAnnuelEstime(enqueteBatimentPayloadWeb.getMontantLocatifAnnuelEstime());
|
||||
batimentPaylaodWeb.setValeurBatimentEstime(enqueteBatimentPayloadWeb.getValeurBatimentEstime());
|
||||
batimentPaylaodWeb.setValeurBatimentReel(enqueteBatimentPayloadWeb.getValeurBatimentReel());
|
||||
batimentPaylaodWeb.setMontantMensuelLocation(enqueteBatimentPayloadWeb.getMontantMensuelLocation());
|
||||
batimentPaylaodWeb.setUsageId(enqueteBatimentPayloadWeb.getUsageId());
|
||||
batimentPaylaodWeb.setNbreUniteLogement(enqueteBatimentPayloadWeb.getNbreUniteLogement());
|
||||
return batimentPaylaodWeb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public EnqueteBatimentPayloadWeb updateEnqueteBatiment(Long id, EnqueteBatimentPayloadWeb enqueteBatimentPayloadWeb) throws NotFoundException {
|
||||
if (enqueteBatimentPayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle enquete de batiment ayant un id null.");
|
||||
@@ -64,6 +108,18 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
if (!batimentRepository.existsById(enqueteBatimentPayloadWeb.getBatimentId())) {
|
||||
throw new NotFoundException("Impossible d'enregistrer sans le batiment.");
|
||||
}
|
||||
|
||||
BatimentPaylaodWeb batimentPaylaodWeb= getBatimentPayloadFromEnqueteBat(enqueteBatimentPayloadWeb);
|
||||
|
||||
if(enqueteBatimentPayloadWeb.getBatimentId()==null){
|
||||
batimentPaylaodWeb=batimentService.createBatiment(batimentPaylaodWeb);
|
||||
}else{
|
||||
batimentPaylaodWeb=batimentService.updateBatiment(batimentPaylaodWeb.getId(),batimentPaylaodWeb);
|
||||
}
|
||||
|
||||
enqueteBatimentPayloadWeb.setBatimentId(batimentPaylaodWeb.getId());
|
||||
|
||||
|
||||
EnqueteBatiment enqueteBatiment = entityFromPayLoadService.getEnqueteBatimentFromPayLoadWeb(enqueteBatimentPayloadWeb);
|
||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||
enqueteBatimentPayloadWeb= enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||
@@ -110,4 +166,84 @@ public class EnqueteBatimentServiceImpl implements EnqueteBatimentService {
|
||||
public List<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentList(Long batimentId) {
|
||||
return enqueteBatimentRepository.findAllByBatimentToDto(batimentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
|
||||
return enqueteBatimentRepository.findAllEnqueteBatimentByQuartierByStatutToDtoPageable(quartierId,secteurIds,statutEnquete,pageable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnqueteBatimentPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
||||
}
|
||||
Optional<EnqueteBatiment> optionalEnqueteBatiment = enqueteBatimentRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnqueteBatiment.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
||||
}
|
||||
if(optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.REJETE ){
|
||||
throw new NotAcceptableException("Impossible de valider : Le statut actuel "+optionalEnqueteBatiment.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
|
||||
EnqueteBatiment enqueteBatiment = optionalEnqueteBatiment.get();
|
||||
enqueteBatiment.setDateValidation(LocalDate.now());
|
||||
enqueteBatiment.setStatutEnquete(StatutEnquete.VALIDE);
|
||||
|
||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||
return enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnqueteBatimentPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
throw new BadRequestException("Impossible de rejeter une enquête ayant un id null.");
|
||||
}
|
||||
Optional<EnqueteBatiment> optionalEnqueteBatiment = enqueteBatimentRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnqueteBatiment.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez rejeter.");
|
||||
}
|
||||
if(optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnqueteBatiment.get().getStatutEnquete()==StatutEnquete.VALIDE ){
|
||||
throw new NotAcceptableException("Impossible de rejeter : Le statut actuel "+optionalEnqueteBatiment.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
EnqueteBatiment enqueteBatiment = optionalEnqueteBatiment.get();
|
||||
enqueteBatiment.setDateRejet(LocalDate.now());
|
||||
enqueteBatiment.setDescriptionMotifRejet(enqueteTraitementPayLoad.getMotifRejet());
|
||||
enqueteBatiment.setStatutEnquete(StatutEnquete.REJETE);
|
||||
enqueteBatiment= enqueteBatimentRepository.save(enqueteBatiment);
|
||||
return enqueteBatimentRepository.findEnqueteBatimentByIdToDto(enqueteBatiment.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteBatimentPayloadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteBatimentPayloadWeb> enqueteBatimentPayloadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enqueteBatimentPayloadWebs.add(validerEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enqueteBatimentPayloadWebs.add(null);
|
||||
}
|
||||
return enqueteBatimentPayloadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteBatimentPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteBatimentPayloadWeb> enqueteBatimentPayloadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enqueteBatimentPayloadWebs.add(rejeterEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enqueteBatimentPayloadWebs.add(null);
|
||||
}
|
||||
return enqueteBatimentPayloadWebs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,36 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.*;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueUniteLogementService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteUniteLogementService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.UniteLogementService;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.UniteLogementPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteUniteLogementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.UniteLogementRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.transaction.Transactional;
|
||||
import jakarta.ws.rs.NotAcceptableException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@AllArgsConstructor
|
||||
@@ -28,31 +38,65 @@ import java.util.Optional;
|
||||
public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementService {
|
||||
|
||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||
private final UniteLogementService uniteLogementService;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService ;
|
||||
private final PersonneRepository personneRepository ;
|
||||
private final EnqueteRepository enqueteRepository ;
|
||||
private final UploadRepository uploadRepository ;
|
||||
private final UniteLogementRepository uniteLogementRepository ;
|
||||
private final CaracteristiqueUniteLogementService caracteristiqueUniteLogementService ;
|
||||
private final UniteLogementService uniteLogementService ;
|
||||
private final SecteurService secteurService ;
|
||||
|
||||
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public EnqueteUniteLogementPayloadWeb createEnqueteUniteLogement(EnqueteUniteLogementPayloadWeb enqueteUniteLogementPayloadWeb) throws BadRequestException {
|
||||
EnqueteUniteLogement enqueteUniteLogement=new EnqueteUniteLogement();
|
||||
Optional<UniteLogement> optionalUniteLogement= Optional.empty();
|
||||
|
||||
if (enqueteUniteLogementPayloadWeb.getUniteLogementId() == null) {
|
||||
throw new BadRequestException("Impossible d'enregistrer une nouvelle enquete d'unité de logement sans l'unité de logement.");
|
||||
if(enqueteUniteLogementPayloadWeb.getUniteLogementId()!=null) {
|
||||
if (!uniteLogementRepository.existsById(enqueteUniteLogementPayloadWeb.getUniteLogementId())) {
|
||||
throw new NotFoundException("Unité de logement inexistant.");
|
||||
}
|
||||
}
|
||||
|
||||
UniteLogementPaylaodWeb uniteLogementPaylaodWeb=getUniteLogementPayloadFromEnqueteUl(enqueteUniteLogementPayloadWeb);
|
||||
|
||||
if(enqueteUniteLogementPayloadWeb.getId()==null){
|
||||
uniteLogementPaylaodWeb= uniteLogementService.createUniteLogement(uniteLogementPaylaodWeb);
|
||||
}else{
|
||||
uniteLogementPaylaodWeb= uniteLogementService.createUniteLogement(uniteLogementPaylaodWeb);
|
||||
}
|
||||
enqueteUniteLogementPayloadWeb.setUniteLogementId(uniteLogementPaylaodWeb.getId());
|
||||
|
||||
enqueteUniteLogement = entityFromPayLoadService.getEnqueteUniteLogementFromPayLoadWeb(enqueteUniteLogementPayloadWeb);
|
||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||
enqueteUniteLogementPayloadWeb = enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||
return enqueteUniteLogementPayloadWeb ;
|
||||
}
|
||||
|
||||
private UniteLogementPaylaodWeb getUniteLogementPayloadFromEnqueteUl(EnqueteUniteLogementPayloadWeb enqueteUniteLogementPayloadWeb) {
|
||||
UniteLogementPaylaodWeb uniteLogementPaylaodWeb=new UniteLogementPaylaodWeb();
|
||||
uniteLogementPaylaodWeb.setId(enqueteUniteLogementPayloadWeb.getId());
|
||||
uniteLogementPaylaodWeb.setNul(enqueteUniteLogementPayloadWeb.getNul());
|
||||
uniteLogementPaylaodWeb.setNumeroEtage(enqueteUniteLogementPayloadWeb.getNumeroEtage());
|
||||
uniteLogementPaylaodWeb.setCode(enqueteUniteLogementPayloadWeb.getCode());
|
||||
uniteLogementPaylaodWeb.setBatimentId(enqueteUniteLogementPayloadWeb.getBatimentId());
|
||||
uniteLogementPaylaodWeb.setSuperficieAuSol(enqueteUniteLogementPayloadWeb.getSuperficieAuSol());
|
||||
uniteLogementPaylaodWeb.setSuperficieLouee(enqueteUniteLogementPayloadWeb.getSuperficieLouee());
|
||||
uniteLogementPaylaodWeb.setObservation(enqueteUniteLogementPayloadWeb.getObservation());
|
||||
uniteLogementPaylaodWeb.setDateConstruction(enqueteUniteLogementPayloadWeb.getDateConstruction());
|
||||
uniteLogementPaylaodWeb.setPersonneId(enqueteUniteLogementPayloadWeb.getPersonneId());
|
||||
uniteLogementPaylaodWeb.setCategorieBatimentId(enqueteUniteLogementPayloadWeb.getCategorieBatimentId());
|
||||
uniteLogementPaylaodWeb.setMontantLocatifAnnuelDeclare(enqueteUniteLogementPayloadWeb.getMontantLocatifAnnuelDeclare());
|
||||
uniteLogementPaylaodWeb.setMontantLocatifAnnuelEstime(enqueteUniteLogementPayloadWeb.getMontantLocatifAnnuelEstime());
|
||||
uniteLogementPaylaodWeb.setMontantMensuelLocation(enqueteUniteLogementPayloadWeb.getMontantMensuelLocation());
|
||||
uniteLogementPaylaodWeb.setValeurUniteLogementReel(enqueteUniteLogementPayloadWeb.getValeurUniteLogementReel());
|
||||
uniteLogementPaylaodWeb.setValeurUniteLogementEstime(enqueteUniteLogementPayloadWeb.getValeurUniteLogementEstime());
|
||||
uniteLogementPaylaodWeb.setNombrePiscine(enqueteUniteLogementPayloadWeb.getNombrePiscine());
|
||||
uniteLogementPaylaodWeb.setUsageId(enqueteUniteLogementPayloadWeb.getUsageId());
|
||||
return uniteLogementPaylaodWeb;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public EnqueteUniteLogementPayloadWeb updateEnqueteUniteLogement(Long id, EnqueteUniteLogementPayloadWeb enqueteUniteLogementPayloadWeb) throws NotFoundException {
|
||||
if (enqueteUniteLogementPayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle enquete d'unité de logement ayant un id null.");
|
||||
@@ -68,6 +112,16 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
|
||||
EnqueteUniteLogement enqueteUniteLogement= new EnqueteUniteLogement();
|
||||
|
||||
UniteLogementPaylaodWeb uniteLogementPaylaodWeb=getUniteLogementPayloadFromEnqueteUl(enqueteUniteLogementPayloadWeb);
|
||||
|
||||
if(enqueteUniteLogementPayloadWeb.getId()==null){
|
||||
uniteLogementPaylaodWeb= uniteLogementService.createUniteLogement(uniteLogementPaylaodWeb);
|
||||
}else{
|
||||
uniteLogementPaylaodWeb= uniteLogementService.createUniteLogement(uniteLogementPaylaodWeb);
|
||||
}
|
||||
enqueteUniteLogementPayloadWeb.setUniteLogementId(uniteLogementPaylaodWeb.getId());
|
||||
|
||||
|
||||
enqueteUniteLogement = entityFromPayLoadService.getEnqueteUniteLogementFromPayLoadWeb(enqueteUniteLogementPayloadWeb);
|
||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||
enqueteUniteLogementPayloadWeb = enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||
@@ -114,4 +168,84 @@ public class EnqueteUniteLogementServiceImpl implements EnqueteUniteLogementServ
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable) {
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
|
||||
return enqueteUniteLogementRepository.findAllEnqueteUniteLogementByQuartierByStatutToDtoPageable(quartierId,secteurIds,statutEnquete,pageable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnqueteUniteLogementPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
throw new BadRequestException("Impossible de valider une enquête ayant un id null.");
|
||||
}
|
||||
Optional<EnqueteUniteLogement> optionalEnqueteUniteLogement = enqueteUniteLogementRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnqueteUniteLogement.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
||||
}
|
||||
if(optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.REJETE ){
|
||||
throw new NotAcceptableException("Impossible de valider : Le statut actuel "+optionalEnqueteUniteLogement.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
|
||||
EnqueteUniteLogement enqueteUniteLogement = optionalEnqueteUniteLogement.get();
|
||||
enqueteUniteLogement.setDateValidation(LocalDate.now());
|
||||
enqueteUniteLogement.setStatutEnquete(StatutEnquete.VALIDE);
|
||||
|
||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||
return enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnqueteUniteLogementPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad) {
|
||||
if (enqueteTraitementPayLoad == null || enqueteTraitementPayLoad.getIdBackend()==null) {
|
||||
throw new BadRequestException("Impossible de rejeter une enquête ayant un id null.");
|
||||
}
|
||||
Optional<EnqueteUniteLogement> optionalEnqueteUniteLogement = enqueteUniteLogementRepository.findById(enqueteTraitementPayLoad.getIdBackend());
|
||||
if (!optionalEnqueteUniteLogement.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez rejeter.");
|
||||
}
|
||||
if(optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.CLOTURE ||
|
||||
optionalEnqueteUniteLogement.get().getStatutEnquete()==StatutEnquete.VALIDE ){
|
||||
throw new NotAcceptableException("Impossible de rejeter : Le statut actuel "+optionalEnqueteUniteLogement.get().getStatutEnquete()+" ne le permet pas.");
|
||||
}
|
||||
EnqueteUniteLogement enqueteUniteLogement = optionalEnqueteUniteLogement.get();
|
||||
enqueteUniteLogement.setDateRejet(LocalDate.now());
|
||||
enqueteUniteLogement.setDescriptionMotifRejet(enqueteTraitementPayLoad.getMotifRejet());
|
||||
enqueteUniteLogement.setStatutEnquete(StatutEnquete.REJETE);
|
||||
enqueteUniteLogement= enqueteUniteLogementRepository.save(enqueteUniteLogement);
|
||||
return enqueteUniteLogementRepository.findEnqueteUniteLogementToDto(enqueteUniteLogement.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteUniteLogementPayloadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteUniteLogementPayloadWeb> enqueteUniteLogementPayloadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enqueteUniteLogementPayloadWebs.add(validerEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enqueteUniteLogementPayloadWebs.add(null);
|
||||
}
|
||||
return enqueteUniteLogementPayloadWebs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteUniteLogementPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads) {
|
||||
List<EnqueteUniteLogementPayloadWeb> enqueteUniteLogementPayloadWebs = new ArrayList<>();
|
||||
try {
|
||||
for (EnqueteTraitementPayLoad enqueteTraitementPayLoad : enqueteTraitementPayLoads) {
|
||||
enqueteUniteLogementPayloadWebs.add(rejeterEnquete(enqueteTraitementPayLoad));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
enqueteUniteLogementPayloadWebs.add(null);
|
||||
}
|
||||
return enqueteUniteLogementPayloadWebs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.UniteLogementService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.UniteLogementPaylaodWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.UniteLogementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuNonBatiRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CategorieBatimentRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -20,6 +23,8 @@ public class UniteLogementServiceImpl implements UniteLogementService {
|
||||
|
||||
private final UniteLogementRepository uniteLogementRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final BatimentRepository batimentRepository;
|
||||
private final CategorieBatimentRepository categorieBatimentRepository;
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +33,21 @@ public class UniteLogementServiceImpl implements UniteLogementService {
|
||||
if (uniteLogementPaylaodWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle unité de logement ayant un id non null.");
|
||||
}
|
||||
|
||||
if (uniteLogementPaylaodWeb.getBatimentId() == null) {
|
||||
throw new BadRequestException("Impossible de créer l'unité de logement: Le batiment doit être précisé.");
|
||||
}else {
|
||||
if(!batimentRepository.existsById(uniteLogementPaylaodWeb.getBatimentId()))
|
||||
throw new BadRequestException("Impossible de créer l'unite de logement: L'unité de logement doit être précisée.");
|
||||
}
|
||||
|
||||
if (uniteLogementPaylaodWeb.getCategorieBatimentId() == null) {
|
||||
throw new BadRequestException("Impossible de créer l'unite de logement: La catégorie doit être précisée.");
|
||||
}else {
|
||||
if(!categorieBatimentRepository.existsById(uniteLogementPaylaodWeb.getCategorieBatimentId()))
|
||||
throw new BadRequestException("Impossible de créer l'unite de logement: La catégorie doit être précisée.");
|
||||
}
|
||||
|
||||
UniteLogement uniteLogement = entityFromPayLoadService.getUniteLogementFromPayLoadWeb(uniteLogementPaylaodWeb);
|
||||
uniteLogement = uniteLogementRepository.save(uniteLogement);
|
||||
return uniteLogementRepository.findUniteLogementAvecOccupantCourantToDto(uniteLogement.getId()).orElse(null);
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
package io.gmss.fiscad.implementations.statistiques;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
|
||||
import io.gmss.fiscad.interfaces.user.UserService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.statistique.*;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.BatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteBatimentRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.EnqueteUniteLogementRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.UniteLogementRepository;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -25,14 +34,20 @@ public class StatistiquesServiceImpl implements StatistiquesService {
|
||||
private final BatimentRepository batimentRepository;
|
||||
private final UniteLogementRepository uniteLogementRepository;
|
||||
private final PersonneRepository personneRepository;
|
||||
private final SecteurService secteurService;
|
||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||
|
||||
public StatistiquesServiceImpl(UserService userService, EnqueteRepository enqueteRepository, ParcelleRepository parcelleRepository, BatimentRepository batimentRepository, UniteLogementRepository uniteLogementRepository, PersonneRepository personneRepository) {
|
||||
public StatistiquesServiceImpl(UserService userService, EnqueteRepository enqueteRepository, ParcelleRepository parcelleRepository, BatimentRepository batimentRepository, UniteLogementRepository uniteLogementRepository, PersonneRepository personneRepository, SecteurService secteurService, EnqueteBatimentRepository enqueteBatimentRepository, EnqueteUniteLogementRepository enqueteUniteLogementRepository) {
|
||||
this.userService = userService;
|
||||
this.enqueteRepository = enqueteRepository;
|
||||
this.parcelleRepository = parcelleRepository;
|
||||
this.batimentRepository = batimentRepository;
|
||||
this.uniteLogementRepository = uniteLogementRepository;
|
||||
this.personneRepository = personneRepository;
|
||||
this.secteurService = secteurService;
|
||||
this.enqueteBatimentRepository = enqueteBatimentRepository;
|
||||
this.enqueteUniteLogementRepository = enqueteUniteLogementRepository;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,4 +113,20 @@ public class StatistiquesServiceImpl implements StatistiquesService {
|
||||
public List<StatistiqueTypeNombreResponse> getStatNombrePersonneParCategorie() {
|
||||
return personneRepository.getNombrePersonnesResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NombreEnquetesParObjet getStatNombreEnqueteParObjetUserConnect(Long userId, String statutEnquete) {
|
||||
NombreEnquetesParObjet nombreEnquetesParObjet= new NombreEnquetesParObjet();
|
||||
List<Secteur> secteurs= secteurService.getListSecteurUserId(userId);
|
||||
List<Long> secteurIds = secteurs.stream()
|
||||
.map(Secteur::getId)
|
||||
.toList();
|
||||
|
||||
nombreEnquetesParObjet.setNombreEnqueteUniteLogement(enqueteUniteLogementRepository.getNombreEnqueteUniteLogementByUserConnecte(secteurIds,statutEnquete));
|
||||
nombreEnquetesParObjet.setNombreEnqueteParcelle(enqueteRepository.getNombreEnqueteByUserConnecte(secteurIds,statutEnquete));
|
||||
nombreEnquetesParObjet.setNombreEnqueteBatiment(enqueteBatimentRepository.getNombreEnqueteBatimentByUserConnecte(secteurIds,statutEnquete));
|
||||
|
||||
return nombreEnquetesParObjet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.gmss.fiscad.interfaces.decoupage;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurDecoupagePaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
||||
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -33,4 +33,7 @@ public interface SecteurDecoupageService {
|
||||
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageUnSecteur(Long secteurId) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatParcelleDecoupageByUserId(Long userId) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteDecoupageByUserId(Long userId, String statutEnquete) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteBatimentDecoupageByUserId(Long userId, String statutEnquete) ;
|
||||
List<ParcelleStatsProjectionUnSecteur> getStatEnqueteUniteLogementDecoupageByUserId(Long userId, String statutEnquete) ;
|
||||
}
|
||||
@@ -4,8 +4,6 @@ import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.SecteurPaylaodWeb;
|
||||
import io.gmss.fiscad.paylaods.request.synchronisation.SecteurPayload;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@ package io.gmss.fiscad.interfaces.infocad.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.EnqueteFiltreResponse;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.synchronisation.EnqueteNonSyncResponse;
|
||||
import io.gmss.fiscad.paylaods.response.EnqueteResponse;
|
||||
import io.gmss.fiscad.paylaods.response.FicheResponse.FicheEnqueteResponse;
|
||||
@@ -38,13 +40,13 @@ public interface EnqueteService {
|
||||
|
||||
Optional<EnquetePayLoadWeb> getEnqueteById(Long id);
|
||||
|
||||
Enquete validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
EnquetePayLoadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
Enquete rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
EnquetePayLoadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
List<Enquete> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
List<EnquetePayLoadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
List<Enquete> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
List<EnquetePayLoadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
Enquete finaliserEnquete(Long enqueteId);
|
||||
|
||||
@@ -60,4 +62,8 @@ public interface EnqueteService {
|
||||
|
||||
int cloturerEnqueteParcelleBatimentUniteLogementByStructureIdAndExerciceId(Long strucutreId,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.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.FiltreParcelle;
|
||||
import io.gmss.fiscad.paylaods.request.FiltreParcellePayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.dataTableResponse.ParcelleDataTableResponse;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.ParcelleStatsProjectionUnSecteur;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package io.gmss.fiscad.interfaces.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -26,4 +29,15 @@ public interface EnqueteBatimentService {
|
||||
Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentListPageable(Long batimentId, Pageable pageable);
|
||||
|
||||
List<EnqueteBatimentPayloadWeb> getEnqueteBatimentByBatimentList(Long batimentId);
|
||||
|
||||
Page<EnqueteBatimentPayloadWeb> getEnqueteBatimentListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable);
|
||||
|
||||
EnqueteBatimentPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
EnqueteBatimentPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
List<EnqueteBatimentPayloadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
List<EnqueteBatimentPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package io.gmss.fiscad.interfaces.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import io.gmss.fiscad.enums.StatutEnquete;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.EnqueteTraitementPayLoad;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteUniteLogementPayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -27,4 +30,14 @@ public interface EnqueteUniteLogementService {
|
||||
List<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementUniteLogementList(Long uniteLogementId);
|
||||
|
||||
Optional<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementById(Long enqueteUniteLogement);
|
||||
|
||||
Page<EnqueteUniteLogementPayloadWeb> getEnqueteUniteLogementListByQuartierByStatutPageableToDto(Long userId, Long quartierId, StatutEnquete statutEnquete, Pageable pageable);
|
||||
|
||||
EnqueteUniteLogementPayloadWeb validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
EnqueteUniteLogementPayloadWeb rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
List<EnqueteUniteLogementPayloadWeb> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
|
||||
List<EnqueteUniteLogementPayloadWeb> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||
}
|
||||
|
||||
@@ -11,4 +11,5 @@ public interface StatistiquesService {
|
||||
List<StatEnqueteParBlocResponse> getStatBloc();
|
||||
StatNombreTotalObjet getStatNombreTotalObjet(String codeDecoupageAdmin);
|
||||
List<StatistiqueTypeNombreResponse> getStatNombrePersonneParCategorie();
|
||||
NombreEnquetesParObjet getStatNombreEnqueteParObjetUserConnect(Long userId, String statutEnquete);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,6 @@ import java.util.List;
|
||||
@Data
|
||||
public class EnqueteBatimentPayloadWeb {
|
||||
private Long id;
|
||||
// private BatimentPaylaodWeb batimentPaylaodWeb ;
|
||||
// private List<CaracteristiqueBatimentPayloadWeb> caracteristiqueBatimentPayloadWebs;
|
||||
// private List<UploadPayLoadWeb> uploadPayLoadWebs;
|
||||
private String observation;
|
||||
private String autreMenuisierie;
|
||||
private String autreMur;
|
||||
@@ -52,7 +49,6 @@ public class EnqueteBatimentPayloadWeb {
|
||||
private String enqueteurNom;
|
||||
private String enqueteurPrenom;
|
||||
@Enumerated(EnumType.STRING)
|
||||
// @JsonIgnore
|
||||
private StatutEnquete statutEnquete;
|
||||
private Long exerciceId;
|
||||
private Integer exerciceAnnee;
|
||||
@@ -68,6 +64,18 @@ public class EnqueteBatimentPayloadWeb {
|
||||
private Long usageId;
|
||||
private String usageNom;
|
||||
|
||||
private String nub;
|
||||
private String code;
|
||||
private LocalDate dateConstruction;
|
||||
private Long parcelleId;
|
||||
private String parcelleNup;
|
||||
private String parcelleQ;
|
||||
private String parcelleI;
|
||||
private String parcelleP;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long valeurBatimentCalcule;
|
||||
private Integer nbreUniteLogement;
|
||||
|
||||
public EnqueteBatimentPayloadWeb(Long id, String observation, String autreMenuisierie, String autreMur, boolean sbee, String numCompteurSbee, boolean soneb, String numCompteurSoneb, int nbreLotUnite, int nbreUniteLocation, Float superficieLouee, Float superficieAuSol, LocalDate dateEnquete, int nbreMenage, int nbreHabitant, Long montantMensuelLocation, Long montantLocatifAnnuelDeclare, Long nbreEtage, Long valeurBatimentEstime, Long valeurBatimentReel, int nbreMoisLocation, String autreCaracteristiquePhysique, LocalDate dateDebutExcemption, LocalDate dateFinExcemption, Long batimentId, String batimentNub, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, Long enqueteurId, String enqueteurNom, String enqueteurPrenom,
|
||||
StatutEnquete statutEnquete,
|
||||
Long exerciceId,
|
||||
@@ -82,7 +90,18 @@ public class EnqueteBatimentPayloadWeb {
|
||||
Integer nombrePiscine,
|
||||
Long montantLocatifAnnuelCalcule,
|
||||
Long usageId,
|
||||
String usageNom
|
||||
String usageNom,
|
||||
String nub,
|
||||
String code,
|
||||
LocalDate dateConstruction,
|
||||
Long parcelleId,
|
||||
String parcelleNup,
|
||||
String parcelleQ,
|
||||
String parcelleI,
|
||||
String parcelleP,
|
||||
Long montantLocatifAnnuelEstime,
|
||||
Long valeurBatimentCalcule,
|
||||
Integer nbreUniteLogement
|
||||
) {
|
||||
this.id = id;
|
||||
this.observation = observation;
|
||||
@@ -131,5 +150,16 @@ public class EnqueteBatimentPayloadWeb {
|
||||
this.montantLocatifAnnuelCalcule = montantLocatifAnnuelCalcule;
|
||||
this.usageId = usageId ;
|
||||
this.usageNom = usageNom ;
|
||||
this.nub=nub;
|
||||
this.code=code;
|
||||
this.dateConstruction=dateConstruction;
|
||||
this.parcelleId=parcelleId;
|
||||
this.parcelleNup=parcelleNup;
|
||||
this.parcelleQ=parcelleQ;
|
||||
this.parcelleI=parcelleI;
|
||||
this.parcelleP=parcelleP;
|
||||
this.montantLocatifAnnuelEstime=montantLocatifAnnuelEstime;
|
||||
this.valeurBatimentCalcule=valeurBatimentCalcule;
|
||||
this.nbreUniteLogement=nbreUniteLogement;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,19 +15,10 @@ public class EnquetePayLoadWeb {
|
||||
private LocalDate dateEnquete;
|
||||
private LocalDate dateFinalisation;
|
||||
private Boolean litige;
|
||||
// private ParcellePayLoadWeb parcellePayLoadWeb;
|
||||
// private List<CaracteristiqueParcellePayloadWeb> caracteristiqueParcellePayloadWebs;
|
||||
// private List<DeclarationNcPayloadWeb> declarationNcPayloadWebs;
|
||||
// private List<PiecePayLoadWeb> piecePayLoadWebs;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatutEnquete statutEnquete;
|
||||
private String descriptionMotifRejet;
|
||||
private String observation;
|
||||
private String numeroTitreFoncier;
|
||||
private LocalDate dateTitreFoncier;
|
||||
private String numEntreeParcelle;
|
||||
private String numRue;
|
||||
private String nomRue;
|
||||
private Float precision;
|
||||
private Integer nbreCoProprietaire;
|
||||
private Integer nbreIndivisiaire;
|
||||
@@ -51,11 +42,6 @@ public class EnquetePayLoadWeb {
|
||||
private Long enqueteurId;
|
||||
private String enqueteurNom;
|
||||
private String enqueteurPrenom;
|
||||
private Long parcelleId;
|
||||
private String parcelleNup;
|
||||
private String parcelleQ;
|
||||
private String parcelleI;
|
||||
private String parcelleP;
|
||||
private Long exerciceId;
|
||||
private Integer exerciceAnnee;
|
||||
private Long modeAcquisitionId;
|
||||
@@ -65,12 +51,54 @@ public class EnquetePayLoadWeb {
|
||||
private String representantTel;
|
||||
private String representantNpi;
|
||||
|
||||
private Long parcelleId;
|
||||
private String parcelleNup;
|
||||
private String parcelleQ;
|
||||
private String parcelleI;
|
||||
private String parcelleP;
|
||||
|
||||
private String numeroTitreFoncier;
|
||||
private LocalDate dateTitreFoncier;
|
||||
private String numEntreeParcelle;
|
||||
private String numRue;
|
||||
private String nomRue;
|
||||
|
||||
private String nupProvisoire;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private String altitude;
|
||||
private String situationGeographique;
|
||||
private Long quartierId;
|
||||
private String quartierCode;
|
||||
private String quartierNom;
|
||||
private Long natureDomaineId;
|
||||
private String natureDomaineLibelle;
|
||||
private Long typeDomaineId;
|
||||
private String typeDomaineLibelle;
|
||||
private Long rueId;
|
||||
|
||||
|
||||
public EnquetePayLoadWeb(Long id, LocalDate dateEnquete, LocalDate dateFinalisation, Boolean litige, StatutEnquete statutEnquete, String descriptionMotifRejet, String observation, String numeroTitreFoncier, LocalDate dateTitreFoncier, String numEntreeParcelle, String numRue, String nomRue, Float precision, Integer nbreCoProprietaire, Integer nbreIndivisiaire, String autreAdresse, Float superficie, Integer nbreBatiment, Integer nbrePiscine, LocalDate dateDebutExemption, LocalDate dateFinExemption, String autreNumeroTitreFoncier, Long montantMensuelleLocation, Long montantAnnuelleLocation, Long valeurParcelleEstime, Long valeurParcelleReel, Long zoneRfuId, String zoneRfuNom, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, Long enqueteurId, String enqueteurNom, String enqueteurPrenom,Long parcelleId, String parcelleNup, String parcelleQ, String parcelleI, String parcelleP, Long exerciceId, Integer exerciceAnnee,
|
||||
Long modeAcquisitionId,String modeAcquisitionLibelle,
|
||||
Long modeAcquisitionId,
|
||||
String modeAcquisitionLibelle,
|
||||
String representantNom,
|
||||
String representantPrenom,
|
||||
String representantTel,
|
||||
String representantNpi) {
|
||||
String representantNpi,
|
||||
String nupProvisoire,
|
||||
String longitude,
|
||||
String latitude,
|
||||
String altitude,
|
||||
String situationGeographique,
|
||||
Long quartierId,
|
||||
String quartierCode,
|
||||
String quartierNom,
|
||||
Long natureDomaineId,
|
||||
String natureDomaineLibelle,
|
||||
Long typeDomaineId,
|
||||
String typeDomaineLibelle,
|
||||
Long rueId
|
||||
) {
|
||||
this.id = id;
|
||||
this.dateEnquete = dateEnquete;
|
||||
this.dateFinalisation = dateFinalisation;
|
||||
@@ -119,5 +147,18 @@ public class EnquetePayLoadWeb {
|
||||
this.representantTel = representantTel;
|
||||
this.representantPrenom = representantPrenom;
|
||||
this.representantNpi = representantNpi;
|
||||
this.nupProvisoire=nupProvisoire;
|
||||
this.longitude=longitude;
|
||||
this.latitude=latitude;
|
||||
this.altitude=altitude;
|
||||
this.situationGeographique=situationGeographique;
|
||||
this.quartierId=quartierId;
|
||||
this.quartierCode=quartierCode;
|
||||
this.quartierNom=quartierNom;
|
||||
this.natureDomaineId=natureDomaineId;
|
||||
this.natureDomaineLibelle=natureDomaineLibelle;
|
||||
this.typeDomaineId=typeDomaineId;
|
||||
this.typeDomaineLibelle=typeDomaineLibelle;
|
||||
this.rueId=rueId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,17 @@ public class EnqueteUniteLogementPayloadWeb {
|
||||
private Integer nombrePiscine;
|
||||
private Long usageId;
|
||||
private String usageNom;
|
||||
|
||||
|
||||
private String nul;
|
||||
private String numeroEtage;
|
||||
private String code;
|
||||
private Long batimentId;
|
||||
private String batimentNub;
|
||||
private LocalDate dateConstruction;
|
||||
private Long enqueteUniteLogementCourantId;
|
||||
private Long montantLocatifAnnuelEstime;
|
||||
private Long valeurUniteLogementCalcule;
|
||||
public EnqueteUniteLogementPayloadWeb(Long id, String observation, Integer nbrePiece, Integer nbreHabitant, Integer nbreMenage, Boolean enLocation, Integer nbreMoisLocation, Long montantMensuelLocation, Long montantLocatifAnnuelDeclare, Long valeurUniteLogementEstime, Long valeurUniteLogementReel, Float superficieLouee, Float superficieAuSol, LocalDate dateEnquete, Boolean sbee, Boolean soneb, String numCompteurSbee, String numCompteurSoneb, LocalDate dateDebutExemption, LocalDate dateFinExemption, Long uniteLogementId, String uniteLogementNumeroEtage, String uniteLogementNul, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, Long enqueteurId, String enqueteurNom, String enqueteurPrenom, Long exerciceId, Integer exerciceAnnee,
|
||||
StatutEnquete statutEnquete,
|
||||
String representantNom,
|
||||
@@ -68,7 +79,15 @@ public class EnqueteUniteLogementPayloadWeb {
|
||||
Integer nombrePiscine,
|
||||
Long montantLocatifAnnuelCalcule,
|
||||
Long usageId,
|
||||
String usageNom
|
||||
String usageNom,
|
||||
String nul,
|
||||
String numeroEtage,
|
||||
String code,
|
||||
Long batimentId,
|
||||
String batimentNub,
|
||||
LocalDate dateConstruction,
|
||||
Long montantLocatifAnnuelEstime,
|
||||
Long valeurUniteLogementCalcule
|
||||
) {
|
||||
this.id = id;
|
||||
this.observation = observation;
|
||||
@@ -114,5 +133,14 @@ public class EnqueteUniteLogementPayloadWeb {
|
||||
this.montantLocatifAnnuelCalcule = montantLocatifAnnuelCalcule;
|
||||
this.usageId = usageId ;
|
||||
this.usageNom = usageNom ;
|
||||
|
||||
this.nul=nul;
|
||||
this.numeroEtage=numeroEtage;
|
||||
this.code=code;
|
||||
this.batimentId=batimentId;
|
||||
this.batimentNub=batimentNub;
|
||||
this.dateConstruction=dateConstruction;
|
||||
this.montantLocatifAnnuelEstime=montantLocatifAnnuelEstime;
|
||||
this.valeurUniteLogementCalcule=valeurUniteLogementCalcule;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,10 +27,11 @@ public class PiecePayLoadWeb {
|
||||
private Long enqueteId;
|
||||
private Long enqueteBatimentId;
|
||||
private Long enqueteUniteLogementId;
|
||||
//private List<UploadPayLoadWeb> uploadPayLoadWebs;
|
||||
private Long nombreFichier;
|
||||
|
||||
public PiecePayLoadWeb(Long id, LocalDate dateExpiration, LocalDate dateEtablissement, String numeroPiece, String url, Long typePieceId, String typePieceLibelle, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, Long sourceDroitId, String sourceDroitLibelle, Long modeAcquisitionId, String modeAcquisitionLibelle, String observation, Long enqueteId,
|
||||
Long enqueteBatimentId,Long enqueteUniteLogementId) {
|
||||
Long enqueteBatimentId,Long enqueteUniteLogementId,
|
||||
Long nombreFichier) {
|
||||
this.id = id;
|
||||
this.dateExpiration = dateExpiration;
|
||||
this.dateEtablissement = dateEtablissement;
|
||||
@@ -50,6 +51,7 @@ public class PiecePayLoadWeb {
|
||||
this.enqueteId = enqueteId;
|
||||
this.enqueteBatimentId = enqueteBatimentId;
|
||||
this.enqueteUniteLogementId = enqueteUniteLogementId;
|
||||
this.nombreFichier = nombreFichier;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ParcellePayLoad {
|
||||
|
||||
/////////////////////////////////
|
||||
private Long typeDomaineId;
|
||||
private Long numeroProvisoire;
|
||||
private String numeroProvisoire;
|
||||
private Long blocId;
|
||||
private String situationGeographique;
|
||||
private String autreNumeroTitreFoncier;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package io.gmss.fiscad.paylaods.response.statistique;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NombreEnquetesParObjet {
|
||||
Integer nombreEnqueteParcelle;
|
||||
Integer nombreEnqueteBatiment;
|
||||
Integer nombreEnqueteUniteLogement;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.gmss.fiscad.paylaods.response.restoration;
|
||||
package io.gmss.fiscad.paylaods.response.statistique;
|
||||
|
||||
public interface ParcelleStatsProjectionUnSecteur {
|
||||
// ================== Département ==================
|
||||
@@ -1,10 +1,13 @@
|
||||
package io.gmss.fiscad.persistence.repositories.infocad.metier;
|
||||
|
||||
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.ParcellePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.*;
|
||||
import io.gmss.fiscad.paylaods.response.report.EnqueteParBlocResponse;
|
||||
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.StatEnqueteAdminStructureResponse;
|
||||
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);
|
||||
|
||||
|
||||
@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("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb(
|
||||
@@ -303,7 +353,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
e.representantNom,
|
||||
e.representantPrenom,
|
||||
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
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -312,9 +375,12 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
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
|
||||
""")
|
||||
List<EnquetePayLoadWeb> findAllEnquetesToDto();
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb(
|
||||
e.id,
|
||||
@@ -364,7 +430,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
e.representantNom,
|
||||
e.representantPrenom,
|
||||
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
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -373,6 +452,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
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
|
||||
WHERE e.id = :enqueteId
|
||||
""")
|
||||
Optional<EnquetePayLoadWeb> findEnqueteToDto(@Param("enqueteId") Long enqueteId);
|
||||
@@ -427,7 +510,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
e.representantNom,
|
||||
e.representantPrenom,
|
||||
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
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -436,6 +532,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
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
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(e)
|
||||
@@ -493,7 +593,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
e.representantNom,
|
||||
e.representantPrenom,
|
||||
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
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -502,7 +615,12 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
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
|
||||
WHERE ex.id = :exerciceId
|
||||
|
||||
""")
|
||||
List<EnquetePayLoadWeb> findEnquetesByExerciceToDto(
|
||||
@Param("exerciceId") Long exerciceId
|
||||
@@ -559,7 +677,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
e.representantNom,
|
||||
e.representantPrenom,
|
||||
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
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -568,6 +699,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
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
|
||||
WHERE ex.id = :exerciceId
|
||||
""",
|
||||
countQuery = """
|
||||
@@ -631,7 +766,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
e.representantNom,
|
||||
e.representantPrenom,
|
||||
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
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -640,6 +788,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
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
|
||||
WHERE pa.id = :parcelleId
|
||||
""")
|
||||
List<EnquetePayLoadWeb> findAllEnquetesByParcelleToDto(
|
||||
@@ -696,7 +848,20 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
e.representantNom,
|
||||
e.representantPrenom,
|
||||
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
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -705,6 +870,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
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
|
||||
WHERE pa.id = :parcelleId
|
||||
""",
|
||||
countQuery = """
|
||||
@@ -717,4 +886,124 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
@Param("parcelleId") Long parcelleId,
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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.statistique.StatistiqueTypeNombreResponse;
|
||||
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 org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -94,32 +94,39 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT DISTINCT
|
||||
SELECT distinct
|
||||
d.id AS departement_id,
|
||||
d.code AS departement_code,
|
||||
d.nom AS departement_nom,
|
||||
COUNT(p.id) OVER (PARTITION BY d.id) AS nb_parcelles_departement,
|
||||
|
||||
c.id AS commune_id,
|
||||
c.code AS commune_code,
|
||||
c.nom AS commune_nom,
|
||||
COUNT(p.id) OVER (PARTITION BY c.id) AS nb_parcelles_commune,
|
||||
|
||||
a.id AS arrondissement_id,
|
||||
a.code AS arrondissement_code,
|
||||
a.nom AS arrondissement_nom,
|
||||
COUNT(p.id) OVER (PARTITION BY a.id) AS nb_parcelles_arrondissement,
|
||||
|
||||
q.id AS quartier_id,
|
||||
q.code AS quartier_code,
|
||||
q.nom AS quartier_nom,
|
||||
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 commune c ON c.id = a.commune_id
|
||||
JOIN departement d ON d.id = c.departement_id
|
||||
LEFT JOIN parcelle p ON p.quartier_id = q.id
|
||||
WHERE sd.secteur_id IN (:secteurIds)\s
|
||||
ORDER BY
|
||||
d.nom, c.nom, a.nom, q.nom;
|
||||
WHERE EXISTS (
|
||||
SELECT 1
|
||||
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
|
||||
)
|
||||
@@ -348,7 +355,6 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
||||
WHERE e2.parcelle = p
|
||||
)
|
||||
LEFT JOIN e.personne pers
|
||||
INNER JOIN SecteurDecoupage sd on sd.quartier=p.quartier
|
||||
WHERE p.id = :parcelleId
|
||||
""")
|
||||
Optional<ParcellePayLoadWeb> findParcelleToDtoById(
|
||||
@@ -358,7 +364,7 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
SELECT distinct new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
@@ -475,7 +481,7 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
SELECT distinct new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
@@ -541,7 +547,7 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
||||
|
||||
@Query(
|
||||
"""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
SELECT distinct new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
@@ -597,7 +603,7 @@ public interface ParcelleRepository extends JpaRepository<Parcelle, Long>, JpaSp
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
SELECT distinct new io.gmss.fiscad.paylaods.request.crudweb.ParcellePayLoadWeb(
|
||||
p.id,
|
||||
p.q,
|
||||
p.i,
|
||||
|
||||
@@ -76,7 +76,12 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
||||
p.observation,
|
||||
e.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
|
||||
LEFT JOIN p.typePiece tp
|
||||
@@ -109,7 +114,12 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
||||
p.observation,
|
||||
e.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
|
||||
LEFT JOIN p.typePiece tp
|
||||
@@ -141,7 +151,12 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
||||
p.observation,
|
||||
e.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
|
||||
LEFT JOIN p.typePiece tp
|
||||
@@ -180,7 +195,12 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
||||
p.observation,
|
||||
e.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
|
||||
LEFT JOIN p.typePiece tp
|
||||
@@ -249,7 +269,12 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
||||
p.observation,
|
||||
e.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
|
||||
LEFT JOIN p.typePiece tp
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package io.gmss.fiscad.persistence.repositories.rfu.metier;
|
||||
|
||||
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.EnquetePayLoadWeb;
|
||||
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.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
@@ -128,10 +131,23 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
||||
eb.nombrePiscine,
|
||||
eb.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eb.batiment b
|
||||
LEFT JOIN b.parcelle parc
|
||||
LEFT JOIN eb.personne p
|
||||
LEFT JOIN eb.user u
|
||||
LEFT JOIN eb.exercice ex
|
||||
@@ -192,10 +208,22 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
||||
eb.nombrePiscine,
|
||||
eb.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eb.batiment b
|
||||
LEFT JOIN b.parcelle parc
|
||||
LEFT JOIN eb.personne p
|
||||
LEFT JOIN eb.user u
|
||||
LEFT JOIN eb.exercice ex
|
||||
@@ -256,10 +284,22 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
||||
eb.nombrePiscine,
|
||||
eb.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eb.batiment b
|
||||
LEFT JOIN b.parcelle parc
|
||||
LEFT JOIN eb.personne p
|
||||
LEFT JOIN eb.user u
|
||||
LEFT JOIN eb.exercice ex
|
||||
@@ -326,10 +366,22 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
||||
eb.nombrePiscine,
|
||||
eb.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eb.batiment b
|
||||
LEFT JOIN b.parcelle parc
|
||||
LEFT JOIN eb.personne p
|
||||
LEFT JOIN eb.user u
|
||||
LEFT JOIN eb.exercice ex
|
||||
@@ -393,10 +445,22 @@ public interface EnqueteBatimentRepository extends JpaRepository<EnqueteBatiment
|
||||
eb.nombrePiscine,
|
||||
eb.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eb.batiment b
|
||||
LEFT JOIN b.parcelle parc
|
||||
LEFT JOIN eb.personne p
|
||||
LEFT JOIN eb.user u
|
||||
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;
|
||||
|
||||
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.response.restoration.EnqueteUniteLogementPayLoadRestor;
|
||||
import io.gmss.fiscad.paylaods.response.statistique.ParcelleStatsProjectionUnSecteur;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
@@ -118,10 +121,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
||||
eul.nombrePiscine,
|
||||
eul.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eul.uniteLogement ul
|
||||
LEFT JOIN Batiment b
|
||||
LEFT JOIN eul.personne p
|
||||
LEFT JOIN eul.user u
|
||||
LEFT JOIN eul.exercice ex
|
||||
@@ -180,10 +192,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
||||
eul.nombrePiscine,
|
||||
eul.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eul.uniteLogement ul
|
||||
LEFT JOIN ul.batiment b
|
||||
LEFT JOIN eul.personne p
|
||||
LEFT JOIN eul.user u
|
||||
LEFT JOIN eul.exercice ex
|
||||
@@ -243,10 +264,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
||||
eul.nombrePiscine,
|
||||
eul.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eul.uniteLogement ul
|
||||
LEFT JOIN ul.batiment b
|
||||
LEFT JOIN eul.personne p
|
||||
LEFT JOIN eul.user u
|
||||
LEFT JOIN eul.exercice ex
|
||||
@@ -312,10 +342,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
||||
eul.nombrePiscine,
|
||||
eul.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eul.uniteLogement ul
|
||||
LEFT JOIN ul.batiment b
|
||||
LEFT JOIN eul.personne p
|
||||
LEFT JOIN eul.user u
|
||||
LEFT JOIN eul.exercice ex
|
||||
@@ -377,10 +416,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
||||
eul.nombrePiscine,
|
||||
eul.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eul.uniteLogement ul
|
||||
LEFT JOIN ul.batiment b
|
||||
LEFT JOIN eul.personne p
|
||||
LEFT JOIN eul.user u
|
||||
LEFT JOIN eul.exercice ex
|
||||
@@ -448,10 +496,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
||||
eul.nombrePiscine,
|
||||
eul.montantLocatifAnnuelCalcule,
|
||||
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
|
||||
LEFT JOIN eul.uniteLogement ul
|
||||
LEFT JOIN ul.batiment b
|
||||
LEFT JOIN eul.personne p
|
||||
LEFT JOIN eul.user u
|
||||
LEFT JOIN eul.exercice ex
|
||||
@@ -513,10 +570,19 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
||||
eul.nombrePiscine,
|
||||
eul.montantLocatifAnnuelCalcule ,
|
||||
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
|
||||
LEFT JOIN eul.uniteLogement ul
|
||||
LEFT JOIN ul.batiment b
|
||||
LEFT JOIN eul.personne p
|
||||
LEFT JOIN eul.user u
|
||||
LEFT JOIN eul.exercice ex
|
||||
@@ -535,4 +601,171 @@ public interface EnqueteUniteLogementRepository extends JpaRepository<EnqueteUni
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@ package io.gmss.fiscad.service;
|
||||
|
||||
import io.gmss.fiscad.controllers.rfu.metier.ImpositionsTfuController;
|
||||
import io.gmss.fiscad.entities.decoupage.*;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
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.metier.*;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.*;
|
||||
import io.gmss.fiscad.entities.rfu.metier.*;
|
||||
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.paylaods.request.crudweb.*;
|
||||
import io.gmss.fiscad.persistence.repositories.decoupage.*;
|
||||
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.PieceRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.UploadRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.*;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.*;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.*;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.BaremRfuNonBatiRepository;
|
||||
@@ -77,6 +71,9 @@ public class EntityFromPayLoadService {
|
||||
private final BaremRfuRepository baremRfuRepository ;
|
||||
private final BaremRfuNonBatiRepository baremRfuNonBatiRepository ;
|
||||
private final ImpositionsTfuRepository impositionsTfuRepository ;
|
||||
private final RueRepository rueRepository ;
|
||||
private final NatureDomaineRepository natureDomaineRepository ;
|
||||
private final TypeDomaineRepository typeDomaineRepository ;
|
||||
|
||||
|
||||
public CaracteristiqueParcelle getCaracteristiqueParcelleFromPayLoadWeb(CaracteristiqueParcellePayloadWeb caracteristiqueParcellePayloadWeb){
|
||||
@@ -860,6 +857,7 @@ public class EntityFromPayLoadService {
|
||||
|
||||
|
||||
|
||||
|
||||
public BaremRfuBati getBaremRfuBatiFromPayLoadWeb(BaremRfuBatiPayloadWeb baremRfuBatiPayloadWeb){
|
||||
BaremRfuBati baremRfuBati = new BaremRfuBati();
|
||||
if (baremRfuBatiPayloadWeb.getId()!=null)
|
||||
@@ -960,4 +958,43 @@ public class EntityFromPayLoadService {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
spring.profiles.active=${SPRING_PROFILES_ACTIVE}
|
||||
#spring.profiles.active=abomey
|
||||
#spring.profiles.active=test
|
||||
#test
|
||||
spring.jpa.properties.hibernate.id.new_generator_mappings=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
spring.jpa.open-in-view=false
|
||||
|
||||
Reference in New Issue
Block a user