Compare commits
288 Commits
features/f
...
53bdeb0734
| Author | SHA1 | Date | |
|---|---|---|---|
| 53bdeb0734 | |||
| 8eeb1aa97a | |||
| ed054ae4f3 | |||
| fa0f6c0658 | |||
| b3c563d4b6 | |||
| 0c0c6c8eb8 | |||
| 58b6924be2 | |||
| 7d922a0b54 | |||
| c224185aa1 | |||
| 29f2347bf9 | |||
| 838eb03833 | |||
| 3b6a757c43 | |||
| bb2dccf7f5 | |||
| 924f8c140a | |||
| 945391fb89 | |||
| d1cbe9c06e | |||
| 87306e6c42 | |||
| f2f9ed14ab | |||
| 121ac58f51 | |||
| 5a5c829805 | |||
| 9e652e2acc | |||
| 68eaf00e23 | |||
| dd8891a3fb | |||
| 10155a7f7b | |||
| f7bb899497 | |||
| a5a6eb574a | |||
| 0bd56a6e44 | |||
| e1b9ac8915 | |||
| 3a057aa155 | |||
| b135f20152 | |||
| 39d673270f | |||
| 63deb3fb51 | |||
| 65050cf981 | |||
| 9acbdc6a9a | |||
| 27981d656e | |||
| 74e38d501a | |||
| 98641cd52f | |||
| 4feb9b3e1a | |||
| 3c2bd72aeb | |||
| fd900283c6 | |||
| c16a64b1cc | |||
| 5ea11fe63e | |||
| ceb806db2d | |||
| ed4da862f7 | |||
| 02cd322eed | |||
| 9589395dfe | |||
| 95828a304d | |||
| 4779092b3d | |||
| 3edef3963e | |||
| b7d884fd68 | |||
| cde3847b5f | |||
| 3d7cfa0fab | |||
| 919e3938eb | |||
| de86f32f8a | |||
| 5cdd27a2f9 | |||
| ea18e61cfa | |||
| 8cba64f520 | |||
| d54c11844b | |||
| 5c4248a5ae | |||
| f4709c1750 | |||
| 6a2aadd6dd | |||
| 2c09a88a0c | |||
| 272182d605 | |||
| 002299ba82 | |||
| a404b9b678 | |||
| 590e85964e | |||
| ce0bf6cdf9 | |||
| faf56ec592 | |||
| 6c9c0d1920 | |||
| 5279da4f31 | |||
| 6ac42d08fb | |||
| 66eef2c669 | |||
| 816bff63bd | |||
| f976beabb8 | |||
| 07dc4630db | |||
| 38c0d04a19 | |||
| 752f01cfc4 | |||
| 6595e003ae | |||
| 7911903bd8 | |||
| a2283a835b | |||
| 953deff41c | |||
| ea7e693759 | |||
| aa8a24f81e | |||
| 6b954c7467 | |||
| ad28588b0a | |||
| 2b2805a125 | |||
| 1775c19c0a | |||
| 49aea6e50a | |||
| dda6262b23 | |||
| 3e105855f0 | |||
| 5094b1a945 | |||
| 5b73474192 | |||
| 0bedbf0764 | |||
| 13ce1f31e2 | |||
| e333b82e96 | |||
| d8dd0ed95e | |||
| a192520b30 | |||
| ada442ffa4 | |||
| 4cd6e7cbae | |||
| 5d519855a7 | |||
| 6c0fa1ca27 | |||
| 8bcae0751a | |||
| 1e4e8f9ff6 | |||
| 34d1502334 | |||
| d4d4a7be44 | |||
| e2468328fd | |||
| 5ea1c93d2b | |||
| 41e55da1df | |||
| 705af14b4e | |||
| e325b12546 | |||
| 9063162c33 | |||
| 47bcda41fd | |||
| 3f9cdcdad3 | |||
| 3438da3880 | |||
| e58e338123 | |||
| ebb91f8318 | |||
| 253332bbd3 | |||
| 767756acfc | |||
| 6dcd549889 | |||
| 84ede82428 | |||
| 0d27aaebac | |||
| 5beddc7c1b | |||
| afbf525af5 | |||
| a6f7f3d465 | |||
| 8ee2f7c9b0 | |||
| 43b060371a | |||
| 6bdfa3ad1e | |||
| 71f0aa6cd0 | |||
| b8ba15c6fb | |||
| 87f8ad7a61 | |||
| 698b7e7c99 | |||
| 6a29a3f43c | |||
| 9e597386f8 | |||
| 3e871a31e6 | |||
| cb2faeea32 | |||
| 9c62c99305 | |||
| 6b3ab8fc43 | |||
| 8fb0088010 | |||
| 906a74571f | |||
| 1e810f0ddb | |||
| 6494fe235e | |||
| a54adcdcb8 | |||
| 28da361054 | |||
| 6b63ae2f52 | |||
| 3993d28d51 | |||
| 6851270bd5 | |||
| 09d8b21909 | |||
| 274b47d116 | |||
| bdb08b88fd | |||
| 739cc89872 | |||
| b86c685cd0 | |||
| dffd6a54a3 | |||
| d46a14626e | |||
| 920c70c877 | |||
| 267c09c064 | |||
| 2ab5b9299c | |||
| be4524ed67 | |||
| bf19ab6e6a | |||
| 06ea9474f1 | |||
| 84451d5a15 | |||
| c0267fca5e | |||
| e687a9a904 | |||
| 55b97936ab | |||
| 9685c73513 | |||
| adcd51e32b | |||
| 650470efff | |||
| 666519df84 | |||
| 9f5cc61726 | |||
| beb41af562 | |||
| 41175d93f0 | |||
| 57dfdaf64f | |||
| 1ecaecdee3 | |||
| f7e3c118e2 | |||
| 122dfcbead | |||
| 2b4adc0db2 | |||
| d168b68d4b | |||
| a0baf985d4 | |||
| 2af14dd4cd | |||
| 85e9a41fe2 | |||
| 76f0d34e79 | |||
| 3102dbc053 | |||
| 666779ecce | |||
| a21be6aef3 | |||
| 7fcd676fc0 | |||
| 4d708ff4ca | |||
| fffdef7103 | |||
| ea1f92c7e2 | |||
| 95c0dacd1e | |||
| 9e5e8551f0 | |||
| 7ac6b953d3 | |||
| b8b28a673b | |||
| e010100472 | |||
| 70c8c26367 | |||
| 177a9c7b56 | |||
| e1459d85ea | |||
| 3054930a86 | |||
| f927db064a | |||
| 4397abd041 | |||
| 0589883f8e | |||
| a4b403ca20 | |||
| d73e64dbac | |||
| ff7b88f9f8 | |||
| cf7c3aaeb2 | |||
| 37fdba1d85 | |||
| cd4fcb7aa0 | |||
| f50ed9aa5f | |||
| 1e0cfead5b | |||
| 966fd2ca7a | |||
| 0837d0ce08 | |||
| a10253b2e8 | |||
| b58316bb88 | |||
| 08b68f9e08 | |||
| 209d1cd777 | |||
| be487d6a03 | |||
| 1eb3aeeda0 | |||
| 3be64e7f44 | |||
| 03a661cdc0 | |||
| b3c288628c | |||
| a68ec444cc | |||
| d45e01ac85 | |||
| 58f517bf31 | |||
| 9bb0cc5c75 | |||
| 7f18f22efb | |||
| 3a68fd2ce4 | |||
| af3218412f | |||
| fa7421c35b | |||
| f35670c72e | |||
| 5cb9497163 | |||
| a77c0e854d | |||
| 15cac660bc | |||
| e75eff4e20 | |||
| 0feec2982f | |||
| 40d078c653 | |||
| b5ab0772a0 | |||
| 31dd11d017 | |||
| f293f65650 | |||
| 6dfd12fae8 | |||
| cfd1104c28 | |||
| a4ad0a4556 | |||
| 7d64390bae | |||
| 411a6c0c2d | |||
| 4876d8ab14 | |||
| bed73b2b16 | |||
| 2bfb298054 | |||
| 5a0814a0ba | |||
| 54ef33d1ab | |||
| 126254ea94 | |||
| 3fd779854f | |||
| f9e4681af4 | |||
| de2928414b | |||
| 84089d3639 | |||
| 9d6d278d78 | |||
| 02b0a937b4 | |||
| c8b0457195 | |||
| c0096457fb | |||
| b6062ba4d1 | |||
| 8dc8c974d3 | |||
| 9cc74a9a38 | |||
| 957416df9e | |||
| 8e6168d4ee | |||
| 8d8af75108 | |||
| c1a8ce86a6 | |||
| 555f13508e | |||
| 14feb49dcd | |||
| d92a2b2503 | |||
| 39de1c48c0 | |||
| 5ccfdb6a3f | |||
| f9e2b32118 | |||
| 87b3bfbe83 | |||
| 3ebb1cf165 | |||
| 62f25ea726 | |||
| c84176b8d3 | |||
| 6125fcbd0b | |||
| 61f4dd513f | |||
| 211af6103a | |||
| 5e9f437497 | |||
| d27b622db8 | |||
| 69af57f876 | |||
| c80b40082c | |||
| 56f78e77f3 | |||
| 4a88af6487 | |||
| 0c7dc082fd | |||
| 966b0af1c2 | |||
| 3f5d7e980c | |||
| 58aa088ac3 | |||
| 87be4e4483 | |||
| 033b430051 | |||
| b8dbc7f625 |
@@ -6,7 +6,6 @@ import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
|||||||
import io.gmss.fiscad.enums.StatusAvis;
|
import io.gmss.fiscad.enums.StatusAvis;
|
||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||||
@@ -409,7 +408,7 @@ public class DonneesImpositionTfuController {
|
|||||||
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
||||||
public ResponseEntity<?> genererDonneesFiscaleBatieUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,@PathVariable Long parcelleId) {
|
public ResponseEntity<?> genererDonneesFiscaleBatieUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb,@PathVariable Long parcelleId) {
|
||||||
try {
|
try {
|
||||||
Optional<ImpositionsTfuPaylaodWeb> optionalImpositionsTfu =impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfuPaylaodWeb.getId());
|
||||||
|
|
||||||
if(optionalImpositionsTfu.isEmpty()){
|
if(optionalImpositionsTfu.isEmpty()){
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
@@ -425,7 +424,6 @@ public class DonneesImpositionTfuController {
|
|||||||
}
|
}
|
||||||
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
||||||
|
|
||||||
System.out.println("OK apres sorti bati une parcelle");
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true,impositionsTfuPaylaodWeb, "Données d'imposition des fonciers batis Générées avec succès."),
|
new ApiResponse<>(true,impositionsTfuPaylaodWeb, "Données d'imposition des fonciers batis Générées avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
@@ -509,7 +507,7 @@ public class DonneesImpositionTfuController {
|
|||||||
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
@PreAuthorize("hasAnyAuthority('CREATE_DONNEESIMPOSITIONTFU', 'UPDATE_DONNEESIMPOSITIONTFU')")
|
||||||
public ResponseEntity<?> genererDonneesImpositionNonBatiesUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, @PathVariable Long parcelleId) {
|
public ResponseEntity<?> genererDonneesImpositionNonBatiesUneParcelle(@CurrentUser UserPrincipal userPrincipal, @RequestBody ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, @PathVariable Long parcelleId) {
|
||||||
try {
|
try {
|
||||||
Optional<ImpositionsTfuPaylaodWeb> optionalImpositionsTfu = impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfuPaylaodWeb.getId());
|
||||||
|
|
||||||
if(optionalImpositionsTfu.isEmpty()){
|
if(optionalImpositionsTfu.isEmpty()){
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
@@ -518,13 +516,19 @@ public class DonneesImpositionTfuController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if(!optionalImpositionsTfu.get().getStatusAvis().equals(StatusAvis.GENERATION_AUTORISE)){
|
||||||
|
// return new ResponseEntity<>(
|
||||||
|
// new ApiResponse<>(false, null, "l'état actuel : "+optionalImpositionsTfu.get().getStatusAvis()+" ne permet pas cette opération."),
|
||||||
|
// HttpStatus.OK
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
if(userPrincipal==null){
|
if(userPrincipal==null){
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(false, null, "Vous n'êtes pas autorisé à accéder à cette ressource"),
|
new ApiResponse<>(false, null, "Vous n'êtes pas autorisé à accéder à cette ressource"),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleNonBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
impositionsTfuPaylaodWeb=donneesImpositionTfuService.genererDonneesFiscalesParcelleNonBatieUneParcelle(impositionsTfuPaylaodWeb,userPrincipal.getUser().getId(),parcelleId);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
package io.gmss.fiscad.controllers.rfu.metier;
|
package io.gmss.fiscad.controllers.rfu.metier;
|
||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||||
import io.gmss.fiscad.entities.user.User;
|
import io.gmss.fiscad.entities.user.User;
|
||||||
import io.gmss.fiscad.enums.StatusAvis;
|
import io.gmss.fiscad.enums.StatusAvis;
|
||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.StructurePaylaodWeb;
|
|
||||||
import io.gmss.fiscad.security.CurrentUser;
|
import io.gmss.fiscad.security.CurrentUser;
|
||||||
import io.gmss.fiscad.security.UserPrincipal;
|
import io.gmss.fiscad.security.UserPrincipal;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -32,8 +29,6 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -44,8 +39,6 @@ import java.util.Optional;
|
|||||||
public class ImpositionsTfuController {
|
public class ImpositionsTfuController {
|
||||||
|
|
||||||
private final ImpositionsTfuService impositionsTfuService;
|
private final ImpositionsTfuService impositionsTfuService;
|
||||||
private final StructureService structureService;
|
|
||||||
|
|
||||||
private final EnqueteService enqueteService;
|
private final EnqueteService enqueteService;
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ImpositionsTfuController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ImpositionsTfuController.class);
|
||||||
|
|
||||||
@@ -61,22 +54,11 @@ public class ImpositionsTfuController {
|
|||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
User user=currentUser.getUser();
|
||||||
if(impositionsTfuPaylaodWeb.getStructureId()==null){
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(false, null, "Veuillez préciser la strucuture."),
|
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
User user = currentUser.getUser();
|
|
||||||
|
|
||||||
StructurePaylaodWeb st = structureService.getStructureById(impositionsTfuPaylaodWeb.getStructureId()).orElseGet(null);
|
|
||||||
|
|
||||||
|
|
||||||
if(user.getStructure().getId()!=impositionsTfuPaylaodWeb.getStructureId()){
|
if(user.getStructure().getId()!=impositionsTfuPaylaodWeb.getStructureId()){
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(false, null, "Vous n'etes pas autorisé à accéder à cette ressource. Votre centre : "+ user.getStructure().getNom() +" le centre de liquidation : "+ st.getNom()),
|
new ApiResponse<>(false, null, "Vous n'etes pas autorisé à accéder à cette ressource."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,236 +0,0 @@
|
|||||||
package io.gmss.fiscad.controllers.rfu.metier;
|
|
||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.exceptions.*;
|
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.ParticiperService;
|
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb;
|
|
||||||
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.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping(value = "api/participer", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@SecurityRequirement(name = "bearer")
|
|
||||||
@Tag(name = "Participer")
|
|
||||||
@CrossOrigin(origins = "*")
|
|
||||||
public class ParticiperController {
|
|
||||||
|
|
||||||
private final ParticiperService participerService;
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ParticiperController.class);
|
|
||||||
|
|
||||||
public ParticiperController(ParticiperService participerService) {
|
|
||||||
this.participerService = participerService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
|
||||||
@PreAuthorize("hasAuthority('CREATE_PARTICIPER')")
|
|
||||||
public ResponseEntity<?> createParticiper(@RequestBody @Valid @Validated ParticiperPayloadWeb participerPaylaodWeb) {
|
|
||||||
try {
|
|
||||||
participerPaylaodWeb = participerService.createParticiper(participerPaylaodWeb);
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, participerPaylaodWeb, "Participer 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}")
|
|
||||||
@PreAuthorize("hasAuthority('UPDATE_PARTICIPER')")
|
|
||||||
public ResponseEntity<?> updateParticiper(@PathVariable Long id, @RequestBody ParticiperPayloadWeb participerPaylaodWeb) {
|
|
||||||
try {
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, participerService.updateParticiper(id,participerPaylaodWeb), "Participer 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}")
|
|
||||||
@PreAuthorize("hasAuthority('DELETE_PARTICIPER')")
|
|
||||||
public ResponseEntity<?> deleteParticiper(@PathVariable Long id) {
|
|
||||||
try {
|
|
||||||
participerService.deleteParticiper(id);
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, "Participer 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")
|
|
||||||
@PreAuthorize("hasAuthority('READ_PARTICIPER')")
|
|
||||||
public ResponseEntity<?> getAllParticiperList() {
|
|
||||||
try {
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, participerService.getParticiperList(), "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")
|
|
||||||
@PreAuthorize("hasAuthority('READ_PARTICIPER')")
|
|
||||||
public ResponseEntity<?> getAllParticiperPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
|
||||||
try {
|
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, participerService.getParticiperList(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-equipe-id/{equipeId}")
|
|
||||||
@PreAuthorize("hasAuthority('READ_PARTICIPER')")
|
|
||||||
public ResponseEntity<?> getAllParticiperByParcelleList(@PathVariable Long equipeId) {
|
|
||||||
try {
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, participerService.getParticiperListByEquipe(equipeId), "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/by-equipe-id/{equipeId}")
|
|
||||||
@PreAuthorize("hasAuthority('READ_PARTICIPER')")
|
|
||||||
public ResponseEntity<?> getAllParticiperByParcellePaged(@PathVariable Long equipeId, @RequestParam int pageNo, @RequestParam int pageSize) {
|
|
||||||
try {
|
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, participerService.getParticiperListByEquipePageable(equipeId,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("/id/{id}")
|
|
||||||
@PreAuthorize("hasAuthority('READ_PARTICIPER')")
|
|
||||||
public ResponseEntity<?> getParticiperById(@PathVariable Long id) {
|
|
||||||
try {
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, participerService.getParticiperById(id), "Participer 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,6 @@ import io.gmss.fiscad.enums.TypeCampagne;
|
|||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.rfu.parametre.CampagneService;
|
import io.gmss.fiscad.interfaces.rfu.parametre.CampagneService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
@@ -38,11 +37,11 @@ public class CampagneController {
|
|||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@PreAuthorize("hasAuthority('CREATE_CAMPAGNE')")
|
@PreAuthorize("hasAuthority('CREATE_CAMPAGNE')")
|
||||||
public ResponseEntity<?> createCampagne(@RequestBody @Valid @Validated CampagnePayloadWeb campagnePayloadWeb) {
|
public ResponseEntity<?> createCampagne(@RequestBody @Valid @Validated Campagne campagne) {
|
||||||
try {
|
try {
|
||||||
campagnePayloadWeb = campagneService.createCampagne(campagnePayloadWeb);
|
campagne = campagneService.createCampagne(campagne);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, campagnePayloadWeb, "Campagne créé avec succès."),
|
new ApiResponse<>(true, campagne, "Campagne créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
@@ -63,10 +62,10 @@ public class CampagneController {
|
|||||||
|
|
||||||
@PutMapping("/update/{id}")
|
@PutMapping("/update/{id}")
|
||||||
@PreAuthorize("hasAuthority('UPDATE_CAMPAGNE')")
|
@PreAuthorize("hasAuthority('UPDATE_CAMPAGNE')")
|
||||||
public ResponseEntity<?> updateCampagne(@PathVariable Long id, @RequestBody CampagnePayloadWeb campagnePayloadWeb) {
|
public ResponseEntity<?> updateCampagne(@PathVariable Long id, @RequestBody Campagne campagne) {
|
||||||
try {
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, campagneService.updateCampagne(id, campagnePayloadWeb), "Campagne mis à jour avec succès."),
|
new ApiResponse<>(true, campagneService.updateCampagne(id, campagne), "Campagne mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
@@ -208,111 +207,5 @@ public class CampagneController {
|
|||||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/by-exercice-id/{exerciceId}")
|
|
||||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
|
||||||
public ResponseEntity<?> getCampagneByExercice(@PathVariable Long exerciceId) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, campagneService.getCampagneByExerciceId(exerciceId), "Liste des campagne par type 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("/page/by-exercice-id/{exerciceId}")
|
|
||||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
|
||||||
public ResponseEntity<?> getCampagneByExercice(@PathVariable Long exerciceId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, campagneService.getCampagneByExerciceId(exerciceId,pageable), "Liste des campagne par type chargée avec succès."),
|
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
|
||||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
|
||||||
FileStorageException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/by-structure-id/{structureId}")
|
|
||||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
|
||||||
public ResponseEntity<?> getCampagneByStructure(@PathVariable Long structureId) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, campagneService.getCampagneByStructureId(structureId), "Liste des campagne par type 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("/page/by-structure-id/{structureId}")
|
|
||||||
@PreAuthorize("hasAuthority('READ_CAMPAGNE')")
|
|
||||||
public ResponseEntity<?> getCampagneByStructure(@PathVariable Long structureId,@RequestParam int pageNo, @RequestParam int pageSize) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, campagneService.getCampagneByStructureId(structureId,pageable), "Liste des campagne par type 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
|||||||
import io.gmss.fiscad.exceptions.*;
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.rfu.parametre.EquipeService;
|
import io.gmss.fiscad.interfaces.rfu.parametre.EquipeService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb;
|
|
||||||
import io.gmss.fiscad.paylaods.request.synchronisation.EquipePayload;
|
import io.gmss.fiscad.paylaods.request.synchronisation.EquipePayload;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -37,12 +36,12 @@ public class EquipeController {
|
|||||||
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
// @PreAuthorize("hasAuthority('CREATE_EQUIPE')")
|
@PreAuthorize("hasAuthority('CREATE_EQUIPE')")
|
||||||
public ResponseEntity<?> createEquipe(@RequestBody @Valid @Validated EquipePayloadWeb equipePayloadWeb) {
|
public ResponseEntity<?> createEquipe(@RequestBody @Valid @Validated EquipePayload equipePayload) {
|
||||||
try {
|
try {
|
||||||
equipePayloadWeb = equipeService.create(equipePayloadWeb);
|
Equipe equipe = equipeService.createEquipe(equipePayload);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, equipePayloadWeb, "Equipe créé avec succès."),
|
new ApiResponse<>(true, equipe, "Equipe créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
@@ -56,18 +55,17 @@ public class EquipeController {
|
|||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update/{id}")
|
@PutMapping("/update/{id}")
|
||||||
// @PreAuthorize("hasAuthority('UPDATE_EQUIPE')")
|
@PreAuthorize("hasAuthority('UPDATE_EQUIPE')")
|
||||||
public ResponseEntity<?> updateEquipe(@PathVariable Long id, @RequestBody EquipePayloadWeb equipePayloadWeb) {
|
public ResponseEntity<?> updateEquipe(@PathVariable Long id, @RequestBody EquipePayload equipePayload) {
|
||||||
try {
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, equipeService.update(id, equipePayloadWeb), "Equipe mis à jour avec succès."),
|
new ApiResponse<>(true, equipeService.updateEquipe(id, equipePayload), "Equipe mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
@@ -90,7 +88,7 @@ public class EquipeController {
|
|||||||
@PreAuthorize("hasAuthority('DELETE_EQUIPE')")
|
@PreAuthorize("hasAuthority('DELETE_EQUIPE')")
|
||||||
public ResponseEntity<?> deleteEquiper(@PathVariable Long id) {
|
public ResponseEntity<?> deleteEquiper(@PathVariable Long id) {
|
||||||
try {
|
try {
|
||||||
equipeService.delete(id);
|
equipeService.deleteEquipe(id);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, "Equipe supprimée avec succès."),
|
new ApiResponse<>(true, "Equipe supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
@@ -106,18 +104,17 @@ public class EquipeController {
|
|||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
//@PreAuthorize("hasAuthority('READ_EQUIPE')")
|
@PreAuthorize("hasAuthority('READ_EQUIPE')")
|
||||||
public ResponseEntity<?> getAllEquipeList() {
|
public ResponseEntity<?> getAllEquipeList() {
|
||||||
try {
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, equipeService.findAll(), "Liste des equipes chargée avec succès."),
|
new ApiResponse<>(true, equipeService.getEquipeList(), "Liste des equipes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
@@ -143,7 +140,7 @@ public class EquipeController {
|
|||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, equipeService.findAll(pageable), "Liste des equipes chargée avec succès."),
|
new ApiResponse<>(true, equipeService.getEquipeList(pageable), "Liste des equipes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
@@ -167,81 +164,7 @@ public class EquipeController {
|
|||||||
public ResponseEntity<?> getEquipeById(@PathVariable Long id) {
|
public ResponseEntity<?> getEquipeById(@PathVariable Long id) {
|
||||||
try {
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, equipeService.findById(id), "Equipe trouvée avec succès."),
|
new ApiResponse<>(true, equipeService.getEquipeById(id), "Equipe 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-compagne-id/{campagneId}")
|
|
||||||
@PreAuthorize("hasAuthority('READ_EQUIPE')")
|
|
||||||
public ResponseEntity<?> getEquipeByCompagneId(@PathVariable Long campagneId) {
|
|
||||||
try {
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, equipeService.findByCampagneId(campagneId), "Equipe 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-secteur-id/{secteurId}")
|
|
||||||
@PreAuthorize("hasAuthority('READ_EQUIPE')")
|
|
||||||
public ResponseEntity<?> getEquipeBySecteurId(@PathVariable Long secteurId) {
|
|
||||||
try {
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, equipeService.findBySecteurId(secteurId), "Equipe 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-quartier-id/{quartierId}")
|
|
||||||
@PreAuthorize("hasAuthority('READ_EQUIPE')")
|
|
||||||
public ResponseEntity<?> getEquipeByQuartierId(@PathVariable Long quartierId) {
|
|
||||||
try {
|
|
||||||
return new ResponseEntity<>(
|
|
||||||
new ApiResponse<>(true, equipeService.findByQuartierId(quartierId), "Equipe trouvée avec succès."),
|
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class ExerciceController {
|
|||||||
@PreAuthorize("hasAuthority('CREATE_EXERCICE')")
|
@PreAuthorize("hasAuthority('CREATE_EXERCICE')")
|
||||||
public ResponseEntity<?> createExercice(@RequestBody @Valid @Validated Exercice exercice) {
|
public ResponseEntity<?> createExercice(@RequestBody @Valid @Validated Exercice exercice) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
exercice = exerciceService.createExercice(exercice);
|
exercice = exerciceService.createExercice(exercice);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, exercice, "Exercice créé avec succès."),
|
new ApiResponse<>(true, exercice, "Exercice créé avec succès."),
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.hibernate.annotations.Formula;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -184,14 +183,6 @@ public class Enquete extends BaseEntity implements Serializable {
|
|||||||
private Integer nbreIndivisiaire;
|
private Integer nbreIndivisiaire;
|
||||||
private String autreAdresse;
|
private String autreAdresse;
|
||||||
private Float superficie ;
|
private Float superficie ;
|
||||||
@Formula("""
|
|
||||||
(
|
|
||||||
SELECT COUNT(DISTINCT (bat.id))
|
|
||||||
FROM enquete e
|
|
||||||
join batiment bat on bat.parcelle_id =e.parcelle_id
|
|
||||||
WHERE bat.parcelle_id = parcelle_id
|
|
||||||
)
|
|
||||||
""")
|
|
||||||
private Integer nbreBatiment;
|
private Integer nbreBatiment;
|
||||||
private Integer nbrePiscine;
|
private Integer nbrePiscine;
|
||||||
private Long montantMensuelleLocation;
|
private Long montantMensuelleLocation;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import io.gmss.fiscad.entities.BaseEntity;
|
|||||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||||
|
import io.gmss.fiscad.entities.rfu.parametre.Participer;
|
||||||
import io.gmss.fiscad.enums.StatusAvis;
|
import io.gmss.fiscad.enums.StatusAvis;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -15,6 +16,8 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.hibernate.annotations.Formula;
|
import org.hibernate.annotations.Formula;
|
||||||
|
import org.hibernate.annotations.SQLDelete;
|
||||||
|
import org.hibernate.annotations.Where;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -51,7 +54,6 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
|||||||
private String datePieceAdmin;
|
private String datePieceAdmin;
|
||||||
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
|
|
||||||
private StatusAvis statusAvis;
|
private StatusAvis statusAvis;
|
||||||
@Formula("""
|
@Formula("""
|
||||||
(
|
(
|
||||||
@@ -60,7 +62,6 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
|||||||
WHERE d.impositions_tfu_id = id
|
WHERE d.impositions_tfu_id = id
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
@Transient
|
|
||||||
private Integer nombreAvis;
|
private Integer nombreAvis;
|
||||||
@Formula("""
|
@Formula("""
|
||||||
(
|
(
|
||||||
@@ -70,7 +71,6 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
|||||||
and (d.nature_impot='FNB' or d.nature_impot='FB')
|
and (d.nature_impot='FNB' or d.nature_impot='FB')
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
@Transient
|
|
||||||
private Integer nombreAvisFnb;
|
private Integer nombreAvisFnb;
|
||||||
@Formula("""
|
@Formula("""
|
||||||
(
|
(
|
||||||
@@ -81,9 +81,7 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
|||||||
and d.batiment_id is not null
|
and d.batiment_id is not null
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
@Transient
|
|
||||||
private Integer nombreAvisBatiment;
|
private Integer nombreAvisBatiment;
|
||||||
|
|
||||||
@Formula("""
|
@Formula("""
|
||||||
(
|
(
|
||||||
SELECT COUNT(DISTINCT (d.annee, d.code_commune, d.personne_id))
|
SELECT COUNT(DISTINCT (d.annee, d.code_commune, d.personne_id))
|
||||||
@@ -93,16 +91,15 @@ public class ImpositionsTfu extends BaseEntity implements Serializable {
|
|||||||
and d.unite_logement_id is not null
|
and d.unite_logement_id is not null
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
@Transient
|
|
||||||
private Integer nombreAvisUniteLog;
|
private Integer nombreAvisUniteLog;
|
||||||
|
|
||||||
@Column(columnDefinition = "TEXT")
|
@Column(columnDefinition = "TEXT")
|
||||||
private String motif;
|
private String motif;
|
||||||
|
|
||||||
// @JsonIgnore
|
@JsonIgnore
|
||||||
// @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
// @JoinColumn(name = "impositions_tfu_id")
|
@JoinColumn(name = "impositions_tfu_id")
|
||||||
// private List<DonneesImpositionTfu> donneesImpositionTfus;
|
private List<DonneesImpositionTfu> donneesImpositionTfus;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|||||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||||
import io.gmss.fiscad.entities.BaseEntity;
|
import io.gmss.fiscad.entities.BaseEntity;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
|
||||||
import io.gmss.fiscad.enums.TypeCampagne;
|
import io.gmss.fiscad.enums.TypeCampagne;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -40,12 +39,12 @@ public class Campagne extends BaseEntity implements Serializable {
|
|||||||
private LocalDate dateFin;
|
private LocalDate dateFin;
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
private TypeCampagne typeCampagne;
|
private TypeCampagne typeCampagne;
|
||||||
@ManyToOne
|
// @JsonIgnore
|
||||||
private Exercice exercice ;
|
// @OneToMany(mappedBy = "campagne")
|
||||||
|
// private List<Equipe> equipes;
|
||||||
@ManyToOne
|
// @JsonIgnore
|
||||||
private Structure structure ;
|
// @OneToMany(mappedBy = "campagne")
|
||||||
|
// private List<Enquete> enquetes;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package io.gmss.fiscad.entities.rfu.parametre;
|
package io.gmss.fiscad.entities.rfu.parametre;
|
||||||
|
|
||||||
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.BaseEntity;
|
||||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
|
||||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||||
|
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.Participer;
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -16,7 +13,6 @@ import lombok.NoArgsConstructor;
|
|||||||
import org.hibernate.annotations.Where;
|
import org.hibernate.annotations.Where;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@@ -36,10 +32,6 @@ public class Equipe extends BaseEntity implements Serializable {
|
|||||||
private Bloc bloc;
|
private Bloc bloc;
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Secteur secteur;
|
private Secteur secteur;
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
private Quartier quartier;
|
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Campagne campagne;
|
private Campagne campagne;
|
||||||
|
|
||||||
@@ -47,14 +39,6 @@ public class Equipe extends BaseEntity implements Serializable {
|
|||||||
@JoinColumn(name = "equipe_id")
|
@JoinColumn(name = "equipe_id")
|
||||||
private List<Participer> participers;
|
private List<Participer> participers;
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
|
||||||
private LocalDate dateDebut;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
|
||||||
private LocalDate dateFin;
|
|
||||||
|
|
||||||
// @JsonIgnore
|
// @JsonIgnore
|
||||||
// @OneToMany(mappedBy = "equipe")
|
// @OneToMany(mappedBy = "equipe")
|
||||||
// private List<Enquete> enquetes;
|
// private List<Enquete> enquetes;
|
||||||
|
|||||||
@@ -21,11 +21,6 @@ import java.time.LocalDate;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Where(clause = " deleted = false")
|
@Where(clause = " deleted = false")
|
||||||
@Table(
|
|
||||||
uniqueConstraints = {
|
|
||||||
@UniqueConstraint(name = "uk_exercice_annee", columnNames = "annee")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
public class Exercice extends BaseEntity implements Serializable {
|
public class Exercice extends BaseEntity implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package io.gmss.fiscad.entities.rfu.metier;
|
package io.gmss.fiscad.entities.rfu.parametre;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||||
import io.gmss.fiscad.entities.BaseEntity;
|
import io.gmss.fiscad.entities.BaseEntity;
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
|
||||||
import io.gmss.fiscad.entities.user.User;
|
import io.gmss.fiscad.entities.user.User;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -22,15 +21,7 @@ import java.time.LocalDate;
|
|||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
//@Where(clause = " deleted = false")
|
@Where(clause = " deleted = false")
|
||||||
@Table(
|
|
||||||
uniqueConstraints = {
|
|
||||||
@UniqueConstraint(
|
|
||||||
name = "uk_participer_equipe_user",
|
|
||||||
columnNames = {"equipe_id", "user_id"}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
public class Participer extends BaseEntity implements Serializable {
|
public class Participer extends BaseEntity implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@@ -1,9 +1,15 @@
|
|||||||
package io.gmss.fiscad.entities.user;
|
package io.gmss.fiscad.entities.user;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
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.BaseEntity;
|
||||||
|
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||||
|
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.Participer;
|
import io.gmss.fiscad.entities.rfu.parametre.Participer;
|
||||||
|
import io.gmss.fiscad.enums.UserRole;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -13,6 +19,7 @@ import org.hibernate.annotations.SQLDelete;
|
|||||||
import org.hibernate.annotations.Where;
|
import org.hibernate.annotations.Where;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -267,6 +267,7 @@ public class PersonneServiceImpl implements PersonneService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(request.getNpi()!=null && !request.getNpi().equals("")){
|
if(request.getNpi()!=null && !request.getNpi().equals("")){
|
||||||
|
|
||||||
List<PersonnePayLoadWeb> personnePayLoadWebs = personneRepository.findAllPersonneByNpiToDto(request.getNpi());
|
List<PersonnePayLoadWeb> personnePayLoadWebs = personneRepository.findAllPersonneByNpiToDto(request.getNpi());
|
||||||
if(!personnePayLoadWebs.isEmpty())
|
if(!personnePayLoadWebs.isEmpty())
|
||||||
return personnePayLoadWebs;
|
return personnePayLoadWebs;
|
||||||
@@ -276,14 +277,13 @@ public class PersonneServiceImpl implements PersonneService {
|
|||||||
|
|
||||||
result = recherchePersonneLocal(request);
|
result = recherchePersonneLocal(request);
|
||||||
|
|
||||||
if (result != null && ! result.isEmpty()) {
|
if (result != null && !result.isEmpty()) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
// Conversion date en String format yyyy-MM-dd
|
// Conversion date en String format yyyy-MM-dd
|
||||||
String dateNaissance = Optional.ofNullable(request.getDateNaissance())
|
String dateNaissance = Optional.ofNullable(request.getDateNaissance())
|
||||||
.map(d -> d.format(DateTimeFormatter.ISO_LOCAL_DATE))
|
.map(d -> d.format(DateTimeFormatter.ISO_LOCAL_DATE))
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
// Construction du body IFU
|
// Construction du body IFU
|
||||||
IfuEnLigneRechercheBody ifuRequest = new IfuEnLigneRechercheBody();
|
IfuEnLigneRechercheBody ifuRequest = new IfuEnLigneRechercheBody();
|
||||||
ifuRequest.setNom(request.getNom());
|
ifuRequest.setNom(request.getNom());
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ package io.gmss.fiscad.implementations.rfu.metier;
|
|||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.DonneesImpositionTfu;
|
import io.gmss.fiscad.entities.rfu.metier.DonneesImpositionTfu;
|
||||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
||||||
import io.gmss.fiscad.enums.StatusAvis;
|
import io.gmss.fiscad.enums.StatusAvis;
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.*;
|
import io.gmss.fiscad.paylaods.request.crudweb.ArrondissementPaylaodWeb;
|
||||||
|
import io.gmss.fiscad.paylaods.request.crudweb.DonneesImpositionPaylaodWeb;
|
||||||
|
import io.gmss.fiscad.paylaods.request.crudweb.ImpositionsTfuPaylaodWeb;
|
||||||
import io.gmss.fiscad.paylaods.response.DonneesImpositionTfuResponse;
|
import io.gmss.fiscad.paylaods.response.DonneesImpositionTfuResponse;
|
||||||
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
|
import io.gmss.fiscad.persistence.repositories.decoupage.ArrondissementRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
import io.gmss.fiscad.persistence.repositories.infocad.metier.EnqueteRepository;
|
||||||
@@ -45,7 +45,6 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
private final ArrondissementRepository arrondissementRepository;
|
private final ArrondissementRepository arrondissementRepository;
|
||||||
private final BaremRfuRepository baremRfuRepository;
|
private final BaremRfuRepository baremRfuRepository;
|
||||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
private final EntityFromPayLoadService entityFromPayLoadService;
|
||||||
private final StructureService structureService;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -117,38 +116,23 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId,Long parcelleId) {
|
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleNonBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId,Long parcelleId) {
|
||||||
|
|
||||||
boolean existsBareme = baremRfuNonBatiRepository.existsBaremForParcelleNonBati(parcelleId);
|
boolean existsBareme = baremRfuNonBatiRepository.existsBaremForParcelleNonBati(parcelleId);
|
||||||
|
Optional<Parcelle> optionalParcelle= parcelleRepository.findById(parcelleId);
|
||||||
Optional<ParcellePayLoadWeb> optionalParcelle= parcelleRepository.findParcelleToDtoById(parcelleId);
|
|
||||||
|
|
||||||
String nomQuartier="";
|
String nomQuartier="";
|
||||||
String nomArrondissement="";
|
String nomArrondissement="";
|
||||||
String nomCommune="";
|
String nomCommune="";
|
||||||
if(optionalParcelle.isPresent()){
|
if(optionalParcelle.isPresent()){
|
||||||
nomQuartier= optionalParcelle.get().getQuartierNom();
|
nomQuartier= optionalParcelle.get().getQuartier().getNom();
|
||||||
|
nomArrondissement= optionalParcelle.get().getQuartier().getArrondissement().getNom();
|
||||||
|
nomCommune= optionalParcelle.get().getQuartier().getArrondissement().getCommune().getNom();
|
||||||
}
|
}
|
||||||
if(!existsBareme){
|
if(!existsBareme){
|
||||||
throw new BadRequestException("Impossible de continuer la liquidation : Il n'existe pas de barème configuré pour la zone de cette parcelle : "+nomQuartier);
|
throw new BadRequestException("Impossible de continuer la liquidation : Il n'existe pas de barème configuré pour la zone de cette parcelle : "+nomCommune+" : "+nomArrondissement+" : "+nomQuartier);
|
||||||
}
|
}
|
||||||
|
Integer nb= donneesImpositionTfuRepository.genererDonneesTfuNonBatie(impositionsTfuPaylaodWeb.getId(),userId,parcelleId);
|
||||||
List<Structure> structures = structureService.getListStructureUserId(userId);
|
|
||||||
|
|
||||||
boolean existe = structures.stream()
|
|
||||||
.anyMatch(s -> s.getId().equals(impositionsTfuPaylaodWeb.getStructureId()));
|
|
||||||
|
|
||||||
if (!existe) {
|
|
||||||
throw new BadRequestException("Impossible de continuer la liquidation : La parcelle ne se trouve pas dans votre territoire ");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Integer nb= donneesImpositionTfuRepository.genererDonneesTfuNonBatie(impositionsTfuPaylaodWeb.getId(), userId, parcelleId);
|
|
||||||
|
|
||||||
System.out.println(nb);
|
|
||||||
|
|
||||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||||
impositionsTfu.setStatusAvis(StatusAvis.TFU_FNB_GENERE);
|
impositionsTfu.setStatusAvis(StatusAvis.TFU_FNB_GENERE);
|
||||||
|
//impositionsTfu.setNombreAvisFnb(nb);
|
||||||
impositionsTfuRepository.save(impositionsTfu);
|
impositionsTfuRepository.save(impositionsTfu);
|
||||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||||
}
|
}
|
||||||
@@ -189,21 +173,23 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId, Long parcelleId) {
|
public ImpositionsTfuPaylaodWeb genererDonneesFiscalesParcelleBatieUneParcelle(ImpositionsTfuPaylaodWeb impositionsTfuPaylaodWeb, Long userId, Long parcelleId) {
|
||||||
|
|
||||||
Optional<ImpositionsTfuPaylaodWeb> imp=impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
Optional<ImpositionsTfuPaylaodWeb> imp=impositionsTfuRepository.findByIdToDto(impositionsTfuPaylaodWeb.getId());
|
||||||
if(imp.isPresent()){
|
if(imp.isPresent()){
|
||||||
boolean dejaLiquide = donneesImpositionTfuRepository.existsByImpositionAnneeAndParcelle(Long.valueOf(imp.get().getExerciceAnnee()),parcelleId);
|
boolean dejaLiquide = donneesImpositionTfuRepository.existsByImpositionAnneeAndParcelle(Long.valueOf(imp.get().getExerciceAnnee()),parcelleId);
|
||||||
if(dejaLiquide){
|
if(dejaLiquide){
|
||||||
return imp.orElse(null);
|
return imp.orElse(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean existsBareme = baremRfuRepository.existsBaremForParcelle(parcelleId);
|
|
||||||
|
|
||||||
Optional<ParcellePayLoadWeb> optionalParcelle= parcelleRepository.findParcelleToDtoById(parcelleId);
|
boolean existsBareme = baremRfuRepository.existsBaremForParcelle(parcelleId);
|
||||||
|
Optional<Parcelle> optionalParcelle= parcelleRepository.findById(parcelleId);
|
||||||
String nomQuartier="";
|
String nomQuartier="";
|
||||||
String nomArrondissement="";
|
String nomArrondissement="";
|
||||||
String nomCommune="";
|
String nomCommune="";
|
||||||
if(optionalParcelle.isPresent()){
|
if(optionalParcelle.isPresent()){
|
||||||
nomQuartier= optionalParcelle.get().getQuartierNom();
|
nomQuartier= optionalParcelle.get().getQuartier().getNom();
|
||||||
|
nomArrondissement= optionalParcelle.get().getQuartier().getArrondissement().getNom();
|
||||||
|
nomCommune= optionalParcelle.get().getQuartier().getArrondissement().getCommune().getNom();
|
||||||
}
|
}
|
||||||
if(!existsBareme){
|
if(!existsBareme){
|
||||||
throw new BadRequestException("Impossible de continuer la liquidation : Il n'existe pas de barème configuré pour la zone de cette parcelle : "+nomCommune+" : "+nomArrondissement+" : "+nomQuartier);
|
throw new BadRequestException("Impossible de continuer la liquidation : Il n'existe pas de barème configuré pour la zone de cette parcelle : "+nomCommune+" : "+nomArrondissement+" : "+nomQuartier);
|
||||||
@@ -223,10 +209,15 @@ public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuServ
|
|||||||
|
|
||||||
Integer nbMajAcompteRirf= donneesImpositionTfuRepository.majDonneesAcompteRirfUneParcelle(impositionsTfuPaylaodWeb.getId(),parcelleId);
|
Integer nbMajAcompteRirf= donneesImpositionTfuRepository.majDonneesAcompteRirfUneParcelle(impositionsTfuPaylaodWeb.getId(),parcelleId);
|
||||||
|
|
||||||
|
|
||||||
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
ImpositionsTfu impositionsTfu = entityFromPayLoadService.getImpositionsTfuFromPayLoadWeb(impositionsTfuPaylaodWeb);
|
||||||
|
|
||||||
impositionsTfu.setStatusAvis(StatusAvis.GENERE);
|
impositionsTfu.setStatusAvis(StatusAvis.GENERE);
|
||||||
|
|
||||||
|
//impositionsTfu.setNombreAvis(impositionsTfu.getNombreAvis()+1);
|
||||||
|
//impositionsTfu.setNombreAvisBatiment(impositionsTfu.getNombreAvisFnb()+1);
|
||||||
|
//impositionsTfu.setNombreAvisUniteLog(impositionsTfu.getNombreAvisUniteLog()+1);
|
||||||
|
|
||||||
impositionsTfuRepository.save(impositionsTfu);
|
impositionsTfuRepository.save(impositionsTfu);
|
||||||
|
|
||||||
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
return impositionsTfuRepository.findByIdToDto(impositionsTfu.getId()).orElse(null);
|
||||||
|
|||||||
@@ -1,136 +0,0 @@
|
|||||||
package io.gmss.fiscad.implementations.rfu.metier;
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.Participer;
|
|
||||||
import io.gmss.fiscad.exceptions.ApplicationException;
|
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
|
||||||
import io.gmss.fiscad.interfaces.rfu.metier.ParticiperService;
|
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb;
|
|
||||||
import io.gmss.fiscad.persistence.repositories.infocad.metier.ParcelleRepository;
|
|
||||||
import io.gmss.fiscad.persistence.repositories.rfu.metier.ParticiperRepository;
|
|
||||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.EquipeRepository;
|
|
||||||
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
|
|
||||||
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 ParticiperServiceImpl implements ParticiperService {
|
|
||||||
|
|
||||||
private final ParticiperRepository participerRepository;
|
|
||||||
private final EquipeRepository equipeRepository;
|
|
||||||
private final UserRepository userRepository;
|
|
||||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ParticiperPayloadWeb createParticiper(ParticiperPayloadWeb participerPaylaodWeb) throws BadRequestException {
|
|
||||||
if (participerPaylaodWeb.getId() != null) {
|
|
||||||
throw new BadRequestException("Impossible de créer un nouveau participer ayant un id non null.");
|
|
||||||
}
|
|
||||||
if (participerPaylaodWeb.getEquipeId() == null) {
|
|
||||||
throw new BadRequestException("Impossible de créer un nouveau participer: L'équipe doit être précisée.");
|
|
||||||
}else {
|
|
||||||
if(!equipeRepository.existsById(participerPaylaodWeb.getEquipeId()))
|
|
||||||
throw new BadRequestException("Impossible de créer la participation: L'équipe doit être précisée.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (participerPaylaodWeb.getUserId() == null) {
|
|
||||||
throw new BadRequestException("Impossible de créer la participation : Le participant doit être précisé.");
|
|
||||||
}else {
|
|
||||||
if(!userRepository.existsById(participerPaylaodWeb.getUserId()))
|
|
||||||
throw new BadRequestException("Impossible de créer un nouveau participer: Le participant doit être précisé.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (participerRepository.existsByEquipeIdAndUserId(
|
|
||||||
participerPaylaodWeb.getEquipeId(),
|
|
||||||
participerPaylaodWeb.getUserId())) {
|
|
||||||
throw new ApplicationException("Cet utilisateur participe déjà à cette équipe.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Participer participer= entityFromPayLoadService.getParticiperFromPayLoadWeb(participerPaylaodWeb);
|
|
||||||
participer= participerRepository.save(participer);
|
|
||||||
|
|
||||||
return participerRepository.findPayloadById(participer.getId()).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ParticiperPayloadWeb updateParticiper(Long id,ParticiperPayloadWeb participerPaylaodWeb) throws NotFoundException {
|
|
||||||
if (participerPaylaodWeb.getId() == null) {
|
|
||||||
throw new BadRequestException("Participation non spécifiée");
|
|
||||||
}
|
|
||||||
if (!participerRepository.existsById(participerPaylaodWeb.getId())) {
|
|
||||||
throw new NotFoundException("Impossible de trouver la participation.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (participerPaylaodWeb.getEquipeId() == null) {
|
|
||||||
throw new BadRequestException("Impossible de créer un nouveau participer: L'équipe doit être précisée.");
|
|
||||||
}else {
|
|
||||||
if(!equipeRepository.existsById(participerPaylaodWeb.getEquipeId()))
|
|
||||||
throw new BadRequestException("Impossible de créer un nouveau participer: L'équipe doit être précisée.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (participerPaylaodWeb.getUserId() == null) {
|
|
||||||
throw new BadRequestException("Impossible de créer un nouveau participer: Le participant doit être précisé.");
|
|
||||||
}else {
|
|
||||||
if(!userRepository.existsById(participerPaylaodWeb.getUserId()))
|
|
||||||
throw new BadRequestException("Impossible de créer un nouveau participer: Le participant doit être précisé.");
|
|
||||||
}
|
|
||||||
Participer participer= entityFromPayLoadService.getParticiperFromPayLoadWeb(participerPaylaodWeb);
|
|
||||||
participer= participerRepository.save(participer);
|
|
||||||
|
|
||||||
return participerRepository.findPayloadById(participer.getId()).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteParticiper(Long id) throws NotFoundException {
|
|
||||||
Optional<Participer> participerOptional = participerRepository.findById(id);
|
|
||||||
if (participerOptional.isPresent()) {
|
|
||||||
participerRepository.deleteById(participerOptional.get().getId());
|
|
||||||
} else {
|
|
||||||
throw new NotFoundException("Impossible de trouver le participer spécifié dans notre base de données.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ParticiperPayloadWeb> getParticiperList(Pageable pageable) {
|
|
||||||
return participerRepository.findAllPayload(pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ParticiperPayloadWeb> getParticiperList() {
|
|
||||||
return participerRepository.findAllPayload();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ParticiperPayloadWeb> getParticiperListByEquipePageable(Long equipeId, Pageable pageable) {
|
|
||||||
return participerRepository.findAllPayloadByEquipeId(equipeId,pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ParticiperPayloadWeb> getParticiperListByEquipe(Long equipeId) {
|
|
||||||
return participerRepository.findAllPayloadByEquipeId(equipeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<ParticiperPayloadWeb> getParticiperById(Long id) {
|
|
||||||
if (participerRepository.existsById(id)) {
|
|
||||||
return participerRepository.findPayloadById(id);
|
|
||||||
} else {
|
|
||||||
throw new NotFoundException("Impossible de trouver la participation spécifiée dans la base de données.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||||
import io.gmss.fiscad.enums.TypeCampagne;
|
import io.gmss.fiscad.enums.TypeCampagne;
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.interfaces.rfu.parametre.CampagneService;
|
import io.gmss.fiscad.interfaces.rfu.parametre.CampagneService;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
|
||||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CampagneRepository;
|
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CampagneRepository;
|
||||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -19,36 +14,29 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
|
||||||
public class CampagneServiceImpl implements CampagneService {
|
public class CampagneServiceImpl implements CampagneService {
|
||||||
private final CampagneRepository campagneRepository;
|
private final CampagneRepository campagneRepository;
|
||||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
|
||||||
|
|
||||||
|
public CampagneServiceImpl(CampagneRepository campagneRepository) {
|
||||||
|
this.campagneRepository = campagneRepository;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CampagnePayloadWeb createCampagne(CampagnePayloadWeb campagnePayloadWeb) throws BadRequestException {
|
public Campagne createCampagne(Campagne campagne) throws BadRequestException {
|
||||||
if (campagnePayloadWeb.getId() != null) {
|
if (campagne.getId() != null) {
|
||||||
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null.");
|
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null.");
|
||||||
}
|
}
|
||||||
|
return campagneRepository.save(campagne);
|
||||||
Campagne campagne= entityFromPayLoadService.getCampagneFromPayLoadWeb(campagnePayloadWeb);
|
|
||||||
campagne= campagneRepository.save(campagne);
|
|
||||||
|
|
||||||
return campagneRepository.findPayloadById(campagne.getId()).orElse(null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public CampagnePayloadWeb updateCampagne(Long id, CampagnePayloadWeb campagnePayloadWeb) throws NotFoundException {
|
public Campagne updateCampagne(Long id, Campagne campagne) throws NotFoundException {
|
||||||
if (campagnePayloadWeb.getId() == null) {
|
if (campagne.getId() == null) {
|
||||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle campagne ayant un id null.");
|
throw new BadRequestException("Impossible de mettre à jour une nouvelle campagne ayant un id null.");
|
||||||
}
|
}
|
||||||
if (!campagneRepository.existsById(campagnePayloadWeb.getId())) {
|
if (!campagneRepository.existsById(campagne.getId())) {
|
||||||
throw new NotFoundException("Impossible de trouver la campagne spécifiée dans notre base de données.");
|
throw new NotFoundException("Impossible de trouver la campagne spécifiée dans notre base de données.");
|
||||||
}
|
}
|
||||||
Campagne campagne= entityFromPayLoadService.getCampagneFromPayLoadWeb(campagnePayloadWeb);
|
return campagneRepository.save(campagne);
|
||||||
campagne= campagneRepository.save(campagne);
|
|
||||||
|
|
||||||
return campagneRepository.findPayloadById(campagne.getId()).orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -61,13 +49,13 @@ public class CampagneServiceImpl implements CampagneService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Page<CampagnePayloadWeb> getCampagneList(Pageable pageable) {
|
public Page<Campagne> getCampagneList(Pageable pageable) {
|
||||||
return campagneRepository.findAllPayload(pageable);
|
return campagneRepository.findAll(pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CampagnePayloadWeb> getCampagneList() {
|
public List<Campagne> getCampagneList() {
|
||||||
return campagneRepository.findAllPayload();
|
return campagneRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -76,28 +64,8 @@ public class CampagneServiceImpl implements CampagneService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<CampagnePayloadWeb> getCampagneById(Long id) {
|
public Optional<Campagne> getCampagneById(Long id) {
|
||||||
return campagneRepository.findPayloadById(id);
|
return campagneRepository.findById(id);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId) {
|
|
||||||
return campagneRepository.findAllPayloadByExerciceId(exerciceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId, Pageable pageable) {
|
|
||||||
return campagneRepository.findAllPayloadByExerciceId(exerciceId,pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CampagnePayloadWeb> getCampagneByStructureId(Long structureId) {
|
|
||||||
return campagneRepository.findAllPayloadByStructureId(structureId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<CampagnePayloadWeb> getCampagneByStructureId(Long structureId, Pageable pageable) {
|
|
||||||
return campagneRepository.findAllPayloadByStructureId(structureId,pageable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,131 +1,121 @@
|
|||||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||||
|
|
||||||
|
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||||
|
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
||||||
|
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||||
|
import io.gmss.fiscad.entities.rfu.parametre.Participer;
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.interfaces.rfu.parametre.EquipeService;
|
import io.gmss.fiscad.interfaces.rfu.parametre.EquipeService;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb;
|
import io.gmss.fiscad.paylaods.request.synchronisation.EquipePayload;
|
||||||
|
import io.gmss.fiscad.paylaods.request.synchronisation.ParticiperPayload;
|
||||||
|
import io.gmss.fiscad.persistence.repositories.decoupage.SecteurRepository;
|
||||||
|
import io.gmss.fiscad.persistence.repositories.infocad.parametre.BlocRepository;
|
||||||
|
import io.gmss.fiscad.persistence.repositories.rfu.parametre.CampagneRepository;
|
||||||
import io.gmss.fiscad.persistence.repositories.rfu.parametre.EquipeRepository;
|
import io.gmss.fiscad.persistence.repositories.rfu.parametre.EquipeRepository;
|
||||||
import io.gmss.fiscad.service.EntityFromPayLoadService;
|
import io.gmss.fiscad.persistence.repositories.user.UserRepository;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Service
|
@Service
|
||||||
public class EquipeServiceImpl implements EquipeService {
|
public class EquipeServiceImpl implements EquipeService {
|
||||||
private final EntityFromPayLoadService entityFromPayLoadService;
|
private final EquipeRepository equipeRepository;
|
||||||
private final EquipeRepository equipeRepository;
|
private final UserRepository userRepository;
|
||||||
|
private final BlocRepository blocRepository;
|
||||||
|
private final SecteurRepository secteurRepository;
|
||||||
|
private final CampagneRepository campagneRepository;
|
||||||
|
|
||||||
|
public EquipeServiceImpl(EquipeRepository equipeRepository, UserRepository userRepository, BlocRepository blocRepository, SecteurRepository secteurRepository, CampagneRepository campagneRepository) {
|
||||||
|
this.equipeRepository = equipeRepository;
|
||||||
|
this.userRepository = userRepository;
|
||||||
|
this.blocRepository = blocRepository;
|
||||||
|
this.secteurRepository = secteurRepository;
|
||||||
|
this.campagneRepository = campagneRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EquipePayloadWeb create(EquipePayloadWeb equipePayloadWeb) {
|
public Equipe createEquipe(EquipePayload equipePayload) throws BadRequestException {
|
||||||
if (equipePayloadWeb.getId() != null) {
|
if (equipePayload.getId() != null) {
|
||||||
throw new BadRequestException("Impossible de créer une nouvelle caracteristique ayant un id non null.");
|
throw new BadRequestException("Impossible de créer une nouvelle equipe ayant un id non null.");
|
||||||
}
|
}
|
||||||
Equipe equipe = entityFromPayLoadService.getEquipeFromPayLoadWeb(equipePayloadWeb);
|
Equipe equipe = getEquipeFromPayload(equipePayload);
|
||||||
equipe = equipeRepository.save(equipe);
|
return equipeRepository.save(equipe);
|
||||||
return equipeRepository.findPayloadById(equipe.getId()).orElse(null);
|
}
|
||||||
|
|
||||||
|
private Equipe getEquipeFromPayload(EquipePayload equipePayload) {
|
||||||
|
Equipe equipe = new Equipe();
|
||||||
|
Optional<Bloc> optionalBloc = blocRepository.findById(equipePayload.getBlocId());
|
||||||
|
equipe.setBloc(optionalBloc.orElse(null));
|
||||||
|
equipe.setId(equipePayload.getId());
|
||||||
|
equipe.setCode(equipePayload.getCode());
|
||||||
|
equipe.setNom(equipePayload.getNom());
|
||||||
|
Optional<Secteur> optionalSecteur = secteurRepository.findById(equipePayload.getSecteurId());
|
||||||
|
equipe.setSecteur(optionalSecteur.orElse(null));
|
||||||
|
Optional<Campagne> optionalCampagne = campagneRepository.findById(equipePayload.getCampagneId());
|
||||||
|
equipe.setCampagne(optionalCampagne.orElse(null));
|
||||||
|
|
||||||
|
List<Participer> participerList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (ParticiperPayload pp : equipePayload.getParticiperPayloads()) {
|
||||||
|
Participer part = new Participer();
|
||||||
|
part.setId(pp.getId());
|
||||||
|
if (pp.getEquipeId() != null && equipeRepository.existsById(equipe.getId())) {
|
||||||
|
part.setEquipe(equipeRepository.findById(equipe.getId()).orElse(null));
|
||||||
|
}
|
||||||
|
if (pp.getUserId() != null && userRepository.existsById(pp.getUserId())) {
|
||||||
|
part.setUser(userRepository.findById(pp.getUserId()).orElse(null));
|
||||||
|
}
|
||||||
|
part.setDateDebut(pp.getDateDebut());
|
||||||
|
part.setDateFin(pp.getDateFin());
|
||||||
|
participerList.add(part);
|
||||||
|
}
|
||||||
|
equipe.setParticipers(participerList);
|
||||||
|
|
||||||
|
return equipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EquipePayloadWeb update(Long id, EquipePayloadWeb equipePayloadWeb) {
|
public Equipe updateEquipe(Long id, EquipePayload equipePayload) throws NotFoundException {
|
||||||
if (equipePayloadWeb.getId() == null) {
|
if (equipePayload.getId() == null) {
|
||||||
throw new BadRequestException("Impossible de faire la mise à jour: Equipe non fournie");
|
throw new BadRequestException("Impossible de mettre à jour une nouvelle equipe ayant un id null.");
|
||||||
}
|
}
|
||||||
Optional<Equipe> optionalEquipe=Optional.empty();
|
if (!equipeRepository.existsById(equipePayload.getId())) {
|
||||||
if(!equipeRepository.existsById(equipePayloadWeb.getId())){
|
throw new NotFoundException("Impossible de trouver la equipe spécifiée dans notre base de données.");
|
||||||
throw new BadRequestException("Impossible de faire la mise à jour: Equipe non fournie");
|
|
||||||
}
|
}
|
||||||
|
Equipe equipe = getEquipeFromPayload(equipePayload);
|
||||||
Equipe equipe = entityFromPayLoadService.getEquipeFromPayLoadWeb(equipePayloadWeb);
|
return equipeRepository.save(equipe);
|
||||||
equipe = equipeRepository.save(equipe);
|
|
||||||
return equipeRepository.findPayloadById(equipe.getId()).orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Long id) {
|
public void deleteEquipe(Long id) throws NotFoundException {
|
||||||
Optional<Equipe> optionalEquipe = equipeRepository.findById(id);
|
Optional<Equipe> equipeOptional = equipeRepository.findById(id);
|
||||||
if (optionalEquipe.isPresent()) {
|
if (equipeOptional.isPresent()) {
|
||||||
equipeRepository.deleteById(optionalEquipe.get().getId());
|
equipeRepository.deleteById(equipeOptional.get().getId());
|
||||||
} else {
|
} else {
|
||||||
throw new NotFoundException("Impossible de trouver l'équipe spécifiée.");
|
throw new NotFoundException("Impossible de trouver la equipe spécifiée dans notre base de données.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EquipePayloadWeb findById(Long id) {
|
public Page<Equipe> getEquipeList(Pageable pageable) {
|
||||||
if (equipeRepository.existsById(id)) {
|
return equipeRepository.findAll(pageable);
|
||||||
return equipeRepository.findPayloadById(id).orElse(null);
|
|
||||||
} else {
|
|
||||||
throw new NotFoundException("Impossible de trouver la caractéristique spécifiée dans la base de données.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EquipePayloadWeb> findAll() {
|
public List<Equipe> getEquipeList() {
|
||||||
return equipeRepository.findAllPayload();
|
return equipeRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<EquipePayloadWeb> findAll(Pageable pageable) {
|
|
||||||
return equipeRepository.findAllPayload(pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EquipePayloadWeb> findByCampagneId(Long campagneId) {
|
public Optional<Equipe> getEquipeById(Long id) {
|
||||||
return equipeRepository.findAllPayloadByCampagneId(campagneId);
|
return equipeRepository.findById(id);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<EquipePayloadWeb> findByCampagneId(Long campagneId, Pageable pageable) {
|
|
||||||
return equipeRepository.findAllPayloadByCampagneId(campagneId,pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EquipePayloadWeb> findBySecteurId(Long secteurId) {
|
|
||||||
return equipeRepository.findAllPayloadBySecteurId(secteurId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<EquipePayloadWeb> findBySecteurId(Long secteurId, Pageable pageable) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EquipePayloadWeb> findByQuartierId(Long quartierId) {
|
|
||||||
return equipeRepository.findAllPayloadByQuartierId(quartierId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<EquipePayloadWeb> findByQuartierId(Long quartierId, Pageable pageable) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EquipePayloadWeb> findByBlocId(Long blocId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<EquipePayloadWeb> findByBlocId(Long blocId, Pageable pageable) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean existsById(Long id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean existsByCode(String code) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Equipe> findEntityById(Long id) {
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package io.gmss.fiscad.implementations.rfu.parametre;
|
package io.gmss.fiscad.implementations.rfu.parametre;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||||
import io.gmss.fiscad.exceptions.ApplicationException;
|
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.interfaces.rfu.parametre.ExerciceService;
|
import io.gmss.fiscad.interfaces.rfu.parametre.ExerciceService;
|
||||||
@@ -23,14 +22,8 @@ public class ExerciceServiceImpl implements ExerciceService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Exercice createExercice(Exercice exercice) throws BadRequestException {
|
public Exercice createExercice(Exercice exercice) throws BadRequestException {
|
||||||
if (exercice.getId() == null) {
|
if (exercice.getId() != null) {
|
||||||
if (exerciceRepository.existsByAnnee(exercice.getAnnee())) {
|
throw new BadRequestException("Impossible de créer une nouvelle campgne ayant un id non null.");
|
||||||
throw new ApplicationException("Un exercice existe déjà pour l'année " + exercice.getAnnee() + ".");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (exerciceRepository.existsByAnneeAndIdNot(exercice.getAnnee(), exercice.getId())) {
|
|
||||||
throw new ApplicationException("Un exercice existe déjà pour l'année " + exercice.getAnnee() + ".");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return exerciceRepository.save(exercice);
|
return exerciceRepository.save(exercice);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,10 +137,9 @@ public class UserServiceImpl implements UserService {
|
|||||||
public UserPaylaodWeb updateUser(Long id, UserPaylaodWeb userPaylaodWeb) {
|
public UserPaylaodWeb updateUser(Long id, UserPaylaodWeb userPaylaodWeb) {
|
||||||
|
|
||||||
if ((userRepository.findByUsername(userPaylaodWeb.getLogin()).isEmpty())
|
if ((userRepository.findByUsername(userPaylaodWeb.getLogin()).isEmpty())
|
||||||
&& (userRepository.findByEmail(userPaylaodWeb.getEmail()).isEmpty())) {
|
|| (userRepository.findByEmail(userPaylaodWeb.getEmail()).isEmpty())) {
|
||||||
throw new BadRequestException("Cet utilisateur n'existe pas.");
|
throw new BadRequestException("Cet utilisateur n'existe pas.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userPaylaodWeb.getId() == null) {
|
if (userPaylaodWeb.getId() == null) {
|
||||||
throw new BadRequestException("Cet utilisateur n'existe déjà.");
|
throw new BadRequestException("Cet utilisateur n'existe déjà.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
package io.gmss.fiscad.interfaces.rfu.metier;
|
|
||||||
|
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public interface ParticiperService {
|
|
||||||
|
|
||||||
ParticiperPayloadWeb createParticiper(ParticiperPayloadWeb participerPayloadWeb) throws BadRequestException;
|
|
||||||
|
|
||||||
ParticiperPayloadWeb updateParticiper(Long id,ParticiperPayloadWeb participerPayloadWeb) throws NotFoundException;
|
|
||||||
|
|
||||||
void deleteParticiper(Long id) throws NotFoundException;
|
|
||||||
|
|
||||||
Page<ParticiperPayloadWeb> getParticiperList(Pageable pageable);
|
|
||||||
|
|
||||||
List<ParticiperPayloadWeb> getParticiperList();
|
|
||||||
|
|
||||||
Page<ParticiperPayloadWeb> getParticiperListByEquipePageable(Long equipeId, Pageable pageable);
|
|
||||||
|
|
||||||
List<ParticiperPayloadWeb> getParticiperListByEquipe(Long equipeId);
|
|
||||||
|
|
||||||
Optional<ParticiperPayloadWeb> getParticiperById(Long id);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
|||||||
import io.gmss.fiscad.enums.TypeCampagne;
|
import io.gmss.fiscad.enums.TypeCampagne;
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
@@ -13,23 +12,18 @@ import java.util.Optional;
|
|||||||
|
|
||||||
public interface CampagneService {
|
public interface CampagneService {
|
||||||
|
|
||||||
CampagnePayloadWeb createCampagne(CampagnePayloadWeb campagnePayloadWeb) throws BadRequestException;
|
Campagne createCampagne(Campagne campagne) throws BadRequestException;
|
||||||
|
|
||||||
CampagnePayloadWeb updateCampagne(Long id, CampagnePayloadWeb campagnePayloadWeb) throws NotFoundException;
|
Campagne updateCampagne(Long id, Campagne campagne) throws NotFoundException;
|
||||||
|
|
||||||
void deleteCampagne(Long id) throws NotFoundException;
|
void deleteCampagne(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<CampagnePayloadWeb> getCampagneList(Pageable pageable);
|
Page<Campagne> getCampagneList(Pageable pageable);
|
||||||
|
|
||||||
List<CampagnePayloadWeb> getCampagneList();
|
List<Campagne> getCampagneList();
|
||||||
|
|
||||||
List<Campagne> getCampagnesByType(TypeCampagne typeCampagne);
|
List<Campagne> getCampagnesByType(TypeCampagne typeCampagne);
|
||||||
|
|
||||||
Optional<CampagnePayloadWeb> getCampagneById(Long id);
|
Optional<Campagne> getCampagneById(Long id);
|
||||||
List<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId);
|
|
||||||
Page<CampagnePayloadWeb> getCampagneByExerciceId(Long exerciceId,Pageable pageable);
|
|
||||||
List<CampagnePayloadWeb> getCampagneByStructureId(Long structureId);
|
|
||||||
Page<CampagnePayloadWeb> getCampagneByStructureId(Long structureId, Pageable pageable);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package io.gmss.fiscad.interfaces.rfu.parametre;
|
|||||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb;
|
|
||||||
import io.gmss.fiscad.paylaods.request.synchronisation.EquipePayload;
|
import io.gmss.fiscad.paylaods.request.synchronisation.EquipePayload;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -13,42 +12,16 @@ import java.util.Optional;
|
|||||||
|
|
||||||
public interface EquipeService {
|
public interface EquipeService {
|
||||||
|
|
||||||
// CRUD
|
Equipe createEquipe(EquipePayload equipePayload) throws BadRequestException;
|
||||||
EquipePayloadWeb create(EquipePayloadWeb payload);
|
|
||||||
|
|
||||||
EquipePayloadWeb update(Long id, EquipePayloadWeb payload);
|
Equipe updateEquipe(Long id, EquipePayload equipePayload) throws NotFoundException;
|
||||||
|
|
||||||
void delete(Long id);
|
void deleteEquipe(Long id) throws NotFoundException;
|
||||||
|
|
||||||
// Recherche
|
Page<Equipe> getEquipeList(Pageable pageable);
|
||||||
EquipePayloadWeb findById(Long id);
|
|
||||||
|
|
||||||
List<EquipePayloadWeb> findAll();
|
List<Equipe> getEquipeList();
|
||||||
|
|
||||||
Page<EquipePayloadWeb> findAll(Pageable pageable);
|
Optional<Equipe> getEquipeById(Long id);
|
||||||
|
|
||||||
// Filtres
|
|
||||||
List<EquipePayloadWeb> findByCampagneId(Long campagneId);
|
|
||||||
|
|
||||||
Page<EquipePayloadWeb> findByCampagneId(Long campagneId, Pageable pageable);
|
|
||||||
|
|
||||||
List<EquipePayloadWeb> findBySecteurId(Long secteurId);
|
|
||||||
|
|
||||||
Page<EquipePayloadWeb> findBySecteurId(Long secteurId, Pageable pageable);
|
|
||||||
|
|
||||||
List<EquipePayloadWeb> findByQuartierId(Long quartierId);
|
|
||||||
|
|
||||||
Page<EquipePayloadWeb> findByQuartierId(Long quartierId, Pageable pageable);
|
|
||||||
|
|
||||||
List<EquipePayloadWeb> findByBlocId(Long blocId);
|
|
||||||
|
|
||||||
Page<EquipePayloadWeb> findByBlocId(Long blocId, Pageable pageable);
|
|
||||||
|
|
||||||
// Vérifications
|
|
||||||
boolean existsById(Long id);
|
|
||||||
|
|
||||||
boolean existsByCode(String code);
|
|
||||||
|
|
||||||
Optional<Equipe> findEntityById(Long id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|
||||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
|
||||||
import io.gmss.fiscad.enums.TypeCampagne;
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Data
|
|
||||||
public class CampagnePayloadWeb {
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
private String refAdministrative;
|
|
||||||
private String nom;
|
|
||||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
|
||||||
private LocalDate dateDebut;
|
|
||||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
|
||||||
private LocalDate dateFin;
|
|
||||||
@Enumerated(EnumType.STRING)
|
|
||||||
private TypeCampagne typeCampagne;
|
|
||||||
private Long exerciceId ;
|
|
||||||
private Integer exerciceAnnee ;
|
|
||||||
|
|
||||||
private Long structureId ;
|
|
||||||
private String structureCode ;
|
|
||||||
private String structureNom ;
|
|
||||||
|
|
||||||
public CampagnePayloadWeb(Long id, String refAdministrative, String nom, LocalDate dateDebut, LocalDate dateFin, TypeCampagne typeCampagne, Long exerciceId, Integer exerciceAnnee, Long structureId, String structureCode, String structureNom) {
|
|
||||||
this.id = id;
|
|
||||||
this.refAdministrative = refAdministrative;
|
|
||||||
this.nom = nom;
|
|
||||||
this.dateDebut = dateDebut;
|
|
||||||
this.dateFin = dateFin;
|
|
||||||
this.typeCampagne = typeCampagne;
|
|
||||||
this.exerciceId = exerciceId;
|
|
||||||
this.exerciceAnnee = exerciceAnnee;
|
|
||||||
this.structureId = structureId;
|
|
||||||
this.structureCode = structureCode;
|
|
||||||
this.structureNom = structureNom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -36,7 +36,6 @@ public class EnquetePayLoadWeb {
|
|||||||
private Long zoneRfuId;
|
private Long zoneRfuId;
|
||||||
private String zoneRfuNom;
|
private String zoneRfuNom;
|
||||||
private Long personneId;
|
private Long personneId;
|
||||||
private String personneIfu;
|
|
||||||
private String personneNom;
|
private String personneNom;
|
||||||
private String personnePrenom;
|
private String personnePrenom;
|
||||||
private String personneRaisonSociale;
|
private String personneRaisonSociale;
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
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 lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Data
|
|
||||||
public class EquipePayloadWeb {
|
|
||||||
private Long id;
|
|
||||||
private String code;
|
|
||||||
private String nom;
|
|
||||||
|
|
||||||
private Long blocId;
|
|
||||||
private String blocCode;
|
|
||||||
|
|
||||||
private Long secteurId;
|
|
||||||
private String secteurCode;
|
|
||||||
private String secteurNom;
|
|
||||||
|
|
||||||
private Long campagneId;
|
|
||||||
private String campagneNom;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
|
||||||
private LocalDate dateDebut;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
|
||||||
private LocalDate dateFin;
|
|
||||||
|
|
||||||
private Long quartierId;
|
|
||||||
private String quartierCode;
|
|
||||||
private String quartierNom;
|
|
||||||
|
|
||||||
|
|
||||||
public EquipePayloadWeb(Long id, String code, String nom, Long blocId, String blocCode, Long secteurId, String secteurCode, String secteurNom, Long campagneId, String campagneNom, LocalDate dateDebut, LocalDate dateFin, Long quartierId, String quartierCode, String quartierNom) {
|
|
||||||
this.id = id;
|
|
||||||
this.code = code;
|
|
||||||
this.nom = nom;
|
|
||||||
this.blocId = blocId;
|
|
||||||
this.blocCode = blocCode;
|
|
||||||
this.secteurId = secteurId;
|
|
||||||
this.secteurCode = secteurCode;
|
|
||||||
this.secteurNom = secteurNom;
|
|
||||||
this.campagneId = campagneId;
|
|
||||||
this.campagneNom = campagneNom;
|
|
||||||
this.dateDebut = dateDebut;
|
|
||||||
this.dateFin = dateFin;
|
|
||||||
this.quartierId = quartierId;
|
|
||||||
this.quartierCode = quartierCode;
|
|
||||||
this.quartierNom = quartierNom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
package io.gmss.fiscad.paylaods.request.crudweb;
|
|
||||||
|
|
||||||
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.rfu.parametre.Equipe;
|
|
||||||
import io.gmss.fiscad.entities.user.User;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.ManyToOne;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Data
|
|
||||||
public class ParticiperPayloadWeb {
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
|
||||||
private LocalDate dateDebut;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
|
||||||
private LocalDate dateFin;
|
|
||||||
|
|
||||||
private Long equipeId;
|
|
||||||
private String equipeCode;
|
|
||||||
private String equipeNom;
|
|
||||||
|
|
||||||
private Long userId;
|
|
||||||
private String userNom;
|
|
||||||
private String userPrenom;
|
|
||||||
|
|
||||||
public ParticiperPayloadWeb(Long id, LocalDate dateDebut, LocalDate dateFin, Long equipeId, String equipeCode, String equipeNom, Long userId, String userNom, String userPrenom) {
|
|
||||||
this.id = id;
|
|
||||||
this.dateDebut = dateDebut;
|
|
||||||
this.dateFin = dateFin;
|
|
||||||
this.equipeId = equipeId;
|
|
||||||
this.equipeCode = equipeCode;
|
|
||||||
this.equipeNom = equipeNom;
|
|
||||||
this.userId = userId;
|
|
||||||
this.userNom = userNom;
|
|
||||||
this.userPrenom = userPrenom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -73,12 +73,12 @@ public class ParcelleRepositoryCustomImpl implements ParcelleRepositoryCustom {
|
|||||||
r.numero as rueNumero,
|
r.numero as rueNumero,
|
||||||
r.nom as rueNom,
|
r.nom as rueNom,
|
||||||
|
|
||||||
pers.id as proprietaireId,
|
pers.id as personneId,
|
||||||
pers.ifu as proprietaireIfu,
|
pers.ifu as ifu,
|
||||||
pers.npi as proprietaireNpi,
|
pers.npi as npi,
|
||||||
pers.nom as proprietaireNom,
|
pers.nom as nom,
|
||||||
pers.prenom as proprietairePrenom,
|
pers.prenom as prenom,
|
||||||
pers.raison_sociale as proprietaireRaisonSociale,
|
pers.raison_sociale as raisonSociale,
|
||||||
|
|
||||||
de.id as enqueteCouranteId
|
de.id as enqueteCouranteId
|
||||||
|
|
||||||
|
|||||||
@@ -121,10 +121,6 @@ FROM impositions_tfu imp
|
|||||||
order by exo.annee,dimp.parcelle_id,dimp.nature_impot, dimp.montant_taxe-coalesce(dimp.acompte,0)-coalesce(dimp.retenu_irf,0) desc ;
|
order by exo.annee,dimp.parcelle_id,dimp.nature_impot, dimp.montant_taxe-coalesce(dimp.acompte,0)-coalesce(dimp.retenu_irf,0) desc ;
|
||||||
|
|
||||||
|
|
||||||
select * from e_avis_view
|
|
||||||
|
|
||||||
select *
|
|
||||||
from impositions_tfu;
|
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|||||||
@@ -63,15 +63,6 @@ $$;
|
|||||||
|
|
||||||
call integrer_eavis();
|
call integrer_eavis();
|
||||||
|
|
||||||
call integrer_eavis_detail();
|
select * from eavis
|
||||||
|
|
||||||
select *
|
delete from eavis;
|
||||||
from e_avis_view ;
|
|
||||||
|
|
||||||
select * from eavis;
|
|
||||||
|
|
||||||
|
|
||||||
select * from eavis_detail;
|
|
||||||
|
|
||||||
select *
|
|
||||||
from donnees_imposition_tfu;
|
|
||||||
@@ -147,11 +147,3 @@ select * from arrondissement
|
|||||||
|
|
||||||
select left(code,4) as code_commune_fiscad, code as code_quartier_fiscad,nom as nom_quartier_fiscad
|
select left(code,4) as code_commune_fiscad, code as code_quartier_fiscad,nom as nom_quartier_fiscad
|
||||||
from quartier;
|
from quartier;
|
||||||
|
|
||||||
|
|
||||||
create function get_dblink_connection_sigibe() returns text
|
|
||||||
language sql
|
|
||||||
as
|
|
||||||
$$
|
|
||||||
SELECT 'host=193.181.208.4 port=5433 dbname=sigibe_test user=sigibe_test_user password=sigibe_test_pwd';
|
|
||||||
$$;
|
|
||||||
@@ -1,175 +0,0 @@
|
|||||||
package io.gmss.fiscad.persistence.repositories.rfu.metier;
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.Participer;
|
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb;
|
|
||||||
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;
|
|
||||||
|
|
||||||
public interface ParticiperRepository extends JpaRepository<Participer, Long> {
|
|
||||||
boolean existsByEquipeIdAndUserId(Long equipeId, Long userId);
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
|
||||||
p.id,
|
|
||||||
p.dateDebut,
|
|
||||||
p.dateFin,
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
u.id,
|
|
||||||
u.nom,
|
|
||||||
u.prenom
|
|
||||||
)
|
|
||||||
FROM Participer p
|
|
||||||
LEFT JOIN p.equipe e
|
|
||||||
LEFT JOIN p.user u
|
|
||||||
WHERE p.id = :id
|
|
||||||
""")
|
|
||||||
Optional<ParticiperPayloadWeb> findPayloadById(@Param("id") Long id);
|
|
||||||
|
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
|
||||||
p.id,
|
|
||||||
p.dateDebut,
|
|
||||||
p.dateFin,
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
u.id,
|
|
||||||
u.nom,
|
|
||||||
u.prenom
|
|
||||||
)
|
|
||||||
FROM Participer p
|
|
||||||
LEFT JOIN p.equipe e
|
|
||||||
LEFT JOIN p.user u
|
|
||||||
ORDER BY e.nom, u.nom, u.prenom
|
|
||||||
""")
|
|
||||||
List<ParticiperPayloadWeb> findAllPayload();
|
|
||||||
|
|
||||||
|
|
||||||
@Query(value = """
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
|
||||||
p.id,
|
|
||||||
p.dateDebut,
|
|
||||||
p.dateFin,
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
u.id,
|
|
||||||
u.nom,
|
|
||||||
u.prenom
|
|
||||||
)
|
|
||||||
FROM Participer p
|
|
||||||
LEFT JOIN p.equipe e
|
|
||||||
LEFT JOIN p.user u
|
|
||||||
""",
|
|
||||||
countQuery = """
|
|
||||||
SELECT COUNT(p)
|
|
||||||
FROM Participer p
|
|
||||||
""")
|
|
||||||
Page<ParticiperPayloadWeb> findAllPayload(Pageable pageable);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Query(value = """
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
|
||||||
p.id,
|
|
||||||
p.dateDebut,
|
|
||||||
p.dateFin,
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
u.id,
|
|
||||||
u.nom,
|
|
||||||
u.prenom
|
|
||||||
)
|
|
||||||
FROM Participer p
|
|
||||||
LEFT JOIN p.equipe e
|
|
||||||
LEFT JOIN p.user u
|
|
||||||
WHERE e.id = :equipeId
|
|
||||||
""",
|
|
||||||
countQuery = """
|
|
||||||
SELECT COUNT(p)
|
|
||||||
FROM Participer p
|
|
||||||
WHERE p.equipe.id = :equipeId
|
|
||||||
""")
|
|
||||||
Page<ParticiperPayloadWeb> findAllPayloadByEquipeId(
|
|
||||||
@Param("equipeId") Long equipeId,
|
|
||||||
Pageable pageable);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Query(value = """
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
|
||||||
p.id,
|
|
||||||
p.dateDebut,
|
|
||||||
p.dateFin,
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
u.id,
|
|
||||||
u.nom,
|
|
||||||
u.prenom
|
|
||||||
)
|
|
||||||
FROM Participer p
|
|
||||||
LEFT JOIN p.equipe e
|
|
||||||
LEFT JOIN p.user u
|
|
||||||
WHERE u.id = :userId
|
|
||||||
""",
|
|
||||||
countQuery = """
|
|
||||||
SELECT COUNT(p)
|
|
||||||
FROM Participer p
|
|
||||||
WHERE p.user.id = :userId
|
|
||||||
""")
|
|
||||||
Page<ParticiperPayloadWeb> findAllPayloadByUserId(
|
|
||||||
@Param("userId") Long userId,
|
|
||||||
Pageable pageable);
|
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
|
||||||
p.id,
|
|
||||||
p.dateDebut,
|
|
||||||
p.dateFin,
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
u.id,
|
|
||||||
u.nom,
|
|
||||||
u.prenom
|
|
||||||
)
|
|
||||||
FROM Participer p
|
|
||||||
LEFT JOIN p.equipe e
|
|
||||||
LEFT JOIN p.user u
|
|
||||||
WHERE e.id = :equipeId
|
|
||||||
ORDER BY u.nom, u.prenom
|
|
||||||
""")
|
|
||||||
List<ParticiperPayloadWeb> findAllPayloadByEquipeId(@Param("equipeId") Long equipeId);
|
|
||||||
|
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.ParticiperPayloadWeb(
|
|
||||||
p.id,
|
|
||||||
p.dateDebut,
|
|
||||||
p.dateFin,
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
u.id,
|
|
||||||
u.nom,
|
|
||||||
u.prenom
|
|
||||||
)
|
|
||||||
FROM Participer p
|
|
||||||
LEFT JOIN p.equipe e
|
|
||||||
LEFT JOIN p.user u
|
|
||||||
WHERE u.id = :userId
|
|
||||||
ORDER BY e.nom
|
|
||||||
""")
|
|
||||||
List<ParticiperPayloadWeb> findAllPayloadByUserId(@Param("userId") Long userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -2,186 +2,11 @@ package io.gmss.fiscad.persistence.repositories.rfu.parametre;
|
|||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||||
import io.gmss.fiscad.enums.TypeCampagne;
|
import io.gmss.fiscad.enums.TypeCampagne;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb;
|
|
||||||
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.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public interface CampagneRepository extends JpaRepository<Campagne, Long> {
|
public interface CampagneRepository extends JpaRepository<Campagne, Long> {
|
||||||
List<Campagne> findAllByTypeCampagne(TypeCampagne typeCampagne);
|
List<Campagne> findAllByTypeCampagne(TypeCampagne typeCampagne);
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
|
||||||
c.id,
|
|
||||||
c.refAdministrative,
|
|
||||||
c.nom,
|
|
||||||
c.dateDebut,
|
|
||||||
c.dateFin,
|
|
||||||
c.typeCampagne,
|
|
||||||
e.id,
|
|
||||||
e.annee,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom
|
|
||||||
)
|
|
||||||
FROM Campagne c
|
|
||||||
LEFT JOIN c.exercice e
|
|
||||||
LEFT JOIN c.structure s
|
|
||||||
WHERE c.id = :id
|
|
||||||
""")
|
|
||||||
Optional<CampagnePayloadWeb> findPayloadById(@Param("id") Long id);
|
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
|
||||||
c.id,
|
|
||||||
c.refAdministrative,
|
|
||||||
c.nom,
|
|
||||||
c.dateDebut,
|
|
||||||
c.dateFin,
|
|
||||||
c.typeCampagne,
|
|
||||||
e.id,
|
|
||||||
e.annee,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom
|
|
||||||
)
|
|
||||||
FROM Campagne c
|
|
||||||
LEFT JOIN c.exercice e
|
|
||||||
LEFT JOIN c.structure s
|
|
||||||
ORDER BY c.dateDebut DESC
|
|
||||||
""")
|
|
||||||
List<CampagnePayloadWeb> findAllPayload();
|
|
||||||
|
|
||||||
@Query(value = """
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
|
||||||
c.id,
|
|
||||||
c.refAdministrative,
|
|
||||||
c.nom,
|
|
||||||
c.dateDebut,
|
|
||||||
c.dateFin,
|
|
||||||
c.typeCampagne,
|
|
||||||
e.id,
|
|
||||||
e.annee,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom
|
|
||||||
)
|
|
||||||
FROM Campagne c
|
|
||||||
LEFT JOIN c.exercice e
|
|
||||||
LEFT JOIN c.structure s
|
|
||||||
""",
|
|
||||||
countQuery = """
|
|
||||||
SELECT COUNT(c)
|
|
||||||
FROM Campagne c
|
|
||||||
""")
|
|
||||||
Page<CampagnePayloadWeb> findAllPayload(Pageable pageable);
|
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
|
||||||
c.id,
|
|
||||||
c.refAdministrative,
|
|
||||||
c.nom,
|
|
||||||
c.dateDebut,
|
|
||||||
c.dateFin,
|
|
||||||
c.typeCampagne,
|
|
||||||
e.id,
|
|
||||||
e.annee,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom
|
|
||||||
)
|
|
||||||
FROM Campagne c
|
|
||||||
LEFT JOIN c.exercice e
|
|
||||||
LEFT JOIN c.structure s
|
|
||||||
WHERE e.id = :exerciceId
|
|
||||||
ORDER BY c.dateDebut DESC
|
|
||||||
""")
|
|
||||||
List<CampagnePayloadWeb> findAllPayloadByExerciceId(@Param("exerciceId") Long exerciceId);
|
|
||||||
|
|
||||||
|
|
||||||
@Query(value = """
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
|
||||||
c.id,
|
|
||||||
c.refAdministrative,
|
|
||||||
c.nom,
|
|
||||||
c.dateDebut,
|
|
||||||
c.dateFin,
|
|
||||||
c.typeCampagne,
|
|
||||||
e.id,
|
|
||||||
e.annee,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom
|
|
||||||
)
|
|
||||||
FROM Campagne c
|
|
||||||
LEFT JOIN c.exercice e
|
|
||||||
LEFT JOIN c.structure s
|
|
||||||
WHERE e.id = :exerciceId
|
|
||||||
""",
|
|
||||||
countQuery = """
|
|
||||||
SELECT COUNT(c)
|
|
||||||
FROM Campagne c
|
|
||||||
WHERE c.exercice.id = :exerciceId
|
|
||||||
""")
|
|
||||||
Page<CampagnePayloadWeb> findAllPayloadByExerciceId(
|
|
||||||
@Param("exerciceId") Long exerciceId,
|
|
||||||
Pageable pageable);
|
|
||||||
|
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
|
||||||
c.id,
|
|
||||||
c.refAdministrative,
|
|
||||||
c.nom,
|
|
||||||
c.dateDebut,
|
|
||||||
c.dateFin,
|
|
||||||
c.typeCampagne,
|
|
||||||
e.id,
|
|
||||||
e.annee,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom
|
|
||||||
)
|
|
||||||
FROM Campagne c
|
|
||||||
LEFT JOIN c.exercice e
|
|
||||||
LEFT JOIN c.structure s
|
|
||||||
WHERE s.id = :structureId
|
|
||||||
ORDER BY c.dateDebut DESC
|
|
||||||
""")
|
|
||||||
List<CampagnePayloadWeb> findAllPayloadByStructureId(@Param("structureId") Long structureId);
|
|
||||||
|
|
||||||
|
|
||||||
@Query(value = """
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.CampagnePayloadWeb(
|
|
||||||
c.id,
|
|
||||||
c.refAdministrative,
|
|
||||||
c.nom,
|
|
||||||
c.dateDebut,
|
|
||||||
c.dateFin,
|
|
||||||
c.typeCampagne,
|
|
||||||
e.id,
|
|
||||||
e.annee,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom
|
|
||||||
)
|
|
||||||
FROM Campagne c
|
|
||||||
LEFT JOIN c.exercice e
|
|
||||||
LEFT JOIN c.structure s
|
|
||||||
WHERE s.id = :structureId
|
|
||||||
""",
|
|
||||||
countQuery = """
|
|
||||||
SELECT COUNT(c)
|
|
||||||
FROM Campagne c
|
|
||||||
WHERE c.structure.id = :structureId
|
|
||||||
""")
|
|
||||||
Page<CampagnePayloadWeb> findAllPayloadByStructureId(
|
|
||||||
@Param("exerciceId") Long structureId,
|
|
||||||
Pageable pageable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,292 +1,9 @@
|
|||||||
package io.gmss.fiscad.persistence.repositories.rfu.parametre;
|
package io.gmss.fiscad.persistence.repositories.rfu.parametre;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||||
import io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb;
|
|
||||||
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.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public interface EquipeRepository extends JpaRepository<Equipe, Long> {
|
public interface EquipeRepository extends JpaRepository<Equipe, Long> {
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
b.id,
|
|
||||||
b.cote,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom,
|
|
||||||
c.id,
|
|
||||||
c.nom,
|
|
||||||
e.dateDebut,
|
|
||||||
e.dateFin,
|
|
||||||
q.id,
|
|
||||||
q.code,
|
|
||||||
q.nom
|
|
||||||
)
|
|
||||||
FROM Equipe e
|
|
||||||
LEFT JOIN e.bloc b
|
|
||||||
LEFT JOIN e.secteur s
|
|
||||||
LEFT JOIN e.campagne c
|
|
||||||
LEFT JOIN e.quartier q
|
|
||||||
WHERE e.id = :id
|
|
||||||
""")
|
|
||||||
Optional<EquipePayloadWeb> findPayloadById(@Param("id") Long id);
|
|
||||||
|
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
b.id,
|
|
||||||
b.cote,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom,
|
|
||||||
c.id,
|
|
||||||
c.nom,
|
|
||||||
e.dateDebut,
|
|
||||||
e.dateFin,
|
|
||||||
q.id,
|
|
||||||
q.code,
|
|
||||||
q.nom
|
|
||||||
)
|
|
||||||
FROM Equipe e
|
|
||||||
LEFT JOIN e.bloc b
|
|
||||||
LEFT JOIN e.secteur s
|
|
||||||
LEFT JOIN e.campagne c
|
|
||||||
LEFT JOIN e.quartier q
|
|
||||||
ORDER BY e.nom
|
|
||||||
""")
|
|
||||||
List<EquipePayloadWeb> findAllPayload();
|
|
||||||
|
|
||||||
|
|
||||||
@Query(value = """
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
b.id,
|
|
||||||
b.cote,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom,
|
|
||||||
c.id,
|
|
||||||
c.nom,
|
|
||||||
e.dateDebut,
|
|
||||||
e.dateFin,
|
|
||||||
q.id,
|
|
||||||
q.code,
|
|
||||||
q.nom
|
|
||||||
)
|
|
||||||
FROM Equipe e
|
|
||||||
LEFT JOIN e.bloc b
|
|
||||||
LEFT JOIN e.secteur s
|
|
||||||
LEFT JOIN e.campagne c
|
|
||||||
LEFT JOIN e.quartier q
|
|
||||||
""",
|
|
||||||
countQuery = """
|
|
||||||
SELECT COUNT(e)
|
|
||||||
FROM Equipe e
|
|
||||||
""")
|
|
||||||
Page<EquipePayloadWeb> findAllPayload(Pageable pageable);
|
|
||||||
|
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
b.id,
|
|
||||||
b.cote,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom,
|
|
||||||
c.id,
|
|
||||||
c.nom,
|
|
||||||
e.dateDebut,
|
|
||||||
e.dateFin,
|
|
||||||
q.id,
|
|
||||||
q.code,
|
|
||||||
q.nom
|
|
||||||
)
|
|
||||||
FROM Equipe e
|
|
||||||
LEFT JOIN e.bloc b
|
|
||||||
LEFT JOIN e.secteur s
|
|
||||||
LEFT JOIN e.campagne c
|
|
||||||
LEFT JOIN e.quartier q
|
|
||||||
WHERE c.id = :campagneId
|
|
||||||
ORDER BY e.nom
|
|
||||||
""")
|
|
||||||
List<EquipePayloadWeb> findAllPayloadByCampagneId(@Param("campagneId") Long campagneId);
|
|
||||||
|
|
||||||
|
|
||||||
@Query(value ="""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
b.id,
|
|
||||||
b.cote,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom,
|
|
||||||
c.id,
|
|
||||||
c.nom,
|
|
||||||
e.dateDebut,
|
|
||||||
e.dateFin,
|
|
||||||
q.id,
|
|
||||||
q.code,
|
|
||||||
q.nom
|
|
||||||
)
|
|
||||||
FROM Equipe e
|
|
||||||
LEFT JOIN e.bloc b
|
|
||||||
LEFT JOIN e.secteur s
|
|
||||||
LEFT JOIN e.campagne c
|
|
||||||
LEFT JOIN e.quartier q
|
|
||||||
WHERE c.id = :campagneId
|
|
||||||
ORDER BY e.nom
|
|
||||||
""",
|
|
||||||
countQuery = """
|
|
||||||
SELECT COUNT(e)
|
|
||||||
FROM Equipe e
|
|
||||||
where e.campagne.id= :campagneId
|
|
||||||
""")
|
|
||||||
Page<EquipePayloadWeb> findAllPayloadByCampagneId(@Param("campagneId") Long campagneId,Pageable pageable);
|
|
||||||
|
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
b.id,
|
|
||||||
b.cote,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom,
|
|
||||||
c.id,
|
|
||||||
c.nom,
|
|
||||||
e.dateDebut,
|
|
||||||
e.dateFin,
|
|
||||||
q.id,
|
|
||||||
q.code,
|
|
||||||
q.nom
|
|
||||||
)
|
|
||||||
FROM Equipe e
|
|
||||||
LEFT JOIN e.bloc b
|
|
||||||
LEFT JOIN e.secteur s
|
|
||||||
LEFT JOIN e.campagne c
|
|
||||||
LEFT JOIN e.quartier q
|
|
||||||
WHERE s.id = :secteurId
|
|
||||||
ORDER BY e.nom
|
|
||||||
""")
|
|
||||||
List<EquipePayloadWeb> findAllPayloadBySecteurId(@Param("secteurId") Long secteurId);
|
|
||||||
|
|
||||||
|
|
||||||
@Query("""
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
b.id,
|
|
||||||
b.cote,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom,
|
|
||||||
c.id,
|
|
||||||
c.nom,
|
|
||||||
e.dateDebut,
|
|
||||||
e.dateFin,
|
|
||||||
q.id,
|
|
||||||
q.code,
|
|
||||||
q.nom
|
|
||||||
)
|
|
||||||
FROM Equipe e
|
|
||||||
LEFT JOIN e.bloc b
|
|
||||||
LEFT JOIN e.secteur s
|
|
||||||
LEFT JOIN e.campagne c
|
|
||||||
LEFT JOIN e.quartier q
|
|
||||||
WHERE e.quartier.id = :quartierId
|
|
||||||
ORDER BY e.nom
|
|
||||||
""")
|
|
||||||
List<EquipePayloadWeb> findAllPayloadByQuartierId(@Param("quartierId") Long quartierId);
|
|
||||||
|
|
||||||
|
|
||||||
@Query(value = """
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
b.id,
|
|
||||||
b.cote,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom,
|
|
||||||
c.id,
|
|
||||||
c.nom,
|
|
||||||
e.dateDebut,
|
|
||||||
e.dateFin,
|
|
||||||
q.id,
|
|
||||||
q.code,
|
|
||||||
q.nom
|
|
||||||
)
|
|
||||||
FROM Equipe e
|
|
||||||
LEFT JOIN e.bloc b
|
|
||||||
LEFT JOIN e.secteur s
|
|
||||||
LEFT JOIN e.campagne c
|
|
||||||
LEFT JOIN e.quartier q
|
|
||||||
WHERE e.quartier.id = :quartierId
|
|
||||||
""",
|
|
||||||
countQuery = """
|
|
||||||
SELECT COUNT(e)
|
|
||||||
FROM Equipe e
|
|
||||||
WHERE e.quartier.id = :quartierId
|
|
||||||
""")
|
|
||||||
Page<EquipePayloadWeb> findAllPayloadByQuartierId(
|
|
||||||
@Param("quartierId") Long quartierId,
|
|
||||||
Pageable pageable);
|
|
||||||
|
|
||||||
|
|
||||||
@Query(value = """
|
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.EquipePayloadWeb(
|
|
||||||
e.id,
|
|
||||||
e.code,
|
|
||||||
e.nom,
|
|
||||||
b.id,
|
|
||||||
b.cote,
|
|
||||||
s.id,
|
|
||||||
s.code,
|
|
||||||
s.nom,
|
|
||||||
c.id,
|
|
||||||
c.nom,
|
|
||||||
e.dateDebut,
|
|
||||||
e.dateFin,
|
|
||||||
q.id,
|
|
||||||
q.code,
|
|
||||||
q.nom
|
|
||||||
)
|
|
||||||
FROM Equipe e
|
|
||||||
LEFT JOIN e.bloc b
|
|
||||||
LEFT JOIN e.secteur s
|
|
||||||
LEFT JOIN e.campagne c
|
|
||||||
LEFT JOIN e.quartier q
|
|
||||||
WHERE e.secteur.id = :secteurId
|
|
||||||
""",
|
|
||||||
countQuery = """
|
|
||||||
SELECT COUNT(e)
|
|
||||||
FROM Equipe e
|
|
||||||
WHERE e.secteur.id = :secteurId
|
|
||||||
""")
|
|
||||||
Page<EquipePayloadWeb> findAllPayloadBySecteurId(
|
|
||||||
@Param("secteurId") Long secteurId,
|
|
||||||
Pageable pageable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,5 @@ import java.util.Optional;
|
|||||||
|
|
||||||
public interface ExerciceRepository extends JpaRepository<Exercice, Long> {
|
public interface ExerciceRepository extends JpaRepository<Exercice, Long> {
|
||||||
Optional<Exercice> findFirstByAnnee(int annee);
|
Optional<Exercice> findFirstByAnnee(int annee);
|
||||||
boolean existsByAnnee(Integer annee);
|
|
||||||
|
|
||||||
boolean existsByAnneeAndIdNot(Integer annee, Long id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,26 +88,25 @@ public interface AvoirFonctionRepository extends JpaRepository<AvoirFonction, Lo
|
|||||||
Page<AvoirFonctionPaylaodWeb> findAllAvoirFonctionToDtoPageable(Pageable pageable);
|
Page<AvoirFonctionPaylaodWeb> findAllAvoirFonctionToDtoPageable(Pageable pageable);
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT new io.gmss.fiscad.paylaods.request.crudweb.AvoirFonctionPaylaodWeb(
|
SELECT new io.gmss.fiscad.paylaods.request.crudweb.AvoirFonctionPaylaodWeb(
|
||||||
af.id,
|
af.id,
|
||||||
af.dateDebut,
|
af.dateDebut,
|
||||||
af.dateFin,
|
af.dateFin,
|
||||||
f.id,
|
f.id,
|
||||||
f.code,
|
f.code,
|
||||||
f.nom,
|
f.nom,
|
||||||
u.id,
|
u.id,
|
||||||
u.username,
|
u.username,
|
||||||
u.nom,
|
u.nom,
|
||||||
u.prenom,
|
u.prenom,
|
||||||
u.email,
|
u.email,
|
||||||
af.titre
|
af.titre
|
||||||
)
|
)
|
||||||
FROM AvoirFonction af
|
FROM AvoirFonction af
|
||||||
LEFT JOIN af.user u
|
LEFT JOIN af.user u
|
||||||
LEFT JOIN af.fonction f
|
LEFT JOIN af.fonction f
|
||||||
WHERE u.id = :userId
|
WHERE u.id = :userId
|
||||||
AND (af.dateFin IS NULL OR af.dateFin >= CURRENT_DATE)
|
""")
|
||||||
""")
|
|
||||||
List<AvoirFonctionPaylaodWeb> findAllAvoirFonctionByUserToDto(@Param("userId") Long userId);
|
List<AvoirFonctionPaylaodWeb> findAllAvoirFonctionByUserToDto(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,6 @@ public class EntityFromPayLoadService {
|
|||||||
private final TypePieceRepository typePieceRepository;
|
private final TypePieceRepository typePieceRepository;
|
||||||
private final PieceRepository pieceRepository;
|
private final PieceRepository pieceRepository;
|
||||||
private final CaracteristiqueRepository caracteristiqueRepository;
|
private final CaracteristiqueRepository caracteristiqueRepository;
|
||||||
private final EquipeRepository equipeRepository;
|
|
||||||
private final BlocRepository blocRepository;
|
|
||||||
private final CampagneRepository campagneRepository;
|
|
||||||
private final ModeAcquisitionRepository modeAcquisitionRepository;
|
private final ModeAcquisitionRepository modeAcquisitionRepository;
|
||||||
private final PersonneRepository personneRepository;
|
private final PersonneRepository personneRepository;
|
||||||
private final SourceDroitRepository sourceDroitRepository;
|
private final SourceDroitRepository sourceDroitRepository;
|
||||||
@@ -81,7 +78,6 @@ public class EntityFromPayLoadService {
|
|||||||
private final CommuneCentreAssignationRepository communeCentreAssignationRepository ;
|
private final CommuneCentreAssignationRepository communeCentreAssignationRepository ;
|
||||||
private final ModuleRepository moduleRepository ;
|
private final ModuleRepository moduleRepository ;
|
||||||
private final FonctionnaliteRepository fonctionnaliteRepository ;
|
private final FonctionnaliteRepository fonctionnaliteRepository ;
|
||||||
private final ParticiperRepository participerRepository ;
|
|
||||||
private final ProfileModuleFonctionnaliteRepository profileModuleFonctionnaliteRepository ;
|
private final ProfileModuleFonctionnaliteRepository profileModuleFonctionnaliteRepository ;
|
||||||
private final TypeCaracteristiqueRepository typeCaracteristiqueRepository ;
|
private final TypeCaracteristiqueRepository typeCaracteristiqueRepository ;
|
||||||
|
|
||||||
@@ -143,46 +139,6 @@ public class EntityFromPayLoadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Equipe getEquipeFromPayLoadWeb(EquipePayloadWeb equipePayloadWeb){
|
|
||||||
Equipe equipe=new Equipe();
|
|
||||||
if(equipePayloadWeb.getId()!=null)
|
|
||||||
equipe = equipeRepository.findById(equipePayloadWeb.getId()).orElse(new Equipe());
|
|
||||||
|
|
||||||
Optional<Campagne> optionalCampagne=Optional.empty();
|
|
||||||
Optional<Secteur> optionalSecteur=Optional.empty();
|
|
||||||
Optional<Quartier> optionalQuartier=Optional.empty();
|
|
||||||
Optional<Bloc> optionalBloc=Optional.empty();
|
|
||||||
|
|
||||||
if(equipePayloadWeb.getBlocId()!=null)
|
|
||||||
optionalBloc=blocRepository.findById(equipePayloadWeb.getBlocId());
|
|
||||||
|
|
||||||
|
|
||||||
if(equipePayloadWeb.getCampagneId()!=null)
|
|
||||||
optionalCampagne=campagneRepository.findById(equipePayloadWeb.getCampagneId());
|
|
||||||
if(equipePayloadWeb.getSecteurId()!=null)
|
|
||||||
optionalSecteur=secteurRepository.findById(equipePayloadWeb.getSecteurId());
|
|
||||||
if(equipePayloadWeb.getQuartierId()!=null)
|
|
||||||
optionalQuartier=quartierRepository.findById(equipePayloadWeb.getQuartierId());
|
|
||||||
|
|
||||||
if(optionalBloc.isPresent())
|
|
||||||
equipe.setBloc(optionalBloc.get());
|
|
||||||
|
|
||||||
if(optionalCampagne.isPresent())
|
|
||||||
equipe.setCampagne(optionalCampagne.get());
|
|
||||||
if(optionalSecteur.isPresent())
|
|
||||||
equipe.setSecteur(optionalSecteur.get());
|
|
||||||
if(optionalQuartier.isPresent())
|
|
||||||
equipe.setQuartier(optionalQuartier.get());
|
|
||||||
|
|
||||||
equipe.setId(equipePayloadWeb.getId());
|
|
||||||
equipe.setNom(equipePayloadWeb.getNom());
|
|
||||||
equipe.setCode(equipePayloadWeb.getCode());
|
|
||||||
equipe.setDateDebut(equipePayloadWeb.getDateDebut());
|
|
||||||
equipe.setDateFin(equipePayloadWeb.getDateFin());
|
|
||||||
return equipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ModeAcquisition getModeAcquisitionFromPayLoadWeb(ModeAcquisitionPayloadWeb modeAcquisitionPayloadWeb){
|
public ModeAcquisition getModeAcquisitionFromPayLoadWeb(ModeAcquisitionPayloadWeb modeAcquisitionPayloadWeb){
|
||||||
ModeAcquisition modeAcquisition=new ModeAcquisition();
|
ModeAcquisition modeAcquisition=new ModeAcquisition();
|
||||||
if(modeAcquisitionPayloadWeb.getId()!=null)
|
if(modeAcquisitionPayloadWeb.getId()!=null)
|
||||||
@@ -1206,56 +1162,4 @@ public class EntityFromPayLoadService {
|
|||||||
|
|
||||||
return profileModuleFonctionnalite ;
|
return profileModuleFonctionnalite ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Participer getParticiperFromPayLoadWeb(ParticiperPayloadWeb participerPayloadWeb) {
|
|
||||||
Participer participer =new Participer();
|
|
||||||
if(participerPayloadWeb.getId()!=null)
|
|
||||||
participer = participerRepository.findById(participerPayloadWeb.getId()).orElse(new Participer());
|
|
||||||
|
|
||||||
if (participerPayloadWeb.getEquipeId() != null) {
|
|
||||||
Equipe equipe = new Equipe();
|
|
||||||
equipe.setId(participerPayloadWeb.getEquipeId());
|
|
||||||
participer.setEquipe(equipe);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (participerPayloadWeb.getUserId() != null) {
|
|
||||||
User user = new User();
|
|
||||||
user.setId(participerPayloadWeb.getUserId());
|
|
||||||
participer.setUser(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
participer.setId(participerPayloadWeb.getId());
|
|
||||||
participer.setDateDebut(participerPayloadWeb.getDateDebut());
|
|
||||||
participer.setDateFin(participerPayloadWeb.getDateFin());
|
|
||||||
return participer ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Campagne getCampagneFromPayLoadWeb(CampagnePayloadWeb campagnePayloadWeb) {
|
|
||||||
Campagne campagne =new Campagne();
|
|
||||||
if(campagnePayloadWeb.getId()!=null)
|
|
||||||
campagne = campagneRepository.findById(campagnePayloadWeb.getId()).orElse(new Campagne());
|
|
||||||
|
|
||||||
if (campagnePayloadWeb.getExerciceId() != null) {
|
|
||||||
Exercice exercice = new Exercice();
|
|
||||||
exercice.setId(campagnePayloadWeb.getExerciceId());
|
|
||||||
campagne.setExercice(exercice);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (campagnePayloadWeb.getStructureId() != null) {
|
|
||||||
Structure structure = new Structure();
|
|
||||||
structure.setId(campagnePayloadWeb.getStructureId());
|
|
||||||
campagne.setStructure(structure);
|
|
||||||
}
|
|
||||||
|
|
||||||
campagne.setId(campagnePayloadWeb.getId());
|
|
||||||
campagne.setDateDebut(campagnePayloadWeb.getDateDebut());
|
|
||||||
campagne.setDateFin(campagnePayloadWeb.getDateFin());
|
|
||||||
campagne.setTypeCampagne(campagnePayloadWeb.getTypeCampagne());
|
|
||||||
campagne.setRefAdministrative(campagnePayloadWeb.getRefAdministrative());
|
|
||||||
campagne.setNom(campagnePayloadWeb.getNom());
|
|
||||||
|
|
||||||
return campagne ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ server.port=8282
|
|||||||
io.gmss.fiscad.profile=test
|
io.gmss.fiscad.profile=test
|
||||||
|
|
||||||
# LOCAL ENV TEST
|
# LOCAL ENV TEST
|
||||||
#spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad_dgi
|
spring.datasource.url=jdbc:postgresql://localhost:5432/fiscad_dgi
|
||||||
#spring.datasource.username=infocad_user
|
spring.datasource.username=infocad_user
|
||||||
#spring.datasource.password=W5fwD({9*q53
|
|
||||||
|
|
||||||
|
|
||||||
spring.datasource.url=jdbc:postgresql://193.181.208.4:5432/fiscad_db
|
|
||||||
spring.datasource.username=fiscad_user
|
|
||||||
spring.datasource.password=W5fwD({9*q53
|
spring.datasource.password=W5fwD({9*q53
|
||||||
|
|
||||||
|
|
||||||
|
#spring.datasource.url=jdbc:postgresql://193.181.208.4:5432/fiscad_db
|
||||||
|
#spring.datasource.username=fiscad_user
|
||||||
|
#spring.datasource.password=W5fwD({9*q53
|
||||||
|
|
||||||
|
|
||||||
app.default-user.username=fiscad_admin
|
app.default-user.username=fiscad_admin
|
||||||
app.default-user.password=1234567890
|
app.default-user.password=1234567890
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user