Compare commits
3 Commits
93732ef18b
...
features/f
| Author | SHA1 | Date | |
|---|---|---|---|
| b3c1e10da6 | |||
| b0e0caf3bb | |||
| c9f7afb23d |
@@ -1,14 +1,17 @@
|
|||||||
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;
|
||||||
@@ -29,6 +32,8 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -39,6 +44,8 @@ import org.springframework.web.client.HttpClientErrorException;
|
|||||||
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);
|
||||||
|
|
||||||
@@ -54,11 +61,22 @@ public class ImpositionsTfuController {
|
|||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(impositionsTfuPaylaodWeb.getStructureId()==null){
|
||||||
|
return new ResponseEntity<>(
|
||||||
|
new ApiResponse<>(false, null, "Veuillez préciser la strucuture."),
|
||||||
|
HttpStatus.OK
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
User user = currentUser.getUser();
|
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."),
|
new ApiResponse<>(false, null, "Vous n'etes pas autorisé à accéder à cette ressource. Votre centre : "+ user.getStructure().getNom() +" le centre de liquidation : "+ st.getNom()),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ 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("""
|
||||||
(
|
(
|
||||||
@@ -59,6 +60,7 @@ 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("""
|
||||||
(
|
(
|
||||||
@@ -68,6 +70,7 @@ 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("""
|
||||||
(
|
(
|
||||||
@@ -78,7 +81,9 @@ 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))
|
||||||
@@ -88,6 +93,7 @@ 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")
|
||||||
|
|||||||
@@ -137,9 +137,10 @@ 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à.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,10 @@ 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,6 +63,15 @@ $$;
|
|||||||
|
|
||||||
call integrer_eavis();
|
call integrer_eavis();
|
||||||
|
|
||||||
select * from eavis
|
call integrer_eavis_detail();
|
||||||
|
|
||||||
delete from eavis;
|
select *
|
||||||
|
from e_avis_view ;
|
||||||
|
|
||||||
|
select * from eavis;
|
||||||
|
|
||||||
|
|
||||||
|
select * from eavis_detail;
|
||||||
|
|
||||||
|
select *
|
||||||
|
from donnees_imposition_tfu;
|
||||||
Reference in New Issue
Block a user