traitement updload geom
This commit is contained in:
@@ -17,7 +17,7 @@ public class SwaggerOAS3Config {
|
||||
};
|
||||
|
||||
private static final String[] RFU_PARAMETRE = {
|
||||
"/api/campagne/**", "/api/caracteristique/**", "/api/equipe/**", "/api/type-caracteristique/**"
|
||||
"/api/campagne/**", "/api/caracteristique/**", "/api/equipe/**", "/api/type-caracteristique/**","api/categorie-batiment/**"
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -29,14 +29,15 @@ public class ParcelleGeomController {
|
||||
|
||||
|
||||
@PostMapping(value = "/create-from-geojsonfile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ResponseEntity<?> createTpe(@RequestPart(required = true) MultipartFile file) {
|
||||
public ResponseEntity<?> createTpe(@RequestPart(required = true) MultipartFile file,@RequestParam String reference,@RequestParam String description) {
|
||||
try{
|
||||
int n = parcelleGeomService.createParcelleFromGeoJsonFile(file);
|
||||
int n = parcelleGeomService.createParcelleFromGeoJsonFile(file, reference, description);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, null, n+" Parcelles crées avec succès"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
@@ -44,8 +45,6 @@ public class ParcelleGeomController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllTpeList() {
|
||||
return new ResponseEntity<>(
|
||||
|
||||
@@ -49,11 +49,6 @@ public class UploadController {
|
||||
|
||||
@Autowired
|
||||
private StringManager stringManager;
|
||||
|
||||
// @Autowired
|
||||
// private ActeurRepository proprietaireRepository;
|
||||
|
||||
|
||||
private int firstLineColumnNumber = 0;
|
||||
private String fileHeader;
|
||||
private String fileHeaderType;
|
||||
@@ -84,28 +79,6 @@ public class UploadController {
|
||||
}
|
||||
}
|
||||
|
||||
// @GetMapping("/all/proprietaireid/{proprietaireid}")
|
||||
// @ApiOperation(value = "List des fichiers d'un proprietaire.")
|
||||
// public ResponseEntity<?> allByActeurId(@PathVariable Long proprietaireid) {
|
||||
// try {
|
||||
// List<Upload> uploads=uploadRepository.findAllByActeur_Id(proprietaireid);
|
||||
// if (uploads.isEmpty()) {
|
||||
// return new ResponseEntity<>(new ApiResponse(true, "Empty list. No values present.", HttpStatus.NOT_FOUND, uploads), HttpStatus.OK);
|
||||
// } else {
|
||||
// return new ResponseEntity<>(new ApiResponse(true, "All uploads files founded.", HttpStatus.OK, uploadRepository.findAll()), HttpStatus.OK);
|
||||
// }
|
||||
// } catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
// return new ResponseEntity<>(new ApiResponse(false, "Method POST/GET is required.", HttpStatus.METHOD_NOT_ALLOWED, null), HttpStatus.OK);
|
||||
// } catch (NullPointerException e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, "Null value has been detected {" + e.getMessage() + "}.", HttpStatus.BAD_REQUEST, null), HttpStatus.OK);
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e.getLocalizedMessage());
|
||||
// return new ResponseEntity<>(new ApiResponse(false, "An error has been occur and the content is {" + e.getMessage() + "}.", HttpStatus.INTERNAL_SERVER_ERROR, null), HttpStatus.OK);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> one(@PathVariable Long id) {
|
||||
|
||||
@@ -161,16 +134,6 @@ public class UploadController {
|
||||
|
||||
try {
|
||||
Upload upload = new Upload();
|
||||
// Optional<TypeUpload> optionalTypeUpload=typeUploadRepository.findById(1L);
|
||||
// if(optionalTypeUpload.isPresent()){
|
||||
// upload.setTypeUpload(optionalTypeUpload.get());
|
||||
// }else {
|
||||
// return new ResponseEntity<>(new ApiResponse(false, "Ce type de document n'est pas autorisé", HttpStatus.BAD_REQUEST, null), HttpStatus.OK);
|
||||
// }
|
||||
// Optional<Acteur> optionalActeur = proprietaireRepository.findById(idActeur);
|
||||
// if (optionalActeur.isPresent()) {
|
||||
// upload.setActeur(optionalActeur.get());
|
||||
// }
|
||||
String fileName = fileStorageService.storeFile(file);
|
||||
upload.setFileName(fileName);
|
||||
upload.setMimeType(file.getContentType());
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
package io.gmss.fiscad.controllers.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfu;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
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;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/barem-rfu", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "BaremRfu")
|
||||
public class BaremRfuController {
|
||||
private final BaremRfuService baremRfuService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(BaremRfuController.class);
|
||||
|
||||
public BaremRfuController(BaremRfuService baremRfuService) {
|
||||
this.baremRfuService = baremRfuService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createBaremRfu(@RequestBody @Valid @Validated BaremRfu baremRfu) {
|
||||
try {
|
||||
baremRfu = baremRfuService.createBaremRfu(baremRfu);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfu, "BaremRfu 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<?> updateBaremRfu(@PathVariable Long id, @RequestBody BaremRfu baremRfu) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.updateBaremRfu(id, baremRfu), "BaremRfu mis à 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<?> deleteBaremRfur(@PathVariable Long id) {
|
||||
try {
|
||||
baremRfuService.deleteBaremRfu(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "BaremRfu 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<?> getAllBaremRfuList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.getBaremRfuList(), "Liste des baremRfus 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<?> getAllBaremRfuPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.getBaremRfuList(pageable), "Liste des baremRfus 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<?> getBaremRfuById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.getBaremRfuById(id), "BaremRfu 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("/categorie-batiment/{idCategorieBatiment}")
|
||||
public ResponseEntity<?> getBaremRfuByType(@PathVariable Long idCategorieBatiment) {
|
||||
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.getBaremRfuByType(idCategorieBatiment), "Liste des baremRfu par categorie de batiments chargée avec succès."),
|
||||
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,180 @@
|
||||
package io.gmss.fiscad.controllers.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.CategorieBatiment;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.CategorieBatimentService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
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;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/categorie-batiment", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "CategorieBatiment")
|
||||
public class CategorieBatimentController {
|
||||
|
||||
private final CategorieBatimentService categorieBatimentService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(CategorieBatimentController.class);
|
||||
|
||||
public CategorieBatimentController(CategorieBatimentService categorieBatimentService) {
|
||||
this.categorieBatimentService = categorieBatimentService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createCategorieBatiment(@RequestBody @Valid @Validated CategorieBatiment categorieBatiment) {
|
||||
try {
|
||||
categorieBatiment = categorieBatimentService.createCategorieBatiment(categorieBatiment);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, categorieBatiment, "CategorieBatiment 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<?> updateCategorieBatiment(@PathVariable Long id, @RequestBody CategorieBatiment categorieBatiment) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, categorieBatimentService.updateCategorieBatiment(id, categorieBatiment), "CategorieBatiment mis à 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<?> deleteCategorieBatimentr(@PathVariable Long id) {
|
||||
try {
|
||||
categorieBatimentService.deleteCategorieBatiment(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "CategorieBatiment 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<?> getAllCategorieBatimentList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, categorieBatimentService.getCategorieBatimentList(), "Liste des categorieBatiments 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<?> getAllCategorieBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, categorieBatimentService.getCategorieBatimentList(pageable), "Liste des categorieBatiments 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<?> getCategorieBatimentById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, categorieBatimentService.getCategorieBatimentById(id), "CategorieBatiment trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package io.gmss.fiscad.entities.infocad.metier;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.enums.StatutParcelle;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -51,7 +53,7 @@ public class ParcelleGeom extends BaseEntity implements Serializable {
|
||||
private String arrondissement;
|
||||
private String villageQuartier;
|
||||
private String codeBloc;
|
||||
private String codeParcelle;
|
||||
//private String codeParcelle;
|
||||
private String codeEquipe;
|
||||
private Integer superficie;
|
||||
private String elNumeroEtatLieux;
|
||||
@@ -66,6 +68,15 @@ public class ParcelleGeom extends BaseEntity implements Serializable {
|
||||
private String sourceCollecte;
|
||||
private String observations;
|
||||
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
//@ColumnDefault("NON_ENQUETER")
|
||||
private StatutParcelle statutParcelle;
|
||||
|
||||
@ManyToOne
|
||||
private Upload upload;
|
||||
|
||||
|
||||
////////////
|
||||
|
||||
@OneToOne
|
||||
|
||||
@@ -10,6 +10,7 @@ import lombok.Setter;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@@ -31,7 +32,6 @@ public class Upload extends BaseEntity implements Serializable {
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Piece piece;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private MembreGroupe membreGroupe;
|
||||
@@ -47,10 +47,20 @@ public class Upload extends BaseEntity implements Serializable {
|
||||
private Long max_numero_acteur_concerne_id;
|
||||
private Long enqueteId;
|
||||
private Long blocId;
|
||||
private String reference;
|
||||
private String description;
|
||||
|
||||
@Transient
|
||||
private int nombreParcelleGeom;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "upload")
|
||||
private List<ParcelleGeom> parcelleGeoms ;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private EnqueteBatiment enqueteBatiment;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private EnqueteUniteLogement enqueteUniteLogement;
|
||||
|
||||
@@ -79,4 +89,13 @@ public class Upload extends BaseEntity implements Serializable {
|
||||
'}';
|
||||
|
||||
}
|
||||
|
||||
public int getNombreParcelleGeom(){
|
||||
if(parcelleGeoms!=null){
|
||||
return parcelleGeoms.size();
|
||||
}else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package io.gmss.fiscad.entities.rfu.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String codeDepartement;
|
||||
private String nomDepartement;
|
||||
private String codeCommune;
|
||||
private String nomCommune;
|
||||
private String codeArrondissement;
|
||||
private String nomArrondissement;
|
||||
private String codeQuartierVillage;
|
||||
private String nomQuartierVillage;
|
||||
private String q;
|
||||
private String ilot;
|
||||
private String parcelle;
|
||||
private String nup;
|
||||
private String nupProvisoire;
|
||||
private String titreFoncier;
|
||||
private String numBatiment;
|
||||
private String numUniteLogement;
|
||||
private String ifu;
|
||||
private String npi;
|
||||
private String telProp;
|
||||
private String emailProp;
|
||||
private String nomProp;
|
||||
private String prenomProp;
|
||||
private String raisonSociale;
|
||||
private String adresseProp;
|
||||
private String telSc;
|
||||
private String emailSc;
|
||||
private String nomSc;
|
||||
private String prenomSc;
|
||||
private String adresseSc;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private Long superficieParc;
|
||||
private Long superficieAuSolBat;
|
||||
private Long superficieAuSolUlog;
|
||||
private String batieOuiNon;
|
||||
private String exhonereOuiNon;
|
||||
private Long valeurLocativeAdm;
|
||||
private Long montantLoyerAnnuel;
|
||||
private Long tfuMetreCarre;
|
||||
private Long tfuMinimum;
|
||||
private String standingBat;
|
||||
private String categorieBat;
|
||||
private Long nombrePiscine;
|
||||
private Long nombreUlog;
|
||||
private Long nombreBat;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
}
|
||||
@@ -21,6 +21,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)
|
||||
@@ -66,9 +67,8 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Enquete enquete;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "enqueteBatiment")
|
||||
// List<CaracteristiqueBatiment> caracteristiqueBatiments;
|
||||
@OneToMany(mappedBy = "enqueteBatiment")
|
||||
private List<CaracteristiqueBatiment> caracteristiqueBatiments;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
@@ -81,4 +81,19 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
@Enumerated(EnumType.STRING)
|
||||
@JsonIgnore
|
||||
private StatutEnregistrement statutEnregistrement;
|
||||
|
||||
public List<CaracteristiqueBatiment> getCaracteristiqueBatiments(){
|
||||
List<CaracteristiqueBatiment> caracteristiqueBatimentList=new ArrayList<>();
|
||||
if(caracteristiqueBatiments!=null){
|
||||
caracteristiqueBatiments.forEach(caracteristiqueBatiment -> {
|
||||
caracteristiqueBatiment.setEnqueteBatiment(null);
|
||||
caracteristiqueBatimentList.add(caracteristiqueBatiment);
|
||||
});
|
||||
}
|
||||
return caracteristiqueBatimentList;
|
||||
}
|
||||
|
||||
//@JsonIgnore
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,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)
|
||||
@@ -64,9 +65,8 @@ public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
||||
private UniteLogement uniteLogement;
|
||||
@OneToOne
|
||||
private Personne personne;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "enqueteUniteLogement")
|
||||
// private List<CaracteristiqueUniteLogement> caracteristiqueUniteLogements;
|
||||
@OneToMany(mappedBy = "enqueteUniteLogement")
|
||||
private List<CaracteristiqueUniteLogement> caracteristiqueUniteLogements;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
@@ -79,4 +79,15 @@ public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
||||
@JsonIgnore
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatutEnregistrement statutEnregistrement;
|
||||
|
||||
public List<CaracteristiqueUniteLogement> getCaracteristiqueUniteLogements(){
|
||||
List<CaracteristiqueUniteLogement> caracteristiqueUniteLogementList=new ArrayList<>();
|
||||
if(caracteristiqueUniteLogements!=null){
|
||||
caracteristiqueUniteLogements.forEach(caracteristiqueUniteLogement -> {
|
||||
caracteristiqueUniteLogement.setEnqueteUniteLogement(null);
|
||||
caracteristiqueUniteLogementList.add(caracteristiqueUniteLogement);
|
||||
});
|
||||
}
|
||||
return caracteristiqueUniteLogementList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
import io.gmss.fiscad.enums.TypeImmeuble;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class BaremRfu extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Long valeurLocative;
|
||||
private Long tfuMetreCarre;
|
||||
private Long tfuMinimum;
|
||||
@ManyToOne
|
||||
private CategorieBatiment categorieBatiment;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment;
|
||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueUniteLogement;
|
||||
@@ -23,7 +24,6 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class Caracteristique extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@@ -34,15 +34,11 @@ public class Caracteristique extends BaseEntity implements Serializable {
|
||||
private TypeImmeuble typeImmeuble;
|
||||
@ManyToOne
|
||||
private TypeCaracteristique typeCaracteristique;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "caracteristique")
|
||||
// private List<CaracteristiqueBatiment> caracteristiqueBatiments;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "caracteristique")
|
||||
// private List<CaracteristiqueUniteLogement> caracteristiqueUniteLogements;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private CategorieBatiment categorieBatiment;
|
||||
@ManyToOne
|
||||
private Arrondissement arrondissement;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class CategorieBatiment extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Long code;
|
||||
private Long nom;
|
||||
}
|
||||
6
src/main/java/io/gmss/fiscad/enums/ProfileApp.java
Normal file
6
src/main/java/io/gmss/fiscad/enums/ProfileApp.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum ProfileApp {
|
||||
ABOMEY,
|
||||
DGI
|
||||
}
|
||||
9
src/main/java/io/gmss/fiscad/enums/StatutParcelle.java
Normal file
9
src/main/java/io/gmss/fiscad/enums/StatutParcelle.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum StatutParcelle {
|
||||
|
||||
NON_ENQUETER,
|
||||
ENQUETER_NON_BATIE,
|
||||
ENQUETER_BATIE
|
||||
|
||||
}
|
||||
@@ -2,11 +2,20 @@ package io.gmss.fiscad.implementations.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.infocad.metier.ParcelleGeom;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.enums.StatutParcelle;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.ParcelleGeomService;
|
||||
import io.gmss.fiscad.interfaces.synchronisation.SynchronisationService;
|
||||
import io.gmss.fiscad.paylaods.request.UploadPayLoad;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.ParcelleGeomRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.UploadRepository;
|
||||
import io.gmss.fiscad.service.FileStorageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.locationtech.jts.geom.Coordinate;
|
||||
import org.locationtech.jts.geom.GeometryFactory;
|
||||
@@ -28,30 +37,34 @@ import java.util.Optional;
|
||||
public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
|
||||
private final ParcelleGeomRepository parcelleGeomRepository;
|
||||
private final EnqueteRepository enqueteRepository;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final FileStorageService fileStorageService;
|
||||
private final UploadRepository uploadRepository;
|
||||
|
||||
@Override
|
||||
public int createParcelleFromGeoJsonFile(MultipartFile file) throws BadRequestException {
|
||||
public int createParcelleFromGeoJsonFile(MultipartFile file,String reference,String description) throws BadRequestException {
|
||||
InputStream inputStream = null;
|
||||
JsonNode rootNode=null;
|
||||
try {
|
||||
inputStream = file.getInputStream();
|
||||
rootNode = objectMapper.readTree(inputStream);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new RuntimeException("Le fichier ne respecte pas le format d'un GeoJson");
|
||||
}
|
||||
int n=0;
|
||||
if (!rootNode.has("features")) {
|
||||
throw new RuntimeException("Le fichier ne contient pas de 'features'");
|
||||
throw new BadRequestException("Le fichier ne respecte pas le format d'un GeoJson");
|
||||
}
|
||||
|
||||
WKTReader wktReader = new WKTReader();
|
||||
Iterator<JsonNode> features = rootNode.get("features").elements();
|
||||
|
||||
Upload upload= saveGeoJsonUpload(file,reference,description);
|
||||
while (features.hasNext()) {
|
||||
n++;
|
||||
JsonNode feature = features.next();
|
||||
createOnParcelleFromGeoJson(feature);
|
||||
createOnParcelleFromGeoJson(feature,upload);
|
||||
}
|
||||
try {
|
||||
parcelleGeomRepository.majIdQuartier();
|
||||
@@ -60,8 +73,21 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
return n;
|
||||
}
|
||||
|
||||
private Upload saveGeoJsonUpload(MultipartFile file,String reference,String desc) {
|
||||
Upload upload = new Upload();
|
||||
String fileName = fileStorageService.storeFile(file);
|
||||
upload.setReference(reference);
|
||||
upload.setDescription(desc);
|
||||
upload.setFileName(fileName);
|
||||
upload.setMimeType(file.getContentType());
|
||||
upload.setSize(file.getSize());
|
||||
upload.setOriginalFileName(file.getOriginalFilename());
|
||||
uploadRepository.save(upload);
|
||||
return upload;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParcelleGeom createOnParcelleFromGeoJson(JsonNode feature) throws BadRequestException {
|
||||
public ParcelleGeom createOnParcelleFromGeoJson(JsonNode feature,Upload upload) throws BadRequestException {
|
||||
JsonNode geometryNode = feature.get("geometry");
|
||||
JsonNode propertiesNode = feature.get("properties");
|
||||
WKTReader wktReader = new WKTReader();
|
||||
@@ -77,20 +103,18 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
// throw new RuntimeException(e);
|
||||
}
|
||||
ParcelleGeom parcelleGeom = new ParcelleGeom();
|
||||
parcelleGeom.setUpload(upload);
|
||||
parcelleGeom.setGeometry(geometry);
|
||||
parcelleGeom.setDepartement(propertiesNode.get("DEPARTEMENT").textValue());
|
||||
parcelleGeom.setCommune(propertiesNode.get("COMMUNE").textValue());
|
||||
parcelleGeom.setArrondissement(propertiesNode.get("ARRONDISSEMENT").textValue());
|
||||
parcelleGeom.setVillageQuartier(propertiesNode.get("VILLAGE_QUARTIER").textValue());
|
||||
parcelleGeom.setCodeBloc(propertiesNode.get("CODE_BLOC").textValue());
|
||||
parcelleGeom.setCodeParcelle(propertiesNode.get("CODE_PARCELLE").textValue());
|
||||
parcelleGeom.setNupProvisoire(propertiesNode.get("CODE_PARCELLE").textValue());
|
||||
parcelleGeom.setCodeEquipe(propertiesNode.get("CODE_EQUIPE").textValue());
|
||||
|
||||
|
||||
try {
|
||||
parcelleGeom.setSuperficie(Integer.parseInt(propertiesNode.get("SUPERFICIE").textValue()));
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
parcelleGeom.setElNumeroEtatLieux(propertiesNode.get("EL_NUMERO_ETAT_LIEUX").textValue());
|
||||
parcelleGeom.setElLot(propertiesNode.get("EL_LOT").textValue());
|
||||
@@ -103,7 +127,14 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
parcelleGeom.setNomEtPrenoms(propertiesNode.get("NOM_ET_PRENOMS").textValue());
|
||||
parcelleGeom.setSourceCollecte(propertiesNode.get("SOURCE_COLLECTE").textValue());
|
||||
parcelleGeom.setObservations(propertiesNode.get("OBSERVATIONS").textValue());
|
||||
return parcelleGeomRepository.save(parcelleGeom);
|
||||
parcelleGeom= parcelleGeomRepository.save(parcelleGeom);
|
||||
try {
|
||||
setStatutParcelleGeom(parcelleGeom.getNupProvisoire());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return parcelleGeom;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
@@ -141,6 +172,29 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
return parcelleGeomRepository.findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatutParcelleGeom(String nupProvisoir) {
|
||||
Optional<ParcelleGeom> optionalParcelleGeom=parcelleGeomRepository.findFirstByNupProvisoire(nupProvisoir);
|
||||
Optional<Enquete> enqueteOptional=enqueteRepository.getEnquetByNupProvisoir(nupProvisoir);
|
||||
|
||||
if(enqueteOptional.isEmpty()){
|
||||
if(!optionalParcelleGeom.isEmpty()){
|
||||
optionalParcelleGeom.get().setStatutParcelle(StatutParcelle.NON_ENQUETER);
|
||||
}
|
||||
}else {
|
||||
if(!optionalParcelleGeom.isEmpty()){
|
||||
if(enqueteOptional.get().getEnqueteBatiments()!=null && !enqueteOptional.get().getEnqueteBatiments().isEmpty()) {
|
||||
optionalParcelleGeom.get().setStatutParcelle(StatutParcelle.ENQUETER_BATIE);
|
||||
}else{
|
||||
optionalParcelleGeom.get().setStatutParcelle(StatutParcelle.ENQUETER_NON_BATIE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Polygon convertGeoJsonToPolygon(String geoJson) throws Exception {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfu;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
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.parametre.BaremRfuService;
|
||||
import io.gmss.fiscad.repositories.rfu.parametre.BaremRfuRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.parametre.CampagneRepository;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@Service
|
||||
public class BaremRfuServiceImpl implements BaremRfuService {
|
||||
private final BaremRfuRepository baremRfuRepository;
|
||||
|
||||
public BaremRfuServiceImpl(BaremRfuRepository baremRfuRepository) {
|
||||
this.baremRfuRepository = baremRfuRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaremRfu createBaremRfu(BaremRfu baremRfu) throws BadRequestException {
|
||||
if (baremRfu.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer un nouvel bareme rfu ayant un id non null.");
|
||||
}
|
||||
return baremRfuRepository.save(baremRfu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaremRfu updateBaremRfu(Long id, BaremRfu baremRfu) throws NotFoundException {
|
||||
if (baremRfu.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvel bareme rfu ayant un id null.");
|
||||
}
|
||||
if (!baremRfuRepository.existsById(baremRfu.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver le bareme spécifiée dans notre base de données.");
|
||||
}
|
||||
return baremRfuRepository.save(baremRfu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBaremRfu(Long id) throws NotFoundException {
|
||||
Optional<BaremRfu> baremRfuOptional = baremRfuRepository.findById(id);
|
||||
if (baremRfuOptional.isPresent()) {
|
||||
baremRfuRepository.deleteById(baremRfuOptional.get().getId());
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver le Bareme spécifié dans notre base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<BaremRfu> getBaremRfuList(Pageable pageable) {
|
||||
return baremRfuRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaremRfu> getBaremRfuList() {
|
||||
return baremRfuRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaremRfu> getBaremRfuByType(Long idCategorieBatiment) {
|
||||
return baremRfuRepository.findAllByCategorieBatiment_Id(idCategorieBatiment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<BaremRfu> getBaremRfuById(Long id) {
|
||||
return baremRfuRepository.findById(id);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ public class CampagneServiceImpl implements CampagneService {
|
||||
}
|
||||
return campagneRepository.save(campagne);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Campagne updateCampagne(Long id, Campagne campagne) throws NotFoundException {
|
||||
if (campagne.getId() == null) {
|
||||
@@ -49,7 +48,6 @@ public class CampagneServiceImpl implements CampagneService {
|
||||
throw new NotFoundException("Impossible de trouver la campagne spécifiée dans notre base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Campagne> getCampagneList(Pageable pageable) {
|
||||
return campagneRepository.findAll(pageable);
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||
|
||||
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.parametre.CategorieBatimentService;
|
||||
import io.gmss.fiscad.repositories.rfu.parametre.CategorieBatimentRepository;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class CategorieBatimentServiceImpl implements CategorieBatimentService {
|
||||
private final CategorieBatimentRepository campagneRepositoryRepository;
|
||||
|
||||
public CategorieBatimentServiceImpl(CategorieBatimentRepository campagneRepositoryRepository) {
|
||||
this.campagneRepositoryRepository = campagneRepositoryRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategorieBatiment createCategorieBatiment(CategorieBatiment campagneRepository) throws BadRequestException {
|
||||
if (campagneRepository.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null.");
|
||||
}
|
||||
return campagneRepositoryRepository.save(campagneRepository);
|
||||
}
|
||||
@Override
|
||||
public CategorieBatiment updateCategorieBatiment(Long id, CategorieBatiment campagneRepository) throws NotFoundException {
|
||||
if (campagneRepository.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle campagneRepository ayant un id null.");
|
||||
}
|
||||
if (!campagneRepositoryRepository.existsById(campagneRepository.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la campagneRepository spécifiée dans notre base de données.");
|
||||
}
|
||||
return campagneRepositoryRepository.save(campagneRepository);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCategorieBatiment(Long id) throws NotFoundException {
|
||||
Optional<CategorieBatiment> campagneRepositoryOptional = campagneRepositoryRepository.findById(id);
|
||||
if (campagneRepositoryOptional.isPresent()) {
|
||||
campagneRepositoryRepository.deleteById(campagneRepositoryOptional.get().getId());
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la campagneRepository spécifiée dans notre base de données.");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Page<CategorieBatiment> getCategorieBatimentList(Pageable pageable) {
|
||||
return campagneRepositoryRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CategorieBatiment> getCategorieBatimentList() {
|
||||
return campagneRepositoryRepository.findAll();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<CategorieBatiment> getCategorieBatimentById(Long id) {
|
||||
return campagneRepositoryRepository.findById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@ import io.gmss.fiscad.entities.rfu.parametre.Caracteristique;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.TypeCaracteristique;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.Categorie;
|
||||
import io.gmss.fiscad.enums.ProfileApp;
|
||||
import io.gmss.fiscad.enums.StatusEnquete;
|
||||
import io.gmss.fiscad.enums.StatutEnregistrement;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.ParcelleGeomService;
|
||||
import io.gmss.fiscad.interfaces.synchronisation.SynchronisationService;
|
||||
import io.gmss.fiscad.interfaces.user.UserService;
|
||||
import io.gmss.fiscad.paylaods.request.*;
|
||||
@@ -25,6 +27,7 @@ import io.gmss.fiscad.repositories.rfu.parametre.TypeCaracteristiqueRepository;
|
||||
import io.gmss.fiscad.repositories.user.UserRepository;
|
||||
import io.gmss.fiscad.service.FileStorageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -81,49 +84,9 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
||||
private final CaracteristiqueBatimentRepository caracteristiqueBatimentRepository;
|
||||
private final CaracteristiqueParcelleRepository caracteristiqueParcelleRepository;
|
||||
private final CaracteristiqueUniteLogementRepository caracteristiqueUniteLogementRepository;
|
||||
|
||||
// public SynchronisationServiceImpl(UserService userService, DepartementRepository departementRepository, CommuneRepository communeRepository, ArrondissementRepository arrondissementRepository, QuartierRepository quartierRepository, BlocRepository blocRepository, ModeAcquisitionRepository modeAcquisitionRepository, NationaliteRepository nationaliteRepository, NatureDomaineRepository natureDomaineRepository, PositionRepresentationRepository positionRepresentationRepository, ProfessionRepository professionRepository, SituationMatrimonialeRepository situationMatrimonialeRepository, SourceDroitRepository sourceDroitRepository, StructureRepository structureRepository, TypeContestationRepository typeContestationRepository, TypeDomaineRepository typeDomaineRepository, TypePersonneRepository typePersonneRepository, TypePieceRepository typePieceRepository, TypeRepresentationRepository typeRepresentationRepository, MembreGroupeRepository membreGroupeRepository, PersonneRepository personneRepository, EnqueteRepository enqueteRepository, ParcelleRepository parcelleRepository, UserRepository userRepository, SituationGeographiqueRepository situationGeographiqueRepository, PieceRepository pieceRepository, ActeurConcerneRepository acteurConcerneRepository, UploadRepository uploadRepository, FileStorageService fileStorageService, TpeRepository tpeRepository, BatimentRepository batimentRepository, UniteLogementRepository uniteLogementRepository, CaracteristiqueRepository caracteristiqueRepository, TypeCaracteristiqueRepository typeCaracteristiqueRepository, EnqueteBatimentRepository enqueteBatimentRepository, EnqueteUniteLogementRepository enqueteUniteLogementRepository, CaracteristiqueBatimentRepository caracteristiqueBatimentRepository, CaracteristiqueParcelleRepository caracteristiqueParcelleRepository, CaracteristiqueUniteLogementRepository caracteristiqueUniteLogementRepository) {
|
||||
// this.userService = userService;
|
||||
// this.departementRepository = departementRepository;
|
||||
// this.communeRepository = communeRepository;
|
||||
// this.arrondissementRepository = arrondissementRepository;
|
||||
// this.quartierRepository = quartierRepository;
|
||||
// this.blocRepository = blocRepository;
|
||||
// this.modeAcquisitionRepository = modeAcquisitionRepository;
|
||||
// this.nationaliteRepository = nationaliteRepository;
|
||||
// this.natureDomaineRepository = natureDomaineRepository;
|
||||
// this.positionRepresentationRepository = positionRepresentationRepository;
|
||||
// this.professionRepository = professionRepository;
|
||||
// this.situationMatrimonialeRepository = situationMatrimonialeRepository;
|
||||
// this.sourceDroitRepository = sourceDroitRepository;
|
||||
// this.structureRepository = structureRepository;
|
||||
// this.typeContestationRepository = typeContestationRepository;
|
||||
// this.typeDomaineRepository = typeDomaineRepository;
|
||||
// this.typePersonneRepository = typePersonneRepository;
|
||||
// this.typePieceRepository = typePieceRepository;
|
||||
// this.typeRepresentationRepository = typeRepresentationRepository;
|
||||
// this.membreGroupeRepository = membreGroupeRepository;
|
||||
// this.personneRepository = personneRepository;
|
||||
// this.enqueteRepository = enqueteRepository;
|
||||
// this.parcelleRepository = parcelleRepository;
|
||||
// this.userRepository = userRepository;
|
||||
// this.situationGeographiqueRepository = situationGeographiqueRepository;
|
||||
// this.pieceRepository = pieceRepository;
|
||||
// this.acteurConcerneRepository = acteurConcerneRepository;
|
||||
// this.uploadRepository = uploadRepository;
|
||||
// this.fileStorageService = fileStorageService;
|
||||
// this.tpeRepository = tpeRepository;
|
||||
// this.batimentRepository = batimentRepository;
|
||||
// this.uniteLogementRepository = uniteLogementRepository;
|
||||
// this.caracteristiqueRepository = caracteristiqueRepository;
|
||||
// this.typeCaracteristiqueRepository = typeCaracteristiqueRepository;
|
||||
// this.enqueteBatimentRepository = enqueteBatimentRepository;
|
||||
// this.enqueteUniteLogementRepository = enqueteUniteLogementRepository;
|
||||
// this.caracteristiqueBatimentRepository = caracteristiqueBatimentRepository;
|
||||
// this.caracteristiqueParcelleRepository = caracteristiqueParcelleRepository;
|
||||
// this.caracteristiqueUniteLogementRepository = caracteristiqueUniteLogementRepository;
|
||||
// }
|
||||
|
||||
private final ParcelleGeomService parcelleGeomService;
|
||||
@Value("${io.gmss.fiscad.profile}")
|
||||
private String profile;
|
||||
|
||||
@Override
|
||||
public UserDecoupageSyncResponses getDecoupageAdminUserConnecter() {
|
||||
@@ -143,16 +106,20 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
||||
List<QuartierSyncResponse> quartierSyncResponses =
|
||||
quartierRepository.getQuartierResponse(user.getStructure().getId());
|
||||
|
||||
// List<BlocSyncResponse> blocSyncResponses =
|
||||
// blocRepository.getBlocResponse(user.getStructure().getId());
|
||||
|
||||
List<BlocSyncResponse> blocSyncResponses = new ArrayList<>();
|
||||
if (user.getIdSecteurCourant() == null) {
|
||||
blocSyncResponses =
|
||||
blocRepository.getBlocResponse(user.getStructure().getId());
|
||||
} else {
|
||||
blocSyncResponses =
|
||||
blocRepository.getBlocSecteurResponse(user.getStructure().getId(), user.getIdSecteurCourant());
|
||||
if (profile.equals(ProfileApp.ABOMEY.toString())) {
|
||||
if (user.getStructure() != null) {
|
||||
System.out.println(user.getStructure().getId());
|
||||
blocSyncResponses =
|
||||
blocRepository.getBlocResponse(user.getStructure().getId());
|
||||
}
|
||||
}
|
||||
|
||||
if (profile.equals(ProfileApp.DGI.toString())) {
|
||||
if (user.getIdSecteurCourant() != null) {
|
||||
blocSyncResponses =
|
||||
blocRepository.getBlocSecteurResponse(user.getStructure().getId(), user.getIdSecteurCourant());
|
||||
}
|
||||
}
|
||||
|
||||
UserDecoupageSyncResponses userDecoupageSyncResponses = new UserDecoupageSyncResponses();
|
||||
@@ -577,8 +544,10 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
||||
deleteFromEnquete(enquetePayLoad.getIdBackend());
|
||||
enquete = getEnqueteFromEnquetePayLoad(enquete, enquetePayLoad);
|
||||
enquete.setStatutEnregistrement(StatutEnregistrement.MISE_A_JOUR);
|
||||
|
||||
enquete = enqueteRepository.save(enquete);
|
||||
enquetePayLoad.setIdBackend(enquete.getId());
|
||||
|
||||
} else {
|
||||
enquetePayLoad.setObservation("Le statut de cette enquête est déjà VALIDE. Une mise à jour sur cette enquête n'est donc plus possible.");
|
||||
}
|
||||
@@ -595,6 +564,13 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
||||
syncResponse.setSynchronise(enquetePayLoad.isSynchronise());
|
||||
syncResponse.setIdBackend(enquetePayLoad.getIdBackend());
|
||||
syncResponses.add(syncResponse);
|
||||
try{
|
||||
if(enquete.getParcelle()!=null) {
|
||||
parcelleGeomService.setStatutParcelleGeom(enquete.getParcelle().getNupProvisoire());
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
SyncResponse syncResponse = new SyncResponse(enquetePayLoad.getIdBackend(),
|
||||
@@ -1242,12 +1218,12 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
||||
} else {
|
||||
upload = optionalUpload.get();
|
||||
upload = getUploadFromUplaodPayLoad(upload, uploadPayLoad);
|
||||
upload = uploadRepository.save(upload);
|
||||
//upload = uploadRepository.save(upload);
|
||||
uploadPayLoad.setIdBackend(upload.getId());
|
||||
}
|
||||
} else {
|
||||
upload = getUploadFromUplaodPayLoad(upload, uploadPayLoad);
|
||||
upload = uploadRepository.save(upload);
|
||||
//upload = uploadRepository.save(upload);
|
||||
uploadPayLoad.setIdBackend(upload.getId());
|
||||
}
|
||||
syncResponse.setObservation(uploadPayLoad.getObservation());
|
||||
@@ -1285,7 +1261,7 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
||||
}
|
||||
}
|
||||
|
||||
private Upload getUploadFromUplaodPayLoad(Upload upload, UploadPayLoad uploadPayLoad) {
|
||||
public Upload getUploadFromUplaodPayLoad(Upload upload, UploadPayLoad uploadPayLoad) {
|
||||
if (uploadPayLoad.getTerminalId() != null) {
|
||||
Optional<Tpe> optionalTpe = tpeRepository.findById(uploadPayLoad.getTerminalId());
|
||||
upload.setTerminal(optionalTpe.orElse(null));
|
||||
@@ -1307,6 +1283,7 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
||||
Optional<EnqueteUniteLogement> optionalEnqueteUniteLogement = enqueteUniteLogementRepository.findFirstByExternalKeyAndTerminal_Id(uploadPayLoad.getEnqueteUniteLogementId(), uploadPayLoad.getTerminalId());
|
||||
upload.setEnqueteUniteLogement(optionalEnqueteUniteLogement.orElse(null));
|
||||
}
|
||||
|
||||
if (uploadPayLoad.getIdBackend() != null && uploadPayLoad.getIdBackend() != 0) {
|
||||
try {
|
||||
fileStorageService.deleteFile(upload.getFileName());
|
||||
@@ -1321,7 +1298,6 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
||||
upload.setMimeType(uploadPayLoad.getFile().getContentType());
|
||||
upload.setSize(uploadPayLoad.getFile().getSize());
|
||||
upload.setOriginalFileName(uploadPayLoad.getFile().getOriginalFilename());
|
||||
|
||||
upload.setName(uploadPayLoad.getName());
|
||||
upload.setFilePath(uploadPayLoad.getFilePath());
|
||||
upload.setMax_numero_upload_id(uploadPayLoad.getMax_numero_upload_id());
|
||||
@@ -1329,6 +1305,7 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
||||
upload.setMax_numero_acteur_concerne_id(uploadPayLoad.getMax_numero_acteur_concerne_id());
|
||||
upload.setEnqueteId(uploadPayLoad.getEnqueteId());
|
||||
upload.setBlocId(uploadPayLoad.getBlocId());
|
||||
upload = uploadRepository.save(upload);
|
||||
return upload;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.gmss.fiscad.interfaces.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.gmss.fiscad.entities.infocad.metier.ParcelleGeom;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -12,8 +13,8 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ParcelleGeomService {
|
||||
int createParcelleFromGeoJsonFile(MultipartFile file) throws BadRequestException;
|
||||
ParcelleGeom createOnParcelleFromGeoJson(JsonNode jsonNode) throws BadRequestException;
|
||||
int createParcelleFromGeoJsonFile(MultipartFile file,String reference,String description) throws BadRequestException;
|
||||
ParcelleGeom createOnParcelleFromGeoJson(JsonNode jsonNode, Upload upload) throws BadRequestException;
|
||||
ParcelleGeom updateParcelleGeom(MultipartFile file) throws NotFoundException;
|
||||
void deleteParcelle(Long id) throws NotFoundException;
|
||||
Page<ParcelleGeom> getParcelleGeomList(Pageable pageable);
|
||||
@@ -21,4 +22,9 @@ public interface ParcelleGeomService {
|
||||
List<ParcelleGeom> getParcelleGeomListUnQuatier(String codeQuartier);
|
||||
|
||||
Optional<ParcelleGeom> getParcelleGeomById(Long id);
|
||||
|
||||
|
||||
void setStatutParcelleGeom(String nupProvisoir);
|
||||
|
||||
///List<ParcelleGeom> getListParcelle(String nupProvisoir);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.gmss.fiscad.interfaces.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfu;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.CategorieBatiment;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface BaremRfuService {
|
||||
|
||||
BaremRfu createBaremRfu(BaremRfu baremRfu) throws BadRequestException;
|
||||
|
||||
BaremRfu updateBaremRfu(Long id, BaremRfu baremRfu) throws NotFoundException;
|
||||
|
||||
void deleteBaremRfu(Long id) throws NotFoundException;
|
||||
|
||||
Page<BaremRfu> getBaremRfuList(Pageable pageable);
|
||||
|
||||
List<BaremRfu> getBaremRfuList();
|
||||
|
||||
List<BaremRfu> getBaremRfuByType(Long IdCategorieBatiment);
|
||||
|
||||
Optional<BaremRfu> getBaremRfuById(Long id);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.gmss.fiscad.interfaces.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.CategorieBatiment;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@Service
|
||||
public interface CategorieBatimentService {
|
||||
|
||||
CategorieBatiment createCategorieBatiment(CategorieBatiment categorieBatiment) throws BadRequestException;
|
||||
|
||||
CategorieBatiment updateCategorieBatiment(Long id, CategorieBatiment categorieBatiment) throws NotFoundException;
|
||||
|
||||
void deleteCategorieBatiment(Long id) throws NotFoundException;
|
||||
|
||||
Page<CategorieBatiment> getCategorieBatimentList(Pageable pageable);
|
||||
|
||||
List<CategorieBatiment> getCategorieBatimentList();
|
||||
|
||||
Optional<CategorieBatiment> getCategorieBatimentById(Long id);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.interfaces.synchronisation;
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.paylaods.request.*;
|
||||
import io.gmss.fiscad.paylaods.response.ReferencesSyncResponses;
|
||||
import io.gmss.fiscad.paylaods.response.SyncEnqueteAllDataResponse;
|
||||
@@ -61,4 +62,5 @@ public interface SynchronisationService {
|
||||
|
||||
public List<SyncResponse> syncEnqueteFromMobile(List<Long> idEnquete);
|
||||
|
||||
public Upload getUploadFromUplaodPayLoad(Upload upload, UploadPayLoad uploadPayLoad);
|
||||
}
|
||||
@@ -24,6 +24,8 @@ public class UploadPayLoad {
|
||||
private Long blocId;
|
||||
private Long enqueteBatimentId;
|
||||
private Long enqueteUniteLogementId;
|
||||
private String reference;
|
||||
private String description;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -206,4 +206,13 @@ public interface EnqueteRepository extends JpaRepository<Enquete, Long> {
|
||||
|
||||
|
||||
Optional<Enquete> findFirstByParcelle_NupProvisoireOrderByDateEnqueteDesc(String numProvisoire);
|
||||
|
||||
|
||||
@Query(value = "SELECT * " +
|
||||
" FROM enquete e " +
|
||||
" inner join parcelle p on p.id=e.parcelle_id " +
|
||||
" inner join parcelle_geom pg on pg.nup_provisoire=p.nup_provisoire " +
|
||||
" WHERE p.deleted is false and p.nup_provisoire = ?1 ", nativeQuery = true)
|
||||
Optional<Enquete> getEnquetByNupProvisoir(String numProvisoire);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ParcelleGeomRepository extends JpaRepository<ParcelleGeom, Long> {
|
||||
|
||||
@@ -20,4 +21,5 @@ public interface ParcelleGeomRepository extends JpaRepository<ParcelleGeom, Long
|
||||
"and upper(parcelle_geom.commune)=upper(T.nom_commune) ",nativeQuery = true)
|
||||
void majIdQuartier();
|
||||
|
||||
Optional<ParcelleGeom> findFirstByNupProvisoire(String nupProvisoir);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface BlocRepository extends JpaRepository<Bloc, Long> {
|
||||
|
||||
@Query(value = "select b.id, b.cote, b.nom, b.arrondissement_id as arrondissementid, b.quartier_id as quartierid " +
|
||||
" from bloc b " +
|
||||
" inner join secteur_decoupage sd on cd.bloc_id=b.id " +
|
||||
" inner join secteur_decoupage sd on sd.bloc_id=b.id " +
|
||||
" where b.deleted is false and s.structure_id = ?1 and sd.secteur_id=?2", nativeQuery = true)
|
||||
List<BlocSyncResponse> getBlocSecteurResponse(Long structure_id, Long secteur_id);
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.gmss.fiscad.repositories.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfu;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BaremRfuRepository extends JpaRepository<BaremRfu, Long> {
|
||||
List<BaremRfu> findAllByCategorieBatiment_Id(Long idCategorieBat);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.gmss.fiscad.repositories.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.CategorieBatiment;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CategorieBatimentRepository extends JpaRepository<CategorieBatiment, Long> {
|
||||
|
||||
}
|
||||
|
||||
15
src/main/resources/application-abomey.properties
Executable file
15
src/main/resources/application-abomey.properties
Executable file
@@ -0,0 +1,15 @@
|
||||
server.port=8282
|
||||
io.gmss.fiscad.profile=ABOMEY
|
||||
# TEST ENV
|
||||
#spring.datasource.url=jdbc:postgresql://vmi792116.contaboserver.net:5599/abomey_db
|
||||
#spring.datasource.username=infocad_user
|
||||
#spring.datasource.password=W5fwD({9*q53
|
||||
|
||||
# LOCAL ENV
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/abomey_db
|
||||
spring.datasource.username=infocad_user
|
||||
spring.datasource.password=12345
|
||||
|
||||
|
||||
file.upload_dir=./uploads
|
||||
file.jasper-reports=./jasperReport
|
||||
13
src/main/resources/application-dgi.properties
Executable file
13
src/main/resources/application-dgi.properties
Executable file
@@ -0,0 +1,13 @@
|
||||
server.port=8292
|
||||
io.gmss.fiscad.profile=DGI
|
||||
# TEST ENV
|
||||
spring.datasource.url=jdbc:postgresql://vmi792116.contaboserver.net:5599/dgi_db
|
||||
spring.datasource.username=infocad_user
|
||||
spring.datasource.password=W5fwD({9*q53
|
||||
# LOCAL ENV
|
||||
#spring.datasource.url=jdbc:postgresql://localhost:5432/abomey_db
|
||||
#spring.datasource.username=infocad_user
|
||||
#spring.datasource.password=12345
|
||||
|
||||
file.upload_dir=./uploads
|
||||
file.jasper-reports=./jasperReport
|
||||
@@ -1,17 +1,5 @@
|
||||
spring.profiles.active=abomey
|
||||
spring.jpa.properties.hibernate.id.new_generator_mappings=false
|
||||
|
||||
# TEST ENV
|
||||
spring.datasource.url=jdbc:postgresql://vmi792116.contaboserver.net:5599/abomey_db
|
||||
spring.datasource.username=infocad_user
|
||||
spring.datasource.password=W5fwD({9*q53
|
||||
# LOCAL ENV
|
||||
#
|
||||
#spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad
|
||||
#spring.datasource.username=fiscad
|
||||
#spring.datasource.password=fiscad
|
||||
#spring.datasource.url=jdbc:postgresql://192.168.1.107:5432/abomey_db
|
||||
#spring.datasource.username=infocad_user
|
||||
#spring.datasource.password=12345
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
spring.jpa.open-in-view=false
|
||||
spring.jpa.show-sql=true
|
||||
@@ -34,16 +22,12 @@ spring.datasource.hikari.maximum-pool-size=10
|
||||
spring.datasource.hikari.idle-timeout=120000
|
||||
spring.datasource.hikari.connection-timeout=300000
|
||||
spring.datasource.hikari.leak-detection-threshold=300000
|
||||
file.upload_dir=./uploads
|
||||
file.jasper-reports=./jasperReport
|
||||
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration
|
||||
spring.groovy.template.enabled=false
|
||||
spring.groovy.template.check-template-location=false
|
||||
#####Gestion de l'identifiant du systme de rfence spatiale###########
|
||||
infocad.geom.srid=32631
|
||||
infocad.geom.sridfixe=4326
|
||||
server.port=8282
|
||||
# application.properties
|
||||
spring.mvc.contentnegotiation.favor-parameter=false
|
||||
spring.mvc.contentnegotiation.parameter-name=mediaType
|
||||
spring.mvc.contentnegotiation.ignore-unknown-path-extensions=true
|
||||
|
||||
Reference in New Issue
Block a user