gestion revu de code en utilisant uniquement les DTO
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 30s
All checks were successful
CI - Build & Test (develop) / build-and-test (pull_request) Successful in 30s
This commit is contained in:
@@ -212,8 +212,8 @@ public class EnqueteController {
|
||||
summary = "Récupérer les enquetes d'une parcelle",
|
||||
description = "Permet de récuperer les enquêtes déjà réalisées sur une parcelles"
|
||||
)
|
||||
@GetMapping("/all/by-parcelle-id/{parcelleId}")
|
||||
public ResponseEntity<?> getAllByEnqueteDecoupageAdmin(@PathVariable Long parcelleId) {
|
||||
@GetMapping("/by-parcelle-id/{parcelleId}")
|
||||
public ResponseEntity<?> getAllByParcelle(@PathVariable Long parcelleId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteListByParcelle(parcelleId), "Liste des enquetes chargée avec succès."),
|
||||
@@ -236,6 +236,36 @@ public class EnqueteController {
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "Récupérer les enquetes d'une parcelle",
|
||||
description = "Permet de récuperer les enquêtes déjà réalisées sur une parcelles"
|
||||
)
|
||||
@GetMapping("/page/by-parcelle-id/{parcelleId}")
|
||||
public ResponseEntity<?> getAllByParcellePaged(@PathVariable Long parcelleId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteListByParcellePageable(parcelleId,pageable), "Liste des enquetes 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/dgi/decoupage-admin-for-enquete")
|
||||
|
||||
@@ -7,6 +7,7 @@ import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.PersonneService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.dto.PersonneCompletDTO;
|
||||
import io.gmss.fiscad.paylaods.request.RecherchePersonneResquestBody;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnquetePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.PersonnePayLoadWeb;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -111,4 +112,21 @@ public class PersonneController {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/recherche")
|
||||
public ResponseEntity<?> rechercherPersonne(@RequestBody RecherchePersonneResquestBody recherchePersonneResquestBody ) {
|
||||
try{
|
||||
personneService.recherchePersonne(recherchePersonneResquestBody);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, null, "Personne retrouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
package io.gmss.fiscad.controllers.infocad.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.PieceService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.PiecePayLoadWeb;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping(value = "api/piece", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Piece")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class PieceController {
|
||||
|
||||
private final PieceService pieceService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PieceController.class);
|
||||
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createPiece(@RequestBody @Valid @Validated PiecePayLoadWeb piecePayLoadWeb) {
|
||||
try {
|
||||
piecePayLoadWeb = pieceService.createPiece(piecePayLoadWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, piecePayLoadWeb, "Piece créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updatePiece(@PathVariable Long id, @RequestBody PiecePayLoadWeb piecePayLoadWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, pieceService.updatePiece(id,piecePayLoadWeb), "Piece mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deletePiece(@PathVariable Long id) {
|
||||
try {
|
||||
pieceService.deletePiece(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "Piece supprimé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")
|
||||
public ResponseEntity<?> getAllPieceList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, pieceService.getPieceListToDto(), "Liste des caractéristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllPiecePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, pieceService.getPieceListToDtoPageable(pageable), "Liste des caractéristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all/by-enquete-id/{enqueteId}")
|
||||
public ResponseEntity<?> getAllPieceByEnqueteList(@PathVariable Long enqueteId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, pieceService.getAllPieceByEnqueteToDto(enqueteId), "Liste des pieces 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/by-enquete-id/{enqueteId}")
|
||||
public ResponseEntity<?> getAllPieceByParcellePaged(@PathVariable Long enqueteId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, pieceService.getAllPieceByEnqueteToDtoPageable(enqueteId,pageable), "Liste des pieces 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("/id/{id}")
|
||||
public ResponseEntity<?> getPieceById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, pieceService.getPieceByToDto(id), "Piece trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DeclarationNcService;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteBatimentService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DeclarationNcPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.EnqueteBatimentPayloadWeb;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping(value = "api/declaration-nc", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Déclaration NC")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class DeclarationNcController {
|
||||
|
||||
private final DeclarationNcService declarationNcService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(DeclarationNcController.class);
|
||||
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createDeclarationNc(@RequestBody @Valid @Validated DeclarationNcPayloadWeb declarationNcPayloadWeb) {
|
||||
try {
|
||||
declarationNcPayloadWeb = declarationNcService.createDeclarationNc(declarationNcPayloadWeb);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, declarationNcPayloadWeb, "Déclaration NC créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateEnqueteBatiment(@PathVariable Long id, @RequestBody DeclarationNcPayloadWeb declarationNcPayloadWeb) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, declarationNcService.updateDeclarationNc(id, declarationNcPayloadWeb), "Enquete batiment mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteEnqueteBatiment(@PathVariable Long id) {
|
||||
try {
|
||||
declarationNcService.deleteDeclarationNc(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "Déclaration Nc supprimé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")
|
||||
public ResponseEntity<?> getAllEnqueteBatimentList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, declarationNcService.getDeclarationNcList(), "Liste des Enquetes batiments chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllEnqueteBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, declarationNcService.getDeclarationNcList(pageable), "Liste des Enquetes batiments chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getEnqueteBatimentById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, declarationNcService.getDeclarationNcById(id), "Enquete batiment trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/by-personne-id/{personneId}")
|
||||
public ResponseEntity<?> getDeclarationNcByPersonne(@PathVariable Long personneId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, declarationNcService.getDeclarationNcByPersonneList(personneId), "Déclarations NC trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/page/by-personne-id/{personneId}")
|
||||
public ResponseEntity<?> getDeclarationNcByPersonnePaged(@PathVariable Long personneId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, declarationNcService.getDeclarationNcByPersonneList(personneId,pageable), "Déclaration NC trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.ModeAcquisition;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueParcelle;
|
||||
@@ -74,6 +75,10 @@ public class Enquete extends BaseEntity implements Serializable {
|
||||
@ManyToOne
|
||||
private Exercice exercice;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private ModeAcquisition modeAcquisition;
|
||||
|
||||
private Long mobileDataId;
|
||||
|
||||
@JsonIgnore
|
||||
|
||||
@@ -32,18 +32,22 @@ public class DeclarationNc extends BaseEntity implements Serializable {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDerniereDeclaration;
|
||||
|
||||
private String nc;
|
||||
|
||||
@OneToOne
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDeclarationNc;
|
||||
|
||||
private String nc;
|
||||
private String observation;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Structure structure;
|
||||
|
||||
// @JsonIgnore
|
||||
// @ManyToOne
|
||||
// private Enquete enquete;
|
||||
|
||||
private Long enqueteExternalKey;
|
||||
|
||||
|
||||
@@ -308,24 +308,29 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Enquete> getEnqueteList(Pageable pageable) {
|
||||
return enqueteRepository.findAll(pageable);
|
||||
public Page<EnquetePayLoadWeb> getEnqueteList(Pageable pageable) {
|
||||
return enqueteRepository.findAllEnquetesToDtoPageable(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Enquete> getEnqueteList() {
|
||||
return enqueteRepository.findAll();
|
||||
public List<EnquetePayLoadWeb> getEnqueteList() {
|
||||
return enqueteRepository.findAllEnquetesToDto();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Enquete> getEnqueteListByParcelle(Long parcelleId) {
|
||||
return enqueteRepository.findAllByParcelle_Id(parcelleId);
|
||||
public List<EnquetePayLoadWeb> getEnqueteListByParcelle(Long parcelleId) {
|
||||
return enqueteRepository.findAllEnquetesByParcelleToDto(parcelleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Enquete> getEnqueteById(Long id) {
|
||||
public Page<EnquetePayLoadWeb> getEnqueteListByParcellePageable(Long parcelleId, Pageable pageable) {
|
||||
return enqueteRepository.findAllEnquetesByParcelleToDtoPageable(parcelleId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<EnquetePayLoadWeb> getEnqueteById(Long id) {
|
||||
if (enqueteRepository.existsById(id)) {
|
||||
return enqueteRepository.findById(id);
|
||||
return enqueteRepository.findEnqueteToDto(id);
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête.");
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.PersonneService;
|
||||
import io.gmss.fiscad.paylaods.dto.*;
|
||||
import io.gmss.fiscad.paylaods.request.RecherchePersonneResquestBody;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.PersonnePayLoadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.decoupage.CommuneRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.decoupage.NationaliteRepository;
|
||||
@@ -17,6 +18,7 @@ import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneReposit
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.ProfessionRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.SituationMatrimonialeRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.TypePersonneRepository;
|
||||
import io.gmss.fiscad.service.CallAPIService;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -41,6 +43,7 @@ public class PersonneServiceImpl implements PersonneService {
|
||||
private final ProfessionRepository professionRepository;
|
||||
private final SituationMatrimonialeRepository situationMatrimonialeRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final CallAPIService callAPIService;
|
||||
|
||||
@Override
|
||||
public Personne createPersonne(PersonnePayLoadWeb personnePayLoadWeb) throws BadRequestException {
|
||||
@@ -189,5 +192,11 @@ public class PersonneServiceImpl implements PersonneService {
|
||||
membres
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Personne> recherchePersonne(RecherchePersonneResquestBody recherchePersonneResquestBody) {
|
||||
callAPIService.callGetIfuEnLigneToken();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,44 +1,106 @@
|
||||
package io.gmss.fiscad.implementations.infocad.metier;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Piece;
|
||||
import io.gmss.fiscad.entities.rfu.metier.DeclarationNc;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.PieceService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.PiecePayLoadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.PieceRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class PieceServiceImpl implements PieceService {
|
||||
private final PieceRepository pieceRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
private final EnqueteRepository enqueteRepository;
|
||||
private final PersonneRepository personneRepository;
|
||||
@Override
|
||||
public Piece createPiece(Piece piece) throws BadRequestException {
|
||||
return null;
|
||||
public PiecePayLoadWeb createPiece(PiecePayLoadWeb piecePayLoadWeb) throws BadRequestException {
|
||||
if (piecePayLoadWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle déclaration NC ayant un id non null.");
|
||||
}
|
||||
|
||||
Piece piece= entityFromPayLoadService.getPieceFromPayLoadWeb(piecePayLoadWeb);
|
||||
piece =pieceRepository.save(piece);
|
||||
return pieceRepository.findPieceToDto(piece.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Piece updatePiece(Long id, Piece piece) throws NotFoundException {
|
||||
return null;
|
||||
public PiecePayLoadWeb updatePiece(Long id, PiecePayLoadWeb piecePayLoadWeb) throws NotFoundException {
|
||||
if (piecePayLoadWeb.getId() == null) {
|
||||
throw new BadRequestException("La piece n'existe pas.");
|
||||
}
|
||||
|
||||
if (!pieceRepository.existsById(piecePayLoadWeb.getId())) {
|
||||
throw new NotFoundException("La piece n'existe pas");
|
||||
}
|
||||
|
||||
Piece piece= entityFromPayLoadService.getPieceFromPayLoadWeb(piecePayLoadWeb);
|
||||
piece =pieceRepository.save(piece);
|
||||
return pieceRepository.findPieceToDto(piece.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePiece(Long id) throws NotFoundException {
|
||||
|
||||
Optional<Piece> pieceOptional = pieceRepository.findById(id);
|
||||
if (pieceOptional.isPresent()) {
|
||||
pieceRepository.deleteById(pieceOptional.get().getId());
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la piece à supprimer .");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Piece> getPieceList(Pageable pageable) {
|
||||
return null;
|
||||
public Page<PiecePayLoadWeb> getPieceListToDtoPageable(Pageable pageable) {
|
||||
return pieceRepository.findAllToDtoPageable(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Piece> getPieceList() {
|
||||
return null;
|
||||
public List<PiecePayLoadWeb> getPieceListToDto() {
|
||||
return pieceRepository.findAllPieceToDto();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Piece> getPieceById(Long id) {
|
||||
return Optional.empty();
|
||||
public Optional<PiecePayLoadWeb> getPieceByToDto(Long id) {
|
||||
return pieceRepository.findPieceToDto(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PiecePayLoadWeb> getAllPieceByEnqueteToDto(Long id) {
|
||||
return pieceRepository.findByFilters(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
id,
|
||||
null,
|
||||
null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PiecePayLoadWeb> getAllPieceByEnqueteToDtoPageable(Long id,Pageable pageable) {
|
||||
return pieceRepository.findByFiltersPageable(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
id,
|
||||
null,
|
||||
null,
|
||||
pageable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +1,66 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueUniteLogement;
|
||||
import io.gmss.fiscad.entities.rfu.metier.DeclarationNc;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DeclarationNcService;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DeclarationNcPayloadWeb;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.PersonneRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.infocad.parametre.StructureRepository;
|
||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.DeclarationNcRepository;
|
||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Service
|
||||
public class DeclarationNcServiceImpl implements DeclarationNcService {
|
||||
|
||||
private final DeclarationNcRepository declarationNcRepository;
|
||||
private final StructureRepository structureRepository;
|
||||
private final PersonneRepository personneRepository;
|
||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||
|
||||
public DeclarationNcServiceImpl(DeclarationNcRepository declarationNcRepository) {
|
||||
this.declarationNcRepository = declarationNcRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeclarationNc createDeclarationNc(DeclarationNc declarationNc) throws BadRequestException {
|
||||
if (declarationNc.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle enquete de batiment ayant un id non null.");
|
||||
public DeclarationNcPayloadWeb createDeclarationNc(DeclarationNcPayloadWeb declarationNcPayloadWeb) throws BadRequestException {
|
||||
if (declarationNcPayloadWeb.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle déclaration NC ayant un id non null.");
|
||||
}
|
||||
return declarationNcRepository.save(declarationNc);
|
||||
if (!personneRepository.existsById(declarationNcPayloadWeb.getPersonneId())) {
|
||||
throw new BadRequestException("Veuillez préciser le contribuable.");
|
||||
}
|
||||
if (!structureRepository.existsById(declarationNcPayloadWeb.getStructureId())) {
|
||||
throw new BadRequestException("Veuillez préciser le centre.");
|
||||
}
|
||||
|
||||
DeclarationNc declarationNc= entityFromPayLoadService.getDeclarationNcFromPayLoadWeb(declarationNcPayloadWeb);
|
||||
declarationNc =declarationNcRepository.save(declarationNc);
|
||||
return declarationNcRepository.findDeclarationNcToDto(declarationNc.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeclarationNc updateDeclarationNc(Long id, DeclarationNc declarationNc) throws NotFoundException {
|
||||
if (declarationNc.getId() == null) {
|
||||
public DeclarationNcPayloadWeb updateDeclarationNc(Long id, DeclarationNcPayloadWeb declarationNcPayloadWeb) throws NotFoundException {
|
||||
if (declarationNcPayloadWeb.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle enquete de batiment ayant un id null.");
|
||||
}
|
||||
if (!declarationNcRepository.existsById(declarationNc.getId())) {
|
||||
if (!declarationNcRepository.existsById(declarationNcPayloadWeb.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle enquete de batiment spécifiée dans notre base de données.");
|
||||
}
|
||||
return declarationNcRepository.save(declarationNc);
|
||||
if (!personneRepository.existsById(declarationNcPayloadWeb.getPersonneId())) {
|
||||
throw new BadRequestException("Veuillez préciser le contribuable.");
|
||||
}
|
||||
if (!structureRepository.existsById(declarationNcPayloadWeb.getStructureId())) {
|
||||
throw new BadRequestException("Veuillez préciser le centre.");
|
||||
}
|
||||
DeclarationNc declarationNc= entityFromPayLoadService.getDeclarationNcFromPayLoadWeb(declarationNcPayloadWeb);
|
||||
declarationNc =declarationNcRepository.save(declarationNc);
|
||||
return declarationNcRepository.findDeclarationNcToDto(declarationNc.getId()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -51,23 +74,36 @@ public class DeclarationNcServiceImpl implements DeclarationNcService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DeclarationNc> getDeclarationNcList(Pageable pageable) {
|
||||
return declarationNcRepository.findAll(pageable);
|
||||
public Page<DeclarationNcPayloadWeb> getDeclarationNcList(Pageable pageable) {
|
||||
return declarationNcRepository.findAllDeclarationNcToDtoPageable(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeclarationNc> getDeclarationNcList() {
|
||||
return declarationNcRepository.findAll();
|
||||
public List<DeclarationNcPayloadWeb> getDeclarationNcList() {
|
||||
return declarationNcRepository.findAllDeclarationNcToDto();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<DeclarationNc> getDeclarationNcById(Long id) {
|
||||
public Optional<DeclarationNcPayloadWeb> getDeclarationNcById(Long id) {
|
||||
if (declarationNcRepository.existsById(id)) {
|
||||
return declarationNcRepository.findById(id);
|
||||
return declarationNcRepository.findDeclarationNcToDto(id);
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle enquete de batiment spécifiée dans la base de données.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DeclarationNcPayloadWeb> getDeclarationNcByPersonneList(Long personneId, Pageable pageable) {
|
||||
return declarationNcRepository.findAllDeclarationNcByPersonneToDtoPageable(personneId,pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeclarationNcPayloadWeb> getDeclarationNcByPersonneList(Long personneId) {
|
||||
return declarationNcRepository.findAllDeclarationNcByPersonneToDto(personneId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,17 +25,18 @@ public interface EnqueteService {
|
||||
|
||||
void deleteEnquete(Long id) throws NotFoundException;
|
||||
|
||||
Page<Enquete> getEnqueteList(Pageable pageable);
|
||||
Page<EnquetePayLoadWeb> getEnqueteList(Pageable pageable);
|
||||
|
||||
List<Enquete> getEnqueteList();
|
||||
List<EnquetePayLoadWeb> getEnqueteList();
|
||||
|
||||
List<Enquete> getEnqueteListByParcelle(Long parcelleId);
|
||||
List<EnquetePayLoadWeb> getEnqueteListByParcelle(Long parcelleId);
|
||||
Page<EnquetePayLoadWeb> getEnqueteListByParcellePageable(Long parcelleId,Pageable pageable);
|
||||
|
||||
List<EnqueteResponse> getEnqueteCommuneArrondBloc();
|
||||
|
||||
List<EnqueteFiltreResponse> getEnqueteCommuneArrondBlocFiltre(FiltreEnquetePayLoad filtreEnquetePayLoad);
|
||||
|
||||
Optional<Enquete> getEnqueteById(Long id);
|
||||
Optional<EnquetePayLoadWeb> getEnqueteById(Long id);
|
||||
|
||||
Enquete validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.dto.PersonneCompletDTO;
|
||||
import io.gmss.fiscad.paylaods.request.RecherchePersonneResquestBody;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.PersonnePayLoadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -25,4 +26,5 @@ public interface PersonneService {
|
||||
|
||||
Optional<Personne> getPersonneById(Long id);
|
||||
PersonneCompletDTO getPersonneComplete(Long id);
|
||||
List<Personne> recherchePersonne(RecherchePersonneResquestBody recherchePersonneResquestBody);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.interfaces.infocad.metier;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Piece;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.PiecePayLoadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -11,15 +12,17 @@ import java.util.Optional;
|
||||
|
||||
public interface PieceService {
|
||||
|
||||
Piece createPiece(Piece piece) throws BadRequestException;
|
||||
PiecePayLoadWeb createPiece(PiecePayLoadWeb piecePayLoadWeb) throws BadRequestException;
|
||||
|
||||
Piece updatePiece(Long id, Piece piece) throws NotFoundException;
|
||||
PiecePayLoadWeb updatePiece(Long id, PiecePayLoadWeb piecePayLoadWeb) throws NotFoundException;
|
||||
|
||||
void deletePiece(Long id) throws NotFoundException;
|
||||
|
||||
Page<Piece> getPieceList(Pageable pageable);
|
||||
Page<PiecePayLoadWeb> getPieceListToDtoPageable(Pageable pageable);
|
||||
|
||||
List<Piece> getPieceList();
|
||||
List<PiecePayLoadWeb> getPieceListToDto();
|
||||
|
||||
Optional<Piece> getPieceById(Long id);
|
||||
Optional<PiecePayLoadWeb> getPieceByToDto(Long id);
|
||||
List<PiecePayLoadWeb> getAllPieceByEnqueteToDto(Long id);
|
||||
Page<PiecePayLoadWeb> getAllPieceByEnqueteToDtoPageable(Long id,Pageable pageable);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.interfaces.rfu.metier;
|
||||
import io.gmss.fiscad.entities.rfu.metier.DeclarationNc;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DeclarationNcPayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -11,15 +12,19 @@ import java.util.Optional;
|
||||
|
||||
public interface DeclarationNcService {
|
||||
|
||||
DeclarationNc createDeclarationNc(DeclarationNc declarationNc) throws BadRequestException;
|
||||
DeclarationNcPayloadWeb createDeclarationNc(DeclarationNcPayloadWeb declarationNcPayloadWeb) throws BadRequestException;
|
||||
|
||||
DeclarationNc updateDeclarationNc(Long id, DeclarationNc declarationNc) throws NotFoundException;
|
||||
DeclarationNcPayloadWeb updateDeclarationNc(Long id, DeclarationNcPayloadWeb declarationNcPayloadWeb) throws NotFoundException;
|
||||
|
||||
void deleteDeclarationNc(Long id) throws NotFoundException;
|
||||
|
||||
Page<DeclarationNc> getDeclarationNcList(Pageable pageable);
|
||||
Page<DeclarationNcPayloadWeb> getDeclarationNcList(Pageable pageable);
|
||||
|
||||
List<DeclarationNc> getDeclarationNcList();
|
||||
List<DeclarationNcPayloadWeb> getDeclarationNcList();
|
||||
|
||||
Optional<DeclarationNc> getDeclarationNcById(Long id);
|
||||
Optional<DeclarationNcPayloadWeb> getDeclarationNcById(Long id);
|
||||
|
||||
Page<DeclarationNcPayloadWeb> getDeclarationNcByPersonneList(Long personneId,Pageable pageable);
|
||||
|
||||
List<DeclarationNcPayloadWeb> getDeclarationNcByPersonneList(Long personneId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package io.gmss.fiscad.paylaods.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IfuEnLigneLoginBoby {
|
||||
private String password;
|
||||
private String usernameOrEmail;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package io.gmss.fiscad.paylaods.request;
|
||||
|
||||
public class IfuEnLigneRechercheBody {
|
||||
private String ifu;
|
||||
private String nom;
|
||||
private String prenom;
|
||||
private String dateNaissance;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package io.gmss.fiscad.paylaods.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RecherchePersonneResquestBody {
|
||||
private String ifu;
|
||||
private String nom;
|
||||
private String nomMere;
|
||||
private String prenom;
|
||||
private String dateNaissance;
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@@ -9,10 +12,29 @@ import java.util.List;
|
||||
public class DeclarationNcPayloadWeb {
|
||||
private Long id;
|
||||
private LocalDate dateDerniereDeclaration;
|
||||
private LocalDate dateDeclarationNc;
|
||||
private String nc;
|
||||
private Long structureId;
|
||||
private Long enqueteId;
|
||||
private String structureCode;
|
||||
private String structureNom;
|
||||
private Long personneId;
|
||||
private String personneNom;
|
||||
private String personnePrenom;
|
||||
private String personneRaisonSociale;
|
||||
private String observation;
|
||||
private List<UploadPayLoadWeb> uploadPayLoadWebs;
|
||||
|
||||
public DeclarationNcPayloadWeb(Long id, LocalDate dateDerniereDeclaration, LocalDate dateDeclarationNc, String nc, Long structureId, String structureCode, String structureNom, Long personneId, String personneNom, String personnePrenom, String personneRaisonSociale, String observation) {
|
||||
this.id = id;
|
||||
this.dateDerniereDeclaration = dateDerniereDeclaration;
|
||||
this.dateDeclarationNc = dateDeclarationNc;
|
||||
this.nc = nc;
|
||||
this.structureId = structureId;
|
||||
this.structureCode = structureCode;
|
||||
this.structureNom = structureNom;
|
||||
this.personneId = personneId;
|
||||
this.personneNom = personneNom;
|
||||
this.personnePrenom = personnePrenom;
|
||||
this.personneRaisonSociale = personneRaisonSociale;
|
||||
this.observation = observation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,11 @@ public class EnquetePayLoadWeb {
|
||||
private String parcelleP;
|
||||
private Long exerviceId;
|
||||
private Integer exerviceAnnee;
|
||||
private Long modeAcquisitionId;
|
||||
private String modeAcquisitionLibelle;
|
||||
|
||||
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 exerviceId, Integer exerviceAnnee) {
|
||||
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 exerviceId, Integer exerviceAnnee,
|
||||
Long modeAcquisitionId,String modeAcquisitionLibelle) {
|
||||
this.id = id;
|
||||
this.dateEnquete = dateEnquete;
|
||||
this.dateFinalisation = dateFinalisation;
|
||||
@@ -101,5 +104,7 @@ public class EnquetePayLoadWeb {
|
||||
this.parcelleP = parcelleP;
|
||||
this.exerviceId = exerviceId;
|
||||
this.exerviceAnnee = exerviceAnnee;
|
||||
this.modeAcquisitionId = modeAcquisitionId;
|
||||
this.modeAcquisitionLibelle = modeAcquisitionLibelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,37 @@ public class PiecePayLoadWeb {
|
||||
private String numeroPiece;
|
||||
private String url;
|
||||
private Long typePieceId;
|
||||
private String typePieceLibelle;
|
||||
private Long personneId;
|
||||
private String personneNom;
|
||||
private String personnePrenom;
|
||||
private String personneRaisonSociale;
|
||||
private Long sourceDroitId;
|
||||
private String sourceDroitLibelle;
|
||||
private Long modeAcquisitionId;
|
||||
private String modeAcquisitionLibelle;
|
||||
private String observation;
|
||||
private Long enqueteId;
|
||||
private List<UploadPayLoadWeb> uploadPayLoadWebs;
|
||||
|
||||
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) {
|
||||
this.id = id;
|
||||
this.dateExpiration = dateExpiration;
|
||||
this.dateEtablissement = dateEtablissement;
|
||||
this.numeroPiece = numeroPiece;
|
||||
this.url = url;
|
||||
this.typePieceId = typePieceId;
|
||||
this.typePieceLibelle = typePieceLibelle;
|
||||
this.personneId = personneId;
|
||||
this.personneNom = personneNom;
|
||||
this.personnePrenom = personnePrenom;
|
||||
this.personneRaisonSociale = personneRaisonSociale;
|
||||
this.sourceDroitId = sourceDroitId;
|
||||
this.sourceDroitLibelle = sourceDroitLibelle;
|
||||
this.modeAcquisitionId = modeAcquisitionId;
|
||||
this.modeAcquisitionLibelle = modeAcquisitionLibelle;
|
||||
this.observation = observation;
|
||||
this.enqueteId = enqueteId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,9 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
pa.i,
|
||||
pa.p,
|
||||
ex.id,
|
||||
ex.annee
|
||||
ex.annee,
|
||||
ma.id,
|
||||
ma.libelle
|
||||
)
|
||||
FROM Enquete e
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -284,6 +286,7 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
LEFT JOIN e.user u
|
||||
LEFT JOIN e.parcelle pa
|
||||
LEFT JOIN e.exercice ex
|
||||
LEFT JOIN e.modeAcquisition ma
|
||||
""")
|
||||
List<EnquetePayLoadWeb> findAllEnquetesToDto();
|
||||
|
||||
@@ -330,7 +333,9 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
pa.i,
|
||||
pa.p,
|
||||
ex.id,
|
||||
ex.annee
|
||||
ex.annee,
|
||||
ma.id,
|
||||
ma.libelle
|
||||
)
|
||||
FROM Enquete e
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -338,6 +343,7 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
LEFT JOIN e.user u
|
||||
LEFT JOIN e.parcelle pa
|
||||
LEFT JOIN e.exercice ex
|
||||
LEFT JOIN e.modeAcquisition ma
|
||||
WHERE e.id = :enqueteId
|
||||
""")
|
||||
Optional<EnquetePayLoadWeb> findEnqueteToDto(@Param("enqueteId") Long enqueteId);
|
||||
@@ -386,7 +392,9 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
pa.i,
|
||||
pa.p,
|
||||
ex.id,
|
||||
ex.annee
|
||||
ex.annee,
|
||||
ma.id,
|
||||
ma.libelle
|
||||
)
|
||||
FROM Enquete e
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -394,6 +402,7 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
LEFT JOIN e.user u
|
||||
LEFT JOIN e.parcelle pa
|
||||
LEFT JOIN e.exercice ex
|
||||
LEFT JOIN e.modeAcquisition ma
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(e)
|
||||
@@ -445,7 +454,9 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
pa.i,
|
||||
pa.p,
|
||||
ex.id,
|
||||
ex.annee
|
||||
ex.annee,
|
||||
ma.id,
|
||||
ma.libelle
|
||||
)
|
||||
FROM Enquete e
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -453,6 +464,7 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
LEFT JOIN e.user u
|
||||
LEFT JOIN e.parcelle pa
|
||||
LEFT JOIN e.exercice ex
|
||||
LEFT JOIN e.modeAcquisition ma
|
||||
WHERE ex.id = :exerciceId
|
||||
""")
|
||||
List<EnquetePayLoadWeb> findEnquetesByExerciceToDto(
|
||||
@@ -504,7 +516,9 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
pa.i,
|
||||
pa.p,
|
||||
ex.id,
|
||||
ex.annee
|
||||
ex.annee,
|
||||
ma.id,
|
||||
ma.libelle
|
||||
)
|
||||
FROM Enquete e
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -512,6 +526,7 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
LEFT JOIN e.user u
|
||||
LEFT JOIN e.parcelle pa
|
||||
LEFT JOIN e.exercice ex
|
||||
LEFT JOIN e.modeAcquisition ma
|
||||
WHERE ex.id = :exerciceId
|
||||
""",
|
||||
countQuery = """
|
||||
@@ -569,7 +584,9 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
pa.i,
|
||||
pa.p,
|
||||
ex.id,
|
||||
ex.annee
|
||||
ex.annee,
|
||||
ma.id,
|
||||
ma.libelle
|
||||
)
|
||||
FROM Enquete e
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -577,9 +594,10 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
LEFT JOIN e.user u
|
||||
LEFT JOIN e.parcelle pa
|
||||
LEFT JOIN e.exercice ex
|
||||
LEFT JOIN e.modeAcquisition ma
|
||||
WHERE pa.id = :parcelleId
|
||||
""")
|
||||
List<EnquetePayLoadWeb> findEnquetesByParcelleToDto(
|
||||
List<EnquetePayLoadWeb> findAllEnquetesByParcelleToDto(
|
||||
@Param("parcelleId") Long parcelleId
|
||||
);
|
||||
|
||||
@@ -627,7 +645,9 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
pa.i,
|
||||
pa.p,
|
||||
ex.id,
|
||||
ex.annee
|
||||
ex.annee,
|
||||
ma.id,
|
||||
ma.libelle
|
||||
)
|
||||
FROM Enquete e
|
||||
LEFT JOIN e.zoneRfu zr
|
||||
@@ -635,6 +655,7 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
LEFT JOIN e.user u
|
||||
LEFT JOIN e.parcelle pa
|
||||
LEFT JOIN e.exercice ex
|
||||
LEFT JOIN e.modeAcquisition ma
|
||||
WHERE pa.id = :parcelleId
|
||||
""",
|
||||
countQuery = """
|
||||
@@ -643,7 +664,7 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
WHERE e.parcelle.id = :parcelleId
|
||||
"""
|
||||
)
|
||||
Page<EnquetePayLoadWeb> findEnquetesByParcelleToDtoPageable(
|
||||
Page<EnquetePayLoadWeb> findAllEnquetesByParcelleToDtoPageable(
|
||||
@Param("parcelleId") Long parcelleId,
|
||||
Pageable pageable
|
||||
);
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package io.gmss.fiscad.persistence.repositories.infocad.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Piece;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.PiecePayLoadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.PiecePayLoadRestor;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -51,5 +56,211 @@ public interface PieceRepository extends JpaRepository<Piece, Long> {
|
||||
|
||||
List<Piece> findByPersonne_IdAndEnqueteIsNull(Long id);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.PiecePayLoadWeb(
|
||||
p.id,
|
||||
p.dateExpiration,
|
||||
p.dateEtablissement,
|
||||
p.numeroPiece,
|
||||
p.url,
|
||||
tp.id,
|
||||
tp.libelle,
|
||||
per.id,
|
||||
per.nom,
|
||||
per.prenom,
|
||||
per.raisonSociale,
|
||||
sd.id,
|
||||
sd.libelle,
|
||||
ma.id,
|
||||
ma.libelle,
|
||||
p.observation,
|
||||
e.id
|
||||
)
|
||||
FROM Piece p
|
||||
LEFT JOIN p.typePiece tp
|
||||
LEFT JOIN p.personne per
|
||||
LEFT JOIN p.sourceDroit sd
|
||||
LEFT JOIN p.modeAcquisition ma
|
||||
LEFT JOIN p.enquete e
|
||||
WHERE p.id = :pieceId
|
||||
""")
|
||||
Optional<PiecePayLoadWeb> findPieceToDto(@Param("pieceId") Long pieceId);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.PiecePayLoadWeb(
|
||||
p.id,
|
||||
p.dateExpiration,
|
||||
p.dateEtablissement,
|
||||
p.numeroPiece,
|
||||
p.url,
|
||||
tp.id,
|
||||
tp.libelle,
|
||||
per.id,
|
||||
per.nom,
|
||||
per.prenom,
|
||||
per.raisonSociale,
|
||||
sd.id,
|
||||
sd.libelle,
|
||||
ma.id,
|
||||
ma.libelle,
|
||||
p.observation,
|
||||
e.id
|
||||
)
|
||||
FROM Piece p
|
||||
LEFT JOIN p.typePiece tp
|
||||
LEFT JOIN p.personne per
|
||||
LEFT JOIN p.sourceDroit sd
|
||||
LEFT JOIN p.modeAcquisition ma
|
||||
LEFT JOIN p.enquete e
|
||||
""")
|
||||
List<PiecePayLoadWeb> findAllPieceToDto();
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.PiecePayLoadWeb(
|
||||
p.id,
|
||||
p.dateExpiration,
|
||||
p.dateEtablissement,
|
||||
p.numeroPiece,
|
||||
p.url,
|
||||
tp.id,
|
||||
tp.libelle,
|
||||
per.id,
|
||||
per.nom,
|
||||
per.prenom,
|
||||
per.raisonSociale,
|
||||
sd.id,
|
||||
sd.libelle,
|
||||
ma.id,
|
||||
ma.libelle,
|
||||
p.observation,
|
||||
e.id
|
||||
)
|
||||
FROM Piece p
|
||||
LEFT JOIN p.typePiece tp
|
||||
LEFT JOIN p.personne per
|
||||
LEFT JOIN p.sourceDroit sd
|
||||
LEFT JOIN p.modeAcquisition ma
|
||||
LEFT JOIN p.enquete e
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(p)
|
||||
FROM Piece p
|
||||
"""
|
||||
)
|
||||
Page<PiecePayLoadWeb> findAllToDtoPageable(Pageable pageable);
|
||||
|
||||
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.PiecePayLoadWeb(
|
||||
p.id,
|
||||
p.dateExpiration,
|
||||
p.dateEtablissement,
|
||||
p.numeroPiece,
|
||||
p.url,
|
||||
tp.id,
|
||||
tp.libelle,
|
||||
per.id,
|
||||
per.nom,
|
||||
per.prenom,
|
||||
per.raisonSociale,
|
||||
sd.id,
|
||||
sd.libelle,
|
||||
ma.id,
|
||||
ma.libelle,
|
||||
p.observation,
|
||||
e.id
|
||||
)
|
||||
FROM Piece p
|
||||
LEFT JOIN p.typePiece tp
|
||||
LEFT JOIN p.personne per
|
||||
LEFT JOIN p.sourceDroit sd
|
||||
LEFT JOIN p.modeAcquisition ma
|
||||
LEFT JOIN p.enquete e
|
||||
WHERE (:typePieceId IS NULL OR tp.id = :typePieceId)
|
||||
AND (:personneId IS NULL OR per.id = :personneId)
|
||||
AND (:sourceDroitId IS NULL OR sd.id = :sourceDroitId)
|
||||
AND (:modeAcquisitionId IS NULL OR ma.id = :modeAcquisitionId)
|
||||
AND (:enqueteId IS NULL OR e.id = :enqueteId)
|
||||
AND (:dateDebut IS NULL OR p.dateEtablissement >= :dateDebut)
|
||||
AND (:dateFin IS NULL OR p.dateEtablissement <= :dateFin)
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(p)
|
||||
FROM Piece p
|
||||
LEFT JOIN p.typePiece tp
|
||||
LEFT JOIN p.personne per
|
||||
LEFT JOIN p.sourceDroit sd
|
||||
LEFT JOIN p.modeAcquisition ma
|
||||
LEFT JOIN p.enquete e
|
||||
WHERE (:typePieceId IS NULL OR tp.id = :typePieceId)
|
||||
AND (:personneId IS NULL OR per.id = :personneId)
|
||||
AND (:sourceDroitId IS NULL OR sd.id = :sourceDroitId)
|
||||
AND (:modeAcquisitionId IS NULL OR ma.id = :modeAcquisitionId)
|
||||
AND (:enqueteId IS NULL OR e.id = :enqueteId)
|
||||
AND (:dateDebut IS NULL OR p.dateEtablissement >= :dateDebut)
|
||||
AND (:dateFin IS NULL OR p.dateEtablissement <= :dateFin)
|
||||
"""
|
||||
)
|
||||
Page<PiecePayLoadWeb> findByFiltersPageable(
|
||||
@Param("typePieceId") Long typePieceId,
|
||||
@Param("personneId") Long personneId,
|
||||
@Param("sourceDroitId") Long sourceDroitId,
|
||||
@Param("modeAcquisitionId") Long modeAcquisitionId,
|
||||
@Param("enqueteId") Long enqueteId,
|
||||
@Param("dateDebut") LocalDate dateDebut,
|
||||
@Param("dateFin") LocalDate dateFin,
|
||||
Pageable pageable
|
||||
);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.PiecePayLoadWeb(
|
||||
p.id,
|
||||
p.dateExpiration,
|
||||
p.dateEtablissement,
|
||||
p.numeroPiece,
|
||||
p.url,
|
||||
tp.id,
|
||||
tp.libelle,
|
||||
per.id,
|
||||
per.nom,
|
||||
per.prenom,
|
||||
per.raisonSociale,
|
||||
sd.id,
|
||||
sd.libelle,
|
||||
ma.id,
|
||||
ma.libelle,
|
||||
p.observation,
|
||||
e.id
|
||||
)
|
||||
FROM Piece p
|
||||
LEFT JOIN p.typePiece tp
|
||||
LEFT JOIN p.personne per
|
||||
LEFT JOIN p.sourceDroit sd
|
||||
LEFT JOIN p.modeAcquisition ma
|
||||
LEFT JOIN p.enquete e
|
||||
WHERE (:typePieceId IS NULL OR tp.id = :typePieceId)
|
||||
AND (:personneId IS NULL OR per.id = :personneId)
|
||||
AND (:sourceDroitId IS NULL OR sd.id = :sourceDroitId)
|
||||
AND (:modeAcquisitionId IS NULL OR ma.id = :modeAcquisitionId)
|
||||
AND (:enqueteId IS NULL OR e.id = :enqueteId)
|
||||
AND (:dateDebut IS NULL OR p.dateEtablissement >= :dateDebut)
|
||||
AND (:dateFin IS NULL OR p.dateEtablissement <= :dateFin)
|
||||
"""
|
||||
)
|
||||
List<PiecePayLoadWeb> findByFilters(
|
||||
@Param("typePieceId") Long typePieceId,
|
||||
@Param("personneId") Long personneId,
|
||||
@Param("sourceDroitId") Long sourceDroitId,
|
||||
@Param("modeAcquisitionId") Long modeAcquisitionId,
|
||||
@Param("enqueteId") Long enqueteId,
|
||||
@Param("dateDebut") LocalDate dateDebut,
|
||||
@Param("dateFin") LocalDate dateFin
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.gmss.fiscad.persistence.repositories.infocad.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DeclarationNcPayloadWeb;
|
||||
import io.gmss.fiscad.paylaods.response.statistique.StatistiqueTypeNombreResponse;
|
||||
import io.gmss.fiscad.paylaods.response.restoration.PersonnePayLoad;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
@@ -60,4 +61,7 @@ public interface PersonneRepository extends JpaRepository<Personne, Long> {
|
||||
group by tp.libelle
|
||||
""",nativeQuery = true)
|
||||
List<StatistiqueTypeNombreResponse> getNombrePersonnesResponse();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package io.gmss.fiscad.persistence.repositories.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.DeclarationNc;
|
||||
import io.gmss.fiscad.paylaods.request.crudweb.DeclarationNcPayloadWeb;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -10,5 +15,124 @@ import java.util.Optional;
|
||||
public interface DeclarationNcRepository extends JpaRepository<DeclarationNc, Long> {
|
||||
Optional<DeclarationNc> findByMobileDataId(Long id);
|
||||
Optional<DeclarationNc> findFirstByExternalKeyAndTerminal_Id(Long externalKey, Long TerminalId);
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DeclarationNcPayloadWeb(
|
||||
d.id,
|
||||
d.dateDerniereDeclaration,
|
||||
d.dateDeclarationNc,
|
||||
d.nc,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
p.id,
|
||||
p.nom,
|
||||
p.prenom,
|
||||
p.raisonSociale,
|
||||
d.observation
|
||||
)
|
||||
FROM DeclarationNc d
|
||||
LEFT JOIN d.structure s
|
||||
LEFT JOIN d.personne p
|
||||
WHERE d.id = :declarationNcId
|
||||
""")
|
||||
Optional<DeclarationNcPayloadWeb> findDeclarationNcToDto(@Param("declarationNcId") Long declarationNcId);
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DeclarationNcPayloadWeb(
|
||||
d.id,
|
||||
d.dateDerniereDeclaration,
|
||||
d.dateDeclarationNc,
|
||||
d.nc,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
p.id,
|
||||
p.nom,
|
||||
p.prenom,
|
||||
p.raisonSociale,
|
||||
d.observation
|
||||
)
|
||||
FROM DeclarationNc d
|
||||
LEFT JOIN d.structure s
|
||||
LEFT JOIN d.personne p
|
||||
""")
|
||||
List<DeclarationNcPayloadWeb> findAllDeclarationNcToDto();
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DeclarationNcPayloadWeb(
|
||||
d.id,
|
||||
d.dateDerniereDeclaration,
|
||||
d.dateDeclarationNc,
|
||||
d.nc,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
p.id,
|
||||
p.nom,
|
||||
p.prenom,
|
||||
p.raisonSociale,
|
||||
d.observation
|
||||
)
|
||||
FROM DeclarationNc d
|
||||
LEFT JOIN d.structure s
|
||||
LEFT JOIN d.personne p
|
||||
""")
|
||||
Page<DeclarationNcPayloadWeb> findAllDeclarationNcToDtoPageable(Pageable pageable);
|
||||
|
||||
|
||||
@Query("""
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DeclarationNcPayloadWeb(
|
||||
d.id,
|
||||
d.dateDerniereDeclaration,
|
||||
d.dateDeclarationNc,
|
||||
d.nc,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
p.id,
|
||||
p.nom,
|
||||
p.prenom,
|
||||
p.raisonSociale,
|
||||
d.observation
|
||||
)
|
||||
FROM DeclarationNc d
|
||||
LEFT JOIN d.structure s
|
||||
LEFT JOIN d.personne p
|
||||
WHERE p.id = :personneId
|
||||
""")
|
||||
List<DeclarationNcPayloadWeb> findAllDeclarationNcByPersonneToDto(@Param("personneId") Long personneId);
|
||||
|
||||
@Query(
|
||||
value = """
|
||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.DeclarationNcPayloadWeb(
|
||||
d.id,
|
||||
d.dateDerniereDeclaration,
|
||||
d.dateDeclarationNc,
|
||||
d.nc,
|
||||
s.id,
|
||||
s.code,
|
||||
s.nom,
|
||||
p.id,
|
||||
p.nom,
|
||||
p.prenom,
|
||||
p.raisonSociale,
|
||||
d.observation
|
||||
)
|
||||
FROM DeclarationNc d
|
||||
LEFT JOIN d.structure s
|
||||
LEFT JOIN d.personne p
|
||||
WHERE p.id = :personneId
|
||||
""",
|
||||
countQuery = """
|
||||
SELECT COUNT(d)
|
||||
FROM DeclarationNc d
|
||||
LEFT JOIN d.personne p
|
||||
WHERE p.id = :personneId
|
||||
"""
|
||||
)
|
||||
Page<DeclarationNcPayloadWeb> findAllDeclarationNcByPersonneToDtoPageable(
|
||||
@Param("personneId") Long personneId,
|
||||
Pageable pageable
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
138
src/main/java/io/gmss/fiscad/service/CallAPIService.java
Executable file
138
src/main/java/io/gmss/fiscad/service/CallAPIService.java
Executable file
@@ -0,0 +1,138 @@
|
||||
package io.gmss.fiscad.service;
|
||||
|
||||
|
||||
import io.gmss.fiscad.interfaces.ParametersRepository;
|
||||
import io.gmss.fiscad.paylaods.request.IfuEnLigneLoginBoby;
|
||||
import io.gmss.fiscad.paylaods.request.IfuEnLigneRechercheBody;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.server.MethodNotAllowedException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CallAPIService {
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CallAPIService.class);
|
||||
|
||||
@Autowired
|
||||
private ParametersRepository parametersRepository;
|
||||
@Value("${ifu-en-ligne.api.base-url}")
|
||||
private String ifuEnLigneBaseUrl;
|
||||
|
||||
@Value("${ifu-en-ligne.api.username}")
|
||||
private String ifuEnLigneUserName;
|
||||
@Value("${ifu-en-ligne.api.password}")
|
||||
private String ifuEnLignePassWord;
|
||||
private String ifuEnLigneToken ;
|
||||
|
||||
public RestTemplate executeRestemplate(String localTokenName,String accessToken){
|
||||
RestTemplate restTemplate = new RestTemplateBuilder(rt-> rt.getInterceptors().add((request, body, execution) -> {
|
||||
if(localTokenName!=null) {
|
||||
request.getHeaders().add(localTokenName, accessToken);
|
||||
}
|
||||
request.getHeaders().add("Accept", "application/json");
|
||||
request.getHeaders().add("Content-Type", "application/json");
|
||||
return execution.execute(request, body);
|
||||
})).build();
|
||||
return restTemplate;
|
||||
}
|
||||
|
||||
public String callGetIfuEnLigneToken(){
|
||||
|
||||
try {
|
||||
String url = ifuEnLigneBaseUrl+"/api/auth/signin" ;
|
||||
IfuEnLigneLoginBoby ifuEnLigneLoginBoby=new IfuEnLigneLoginBoby();
|
||||
ifuEnLigneLoginBoby.setUsernameOrEmail(ifuEnLigneUserName);
|
||||
ifuEnLigneLoginBoby.setPassword(ifuEnLignePassWord);
|
||||
System.out.println("JE SUIS DANS LE CALL API : "+url);
|
||||
HttpEntity<IfuEnLigneLoginBoby> request = new HttpEntity<>(ifuEnLigneLoginBoby);
|
||||
RestTemplate restTemplate = executeRestemplate(null, null);
|
||||
ResponseEntity<String> response = restTemplate.postForEntity(url, request, String.class);
|
||||
|
||||
if(response.getStatusCodeValue()==200){
|
||||
return response.getBody() ;
|
||||
}else{
|
||||
System.out.println(response.getStatusCodeValue());
|
||||
|
||||
// sygmApiResponse.setStatut(false);
|
||||
|
||||
// sygmApiResponse.setMessage("HttpStatus "+response.getStatusCodeValue()+" --- "
|
||||
// +response.getBody().toString());
|
||||
// return sygmApiResponse;
|
||||
return null;
|
||||
}
|
||||
}catch (Exception e ){
|
||||
System.out.println("IFU EN LIGNE : "+e.getMessage()) ;
|
||||
e.printStackTrace();
|
||||
//throw new Exception(e.getMessage()) ;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public SygmApiResponse callPostSygmefCentre(String url, String tokenName, String accessToken,
|
||||
//
|
||||
// SygmApiResponse sygmApiResponse = new SygmApiResponse() ;
|
||||
// try {
|
||||
// HttpEntity<SygmCentre> request = new HttpEntity<>(centre);
|
||||
// RestTemplate restTemplate = executeRestemplate(tokenName, accessToken);
|
||||
// ResponseEntity<SygmApiResponse> response = restTemplate.postForEntity(url, request, SygmApiResponse.class);
|
||||
//
|
||||
// if(response.getStatusCodeValue()==200){
|
||||
// return response.getBody() ;
|
||||
// }else{
|
||||
// sygmApiResponse.setStatut(false);
|
||||
//
|
||||
// sygmApiResponse.setMessage("HttpStatus "+response.getStatusCodeValue()+" --- "
|
||||
// +response.getBody().toString());
|
||||
// return sygmApiResponse;
|
||||
// }
|
||||
// }catch (Exception e ){
|
||||
// System.out.println("SYGMEF : "+e.getMessage()) ;
|
||||
// e.printStackTrace();
|
||||
// throw new Exception(e.getMessage()) ;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
public void callApiRechercheContribIfuEnLigne(IfuEnLigneRechercheBody ifuEnLigneRechercheBody) {
|
||||
try {
|
||||
String url = ifuEnLigneBaseUrl+"/api/contribuable/fiscad";
|
||||
String token = callGetIfuEnLigneToken();
|
||||
RestTemplate restTemplate = executeRestemplate(null,null);
|
||||
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
|
||||
if(response.getStatusCode().value()==200){
|
||||
System.out.println(response.getBody());
|
||||
}
|
||||
} catch (
|
||||
MethodNotAllowedException ex) {
|
||||
logger.error(ex.toString());
|
||||
//return new ResponseEntity(null, HttpStatus.METHOD_NOT_ALLOWED);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString());
|
||||
// return new ResponseEntity(null, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -169,6 +169,7 @@ public class EntityFromPayLoadService {
|
||||
|
||||
if(piecePayLoadWeb.getPersonneId()!=null)
|
||||
optionalPersonne=personneRepository.findById(piecePayLoadWeb.getPersonneId());
|
||||
|
||||
piece.setId(piecePayLoadWeb.getId());
|
||||
piece.setEnquete(optionalEnquete.orElse(null));
|
||||
piece.setTypePiece(optionalTypePiece.orElse(null));
|
||||
@@ -184,25 +185,22 @@ public class EntityFromPayLoadService {
|
||||
|
||||
public DeclarationNc getDeclarationNcFromPayLoadWeb(DeclarationNcPayloadWeb declarationNcPayloadWeb){
|
||||
DeclarationNc declarationNc=new DeclarationNc();
|
||||
Optional<Enquete> optionalEnquete=Optional.empty();
|
||||
Optional<Personne> optionalPersonne=Optional.empty();
|
||||
Optional<Structure> optionalStructure=Optional.empty();
|
||||
if(declarationNcPayloadWeb.getId()!=null)
|
||||
declarationNc = declarationNcRepository.findById(declarationNcPayloadWeb.getId()).orElse(new DeclarationNc());
|
||||
|
||||
|
||||
// if(declarationNcPayloadWeb.getEnqueteId()!=null)
|
||||
// optionalEnquete=enqueteRepository.findById(declarationNcPayloadWeb.getEnqueteId());
|
||||
if(declarationNcPayloadWeb.getPersonneId()!=null)
|
||||
if(declarationNcPayloadWeb.getPersonneId()!=null)
|
||||
optionalPersonne=personneRepository.findById(declarationNcPayloadWeb.getPersonneId());
|
||||
if(declarationNcPayloadWeb.getStructureId()!=null)
|
||||
optionalStructure=structureRepository.findById(declarationNcPayloadWeb.getStructureId());
|
||||
declarationNc.setId(declarationNcPayloadWeb.getId());
|
||||
//declarationNc.setEnquete(optionalEnquete.orElse(null));
|
||||
declarationNc.setStructure(optionalStructure.orElse(null));
|
||||
declarationNc.setPersonne(optionalPersonne.orElse(null));
|
||||
declarationNc.setNc(declarationNcPayloadWeb.getNc());
|
||||
declarationNc.setDateDerniereDeclaration(declarationNcPayloadWeb.getDateDerniereDeclaration());
|
||||
declarationNc.setDateDeclarationNc(declarationNcPayloadWeb.getDateDeclarationNc());
|
||||
return declarationNc ;
|
||||
}
|
||||
|
||||
@@ -733,6 +731,13 @@ public class EntityFromPayLoadService {
|
||||
}
|
||||
|
||||
|
||||
if (enquetePayLoadWeb.getModeAcquisitionId() != null) {
|
||||
ModeAcquisition modeAcquisition = new ModeAcquisition();
|
||||
modeAcquisition.setId(enquetePayLoadWeb.getModeAcquisitionId());
|
||||
enquete.setModeAcquisition(modeAcquisition);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ======================
|
||||
// Champs simples
|
||||
|
||||
Reference in New Issue
Block a user