apres correction et finalisatio de la synchronisation
This commit is contained in:
3
.env
Normal file
3
.env
Normal file
@@ -0,0 +1,3 @@
|
||||
POSTGRES_DB=abomey_db
|
||||
POSTGRES_USER=infocad_user
|
||||
POSTGRES_PASSWORD=W5fwD({9*q53
|
||||
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
# Étape 1 : Build avec Maven et Java 17
|
||||
FROM openjdk:17-jdk-slim
|
||||
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copier le .jar compilé depuis l'étape précédente
|
||||
COPY ./target/Fiscad-0.0.1-SNAPSHOT.jar fiscad.jar
|
||||
|
||||
# Exposer le port configuré
|
||||
EXPOSE 8282
|
||||
|
||||
# Lancer l'application
|
||||
ENTRYPOINT ["java", "-jar", "fiscad.jar"]
|
||||
45
docker-compose.yml
Normal file
45
docker-compose.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
version: '3.9'
|
||||
|
||||
services:
|
||||
|
||||
db:
|
||||
image: postgres:15
|
||||
container_name: fiscad-db
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- db-data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: fiscad-app
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/${POSTGRES_DB}
|
||||
SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER}
|
||||
SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
SERVER_PORT: 8282
|
||||
IO_GMSS_FISCAD_PROFILE: abomey
|
||||
SPRING_PROFILES_ACTIVE: abomey
|
||||
ports:
|
||||
- "8282:8282"
|
||||
volumes:
|
||||
- ./uploads:/app/uploads
|
||||
- ./jasperReport:/app/jasperReport
|
||||
restart: on-failure
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
32
pom.xml
32
pom.xml
@@ -5,6 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<!-- <version>3.1.6</version>-->
|
||||
<version>3.4.2</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
@@ -28,6 +29,18 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>6.1.5</version> <!-- ou même 6.1.6 selon le BOM spring-boot 3.4.2 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>6.1.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
@@ -88,7 +101,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.6.0</version>
|
||||
<version>2.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -109,6 +122,12 @@
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.vladmihalcea</groupId>
|
||||
<artifactId>hibernate-types-60</artifactId>
|
||||
<version>2.21.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.n52.jackson</groupId>
|
||||
<artifactId>jackson-datatype-jts</artifactId>
|
||||
@@ -121,6 +140,12 @@
|
||||
<version>16.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
@@ -147,6 +172,11 @@
|
||||
<version>3.8.1</version> <!-- ou une version plus récente -->
|
||||
<configuration>
|
||||
<release>17</release>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
</compilerArgs>
|
||||
<source>16</source>
|
||||
<target>16</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
52
sql/audits/acteur-concerne-audit.sql
Normal file
52
sql/audits/acteur-concerne-audit.sql
Normal file
@@ -0,0 +1,52 @@
|
||||
-- 1️⃣ Créer la table d’audit
|
||||
CREATE TABLE audit.acteur_concerne_audit_log (
|
||||
audit_id SERIAL PRIMARY KEY,
|
||||
acteur_concerne_id BIGINT,
|
||||
action VARCHAR(10),
|
||||
changed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
old_data JSONB,
|
||||
new_data JSONB
|
||||
);
|
||||
|
||||
-- 2️⃣ Créer la fonction d’audit
|
||||
CREATE OR REPLACE FUNCTION audit.audit_acteur_concerne_changes()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF (TG_OP = 'UPDATE') THEN
|
||||
INSERT INTO audit.acteur_concerne_audit_log (acteur_concerne_id, action, old_data, new_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD),
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'INSERT') THEN
|
||||
INSERT INTO audit.acteur_concerne_audit_log (acteur_concerne_id, action, new_data)
|
||||
VALUES (
|
||||
NEW.id,
|
||||
TG_OP,
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'DELETE') THEN
|
||||
INSERT INTO audit.acteur_concerne_audit_log (acteur_concerne_id, action, old_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD)
|
||||
);
|
||||
RETURN OLD;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- 3️⃣ Créer le trigger
|
||||
CREATE TRIGGER trigger_audit_acteur_concerne
|
||||
AFTER INSERT OR UPDATE OR DELETE ON acteur_concerne
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION audit.audit_acteur_concerne_changes();
|
||||
|
||||
|
||||
GRANT USAGE ON SCHEMA audit TO infocad_user;
|
||||
GRANT INSERT, SELECT ON audit.acteur_concerne_audit_log TO infocad_user;
|
||||
86
sql/audits/enquete-audit.sql
Normal file
86
sql/audits/enquete-audit.sql
Normal file
@@ -0,0 +1,86 @@
|
||||
-- Créer le schéma audit
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS audit;
|
||||
|
||||
|
||||
-- Créer la table d'audit dans le schéma audit
|
||||
|
||||
CREATE TABLE audit.enquete_audit_log (
|
||||
audit_id SERIAL PRIMARY KEY,
|
||||
enquete_id BIGINT,
|
||||
action VARCHAR(10),
|
||||
changed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
old_data JSONB,
|
||||
new_data JSONB
|
||||
);
|
||||
|
||||
-- Créer la fonction dans le schéma audit
|
||||
|
||||
CREATE OR REPLACE FUNCTION audit.audit_enquete_changes()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF (TG_OP = 'UPDATE') THEN
|
||||
INSERT INTO audit.enquete_audit_log (enquete_id, action, old_data, new_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD),
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'INSERT') THEN
|
||||
INSERT INTO audit.enquete_audit_log (enquete_id, action, new_data)
|
||||
VALUES (
|
||||
NEW.id,
|
||||
TG_OP,
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'DELETE') THEN
|
||||
INSERT INTO audit.enquete_audit_log (enquete_id, action, old_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD)
|
||||
);
|
||||
RETURN OLD;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
|
||||
|
||||
|
||||
-- Créer le trigger
|
||||
|
||||
CREATE TRIGGER trigger_audit_enquete
|
||||
AFTER INSERT OR UPDATE OR DELETE ON enquete
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION audit.audit_enquete_changes();
|
||||
|
||||
|
||||
-- donner les droits si nécéssaires
|
||||
|
||||
GRANT USAGE ON SCHEMA audit TO infocad_user;
|
||||
GRANT INSERT, SELECT ON audit.enquete_audit_log TO infocad_user;
|
||||
|
||||
|
||||
-- Lister les audits
|
||||
|
||||
SELECT * FROM enquete_audit_log WHERE enquete_id = 42 ORDER BY changed_at DESC;
|
||||
|
||||
SELECT
|
||||
enquete_id,
|
||||
action,
|
||||
changed_at,
|
||||
old_data->>'status_enquete' AS status_before,
|
||||
new_data->>'status_enquete' AS status_after,
|
||||
old_data->>'updated_by' AS updated_by_before,
|
||||
new_data->>'updated_by' AS updated_by_after
|
||||
FROM audit.enquete_audit_log
|
||||
WHERE enquete_id = 5
|
||||
ORDER BY changed_at DESC;
|
||||
|
||||
|
||||
|
||||
|
||||
55
sql/audits/parcelle-audit.sql
Normal file
55
sql/audits/parcelle-audit.sql
Normal file
@@ -0,0 +1,55 @@
|
||||
-- Créer le schéma audit
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS audit;
|
||||
|
||||
-- 1️⃣ Créer la table d’audit
|
||||
CREATE TABLE audit.parcelle_audit_log (
|
||||
audit_id SERIAL PRIMARY KEY,
|
||||
parcelle_id BIGINT,
|
||||
action VARCHAR(10),
|
||||
changed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
old_data JSONB,
|
||||
new_data JSONB
|
||||
);
|
||||
|
||||
-- 2️⃣ Créer la fonction d’audit
|
||||
CREATE OR REPLACE FUNCTION audit.audit_parcelle_changes()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF (TG_OP = 'UPDATE') THEN
|
||||
INSERT INTO audit.parcelle_audit_log (parcelle_id, action, old_data, new_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD),
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'INSERT') THEN
|
||||
INSERT INTO audit.parcelle_audit_log (parcelle_id, action, new_data)
|
||||
VALUES (
|
||||
NEW.id,
|
||||
TG_OP,
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'DELETE') THEN
|
||||
INSERT INTO audit.parcelle_audit_log (parcelle_id, action, old_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD)
|
||||
);
|
||||
RETURN OLD;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- 3️⃣ Créer le trigger
|
||||
CREATE TRIGGER trigger_audit_parcelle
|
||||
AFTER INSERT OR UPDATE OR DELETE ON parcelle
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION audit.audit_parcelle_changes();
|
||||
|
||||
GRANT USAGE ON SCHEMA audit TO infocad_user;
|
||||
GRANT INSERT, SELECT ON audit.parcelle_audit_log TO infocad_user;
|
||||
69
sql/audits/personne-audit.sql
Normal file
69
sql/audits/personne-audit.sql
Normal file
@@ -0,0 +1,69 @@
|
||||
-- Créer le schéma audit
|
||||
|
||||
CREATE SCHEMA IF NOT EXISTS audit;
|
||||
|
||||
-- 1️⃣ Créer la table d’audit
|
||||
CREATE TABLE audit.personne_audit_log (
|
||||
audit_id SERIAL PRIMARY KEY,
|
||||
personne_id BIGINT,
|
||||
action VARCHAR(10),
|
||||
changed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
old_data JSONB,
|
||||
new_data JSONB
|
||||
);
|
||||
|
||||
-- 2️⃣ Créer la fonction d’audit
|
||||
CREATE OR REPLACE FUNCTION audit.audit_personne_changes()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF (TG_OP = 'UPDATE') THEN
|
||||
INSERT INTO audit.personne_audit_log (personne_id, action, old_data, new_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD),
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'INSERT') THEN
|
||||
INSERT INTO audit.personne_audit_log (personne_id, action, new_data)
|
||||
VALUES (
|
||||
NEW.id,
|
||||
TG_OP,
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'DELETE') THEN
|
||||
INSERT INTO audit.personne_audit_log (personne_id, action, old_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD)
|
||||
);
|
||||
RETURN OLD;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- 3️⃣ Créer le trigger
|
||||
CREATE TRIGGER trigger_audit_personne
|
||||
AFTER INSERT OR UPDATE OR DELETE ON personne
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION audit.audit_personne_changes();
|
||||
|
||||
|
||||
|
||||
GRANT USAGE ON SCHEMA audit TO infocad_user;
|
||||
GRANT INSERT, SELECT ON audit.personne_audit_log TO infocad_user;
|
||||
|
||||
SELECT
|
||||
personne_id,
|
||||
action,
|
||||
changed_at,
|
||||
old_data->>'prenom_ou_raison_sociale' AS prenom_before,
|
||||
new_data->>'prenom_ou_raison_sociale' AS prenom_after,
|
||||
old_data->>'updated_by' AS updated_by_before,
|
||||
new_data->>'updated_by' AS updated_by_after
|
||||
FROM audit.personne_audit_log
|
||||
WHERE personne_id = 10
|
||||
ORDER BY changed_at DESC;
|
||||
52
sql/audits/piece-audit.sql
Normal file
52
sql/audits/piece-audit.sql
Normal file
@@ -0,0 +1,52 @@
|
||||
-- 1️⃣ Créer la table d’audit
|
||||
CREATE TABLE audit.piece_audit_log (
|
||||
audit_id SERIAL PRIMARY KEY,
|
||||
piece_id BIGINT,
|
||||
action VARCHAR(10),
|
||||
changed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
old_data JSONB,
|
||||
new_data JSONB
|
||||
);
|
||||
|
||||
-- 2️⃣ Créer la fonction d’audit
|
||||
CREATE OR REPLACE FUNCTION audit.audit_piece_changes()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF (TG_OP = 'UPDATE') THEN
|
||||
INSERT INTO audit.piece_audit_log (piece_id, action, old_data, new_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD),
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'INSERT') THEN
|
||||
INSERT INTO audit.piece_audit_log (piece_id, action, new_data)
|
||||
VALUES (
|
||||
NEW.id,
|
||||
TG_OP,
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'DELETE') THEN
|
||||
INSERT INTO audit.piece_audit_log (piece_id, action, old_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD)
|
||||
);
|
||||
RETURN OLD;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- 3️⃣ Créer le trigger
|
||||
CREATE TRIGGER trigger_audit_piece
|
||||
AFTER INSERT OR UPDATE OR DELETE ON piece
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION audit.audit_piece_changes();
|
||||
|
||||
|
||||
GRANT USAGE ON SCHEMA audit TO infocad_user;
|
||||
GRANT INSERT, SELECT ON audit.piece_audit_log TO infocad_user;
|
||||
52
sql/audits/upload-audit.sql
Normal file
52
sql/audits/upload-audit.sql
Normal file
@@ -0,0 +1,52 @@
|
||||
-- 1️⃣ Créer la table d’audit
|
||||
CREATE TABLE audit.upload_audit_log (
|
||||
audit_id SERIAL PRIMARY KEY,
|
||||
upload_id BIGINT,
|
||||
action VARCHAR(10),
|
||||
changed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
old_data JSONB,
|
||||
new_data JSONB
|
||||
);
|
||||
|
||||
-- 2️⃣ Créer la fonction d’audit
|
||||
CREATE OR REPLACE FUNCTION audit.audit_upload_changes()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF (TG_OP = 'UPDATE') THEN
|
||||
INSERT INTO audit.upload_audit_log (upload_id, action, old_data, new_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD),
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'INSERT') THEN
|
||||
INSERT INTO audit.upload_audit_log (upload_id, action, new_data)
|
||||
VALUES (
|
||||
NEW.id,
|
||||
TG_OP,
|
||||
to_jsonb(NEW)
|
||||
);
|
||||
RETURN NEW;
|
||||
ELSIF (TG_OP = 'DELETE') THEN
|
||||
INSERT INTO audit.upload_audit_log (upload_id, action, old_data)
|
||||
VALUES (
|
||||
OLD.id,
|
||||
TG_OP,
|
||||
to_jsonb(OLD)
|
||||
);
|
||||
RETURN OLD;
|
||||
END IF;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- 3️⃣ Créer le trigger
|
||||
CREATE TRIGGER trigger_audit_upload
|
||||
AFTER INSERT OR UPDATE OR DELETE ON upload
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION audit.audit_upload_changes();
|
||||
|
||||
|
||||
GRANT USAGE ON SCHEMA audit TO infocad_user;
|
||||
GRANT INSERT, SELECT ON audit.upload_audit_log TO infocad_user;
|
||||
24
sql/migration/script.sh
Normal file
24
sql/migration/script.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
# pour sauvegarder la base infocad
|
||||
# 👉 Explications :
|
||||
#
|
||||
#docker exec -t postgres_db: Exécute la commande dans le container.
|
||||
#
|
||||
#pg_dump: Utilitaire pour exporter la base.
|
||||
#
|
||||
#-U infocad_user: Nom d'utilisateur que tu as mis dans docker-compose.
|
||||
#
|
||||
#infocad: Le nom de la base de données.
|
||||
#
|
||||
#> backup_infocad.sql: Sauvegarde le dump sur ta machine hôte (pas dans le container).
|
||||
|
||||
docker exec -t postgres_db pg_dump -U infocad_user infocad | gzip > backup_infocad.sql.gz
|
||||
|
||||
|
||||
# Suppression des tables
|
||||
|
||||
DROP SCHEMA public CASCADE;
|
||||
CREATE SCHEMA public;
|
||||
|
||||
# 🚀 Pour restaurer plus tard :
|
||||
#a) Copie du fichier dans le container :
|
||||
gunzip -c backup_infocad.sql.gz | docker exec -i postgres_db psql -U infocad_user infocad
|
||||
@@ -0,0 +1,24 @@
|
||||
package io.gmss.fiscad.advice;
|
||||
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
@RestControllerAdvice
|
||||
public class FileUploadExceptionAdvice {
|
||||
|
||||
@Value("${spring.servlet.multipart.max-file-size}")
|
||||
private String maxFileSize;
|
||||
|
||||
@ExceptionHandler(MaxUploadSizeExceededException.class)
|
||||
public ResponseEntity<?> handleMaxSizeException(MaxUploadSizeExceededException exc) {
|
||||
String message = String.format("Le fichier est trop volumineux. Taille maximale autorisée : %s.", maxFileSize);
|
||||
return ResponseEntity.status(HttpStatus.PAYLOAD_TOO_LARGE)
|
||||
.body(new ApiResponse<>(false, null, message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,17 +31,9 @@ import io.swagger.v3.oas.annotations.servers.Server;
|
||||
description = "Local ENV",
|
||||
url = "http://localhost:8282"
|
||||
),
|
||||
@Server(
|
||||
description = "PROD ENV (http)",
|
||||
url = "http://161.97.163.53:20002"
|
||||
),
|
||||
@Server(
|
||||
description = "PROD ENV (https)",
|
||||
url = "https://fiscadbackend.novatic.org"
|
||||
),
|
||||
@Server(
|
||||
description = "Local ENV (http) - 2",
|
||||
url = "http://192.168.1.106:8282"
|
||||
url = "https://backend.fiscad.org"
|
||||
)
|
||||
},
|
||||
security = {
|
||||
|
||||
@@ -13,12 +13,12 @@ public class SwaggerOAS3Config {
|
||||
private static final String[] RFU_METIER = {
|
||||
"/api/batiment/**", "/api/caracteristique-caracteristiqueBatiment/**", "/api/caracteristique-parcelle/**",
|
||||
"/api/caracteristique-unite-logement/**", "/api/enquete-batiment/**", "/api/enquete-unite-logement/**",
|
||||
"/api/unite-logement/**"
|
||||
"/api/unite-logement/**", "/api/donnees-impositions-tfu/**", "/api/impositions-tfu/**"
|
||||
};
|
||||
|
||||
private static final String[] RFU_PARAMETRE = {
|
||||
"/api/campagne/**", "/api/caracteristique/**", "/api/equipe/**", "/api/type-caracteristique/**","api/categorie-batiment/**"
|
||||
|
||||
"/api/campagne/**", "/api/caracteristique/**", "/api/equipe/**", "/api/type-caracteristique/**","/api/categorie-batiment/**","/api/barem-rfu/**",
|
||||
"/api/zone-rfu/**", "/api/barem-rfu-non-bati/**", "/api/exercice/**"
|
||||
};
|
||||
|
||||
private static final String[] DECOUPAGE = {
|
||||
|
||||
@@ -16,6 +16,7 @@ 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;
|
||||
@@ -26,6 +27,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Arrondissement")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class ArrondissementController {
|
||||
|
||||
private final ArrondissementService arrondissementService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Commune")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class CommuneController {
|
||||
|
||||
private final CommuneService communeService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Département")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class DepartementController {
|
||||
|
||||
private final DepartementService departementService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Nationalité")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class NationaliteController {
|
||||
|
||||
private final NationaliteService nationaliteService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Quartier")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class QuartierController {
|
||||
|
||||
private final QuartierService quartierService;
|
||||
|
||||
@@ -14,6 +14,7 @@ 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;
|
||||
@@ -23,6 +24,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@RequestMapping(value = "api/secteur", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
//@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Secteur")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class SecteurController {
|
||||
|
||||
private final SecteurService secteurService;
|
||||
|
||||
@@ -14,6 +14,7 @@ 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;
|
||||
@@ -23,6 +24,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@RequestMapping(value = "api/secteur-decoupage", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "SecteurDecoupage")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class SecteurDecoupageController {
|
||||
|
||||
private final SecteurDecoupageService secteurDecoupageService;
|
||||
|
||||
@@ -2,7 +2,9 @@ package io.gmss.fiscad.controllers.infocad.metier;
|
||||
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.ActeurConcerneService;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.PersonneService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.dto.PersonneCompletDTO;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.slf4j.Logger;
|
||||
@@ -21,11 +23,13 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
public class ActeurConcerneController {
|
||||
|
||||
private final ActeurConcerneService acteurConcerneService;
|
||||
private final PersonneService personneService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ActeurConcerneController.class);
|
||||
|
||||
public ActeurConcerneController(ActeurConcerneService acteurConcerneService) {
|
||||
public ActeurConcerneController(ActeurConcerneService acteurConcerneService, PersonneService personneService) {
|
||||
this.acteurConcerneService = acteurConcerneService;
|
||||
this.personneService = personneService;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +55,20 @@ public class ActeurConcerneController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/get-details/{id}")
|
||||
public ResponseEntity<?> getDetails(@PathVariable Long id) {
|
||||
try{
|
||||
PersonneCompletDTO personneCompletDTO = personneService.getPersonneComplete(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, personneCompletDTO, "Personne retrouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -171,6 +171,30 @@ public class EnqueteController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/all/dgi/decoupage-admin-for-enquete")
|
||||
public ResponseEntity<?> getAllByEnqueteDecoupageAdminForDgi() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getDecoupageAdminUserConnecterAndStatForDgi(), "Liste des enquetes chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteStructurer(@PathVariable Long id) {
|
||||
try {
|
||||
@@ -292,7 +316,7 @@ public class EnqueteController {
|
||||
public ResponseEntity<?> getFicheEnqueteById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getFicheEnquete(id), "enquete trouvé avec succès."),
|
||||
new ApiResponse<>(true, enqueteService.getFicheEnquete(id,null), "enquete trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -315,7 +339,7 @@ public class EnqueteController {
|
||||
public ResponseEntity<?> getFicheEnqueteByNupProvisoir(@PathVariable String nupProvisoir) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getFicheEnqueteByNupProvisoir(nupProvisoir), "enquete trouvé avec succès."),
|
||||
new ApiResponse<>(true, enqueteService.getFicheEnquete(null,nupProvisoir), "enquete trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -357,28 +381,7 @@ public class EnqueteController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/traiter-non-synch-to-mobile/{terminalId}")
|
||||
public ResponseEntity<?> getEnqueteValideNonSynch(@PathVariable Long terminalId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteValideNonSynch(terminalId), "Liste des enquetes traitées non synchronisées sur le termianl."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package io.gmss.fiscad.controllers.infocad.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.PersonneService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.dto.PersonneCompletDTO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/personne", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequiredArgsConstructor
|
||||
public class PersonneController {
|
||||
|
||||
private final PersonneService personneService;
|
||||
|
||||
@GetMapping("/get-details/{id}")
|
||||
public ResponseEntity<?> getDetails(@PathVariable Long id) {
|
||||
try{
|
||||
PersonneCompletDTO personneCompletDTO = personneService.getPersonneComplete(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, personneCompletDTO, "Personne retrouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,9 +57,23 @@ public class TpeController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/re-create")
|
||||
public ResponseEntity<?> reCreateTpe(@RequestBody @Valid @Validated Tpe tpe) {
|
||||
try{
|
||||
tpe = tpeService.reCreateExistTpe(tpe);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, tpe, "Tpe créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, e.getMessage()),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateTpe(@PathVariable Long id, @RequestBody Tpe tpe) {
|
||||
public ResponseEntity<?> majTpe(@PathVariable Long id, @RequestBody Tpe tpe) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, tpeService.updateTpe(id, tpe), "Tpe mis à jour avec succès."),
|
||||
@@ -81,6 +95,30 @@ public class TpeController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/restaure/{id}")
|
||||
public ResponseEntity<?> updateTpe(@PathVariable Long id, @RequestBody Tpe tpe) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, tpeService.majTpe(id, tpe), "Tpe mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteTper(@PathVariable Long id) {
|
||||
try {
|
||||
|
||||
@@ -39,14 +39,10 @@ public class UploadController {
|
||||
boolean headIsValid = false;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(UploadController.class);
|
||||
|
||||
@Autowired
|
||||
private UploadRepository uploadRepository;
|
||||
|
||||
|
||||
@Autowired
|
||||
private FileStorageService fileStorageService;
|
||||
|
||||
@Autowired
|
||||
private StringManager stringManager;
|
||||
private int firstLineColumnNumber = 0;
|
||||
|
||||
@@ -17,6 +17,7 @@ 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;
|
||||
@@ -27,7 +28,8 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Bloc")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class BlocController {
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class BlocController {
|
||||
|
||||
private final BlocService blocService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(BlocController.class);
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Mode d'acquisition")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class ModeAcquisitionController {
|
||||
|
||||
private final ModeAcquisitionService modeAcquisitionService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Nature domaine")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class NatureDomaineController {
|
||||
|
||||
private final NatureDomaineService natureDomaineService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Position représentation")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class PositionRepresentationController {
|
||||
|
||||
private final PositionRepresentationService positionRepresentationService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Profession")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class ProfessionController {
|
||||
|
||||
private final ProfessionService professionService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Situation géographique")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class SituationGeographiqueController {
|
||||
|
||||
private final SituationGeographiqueService situationGeographiqueService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Situation matrimoniale")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class SituationMatrimonialeController {
|
||||
|
||||
private final SituationMatrimonialeService situationMatrimonialeService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Source de droit")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class SourceDroitController {
|
||||
|
||||
private final SourceDroitService sourceDroitService;
|
||||
|
||||
@@ -16,6 +16,7 @@ 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;
|
||||
@@ -26,6 +27,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Structure")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class StructureController {
|
||||
|
||||
private final StructureService structureService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Type de contestation")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class TypeContestationController {
|
||||
|
||||
private final TypeContestationService typeContestationService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Type de domaine")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class TypeDomaineController {
|
||||
|
||||
private final TypeDomaineService typeDomaineService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Type de personne")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class TypePersonneController {
|
||||
|
||||
private final TypePersonneService typePersonneService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Type de pièce")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class TypePieceController {
|
||||
|
||||
private final TypePieceService typePieceService;
|
||||
|
||||
@@ -15,6 +15,7 @@ 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;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Type de représentation")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR')")
|
||||
public class TypeRepresentationController {
|
||||
|
||||
private final TypeRepresentationService typeRepresentationService;
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.DonneesImpositionTfu;
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.repositories.rfu.metier.ImpositionsTfuRepository;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/donnees-impositions-tfu", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "DonneesImpositionTfu")
|
||||
@CrossOrigin(origins = "*")
|
||||
@AllArgsConstructor
|
||||
public class DonneesImpositionTfuController {
|
||||
|
||||
private final DonneesImpositionTfuService donneesImpositionTfuService ;
|
||||
private final ImpositionsTfuRepository impositionsTfuRepository ;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DonneesImpositionTfuController.class);
|
||||
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createDonneesImpositionTfu(@RequestBody @Valid @Validated DonneesImpositionTfu donneesImpositionTfu) {
|
||||
try {
|
||||
donneesImpositionTfu = donneesImpositionTfuService.createDonneesImpositionTfu(donneesImpositionTfu);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfu, "DonneesImpositionTfu créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateDonneesImpositionTfu(@PathVariable Long id, @RequestBody DonneesImpositionTfu donneesImpositionTfu) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.updateDonneesImpositionTfu(id, donneesImpositionTfu), "DonneesImpositionTfu mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteDonneesImpositionTfu(@PathVariable Long id) {
|
||||
try {
|
||||
donneesImpositionTfuService.deleteDonneesImpositionTfu(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "DonneesImpositionTfu supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesImpositionTfuList(), "Liste des caractéristiques chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllDonneesImpositionTfuPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesImpositionTfuList(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}")
|
||||
public ResponseEntity<?> getDonneesImpositionTfuById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesImpositionTfuById(id), "DonneesImpositionTfu 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);
|
||||
}
|
||||
}
|
||||
@Operation(summary = "Générer les données fiscales TFU")
|
||||
@PostMapping("/generer")
|
||||
public ResponseEntity<?> genererDonneesFiscale(@RequestBody ImpositionsTfu impositionsTfu) {
|
||||
try {
|
||||
Optional<ImpositionsTfu> optionalImpositionsTfu =impositionsTfuRepository.findById(impositionsTfu.getId());
|
||||
|
||||
if(optionalImpositionsTfu.isEmpty()){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "L'imposition tfu n'est pas trouvée."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
if(!optionalImpositionsTfu.get().getStatusAvis().equals(StatusAvis.CREE)){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "le statut actuel ne permet pas cette opération."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
optionalImpositionsTfu.get().setStatusAvis(StatusAvis.GENERE);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.genererDonneesFiscales(optionalImpositionsTfu.get()), "DonneesImpositionTfu 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);
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "Récuperer les avis d'id d'une imposition")
|
||||
@GetMapping("/by-impositions-id/{impositionsId}")
|
||||
public ResponseEntity<?> getDonneesFiscale(@PathVariable Long impositionsId) {
|
||||
try {
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByImposition(impositionsId), "DonneesImpositionTfu 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "Récuperer les avis d'id d'une imposition et l'id d'un arrondissement")
|
||||
@GetMapping("/by-impositions-id/by-arrondissement/{impositionsId}/{arrondissementId}")
|
||||
public ResponseEntity<?> getDonneesFiscaleParImpositionArrondissement(@PathVariable Long impositionsId,@PathVariable Long arrondissementId) {
|
||||
try {
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, donneesImpositionTfuService.getDonneesFiscalesByImpositionArrondissement(impositionsId,arrondissementId), "DonneesImpositionTfu trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package io.gmss.fiscad.controllers.rfu.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/impositions-tfu", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Impositions TFU")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class ImpositionsTfuController {
|
||||
|
||||
private final ImpositionsTfuService impositionsTfuService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(ImpositionsTfuController.class);
|
||||
|
||||
public ImpositionsTfuController(ImpositionsTfuService impositionsTfuService) {
|
||||
this.impositionsTfuService = impositionsTfuService;
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createImpositionsTfu(@RequestBody @Valid @Validated ImpositionsTfu impositionsTfu) {
|
||||
try {
|
||||
impositionsTfu = impositionsTfuService.createImpositionsTfu(impositionsTfu);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfu, "Unite de logement créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateImpositionsTfu(@PathVariable Long id, @RequestBody ImpositionsTfu impositionsTfu) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.updateImpositionsTfu(id, impositionsTfu), "Unite de logement 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/valider/{id}")
|
||||
public ResponseEntity<?> validerImpositionsTfu(@RequestBody ImpositionsTfu impositionsTfu) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.validerImpositionsTfu(impositionsTfu), "Unite de logement 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);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/annuler/{id}")
|
||||
public ResponseEntity<?> annulerImpositionsTfu(@PathVariable Long id, @RequestBody ImpositionsTfu impositionsTfu) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.annulerImpositionsTfu(impositionsTfu), "Unite de logement mise à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteImpositionsTfu(@PathVariable Long id) {
|
||||
try {
|
||||
impositionsTfuService.deleteImpositionsTfu(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "Unite Logement supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllImpositionsTfuList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.getImpositionsTfuList(), "Liste des Enquetes des unites Logements chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllImpositionsTfuPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.getImpositionsTfuList(pageable), "Liste des enquetes des unites de logements chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getImpositionsTfuById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, impositionsTfuService.getImpositionsTfuById(id), "Unite de de logement trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.gmss.fiscad.controllers.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfu;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuBati;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
@@ -22,7 +22,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@RestController
|
||||
@RequestMapping(value = "api/barem-rfu", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "BaremRfu")
|
||||
@Tag(name = "Barem Rfu")
|
||||
public class BaremRfuController {
|
||||
private final BaremRfuService baremRfuService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(BaremRfuController.class);
|
||||
@@ -33,11 +33,11 @@ public class BaremRfuController {
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createBaremRfu(@RequestBody @Valid @Validated BaremRfu baremRfu) {
|
||||
public ResponseEntity<?> createBaremRfu(@RequestBody @Valid @Validated BaremRfuBati baremRfuBati) {
|
||||
try {
|
||||
baremRfu = baremRfuService.createBaremRfu(baremRfu);
|
||||
baremRfuBati = baremRfuService.createBaremRfu(baremRfuBati);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfu, "BaremRfu créé avec succès."),
|
||||
new ApiResponse<>(true, baremRfuBati, "BaremRfuBati créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -57,10 +57,10 @@ public class BaremRfuController {
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateBaremRfu(@PathVariable Long id, @RequestBody BaremRfu baremRfu) {
|
||||
public ResponseEntity<?> updateBaremRfu(@PathVariable Long id, @RequestBody BaremRfuBati baremRfuBati) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.updateBaremRfu(id, baremRfu), "BaremRfu mis à jour avec succès."),
|
||||
new ApiResponse<>(true, baremRfuService.updateBaremRfu(id, baremRfuBati), "BaremRfuBati mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -84,7 +84,7 @@ public class BaremRfuController {
|
||||
try {
|
||||
baremRfuService.deleteBaremRfu(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "BaremRfu supprimée avec succès."),
|
||||
new ApiResponse<>(true, "BaremRfuBati supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -155,7 +155,7 @@ public class BaremRfuController {
|
||||
public ResponseEntity<?> getBaremRfuById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuService.getBaremRfuById(id), "BaremRfu trouvée avec succès."),
|
||||
new ApiResponse<>(true, baremRfuService.getBaremRfuById(id), "BaremRfuBati trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -175,7 +175,8 @@ public class BaremRfuController {
|
||||
}
|
||||
|
||||
@GetMapping("/categorie-batiment/{idCategorieBatiment}")
|
||||
public ResponseEntity<?> getBaremRfuByType(@PathVariable Long idCategorieBatiment) {
|
||||
public ResponseEntity<?> getBaremRfuByType( //@Parameter(description = "ID de la catégorie de bâtiment", required = true)
|
||||
@PathVariable Long idCategorieBatiment) {
|
||||
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
package io.gmss.fiscad.controllers.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.BaremRfuNonBatiService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/barem-rfu-non-bati", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Barem rfu non bati")
|
||||
public class BaremRfuNonBatiController {
|
||||
|
||||
private final BaremRfuNonBatiService baremRfuNonBatiService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(BaremRfuNonBatiController.class);
|
||||
|
||||
public BaremRfuNonBatiController(BaremRfuNonBatiService baremRfuNonBatiService) {
|
||||
this.baremRfuNonBatiService = baremRfuNonBatiService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createBaremRfuNonBati(@RequestBody @Valid @Validated BaremRfuNonBati baremRfuNonBati) {
|
||||
try {
|
||||
baremRfuNonBati = baremRfuNonBatiService.createBaremRfuNonBati(baremRfuNonBati);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuNonBati, "BaremRfuNonBati créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateBaremRfuNonBati(@PathVariable Long id, @RequestBody BaremRfuNonBati baremRfuNonBati) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuNonBatiService.updateBaremRfuNonBati(id, baremRfuNonBati), "BaremRfuNonBati mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteBaremRfuNonBatir(@PathVariable Long id) {
|
||||
try {
|
||||
baremRfuNonBatiService.deleteBaremRfuNonBati(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "BaremRfuNonBati supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllBaremRfuNonBatiList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuNonBatiService.getBaremRfuNonBatiList(), "Liste des baremRfuNonBatis chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllBaremRfuNonBatiPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuNonBatiService.getBaremRfuNonBatiList(pageable), "Liste des baremRfuNonBatis chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getBaremRfuNonBatiById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, baremRfuNonBatiService.getBaremRfuNonBatiById(id), "BaremRfuNonBati 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@RestController
|
||||
@RequestMapping(value = "api/categorie-batiment", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "CategorieBatiment")
|
||||
@Tag(name = "Categorie Batiment")
|
||||
public class CategorieBatimentController {
|
||||
|
||||
private final CategorieBatimentService categorieBatimentService;
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
package io.gmss.fiscad.controllers.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.ExerciceService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/exercice", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "exercice")
|
||||
public class ExerciceController {
|
||||
|
||||
private final ExerciceService exerciceService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(ExerciceController.class);
|
||||
|
||||
public ExerciceController(ExerciceService exerciceService) {
|
||||
this.exerciceService = exerciceService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createExercice(@RequestBody @Valid @Validated Exercice exercice) {
|
||||
try {
|
||||
exercice = exerciceService.createExercice(exercice);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, exercice, "Exercice créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateExercice(@PathVariable Long id, @RequestBody Exercice exercice) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, exerciceService.updateExercice(id, exercice), "Exercice mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteExercicer(@PathVariable Long id) {
|
||||
try {
|
||||
exerciceService.deleteExercice(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "Exercice supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllExerciceList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, exerciceService.getExerciceList(), "Liste des exercices chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllExercicePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, exerciceService.getExerciceList(pageable), "Liste des exercices chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getExerciceById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, exerciceService.getExerciceById(id), "Exercice trouvée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
package io.gmss.fiscad.controllers.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.parametre.ZoneRfu;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.rfu.parametre.ZoneRfuService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/zone-rfu", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Zone RFU")
|
||||
public class ZoneRfuController {
|
||||
|
||||
private final ZoneRfuService zoneRfuService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(ZoneRfuController.class);
|
||||
|
||||
public ZoneRfuController(ZoneRfuService zoneRfuService) {
|
||||
this.zoneRfuService = zoneRfuService;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
public ResponseEntity<?> createZoneRfu(@RequestBody @Valid @Validated ZoneRfu zoneRfu) {
|
||||
try {
|
||||
zoneRfu = zoneRfuService.createZoneRfu(zoneRfu);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, zoneRfu, "ZoneRfu créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@PutMapping("/update/{id}")
|
||||
public ResponseEntity<?> updateZoneRfu(@PathVariable Long id, @RequestBody ZoneRfu zoneRfu) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, zoneRfuService.updateZoneRfu(id, zoneRfu), "ZoneRfu mis à jour avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ResponseEntity<?> deleteZoneRfur(@PathVariable Long id) {
|
||||
try {
|
||||
zoneRfuService.deleteZoneRfu(id);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "ZoneRfu supprimée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllZoneRfuList() {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, zoneRfuService.getZoneRfuList(), "Liste des zoneRfus chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/all-paged")
|
||||
public ResponseEntity<?> getAllZoneRfuPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
try {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, zoneRfuService.getZoneRfuList(pageable), "Liste des zoneRfus chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||
FileStorageException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||
} catch (NullPointerException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getZoneRfuById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, zoneRfuService.getZoneRfuById(id), "ZoneRfu 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
|
||||
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.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
@@ -18,6 +19,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Restauration")
|
||||
@CrossOrigin(origins = "*")
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_SUPERVISEUR') or hasRole('ROLE_ENQUETEUR')")
|
||||
public class RestaurationController {
|
||||
public final RestaurationService restaurationService;
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package io.gmss.fiscad.controllers.synchronisation;
|
||||
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||
import io.gmss.fiscad.interfaces.synchronisation.SynchronisationService;
|
||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||
import io.gmss.fiscad.paylaods.request.*;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -22,13 +25,13 @@ import java.util.List;
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "Synchronisation")
|
||||
@CrossOrigin(origins = "*")
|
||||
@AllArgsConstructor
|
||||
public class SynchronisationController {
|
||||
private final SynchronisationService synchronisationService;
|
||||
private final EnqueteService enqueteService;
|
||||
private static final Logger logger = LoggerFactory.getLogger(SynchronisationController.class);
|
||||
|
||||
public SynchronisationController(SynchronisationService synchronisationService) {
|
||||
this.synchronisationService = synchronisationService;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/user-decoupage-territorial")
|
||||
public ResponseEntity<?> getUserDecoupageTerritorial() {
|
||||
@@ -75,7 +78,7 @@ public class SynchronisationController {
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@PostMapping("/personnes")
|
||||
public ResponseEntity<?> syncPersonne(@RequestBody List<PersonnePayLoad> personnePayLoads) {
|
||||
try {
|
||||
@@ -172,6 +175,7 @@ public class SynchronisationController {
|
||||
public ResponseEntity<?> syncPiece(@RequestBody List<PiecePayLoad> piecePayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
//new ApiResponse<>(true, null, "Liste des pièces synchronisée avec succès."),
|
||||
new ApiResponse<>(true, synchronisationService.syncPiece(piecePayLoads), "Liste des pièces synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
@@ -195,6 +199,7 @@ public class SynchronisationController {
|
||||
public ResponseEntity<?> syncActeurConcerne(@RequestBody List<ActeurConcernePayLoad> piecePayLoads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
//new ApiResponse<>(true, null, "Liste des acteurs concernes synchronisée avec succès."),
|
||||
new ApiResponse<>(true, synchronisationService.syncActeurConcerne(piecePayLoads), "Liste des acteurs concernes synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
@@ -217,22 +222,24 @@ public class SynchronisationController {
|
||||
//@PostMapping("/files")
|
||||
@PostMapping(path = "/files")
|
||||
public ResponseEntity<?> syncFiles(@RequestPart(required = true) MultipartFile file,
|
||||
@RequestParam(required = false) Long idBackend,
|
||||
@RequestParam Long externalKey,
|
||||
@RequestParam(required = false) Long pieceId,
|
||||
@RequestParam(required = false) Long membreGroupeId,
|
||||
@RequestParam(required = false) Long terminalId,
|
||||
@RequestParam(required = false) String name,
|
||||
@RequestParam(required = false) String filePath,
|
||||
@RequestParam(required = false) Long max_numero_piece_id,
|
||||
@RequestParam(required = false) Long max_numero_upload_id,
|
||||
@RequestParam(required = false) Long max_numero_acteur_concerne_id,
|
||||
@RequestParam(required = false) Long enqueteId,
|
||||
@RequestParam(required = false) Long enqueteBatimentId,
|
||||
@RequestParam(required = false) Long enqueteUniteLogementId
|
||||
@RequestParam(value = "idBackend",required = false) Long idBackend,
|
||||
@RequestParam(value = "externalKey",required = true) Long externalKey,
|
||||
@RequestParam(value = "pieceId",required = false) Long pieceId,
|
||||
@RequestParam(value = "membreGroupeId",required = false) Long membreGroupeId,
|
||||
@RequestParam(value = "terminalId",required = false) Long terminalId,
|
||||
@RequestParam(value = "name",required = false) String name,
|
||||
@RequestParam(value = "filePath",required = false) String filePath,
|
||||
@RequestParam(value = "max_numero_piece_id",required = false) Long max_numero_piece_id,
|
||||
@RequestParam(value = "max_numero_upload_id",required = false) Long max_numero_upload_id,
|
||||
@RequestParam(value = "max_numero_acteur_concerne_id",required = false) Long max_numero_acteur_concerne_id,
|
||||
@RequestParam(value = "enqueteId",required = false) Long enqueteId,
|
||||
@RequestParam(value = "enqueteBatimentId",required = false) Long enqueteBatimentId,
|
||||
@RequestParam(value = "enqueteUniteLogementId",required = false) Long enqueteUniteLogementId,
|
||||
@RequestParam(value = "personneId",required = false) Long personneId
|
||||
) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
//null,
|
||||
new ApiResponse<>(true, synchronisationService.syncFiles(file,
|
||||
idBackend,
|
||||
externalKey,
|
||||
@@ -244,7 +251,10 @@ public class SynchronisationController {
|
||||
max_numero_piece_id,
|
||||
max_numero_upload_id,
|
||||
max_numero_acteur_concerne_id,
|
||||
enqueteId, enqueteBatimentId, enqueteUniteLogementId), "Liste des fichiers synchronisée avec succès."),
|
||||
enqueteId,
|
||||
enqueteBatimentId,
|
||||
enqueteUniteLogementId,
|
||||
personneId), "Liste des fichiers synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -287,10 +297,10 @@ public class SynchronisationController {
|
||||
}
|
||||
|
||||
@PostMapping(path = "/synchronise/enquete/confirme-from-mobile")
|
||||
public ResponseEntity<?> syncAllEnqueteData(@RequestBody List<BatimentPaylaod> batimentPaylaods) {
|
||||
public ResponseEntity<?> syncAllEnqueteData(@RequestBody List<Long> longList) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, synchronisationService.syncBatiment(batimentPaylaods), "Synchronisation confirmée avec succès."),
|
||||
new ApiResponse<>(true, synchronisationService.syncEnqueteFromMobile(longList), "Synchronisation confirmée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -309,7 +319,6 @@ public class SynchronisationController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Liste des API pour la synchronisation des données liées à FISCAD
|
||||
* Fait le mercredi 15 janvier 2025 à 09h21
|
||||
@@ -320,6 +329,7 @@ public class SynchronisationController {
|
||||
public ResponseEntity<?> syncBatiment(@RequestBody List<BatimentPaylaod> batimentPaylaods) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
//new ApiResponse<>(true, null, "Liste des batiments synchronisées avec succès."),
|
||||
new ApiResponse<>(true, synchronisationService.syncBatiment(batimentPaylaods), "Liste des batiments synchronisées avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
@@ -343,6 +353,7 @@ public class SynchronisationController {
|
||||
public ResponseEntity<?> syncUniteLogement(@RequestBody List<UniteLogementPaylaod> uniteLogementPaylaods) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
//new ApiResponse<>(true,null, "Liste des unités de logement synchronisées avec succès."),
|
||||
new ApiResponse<>(true, synchronisationService.syncUniteLogement(uniteLogementPaylaods), "Liste des unités de logement synchronisées avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
@@ -366,6 +377,7 @@ public class SynchronisationController {
|
||||
public ResponseEntity<?> syncCaracteristiqueBatiment(@RequestBody List<CaracteristiqueBatimentPaylod> caracteristiqueBatimentPaylods) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
//new ApiResponse<>(true, null, "Liste des caractéristiques des bâtiments synchronisée avec succès."),
|
||||
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueBatiment(caracteristiqueBatimentPaylods), "Liste des caractéristiques des bâtiments synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
@@ -389,6 +401,7 @@ public class SynchronisationController {
|
||||
public ResponseEntity<?> syncCaracteristiqueParcelle(@RequestBody List<CaracteristiqueParcellePaylod> caracteristiqueParcellePaylods) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
//new ApiResponse<>(true, null, "Liste des caractéristiques des parcelles synchronisée avec succès."),
|
||||
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueParcelle(caracteristiqueParcellePaylods), "Liste des caractéristiques des parcelles synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
@@ -412,6 +425,7 @@ public class SynchronisationController {
|
||||
public ResponseEntity<?> syncCaracteristiqueUniteLogement(@RequestBody List<CaracteristiqueUniteLogementPaylod> caracteristiqueUniteLogementPaylods) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
//new ApiResponse<>(true, null, "Liste des caractéristiques des unités de logement synchronisée avec succès."),
|
||||
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueUniteLogement(caracteristiqueUniteLogementPaylods), "Liste des caractéristiques des unités de logement synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
@@ -435,6 +449,7 @@ public class SynchronisationController {
|
||||
public ResponseEntity<?> syncEnqueteBatiment(@RequestBody List<EnqueteBatimentPayload> enqueteBatimentPayloads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
//new ApiResponse<>(true, null, "Liste des enquêtes des batiments synchronisée avec succès."),
|
||||
new ApiResponse<>(true, synchronisationService.syncEnqueteBatiment(enqueteBatimentPayloads), "Liste des enquêtes des batiments synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
@@ -458,6 +473,7 @@ public class SynchronisationController {
|
||||
public ResponseEntity<?> syncEnqueteUniteLogement(@RequestBody List<EnqueteUniteLogementPayload> enqueteUniteLogementPayloads) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
//new ApiResponse<>(true, null, "Liste des enquêtes des unités de logement synchronisée avec succès."),
|
||||
new ApiResponse<>(true, synchronisationService.syncEnqueteUniteLogement(enqueteUniteLogementPayloads), "Liste des enquêtes des unités de logement synchronisée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
@@ -477,4 +493,29 @@ public class SynchronisationController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/traiter-non-synch-to-mobile/{terminalId}")
|
||||
public ResponseEntity<?> getEnqueteValideNonSynch(@PathVariable Long terminalId) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, enqueteService.getEnqueteValideNonSynch(terminalId), "Liste des enquetes traitées non synchronisées sur le termianl."),
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
@@ -78,7 +79,11 @@ public class AuthController {
|
||||
} 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) {
|
||||
}
|
||||
catch (BadCredentialsException ex) {
|
||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED)
|
||||
.body(new ApiResponse<>(false, null, "Identifiants invalides. Veuillez vérifier votre nom d'utilisateur et votre mot de passe."));
|
||||
}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);
|
||||
}
|
||||
@@ -89,9 +94,9 @@ public class AuthController {
|
||||
try {
|
||||
User user = getUser(userRequest);
|
||||
user.setUsername(userRequest.getEmail());
|
||||
user = userService.createUser(user, false);
|
||||
user = userService.createUser(user, true);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, user, "User created successully."),
|
||||
new ApiResponse<>(true, user, "Inscription effectué avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class DemandeReinitialisationMPController {
|
||||
try {
|
||||
demandeReinitialisationMPService.createDemandeReinitialisationMP(usernamrOrEmail);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, "DemandeReinitialisation MP créé avec succès."),
|
||||
new ApiResponse<>(true, "Demande Reinitialisation mot de passe créé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.gmss.fiscad.controllers.user;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.user.Role;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.UserRole;
|
||||
import io.gmss.fiscad.exceptions.*;
|
||||
@@ -20,6 +21,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/user", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@@ -114,7 +117,7 @@ public class UserController {
|
||||
try {
|
||||
User user = userService.validateUserAccount(login.getUsername(), login.getUserRole());
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, user, "Cet utilisateur à été activé avec succès."),
|
||||
new ApiResponse<>(true, user, "Cet compte à été activé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -138,7 +141,7 @@ public class UserController {
|
||||
public ResponseEntity<?> updateUser(@PathVariable Long id, @RequestBody User user) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, userService.updateUser(id, user), "User updated successully."),
|
||||
new ApiResponse<>(true, userService.updateUser(id, user), "Utilisateur modifié avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||
@@ -157,11 +160,24 @@ public class UserController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/activate-or-not")
|
||||
public ResponseEntity<?> acitvateOrNotUser(@RequestParam Long id) {
|
||||
@GetMapping("/activate-or-not/{id}")
|
||||
public ResponseEntity<?> acitvateOrNotUser(@PathVariable Long id) {
|
||||
try {
|
||||
|
||||
User user = userService.activateOrNotUser(id);
|
||||
User user = userService.getUserById(id);
|
||||
if(containsRoleAnonyme(user.getRoles())){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, user , "Ce compte n'est pas encore validé."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
if(user.isResetPassword()){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, user , "Ce compte n'est pas encore validé."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
user = userService.activateOrNotUser(id);
|
||||
String message = "Utilisateur activé avec succès";
|
||||
if (!user.isActive()) {
|
||||
message = "Utilisateur désactivé avec succès";
|
||||
@@ -214,7 +230,12 @@ public class UserController {
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAll(@CurrentUser UserPrincipal userPrincipal) {
|
||||
try {
|
||||
|
||||
if(userPrincipal==null){
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(false, null, "Vous n'êtes pas authorisés à accéder à la liste des utilisateurs"),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
User user = userPrincipal.getUser();
|
||||
|
||||
if (user.getRoles().stream().anyMatch(r -> r.getNom().equals(UserRole.ROLE_ADMIN))) {
|
||||
@@ -353,5 +374,12 @@ public class UserController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean containsRoleAnonyme(Set<Role> roles){
|
||||
for(Role r: roles ){
|
||||
if(r.getNom().equals(UserRole.ROLE_ANONYMOUS)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,4 +36,5 @@ public class BaseEntity implements Serializable {
|
||||
@JsonIgnore
|
||||
private boolean deleted;
|
||||
private Long externalKey;
|
||||
private Long enqueteExternalKey;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.entities.decoupage;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
@@ -29,9 +30,11 @@ public class Secteur extends BaseEntity implements Serializable {
|
||||
private User chefSecteur;
|
||||
@ManyToOne
|
||||
private Structure structure;
|
||||
// @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
// @JoinColumn(name = "secteur_id")
|
||||
// private List<SecteurDecoupage> secteurDecoupages;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "secteur_id")
|
||||
@JsonManagedReference
|
||||
private List<SecteurDecoupage> secteurDecoupages;
|
||||
|
||||
///Creer un payload pour la creation de secteur découpage
|
||||
/// ressource pour envoyer les découpage d'un secteur
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.entities.decoupage;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
@@ -35,10 +36,13 @@ public class SecteurDecoupage extends BaseEntity implements Serializable {
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
|
||||
@JsonBackReference
|
||||
@ManyToOne
|
||||
private Secteur secteur;
|
||||
|
||||
@ManyToOne
|
||||
private Arrondissement arrondissement;
|
||||
|
||||
@ManyToOne
|
||||
private Quartier quartier;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.gmss.fiscad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.PositionRepresentation;
|
||||
@@ -25,11 +26,11 @@ import java.util.List;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE acteur_concerne " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE acteur_concerne " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
public class ActeurConcerne extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@@ -44,16 +45,19 @@ public class ActeurConcerne extends BaseEntity implements Serializable {
|
||||
private PositionRepresentation positionRepresentation;
|
||||
@ManyToOne
|
||||
private Personne personne;
|
||||
private Long personneExternalKey;
|
||||
@ManyToOne
|
||||
private TypeContestation typeContestation;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Enquete enquete;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private RoleActeur roleActeur;
|
||||
|
||||
// @OneToMany(mappedBy = "acteurConcerne")
|
||||
// private List<Piece> pieces;
|
||||
@OneToMany(mappedBy = "acteurConcerne")
|
||||
@JsonManagedReference
|
||||
private List<Piece> pieces;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@@ -66,5 +70,4 @@ public class ActeurConcerne extends BaseEntity implements Serializable {
|
||||
private int haveDeclarant;
|
||||
private Long max_numero_acteur_concerne_id;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE commentaire " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE commentaire " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
public class Commentaire extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.gmss.fiscad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
@@ -13,6 +14,7 @@ import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.ZoneRfu;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import io.gmss.fiscad.enums.StatusEnquete;
|
||||
import io.gmss.fiscad.enums.StatutEnregistrement;
|
||||
@@ -33,11 +35,11 @@ import java.util.List;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE enquete " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE enquete " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@DiscriminatorColumn(name = "origine_enquete", discriminatorType = DiscriminatorType.STRING)
|
||||
@DiscriminatorValue("INFOCAD")
|
||||
@@ -50,23 +52,35 @@ public class Enquete extends BaseEntity implements Serializable {
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
private boolean litige;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private User user;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "enquete")
|
||||
private List<ActeurConcerne> acteurConcernes;
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Parcelle parcelle;
|
||||
private Long parcelleExternalKey;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Bloc bloc;
|
||||
@ManyToOne
|
||||
private Campagne campagne;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Equipe equipe;
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private ZoneRfu zoneRfu;
|
||||
private String autreNumeroTitreFoncier;
|
||||
private Long personneId;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatusEnquete statusEnquete;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@@ -106,9 +120,11 @@ public class Enquete extends BaseEntity implements Serializable {
|
||||
|
||||
@Transient
|
||||
private String structureEnqueteur;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
|
||||
@Transient
|
||||
private Long terminalId;
|
||||
|
||||
@@ -142,17 +158,20 @@ public class Enquete extends BaseEntity implements Serializable {
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFinExcemption;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "enquete")
|
||||
private List<EnqueteUniteLogement> enqueteUniteLogements;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "enquete")
|
||||
private List<EnqueteBatiment> enqueteBatiments;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "enquete")
|
||||
private List<CaracteristiqueParcelle> caracteristiqueParcelles;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@JsonIgnore
|
||||
private StatutEnregistrement statutEnregistrement;
|
||||
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ public class MembreGroupe extends BaseEntity implements Serializable {
|
||||
private TypeRepresentation typeRepresentation;
|
||||
@ManyToOne
|
||||
private PositionRepresentation positionRepresentation;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "membreGroupe")
|
||||
// private Set<Upload> uploads;
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "membreGroupe")
|
||||
private Set<Upload> uploads;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
|
||||
@@ -6,10 +6,7 @@ import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
@@ -22,11 +19,11 @@ import java.util.List;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE parcelle " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE parcelle " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
public class Parcelle extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@@ -34,21 +31,15 @@ public class Parcelle extends BaseEntity implements Serializable {
|
||||
private Long id;
|
||||
private String qip;
|
||||
private String q;
|
||||
@Column(unique = true)
|
||||
private String nup;
|
||||
@Column(unique = true)
|
||||
private String nupProvisoire;
|
||||
private String numeroParcelle;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private String situationGeographique;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "parcelle")
|
||||
// private List<Enquete> enquetes;
|
||||
// @ManyToOne
|
||||
// private SituationGeographique situationGeographique;
|
||||
@ColumnDefault("0")
|
||||
private int superficie;
|
||||
@ManyToOne
|
||||
//private TypeDomaine typeDomaine;
|
||||
private NatureDomaine natureDomaine;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@@ -60,14 +51,13 @@ public class Parcelle extends BaseEntity implements Serializable {
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
private String autreNumeroTitreFoncier;
|
||||
|
||||
private Long typeDomaineId;
|
||||
private Long numeroProvisoire;
|
||||
private Long blocId;
|
||||
@ColumnDefault("false")
|
||||
private boolean synchronise;
|
||||
|
||||
|
||||
private Long idDerniereEnquete;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "parcelle")
|
||||
|
||||
@@ -72,9 +72,11 @@ public class ParcelleGeom extends BaseEntity implements Serializable {
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatutParcelle statutParcelle;
|
||||
|
||||
///@JsonIgnore
|
||||
@ManyToOne
|
||||
private Upload upload;
|
||||
// @JsonIgnore
|
||||
// @ManyToOne
|
||||
// private Upload upload;
|
||||
|
||||
private Long uploadId;
|
||||
|
||||
|
||||
////////////
|
||||
@@ -97,7 +99,8 @@ public class ParcelleGeom extends BaseEntity implements Serializable {
|
||||
@JsonSerialize(using = GeometrySerializer.class)
|
||||
@JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
||||
@Column(name = "geometry",columnDefinition = "geometry(Polygon,32631)")
|
||||
//private Polygon geometry32631 ;
|
||||
//@Column(columnDefinition = "geometry")
|
||||
private Polygon geometry;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String geometryString;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
@@ -27,11 +28,11 @@ import java.util.List;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE piece " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE piece " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
public class Piece extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@@ -47,11 +48,16 @@ public class Piece extends BaseEntity implements Serializable {
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Personne personne;
|
||||
private Long personneExternalKey;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@JsonBackReference
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
private ActeurConcerne acteurConcerne;
|
||||
private Long acteurConcerneExternalKey;
|
||||
|
||||
@ManyToOne
|
||||
private SourceDroit sourceDroit;
|
||||
|
||||
@ManyToOne
|
||||
private ModeAcquisition modeAcquisition;
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package io.gmss.fiscad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -19,7 +23,6 @@ public class Upload extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Long externalKey;
|
||||
private String Observation;
|
||||
private boolean synchronise;
|
||||
private String fileName;
|
||||
@@ -29,15 +32,20 @@ public class Upload extends BaseEntity implements Serializable {
|
||||
private String checkSum;
|
||||
private long size;
|
||||
private String mimeType;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Piece piece;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private MembreGroupe membreGroupe;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
private Piece piece;
|
||||
private Long pieceExternalKey;
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
private MembreGroupe membreGroupe;
|
||||
private Long membreGroupeExternalKey;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
private Tpe terminal;
|
||||
|
||||
private String name;
|
||||
@@ -49,32 +57,52 @@ public class Upload extends BaseEntity implements Serializable {
|
||||
private Long blocId;
|
||||
private String reference;
|
||||
private String description;
|
||||
|
||||
@Transient
|
||||
@ColumnDefault("0")
|
||||
private int nombreParcelleGeom;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "enquete_batiment_id")
|
||||
private EnqueteBatiment enqueteBatiment;
|
||||
private Long enqueteBatimentExternalKey;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private EnqueteBatiment enqueteBatiment;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "enquete_unite_logement_id")
|
||||
private EnqueteUniteLogement enqueteUniteLogement;
|
||||
|
||||
private Long enqueteUniteLogementExternalKey;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne (fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "personne_id")
|
||||
private Personne personne ;
|
||||
private Long personneExternalKey ;
|
||||
|
||||
@Type(JsonBinaryType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private Upload uploadJson;
|
||||
|
||||
public Upload() {
|
||||
}
|
||||
|
||||
public String getURIFile() {
|
||||
|
||||
String url = this.serverContext() + fileName;
|
||||
System.out.println("url = " + url);
|
||||
// return url != null ? url.toLowerCase().startsWith("https") ? url : url.toLowerCase().replaceFirst("http", "https") : null;
|
||||
return url != null ? url.toLowerCase().startsWith("https") ? url : url.toLowerCase().replaceFirst("http", "https") : null;
|
||||
|
||||
}
|
||||
|
||||
private String serverContext() {
|
||||
return ServletUriComponentsBuilder.fromCurrentContextPath()
|
||||
String url= ServletUriComponentsBuilder.fromCurrentContextPath()
|
||||
.path("/api/upload/downloadFile/")
|
||||
.toUriString();
|
||||
if(!url.contains("8282/api")){
|
||||
url.replace("/api",":8282/api");
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,13 +114,4 @@ public class Upload extends BaseEntity implements Serializable {
|
||||
'}';
|
||||
|
||||
}
|
||||
|
||||
// public int getNombreParcelleGeom(){
|
||||
// if(parcelleGeoms!=null){
|
||||
// return parcelleGeoms.size();
|
||||
// }else {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -52,6 +53,8 @@ public class Bloc extends BaseEntity implements Serializable {
|
||||
inverseJoinColumns = @JoinColumn(name = "quartier_id")
|
||||
)
|
||||
private Set<Quartier> quartiers;
|
||||
|
||||
@NotNull
|
||||
@ManyToOne
|
||||
private Arrondissement arrondissement;
|
||||
|
||||
|
||||
@@ -47,9 +47,6 @@ public class Personne extends BaseEntity implements Serializable {
|
||||
private String adresse;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Categorie categorie;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "personne")
|
||||
// private List<ActeurConcerne> acteurConcernes;
|
||||
@ManyToOne
|
||||
private SituationMatrimoniale situationMatrimoniale;
|
||||
@ManyToOne
|
||||
@@ -60,8 +57,6 @@ public class Personne extends BaseEntity implements Serializable {
|
||||
private Profession profession;
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
// @OneToMany(mappedBy = "personne")
|
||||
// private List<Piece> pieces;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package io.gmss.fiscad.entities.infocad.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -31,6 +33,7 @@ import java.util.Set;
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
||||
public class Structure extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@@ -44,6 +47,7 @@ public class Structure extends BaseEntity implements Serializable {
|
||||
private String tel;
|
||||
private String email;
|
||||
private String adresse;
|
||||
@NotNull
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
//@JsonIgnore
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package io.gmss.fiscad.entities.metadata;
|
||||
|
||||
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Piece;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class PieceMetaData extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
private Long pieceId;
|
||||
|
||||
@Type(JsonBinaryType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private Piece pieceJson;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.gmss.fiscad.entities.metadata;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.MembreGroupe;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Piece;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Upload;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class UploadMetaData extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
private Long uploadId;
|
||||
|
||||
@Type(JsonBinaryType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private Upload uploadJson;
|
||||
|
||||
}
|
||||
@@ -34,18 +34,13 @@ public class Batiment extends BaseEntity implements Serializable {
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateConstruction;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "batiment")
|
||||
// private List<EnqueteBatiment> enqueteBatiments;
|
||||
private Long idDerniereEnquete;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Parcelle parcelle;
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "batiment")
|
||||
// private List<UniteLogement> uniteLogements;
|
||||
|
||||
private Long parcelleExternalKey;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
private Long enqueteId;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.entities.rfu.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
@@ -19,22 +20,28 @@ import java.io.Serializable;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE caracteristique_batiment " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE caracteristique_batiment " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
public class CaracteristiqueBatiment extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@ManyToOne
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JsonBackReference ///pour couper la recurcivité
|
||||
private EnqueteBatiment enqueteBatiment;
|
||||
private Long enqueteBatimentExternalKey;
|
||||
|
||||
@ManyToOne
|
||||
private Caracteristique caracteristique;
|
||||
private String valeur;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
private Tpe terminal ;
|
||||
private Long enqueteId ;
|
||||
}
|
||||
|
||||
@@ -20,18 +20,19 @@ import java.io.Serializable;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE caracteristique_parcelle " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE caracteristique_parcelle " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
public class CaracteristiqueParcelle extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
private Enquete enquete;
|
||||
@ManyToOne
|
||||
private Caracteristique caracteristique;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.gmss.fiscad.entities.rfu.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
@@ -19,23 +20,26 @@ import java.io.Serializable;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE caracteristique_unite_logement " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE caracteristique_unite_logement " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
public class CaracteristiqueUniteLogement extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@ManyToOne
|
||||
@JsonBackReference
|
||||
private EnqueteUniteLogement enqueteUniteLogement;
|
||||
private Long enqueteUniteLogementExternalKey;
|
||||
@ManyToOne
|
||||
private Caracteristique caracteristique;
|
||||
private String valeur;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
private Long enqueteId;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
import jakarta.persistence.*;
|
||||
@@ -12,6 +13,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -22,10 +24,19 @@ import java.time.LocalDate;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(
|
||||
name = "donnees_imposition_tfu",
|
||||
uniqueConstraints = {
|
||||
@UniqueConstraint(columnNames = {"codeCommune","q","ilot","parcelle","annee","numBatiment","numUniteLogement","impositions_tfu_id"}),
|
||||
@UniqueConstraint(columnNames = {"codeCommune","nup", "annee","numBatiment","numUniteLogement","impositions_tfu_id"}),
|
||||
@UniqueConstraint(columnNames = {"codeCommune","nupProvisoire", "annee","numBatiment","numUniteLogement","impositions_tfu_id"})
|
||||
}
|
||||
)
|
||||
public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Long annee;
|
||||
private String codeDepartement;
|
||||
private String nomDepartement;
|
||||
private String codeCommune;
|
||||
@@ -57,11 +68,13 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
private String adresseSc;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
private Long superficieParc;
|
||||
private int superficieParc;
|
||||
private Long superficieAuSolBat;
|
||||
private Long superficieAuSolUlog;
|
||||
private String batieOuiNon;
|
||||
private String exhonereOuiNon;
|
||||
private String batimentExhonereOuiNon;
|
||||
private String uniteLogementExhonereOuiNon;
|
||||
private Long valeurLocativeAdm;
|
||||
private Long montantLoyerAnnuel;
|
||||
private Long tfuMetreCarre;
|
||||
@@ -74,4 +87,16 @@ public class DonneesImpositionTfu extends BaseEntity implements Serializable {
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateEnquete;
|
||||
private Long enqueteId;
|
||||
private Long structureId;
|
||||
private Long secteurId;
|
||||
|
||||
private Long zoneRfuId;
|
||||
@ColumnDefault("0")
|
||||
private float tauxParcelleNonBati;
|
||||
private Long valeurAdministrativeParcelleNonBati;
|
||||
@JsonIgnore
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "impositions_tfu_id", nullable = false)
|
||||
private ImpositionsTfu impositionsTfu;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package io.gmss.fiscad.entities.rfu.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
@@ -29,11 +31,11 @@ import java.util.List;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE enquete_batiment " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE enquete_batiment " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@@ -62,38 +64,32 @@ public class EnqueteBatiment extends BaseEntity implements Serializable {
|
||||
private LocalDate dateFinExcemption;
|
||||
@OneToOne
|
||||
private Personne personne;
|
||||
private Long personneExternalKey;
|
||||
@ManyToOne
|
||||
private Batiment batiment;
|
||||
private Long batimentExternalKey;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Enquete enquete;
|
||||
|
||||
|
||||
@JsonManagedReference ///pour couper la récurcivité
|
||||
@OneToMany(mappedBy = "enqueteBatiment")
|
||||
private List<CaracteristiqueBatiment> caracteristiqueBatiments;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private User user;
|
||||
@JsonIgnore
|
||||
|
||||
//@JsonIgnore
|
||||
@OneToMany(mappedBy = "enqueteBatiment")
|
||||
private List<Upload> uploads;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@JsonIgnore
|
||||
private StatutEnregistrement statutEnregistrement;
|
||||
|
||||
public List<CaracteristiqueBatiment> getCaracteristiqueBatiments(){
|
||||
List<CaracteristiqueBatiment> caracteristiqueBatimentList=new ArrayList<>();
|
||||
if(caracteristiqueBatiments!=null){
|
||||
caracteristiqueBatiments.forEach(caracteristiqueBatiment -> {
|
||||
caracteristiqueBatiment.setEnqueteBatiment(null);
|
||||
caracteristiqueBatimentList.add(caracteristiqueBatiment);
|
||||
});
|
||||
}
|
||||
return caracteristiqueBatimentList;
|
||||
}
|
||||
|
||||
//@JsonIgnore
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.gmss.fiscad.entities.rfu.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
@@ -29,11 +30,11 @@ import java.util.List;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@SQLDelete(sql =
|
||||
"UPDATE enquete_unite_logement " +
|
||||
"SET deleted = true " +
|
||||
"WHERE id = ?")
|
||||
@Where(clause = " deleted = false")
|
||||
//@SQLDelete(sql =
|
||||
// "UPDATE enquete_unite_logement " +
|
||||
// "SET deleted = true " +
|
||||
// "WHERE id = ?")
|
||||
//@Where(clause = " deleted = false")
|
||||
public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@@ -63,31 +64,25 @@ public class EnqueteUniteLogement extends BaseEntity implements Serializable {
|
||||
private Enquete enquete;
|
||||
@ManyToOne
|
||||
private UniteLogement uniteLogement;
|
||||
private Long uniteLogementExternalKey;
|
||||
@OneToOne
|
||||
private Personne personne;
|
||||
private Long personneExternalKey;
|
||||
|
||||
@OneToMany(mappedBy = "enqueteUniteLogement")
|
||||
@JsonManagedReference
|
||||
private List<CaracteristiqueUniteLogement> caracteristiqueUniteLogements;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private User user;
|
||||
@JsonIgnore
|
||||
//@JsonIgnore
|
||||
@OneToMany(mappedBy = "enqueteUniteLogement")
|
||||
private List<Upload> uploads;
|
||||
@JsonIgnore
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatutEnregistrement statutEnregistrement;
|
||||
|
||||
public List<CaracteristiqueUniteLogement> getCaracteristiqueUniteLogements(){
|
||||
List<CaracteristiqueUniteLogement> caracteristiqueUniteLogementList=new ArrayList<>();
|
||||
if(caracteristiqueUniteLogements!=null){
|
||||
caracteristiqueUniteLogements.forEach(caracteristiqueUniteLogement -> {
|
||||
caracteristiqueUniteLogement.setEnqueteUniteLogement(null);
|
||||
caracteristiqueUniteLogementList.add(caracteristiqueUniteLogement);
|
||||
});
|
||||
}
|
||||
return caracteristiqueUniteLogementList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package io.gmss.fiscad.entities.rfu.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Participer;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ImpositionsTfu extends BaseEntity implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@ManyToOne
|
||||
private Exercice exercice;
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateGeneration;
|
||||
private String ReferencePieceAdmin;
|
||||
private String datePieceAdmin;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private StatusAvis statusAvis;
|
||||
private Long nombreAvis;
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String motif;
|
||||
@JsonIgnore
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "impositions_tfu_id")
|
||||
private List<DonneesImpositionTfu> donneesImpositionTfus;
|
||||
|
||||
public Long getNombreAvis(){
|
||||
return donneesImpositionTfus==null?0l:donneesImpositionTfus.size();
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,10 @@ public class UniteLogement extends BaseEntity implements Serializable {
|
||||
private List<EnqueteUniteLogement> enqueteUniteLogements;
|
||||
@ManyToOne
|
||||
private Batiment batiment;
|
||||
private Long batimentExternalKey;
|
||||
private Long idDerniereEnquete;
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Tpe terminal;
|
||||
private Long enqueteId;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
||||
import io.gmss.fiscad.enums.TypeImmeuble;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -19,13 +17,15 @@ import java.io.Serializable;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class BaremRfu extends BaseEntity implements Serializable {
|
||||
public class BaremRfuBati extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Long valeurLocative;
|
||||
private Long tfuMetreCarre;
|
||||
private Double tfuMetreCarre;
|
||||
private Long tfuMinimum;
|
||||
@ManyToOne
|
||||
private CategorieBatiment categorieBatiment;
|
||||
@ManyToOne
|
||||
private Arrondissement arrondissement;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class BaremRfuNonBati extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Long valeurAdministrative;
|
||||
private float taux;
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
@ManyToOne
|
||||
private ZoneRfu zoneRfu;
|
||||
}
|
||||
@@ -39,6 +39,6 @@ public class Caracteristique extends BaseEntity implements Serializable {
|
||||
private Tpe terminal;
|
||||
@ManyToOne
|
||||
private CategorieBatiment categorieBatiment;
|
||||
@ManyToOne
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
private Arrondissement arrondissement;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -23,6 +20,7 @@ public class CategorieBatiment extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private Long code;
|
||||
private Long nom;
|
||||
@Column(unique = true)
|
||||
private String code;
|
||||
private String nom;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class Equipe extends BaseEntity implements Serializable {
|
||||
private Secteur secteur;
|
||||
@ManyToOne
|
||||
private Campagne campagne;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "equipe_id")
|
||||
private List<Participer> participers;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import io.gmss.fiscad.deserializer.LocalDateDeserializer;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.enums.TypeCampagne;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class Exercice extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private int annee;
|
||||
private boolean estGenerer;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
}
|
||||
|
||||
@@ -26,16 +26,20 @@ public class Participer extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateDebut;
|
||||
@JsonFormat(pattern = "dd-MM-yyyy")
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
private LocalDate dateFin;
|
||||
|
||||
@JsonIgnore
|
||||
@ManyToOne
|
||||
private Equipe equipe;
|
||||
@JsonIgnore
|
||||
|
||||
//@JsonIgnore
|
||||
@ManyToOne
|
||||
private User user;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package io.gmss.fiscad.entities.rfu.parametre;
|
||||
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Where(clause = " deleted = false")
|
||||
public class ZoneRfu extends BaseEntity implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ public class User extends BaseEntity implements Serializable {
|
||||
private String prenom;
|
||||
private String tel;
|
||||
private String email;
|
||||
@JsonIgnore
|
||||
private String username;
|
||||
@JsonIgnore
|
||||
private String password;
|
||||
@Column(columnDefinition = "boolean default true")
|
||||
private boolean active;
|
||||
@@ -57,9 +57,11 @@ public class User extends BaseEntity implements Serializable {
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "user")
|
||||
// private List<Enquete> enquetes;
|
||||
|
||||
@JsonIgnore
|
||||
@OneToMany(mappedBy = "user")
|
||||
private List<Participer> participers;
|
||||
|
||||
// @JsonIgnore
|
||||
// @OneToMany(mappedBy = "chefSecteur")
|
||||
// private List<Secteur> secteurs;
|
||||
@@ -87,7 +89,7 @@ public class User extends BaseEntity implements Serializable {
|
||||
if(participers!=null) {
|
||||
for (Participer p : participers) {
|
||||
if (p.getDateFin() == null) {
|
||||
if (p.getEquipe().getCampagne() != null) {
|
||||
if (p.getEquipe()!= null && p.getEquipe().getCampagne() != null) {
|
||||
return p.getEquipe().getCampagne().getId();
|
||||
}
|
||||
}
|
||||
@@ -100,7 +102,7 @@ public class User extends BaseEntity implements Serializable {
|
||||
if(participers!=null){
|
||||
for (Participer p : participers) {
|
||||
if (p.getDateFin() == null) {
|
||||
if(p.getEquipe().getSecteur()!=null) {
|
||||
if(p.getEquipe()!=null && p.getEquipe().getSecteur()!=null) {
|
||||
return p.getEquipe().getSecteur().getId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,6 @@ public enum RoleActeur {
|
||||
TEMOIN,
|
||||
CONTESTATAIRE,
|
||||
DECLARANT,
|
||||
MEMBRE
|
||||
MEMBRE,
|
||||
PERSONNE_CONTACT
|
||||
}
|
||||
|
||||
8
src/main/java/io/gmss/fiscad/enums/StatusAvis.java
Executable file
8
src/main/java/io/gmss/fiscad/enums/StatusAvis.java
Executable file
@@ -0,0 +1,8 @@
|
||||
package io.gmss.fiscad.enums;
|
||||
|
||||
public enum StatusAvis {
|
||||
CREE,
|
||||
GENERE,
|
||||
ANNULE,
|
||||
VALIDE,
|
||||
}
|
||||
@@ -5,5 +5,6 @@ public enum StatusEnquete {
|
||||
FINALISE,
|
||||
REJETE,
|
||||
VALIDE,
|
||||
SYNCHRONISE
|
||||
//SYNCHRONISE
|
||||
ECHEC
|
||||
}
|
||||
|
||||
@@ -7,5 +7,6 @@ public enum UserRole {
|
||||
ROLE_DIRECTEUR,
|
||||
ROLE_SUPERVISEUR,
|
||||
ROLE_ENQUETEUR,
|
||||
ROLE_ANONYMOUS
|
||||
ROLE_ANONYMOUS,
|
||||
ROLE_RESPONSABLE
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SecteurServiceImpl implements SecteurService {
|
||||
sd.setId(sdp.getId());
|
||||
secteurDecoupageList.add(sd);
|
||||
}
|
||||
//secteur.setSecteurDecoupages(secteurDecoupageList);
|
||||
secteur.setSecteurDecoupages(secteurDecoupageList);
|
||||
//TODO
|
||||
secteur.setId(secteurPayload.getId());
|
||||
secteur.setCode(secteurPayload.getCode());
|
||||
|
||||
@@ -21,10 +21,12 @@ import io.gmss.fiscad.paylaods.response.*;
|
||||
import io.gmss.fiscad.paylaods.response.FicheResponse.*;
|
||||
import io.gmss.fiscad.repositories.decoupage.ArrondissementRepository;
|
||||
import io.gmss.fiscad.repositories.decoupage.CommuneRepository;
|
||||
import io.gmss.fiscad.repositories.decoupage.SecteurRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.ActeurConcerneRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.parametre.BlocRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.parametre.StructureRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.metier.CaracteristiqueParcelleRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.metier.EnqueteBatimentRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.metier.EnqueteUniteLogementRepository;
|
||||
@@ -61,6 +63,8 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
private final CaracteristiqueParcelleRepository caracteristiqueParcelleRepository;
|
||||
private final EnqueteBatimentRepository enqueteBatimentRepository;
|
||||
private final EnqueteUniteLogementRepository enqueteUniteLogementRepository;
|
||||
private final SecteurRepository secteurRepository;
|
||||
private final StructureRepository structureRepository;
|
||||
|
||||
@PersistenceContext
|
||||
private final EntityManager em;
|
||||
@@ -181,8 +185,10 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
condition += " AND e.litige is " + filtreEnquetePayLoad.getLitige();
|
||||
}
|
||||
|
||||
if (filtreEnquetePayLoad.getSecteurId() != null) {
|
||||
condition += " AND b.secteur_id = " + filtreEnquetePayLoad.getSecteurId();
|
||||
}
|
||||
|
||||
System.out.println(condition);
|
||||
StringBuilder sb = new StringBuilder(sql).append(condition);
|
||||
query = em.createNativeQuery(sb.toString(), EnqueteFiltreResponse.class);
|
||||
List<EnqueteFiltreResponse> enqueteFiltreResponses = query.getResultList();
|
||||
@@ -259,10 +265,11 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
if (!optionalEnquete.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez valider.");
|
||||
}
|
||||
optionalEnquete.get().setDateValidation(LocalDate.now());
|
||||
optionalEnquete.get().setStatusEnquete(StatusEnquete.VALIDE);
|
||||
optionalEnquete.get().setSynchronise(false);
|
||||
return enqueteRepository.save(optionalEnquete.get());
|
||||
Enquete enquete = optionalEnquete.get();
|
||||
enquete.setDateValidation(LocalDate.now());
|
||||
enquete.setStatusEnquete(StatusEnquete.VALIDE);
|
||||
enquete.setSynchronise(false);
|
||||
return enqueteRepository.save(enquete);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -274,12 +281,12 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
if (!optionalEnquete.isPresent()) {
|
||||
throw new NotFoundException("Impossible de trouver l'enquête que vous désirez rejeter.");
|
||||
}
|
||||
optionalEnquete.get().setDateRejet(LocalDate.now());
|
||||
optionalEnquete.get().setDescriptionMotifRejet(enqueteTraitementPayLoad.getMotifRejet());
|
||||
|
||||
optionalEnquete.get().setStatusEnquete(StatusEnquete.REJETE);
|
||||
optionalEnquete.get().setSynchronise(false);
|
||||
return enqueteRepository.save(optionalEnquete.get());
|
||||
Enquete enquete = optionalEnquete.get();
|
||||
enquete.setDateRejet(LocalDate.now());
|
||||
enquete.setDescriptionMotifRejet(enqueteTraitementPayLoad.getMotifRejet());
|
||||
enquete.setStatusEnquete(StatusEnquete.REJETE);
|
||||
enquete.setSynchronise(false);
|
||||
return enqueteRepository.save(enquete);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -372,10 +379,57 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
return userDecoupageEnqResponses;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FicheEnqueteResponse getFicheEnquete(Long enqueteId) {
|
||||
public UserDecoupageEnqResponses getDecoupageAdminUserConnecterAndStatForDgi() {
|
||||
String userName = "";
|
||||
try {
|
||||
authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
userName = authentication.getName();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
User user = userService.getUserByUsername(userName);
|
||||
//User user = userService.getUserByUsername("admin@gmail.com");
|
||||
//User user = userService.getUserByUsername("rnovatopo@gmail.com");
|
||||
System.out.println(user);
|
||||
|
||||
System.out.println(user.isAdmin());
|
||||
|
||||
List<CommuneEnqResponse> communeEnqResponses =
|
||||
user.isAdmin() ? communeRepository.getAdminCommuneEnqResponse() : communeRepository.getCommuneEnqResponse(user.getStructure().getId());
|
||||
|
||||
|
||||
List<StructureEnqResponse> structureEnqResponses =
|
||||
user.isAdmin() ? structureRepository.getAdminStructureEnqResponse() : structureRepository.getStructureEnqResponse(user.getStructure().getId());
|
||||
|
||||
|
||||
|
||||
List<SecteurEnqResponse> secteurEnqResponses =
|
||||
user.isAdmin() ? secteurRepository.getAdminSecteurEnqResponse() : secteurRepository.getSecteurEnqResponse(user.getStructure()==null?0l:user.getStructure().getId(),user.getIdSecteurCourant()==null?0l:user.getIdSecteurCourant());
|
||||
|
||||
|
||||
UserDecoupageEnqResponses userDecoupageEnqResponses = new UserDecoupageEnqResponses();
|
||||
userDecoupageEnqResponses.setCommunes(communeEnqResponses);
|
||||
userDecoupageEnqResponses.setStructureEnqResponses(structureEnqResponses);
|
||||
userDecoupageEnqResponses.setSecteurEnqResponses(secteurEnqResponses);
|
||||
return userDecoupageEnqResponses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FicheEnqueteResponse getFicheEnquete(Long enqueteId,String nupProvisoir) {
|
||||
|
||||
if(enqueteId==null){
|
||||
Optional<Enquete> optionalEnquete = enqueteRepository.findFirstByParcelle_NupProvisoireOrderByDateEnqueteDesc(nupProvisoir);
|
||||
if(optionalEnquete.isPresent()){
|
||||
enqueteId=optionalEnquete.get().getId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Optional<Enquete> optionalEnquete = enqueteRepository.findById(enqueteId);
|
||||
|
||||
List<ActeurConcerne> acteurConcernes = acteurConcerneRepository.findActeurConcerneByEnquete_Id(enqueteId);
|
||||
|
||||
FicheEnqueteResponse ficheEnqueteResponse = new FicheEnqueteResponse(); // payload de réponse global
|
||||
@@ -385,6 +439,7 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
if (optionalEnquete.isPresent()) {
|
||||
ficheEnquetesResponse = modelMapper.map(optionalEnquete.get(), FicheEnquetesResponse.class);
|
||||
}
|
||||
|
||||
List<CaracteristiqueParcelle> caracteristiqueParcelles = caracteristiqueParcelleRepository.findAllByEnquete_Id(enqueteId);
|
||||
|
||||
List<EnqueteBatiment> enqueteBatiments = enqueteBatimentRepository.findAllByEnquete_Id(enqueteId);
|
||||
@@ -400,41 +455,6 @@ public class EnqueteServiceImpl implements EnqueteService {
|
||||
return ficheEnqueteResponse;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FicheEnqueteResponse getFicheEnqueteByNupProvisoir(String nupProvisoir) {
|
||||
|
||||
Optional<Enquete> optionalEnquete = enqueteRepository.findFirstByParcelle_NupProvisoireOrderByDateEnqueteDesc(nupProvisoir);
|
||||
|
||||
if(optionalEnquete.isPresent()){
|
||||
|
||||
List<ActeurConcerne> acteurConcernes = acteurConcerneRepository.findActeurConcerneByEnquete_Id(optionalEnquete.get().getId());
|
||||
|
||||
FicheEnqueteResponse ficheEnqueteResponse = new FicheEnqueteResponse(); // payload de réponse global
|
||||
|
||||
FicheEnquetesResponse ficheEnquetesResponse = new FicheEnquetesResponse(); // classe payload de Enquete
|
||||
|
||||
if (optionalEnquete.isPresent()) {
|
||||
ficheEnquetesResponse = modelMapper.map(optionalEnquete.get(), FicheEnquetesResponse.class);
|
||||
}
|
||||
List<CaracteristiqueParcelle> caracteristiqueParcelles = caracteristiqueParcelleRepository.findAllByEnquete_Id(optionalEnquete.get().getId());
|
||||
|
||||
List<EnqueteBatiment> enqueteBatiments = enqueteBatimentRepository.findAllByEnquete_Id(optionalEnquete.get().getId());
|
||||
|
||||
List<EnqueteUniteLogement> enqueteUniteLogements = enqueteUniteLogementRepository.findAllByEnquete_Id(optionalEnquete.get().getId());
|
||||
|
||||
ficheEnquetesResponse.setCaracteristiquesParcelles(caracteristiqueParcelles);
|
||||
ficheEnquetesResponse.setEnquetesBatiments(enqueteBatiments);
|
||||
ficheEnquetesResponse.setEnquetesUniteLogements(enqueteUniteLogements);
|
||||
ficheEnqueteResponse.setEnquete(ficheEnquetesResponse);
|
||||
ficheEnqueteResponse.setActeurConcernes(acteurConcernes);
|
||||
|
||||
return ficheEnqueteResponse;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnqueteNonSyncResponse> getEnqueteValideNonSynch(Long terminalId) {
|
||||
return enqueteRepository.getEnqueteValNonSync(terminalId);
|
||||
|
||||
@@ -12,6 +12,7 @@ import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.ParcelleGeomService;
|
||||
import io.gmss.fiscad.interfaces.synchronisation.SynchronisationService;
|
||||
import io.gmss.fiscad.paylaods.request.UploadPayLoad;
|
||||
import io.gmss.fiscad.paylaods.response.EnqueteCheckResponse;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.ParcelleGeomRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.UploadRepository;
|
||||
@@ -66,10 +67,19 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
JsonNode feature = features.next();
|
||||
createOnParcelleFromGeoJson(feature,upload);
|
||||
}
|
||||
//////Creation de la geometry
|
||||
try {
|
||||
parcelleGeomRepository.creationGeometry();
|
||||
parcelleGeomRepository.majCentroidParcelle();
|
||||
uploadRepository.majNombreParcelle(n,upload.getId());// save(upload);
|
||||
}catch (Exception e){
|
||||
}
|
||||
|
||||
try {
|
||||
parcelleGeomRepository.majIdQuartier();
|
||||
}catch (Exception e){
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -92,19 +102,24 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
JsonNode propertiesNode = feature.get("properties");
|
||||
WKTReader wktReader = new WKTReader();
|
||||
if (geometryNode != null) {
|
||||
// Polygon geometry = null;
|
||||
// try {
|
||||
// geometry = convertGeoJsonToPolygon(geometryNode.toString());
|
||||
// } catch (ParseException e) {
|
||||
// e.printStackTrace();
|
||||
// //throw new RuntimeException(e);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// // throw new RuntimeException(e);
|
||||
// }
|
||||
|
||||
Polygon geometry = null;
|
||||
ParcelleGeom parcelleGeom = new ParcelleGeom();
|
||||
parcelleGeom.setUpload(upload);
|
||||
// parcelleGeom.setGeometry(geometry);
|
||||
try {
|
||||
geometry = convertGeoJsonToPolygon(geometryNode.toString());
|
||||
String polygoneString =geometry.getExteriorRing().toString();
|
||||
polygoneString=polygoneString.replace("LINEARRING (","POLYGON ((" );
|
||||
polygoneString=polygoneString.replace(")","))" );
|
||||
parcelleGeom.setGeometryString(polygoneString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
//throw new RuntimeException(e);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// throw new RuntimeException(e);
|
||||
}
|
||||
parcelleGeom.setUploadId(upload.getId());
|
||||
|
||||
parcelleGeom.setDepartement(propertiesNode.get("DEPARTEMENT").textValue());
|
||||
parcelleGeom.setCommune(propertiesNode.get("COMMUNE").textValue());
|
||||
parcelleGeom.setArrondissement(propertiesNode.get("ARRONDISSEMENT").textValue());
|
||||
@@ -129,7 +144,7 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
parcelleGeom.setObservations(propertiesNode.get("OBSERVATIONS").textValue());
|
||||
parcelleGeom= parcelleGeomRepository.save(parcelleGeom);
|
||||
try {
|
||||
setStatutParcelleGeom(parcelleGeom.getNupProvisoire());
|
||||
setStatutParcelleGeomFromGeoJson(parcelleGeom);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -173,26 +188,48 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatutParcelleGeom(String nupProvisoir) {
|
||||
Optional<ParcelleGeom> optionalParcelleGeom=parcelleGeomRepository.findFirstByNupProvisoire(nupProvisoir);
|
||||
// Optional<Enquete> enqueteOptional=enqueteRepository.getEnquetByNupProvisoir(nupProvisoir);
|
||||
//
|
||||
// if(enqueteOptional.isEmpty()){
|
||||
// if(!optionalParcelleGeom.isEmpty()){
|
||||
// optionalParcelleGeom.get().setStatutParcelle(StatutParcelle.NON_ENQUETER);
|
||||
// }
|
||||
// }else {
|
||||
// if(!optionalParcelleGeom.isEmpty()){
|
||||
// if(enqueteOptional.get().getEnqueteBatiments()!=null && !enqueteOptional.get().getEnqueteBatiments().isEmpty()) {
|
||||
// optionalParcelleGeom.get().setStatutParcelle(StatutParcelle.ENQUETER_BATIE);
|
||||
// }else{
|
||||
// optionalParcelleGeom.get().setStatutParcelle(StatutParcelle.ENQUETER_NON_BATIE);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
public void setStatutParcelleGeomFromGeoJson(ParcelleGeom parcelleGeom) {
|
||||
if(parcelleGeom.getNupProvisoire()!=null) {
|
||||
List<EnqueteCheckResponse> enqueteCheckResponses = enqueteRepository.getEnquetByNupProvisoir(parcelleGeom.getNupProvisoire());
|
||||
|
||||
if (enqueteCheckResponses.isEmpty()) {
|
||||
System.out.println("NON ENQUETE");
|
||||
parcelleGeomRepository.majStatutParcelleGeomNonEnqueter(parcelleGeom.getNupProvisoire());
|
||||
//parcelleGeom.setStatutParcelle(StatutParcelle.NON_ENQUETER);
|
||||
} else {
|
||||
if (enqueteCheckResponses.get(0).getNombreBatiment() != null && enqueteCheckResponses.get(0).getNombreBatiment() != 0) {
|
||||
// parcelleGeom.setStatutParcelle(StatutParcelle.ENQUETER_BATIE);
|
||||
parcelleGeomRepository.majStatutParcelleGeomBatie(parcelleGeom.getNupProvisoire());
|
||||
} else {
|
||||
parcelleGeomRepository.majStatutParcelleGeomNonBatie(parcelleGeom.getNupProvisoire());
|
||||
}
|
||||
}
|
||||
enqueteCheckResponses.clear();
|
||||
// parcelleGeomRepository.save(parcelleGeom);
|
||||
}else{
|
||||
parcelleGeomRepository.majStatutParcelleGeomNonEnqueter(parcelleGeom.getNupProvisoire());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatutParcelleGeomFromEnquete(Enquete enquete) {
|
||||
|
||||
if(enquete.getNbreBatiment()!=0) {
|
||||
parcelleGeomRepository.majStatutParcelleGeomBatie(enquete.getCodeParcelle());
|
||||
}else{
|
||||
parcelleGeomRepository.majStatutParcelleGeomNonBatie(enquete.getCodeParcelle());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void linkParcelleToParcelleGeom(String nupProvisoir,Long parcelleId) {
|
||||
// Optional<ParcelleGeom> parcelleGeomOptional=parcelleGeomRepository.findFirstByNupProvisoire(nupProvisoir);
|
||||
// if(parcelleGeomOptional.isPresent()){
|
||||
// parcelleGeomOptional.get().par
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
package io.gmss.fiscad.implementations.infocad.metier;
|
||||
|
||||
|
||||
import io.gmss.fiscad.entities.infocad.parametre.Personne;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
|
||||
import io.gmss.fiscad.interfaces.infocad.metier.PersonneService;
|
||||
import io.gmss.fiscad.paylaods.dto.*;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.MembreGroupeRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.PieceRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.UploadRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.parametre.PersonneRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PersonneServiceImpl implements PersonneService {
|
||||
|
||||
private final PersonneRepository personneRepository;
|
||||
private final UploadRepository uploadRepository;
|
||||
private final PieceRepository pieceRepository;
|
||||
private final MembreGroupeRepository membreGroupeRepository;
|
||||
|
||||
@Override
|
||||
public Personne createPersonne(Personne personne) throws BadRequestException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Personne updatePersonne(Long id, Personne personne) throws NotFoundException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePersonne(Long id) throws NotFoundException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Personne> getPersonneList(Pageable pageable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Personne> getPersonneList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Personne> getPersonneById(Long id) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersonneCompletDTO getPersonneComplete(Long id) {
|
||||
// 1. Charger la personne
|
||||
Personne personne = personneRepository.findById(id)
|
||||
.orElseThrow(() -> new EntityNotFoundException("Personne non trouvée."));
|
||||
|
||||
// 2. Uploads liés directement
|
||||
List<UploadDTO> uploadsDirects = uploadRepository
|
||||
.findByPersonne_IdAndPieceIsNullAndMembreGroupeIsNull(id)
|
||||
.stream()
|
||||
.map(u -> new UploadDTO(u.getId(), u.getExternalKey(), u.getObservation(), u.isSynchronise(), u.getFileName(), u.getOriginalFileName(), u.getURIFile(), u.getCheckSum(), u.getSize(), u.getMimeType()))
|
||||
.toList();
|
||||
System.out.println(uploadsDirects.size());
|
||||
// 3. Pièces et leurs Uploads
|
||||
List<PieceDTO> pieces = pieceRepository.findByPersonne_Id(id)
|
||||
.stream().map(piece -> {
|
||||
List<UploadDTO> uploads = piece.getUploads().stream()
|
||||
.map(u -> new UploadDTO(u.getId(), u.getExternalKey(), u.getObservation(), u.isSynchronise(), u.getFileName(), u.getOriginalFileName(), u.getURIFile(), u.getCheckSum(), u.getSize(), u.getMimeType()))
|
||||
.toList();
|
||||
return new PieceDTO(
|
||||
piece.getId(),
|
||||
piece.getTypePiece() != null ? piece.getTypePiece().getLibelle() : "",
|
||||
piece.getUrl(),
|
||||
uploads
|
||||
);
|
||||
}).toList();
|
||||
|
||||
// 4. MembreGroupe
|
||||
List<MembreGroupeDTO> membres = membreGroupeRepository
|
||||
.findByPersonneRepresantee_Id(id)
|
||||
.stream().map(mg -> {
|
||||
List<UploadDTO> uploads = mg.getUploads().stream()
|
||||
.map(u -> new UploadDTO(u.getId(), u.getExternalKey(), u.getObservation(), u.isSynchronise(), u.getFileName(), u.getOriginalFileName(), u.getURIFile(), u.getCheckSum(), u.getSize(), u.getMimeType()))
|
||||
.toList();
|
||||
|
||||
Personne pRep = mg.getPersonneRepresantante();
|
||||
|
||||
if(mg.getTypeRepresentation() == null){
|
||||
return new MembreGroupeDTO(
|
||||
mg.getId(),
|
||||
new PersonneSimpleDTO(pRep.getId(), pRep.getNomOuSigle(), pRep.getPrenomOuRaisonSociale()),
|
||||
null,
|
||||
new PositionRepresentationDTO(mg.getPositionRepresentation().getId(), mg.getPositionRepresentation().getLibelle()),
|
||||
uploads
|
||||
);
|
||||
}else{
|
||||
return new MembreGroupeDTO(
|
||||
mg.getId(),
|
||||
new PersonneSimpleDTO(pRep.getId(), pRep.getNomOuSigle(), pRep.getPrenomOuRaisonSociale()),
|
||||
new TypeRepresentationDTO(mg.getTypeRepresentation().getId(), mg.getTypeRepresentation().getLibelle()),
|
||||
new PositionRepresentationDTO(mg.getPositionRepresentation().getId(), mg.getPositionRepresentation().getLibelle()),
|
||||
uploads
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}).toList();
|
||||
|
||||
// 5. Construction finale
|
||||
return new PersonneCompletDTO(
|
||||
personne.getId(),
|
||||
personne.getIfu(),
|
||||
personne.getNomOuSigle(),
|
||||
personne.getPrenomOuRaisonSociale(),
|
||||
personne.getNumRavip(),
|
||||
personne.getNpi(),
|
||||
personne.getDateNaissanceOuConsti(),
|
||||
personne.getLieuNaissance(),
|
||||
personne.getTel1(),
|
||||
personne.getTel2(),
|
||||
personne.getAdresse(),
|
||||
personne.getCategorie(),
|
||||
personne.getSituationMatrimoniale(),
|
||||
personne.getNationalite(),
|
||||
personne.getTypePersonne(),
|
||||
personne.getProfession(),
|
||||
personne.getCommune(),
|
||||
personne.getTerminal(),
|
||||
personne.getHaveRepresentant(),
|
||||
personne.getRavipQuestion(),
|
||||
personne.getAge(),
|
||||
personne.getNomJeuneFille(),
|
||||
personne.getNomMere(),
|
||||
personne.getPrenomMere(),
|
||||
personne.getIndicatifTel1(),
|
||||
personne.getIndicatifTel2(),
|
||||
personne.getSexe(),
|
||||
personne.getMustHaveRepresentant(),
|
||||
personne.getFilePath(),
|
||||
personne.getObservation(),
|
||||
personne.isSynchronise(),
|
||||
uploadsDirects,
|
||||
pieces,
|
||||
membres
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,23 @@ public class TpeServiceImpl implements TpeService {
|
||||
return tpeRepository.save(tpe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tpe majTpe(Long id, Tpe tpe) throws NotFoundException {
|
||||
if (tpe.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour un nouveau tpe ayant un id null.");
|
||||
}
|
||||
Optional<Tpe> optionalTpe=tpeRepository.findById(tpe.getId());
|
||||
if (optionalTpe.isEmpty()) {
|
||||
tpeRepository.insertTpeManuellement(tpe.getId(),
|
||||
tpe.getNumeroEquipement(),
|
||||
tpe.getIdentifier(),
|
||||
tpe.getModel(),
|
||||
tpe.getCodeEquipe()
|
||||
);
|
||||
}
|
||||
return tpe ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTpe(Long id) throws NotFoundException {
|
||||
Optional<Tpe> tpeOptional = tpeRepository.findById(id);
|
||||
@@ -108,5 +125,9 @@ public class TpeServiceImpl implements TpeService {
|
||||
public List<Tpe> getTpeListByUserId(Long userId) {
|
||||
return tpeRepository.getTpeByUserId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tpe reCreateExistTpe(Tpe tpe) throws BadRequestException {
|
||||
tpeRepository.save(tpe);
|
||||
return tpe;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,12 @@ public class BlocServiceImpl implements BlocService {
|
||||
if (bloc.getQuartier() != null) {
|
||||
bloc.setCoteq(getCoteQuartierByCoteBloc(bloc.getCote(), bloc.getQuartier()));
|
||||
}
|
||||
// if (bloc.getSecteurDecoupage() != null) {
|
||||
// bloc.setSecteur(bloc.getSecteurDecoupage().getSecteur());
|
||||
// }
|
||||
if (bloc.getSecteurDecoupage() != null) {
|
||||
bloc.setSecteur(bloc.getSecteurDecoupage().getSecteur());
|
||||
// bloc.setSecteurDecoupage();
|
||||
}
|
||||
|
||||
|
||||
return blocRepository.save(bloc);
|
||||
}
|
||||
|
||||
@@ -98,6 +101,18 @@ public class BlocServiceImpl implements BlocService {
|
||||
if (!blocRepository.existsById(bloc.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver le bloc spécifié dans notre base de données.");
|
||||
}
|
||||
String idBlocParArrondissement = getIdBlocParArrondissementValue(bloc);
|
||||
bloc.setIdBlocParArrondissement(idBlocParArrondissement);
|
||||
|
||||
if (bloc.getStructure() == null) {
|
||||
bloc.setCote(getCoteValue(bloc, idBlocParArrondissement, null));
|
||||
} else {
|
||||
bloc.setCote(getCoteValue(bloc, idBlocParArrondissement, bloc.getStructure().getId()));
|
||||
}
|
||||
|
||||
if (bloc.getQuartier() != null) {
|
||||
bloc.setCoteq(getCoteQuartierByCoteBloc(bloc.getCote(), bloc.getQuartier()));
|
||||
}
|
||||
return blocRepository.save(bloc);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,12 @@ public class StructureServiceImpl implements StructureService {
|
||||
if (!structureRepository.existsById(structure.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la structure spécifiée dans notre base de données.");
|
||||
}
|
||||
structureRepository.save(structure);
|
||||
try {
|
||||
structureRepository.save(structure);
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Structure structure1 = structureRepository.getById(structure.getId());
|
||||
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Enquete;
|
||||
import io.gmss.fiscad.entities.infocad.metier.Parcelle;
|
||||
import io.gmss.fiscad.entities.rfu.metier.DonneesImpositionTfu;
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.BaremRfuNonBati;
|
||||
import io.gmss.fiscad.entities.rfu.parametre.Exercice;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.DonneesImpositionTfuService;
|
||||
import io.gmss.fiscad.paylaods.response.DonneesImpositionTfuResponse;
|
||||
import io.gmss.fiscad.repositories.decoupage.ArrondissementRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.EnqueteRepository;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.ParcelleRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.metier.DonneesImpositionTfuRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.metier.ImpositionsTfuRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.parametre.BaremRfuNonBatiRepository;
|
||||
import io.gmss.fiscad.repositories.rfu.parametre.ExerciceRepository;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class DonneesImpositionTfuServiceImpl implements DonneesImpositionTfuService {
|
||||
|
||||
private final DonneesImpositionTfuRepository donneesImpositionTfuRepository;
|
||||
private final ParcelleRepository parcelleRepository;
|
||||
private final EnqueteRepository enqueteRepository;
|
||||
private final ImpositionsTfuRepository impositionsTfuRepository;
|
||||
private final BaremRfuNonBatiRepository baremRfuNonBatiRepository;
|
||||
private final ExerciceRepository exerciceRepository;
|
||||
private final ArrondissementRepository arrondissementRepository;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public DonneesImpositionTfu createDonneesImpositionTfu(DonneesImpositionTfu donneesImpositionTfu) throws BadRequestException {
|
||||
if (donneesImpositionTfu.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer un nouveau donneesImpositionTfu ayant un id non null.");
|
||||
}
|
||||
return donneesImpositionTfuRepository.save(donneesImpositionTfu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DonneesImpositionTfu updateDonneesImpositionTfu(Long id, DonneesImpositionTfu donneesImpositionTfu) throws NotFoundException {
|
||||
if (donneesImpositionTfu.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour un nouveau donneesImpositionTfu ayant un id null.");
|
||||
}
|
||||
if (!donneesImpositionTfuRepository.existsById(donneesImpositionTfu.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver le donneesImpositionTfu spécifié dans notre base de données.");
|
||||
}
|
||||
return donneesImpositionTfuRepository.save(donneesImpositionTfu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDonneesImpositionTfu(Long id) throws NotFoundException {
|
||||
Optional<DonneesImpositionTfu> donneesImpositionTfuOptional = donneesImpositionTfuRepository.findById(id);
|
||||
if (donneesImpositionTfuOptional.isPresent()) {
|
||||
donneesImpositionTfuRepository.deleteById(donneesImpositionTfuOptional.get().getId());
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver le donneesImpositionTfu spécifié dans notre base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DonneesImpositionTfu> getDonneesImpositionTfuList(Pageable pageable) {
|
||||
return donneesImpositionTfuRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DonneesImpositionTfu> getDonneesImpositionTfuList() {
|
||||
return donneesImpositionTfuRepository.findAll();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<DonneesImpositionTfu> getDonneesImpositionTfuById(Long id) {
|
||||
if (donneesImpositionTfuRepository.existsById(id)) {
|
||||
return donneesImpositionTfuRepository.findById(id);
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la caractéristique spécifiée dans la base de données.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Long genererDonneesFiscales(ImpositionsTfu impositionsTfu) {
|
||||
List<DonneesImpositionTfuResponse> donneesImpositionTfuResponses= donneesImpositionTfuRepository.findAllDonneesImpositionTfu(impositionsTfu.getCommune().getId(),impositionsTfu.getExercice().getAnnee());
|
||||
Long n=0l;
|
||||
for (DonneesImpositionTfuResponse donneesImpositionTfuResponse: donneesImpositionTfuResponses){
|
||||
DonneesImpositionTfu donneesImpositionTfu=new DonneesImpositionTfu();
|
||||
donneesImpositionTfu.setImpositionsTfu(impositionsTfu);
|
||||
donneesImpositionTfu.setZoneRfuId(donneesImpositionTfuResponse.getZoneRfuId());
|
||||
donneesImpositionTfu.setCodeQuartierVillage(donneesImpositionTfuResponse.getCodeQuartierVillage());
|
||||
donneesImpositionTfu.setNomQuartierVillage(donneesImpositionTfuResponse.getNomQuartierVillage());
|
||||
donneesImpositionTfu.setCodeArrondissement(donneesImpositionTfuResponse.getCodeArrondissement());
|
||||
donneesImpositionTfu.setNomArrondissement(donneesImpositionTfuResponse.getNomArrondissement());
|
||||
donneesImpositionTfu.setCodeCommune(donneesImpositionTfuResponse.getCodeCommune());
|
||||
donneesImpositionTfu.setNomCommune(donneesImpositionTfuResponse.getNomCommune());
|
||||
donneesImpositionTfu.setCodeDepartement(donneesImpositionTfuResponse.getCodeDepartement());
|
||||
donneesImpositionTfu.setNomDepartement(donneesImpositionTfuResponse.getNomDepartement());
|
||||
donneesImpositionTfu.setQ(donneesImpositionTfuResponse.getQ());
|
||||
donneesImpositionTfu.setIlot(donneesImpositionTfuResponse.getIlot());
|
||||
donneesImpositionTfu.setParcelle(donneesImpositionTfuResponse.getParcelle());
|
||||
donneesImpositionTfu.setLatitude(donneesImpositionTfuResponse.getLatitude());
|
||||
donneesImpositionTfu.setLongitude(donneesImpositionTfuResponse.getLongitude());
|
||||
donneesImpositionTfu.setNup(donneesImpositionTfuResponse.getNup());
|
||||
donneesImpositionTfu.setNupProvisoire(donneesImpositionTfuResponse.getNupProvisoire());
|
||||
donneesImpositionTfu.setSuperficieParc(donneesImpositionTfuResponse.getSuperficieParc());
|
||||
donneesImpositionTfu.setAdresseProp(donneesImpositionTfuResponse.getAdresseProp());
|
||||
donneesImpositionTfu.setAnnee(donneesImpositionTfuResponse.getAnnee());
|
||||
donneesImpositionTfu.setAdresseSc(donneesImpositionTfuResponse.getAdresseSc());
|
||||
donneesImpositionTfu.setBatieOuiNon(donneesImpositionTfuResponse.getBatieOuiNon());
|
||||
donneesImpositionTfu.setTfuMinimum(donneesImpositionTfuResponse.getTfuMinimum());
|
||||
donneesImpositionTfu.setCategorieBat(donneesImpositionTfuResponse.getCategorieBat());
|
||||
donneesImpositionTfu.setDateEnquete(donneesImpositionTfuResponse.getDateEnquete());
|
||||
donneesImpositionTfu.setEmailProp(donneesImpositionTfuResponse.getEmailProp());
|
||||
donneesImpositionTfu.setEmailSc(donneesImpositionTfuResponse.getEmailSc());
|
||||
donneesImpositionTfu.setMontantLoyerAnnuel(donneesImpositionTfuResponse.getMontantLoyerAnnuel());
|
||||
donneesImpositionTfu.setEnqueteId(donneesImpositionTfuResponse.getEnqueteId());
|
||||
donneesImpositionTfu.setExhonereOuiNon(donneesImpositionTfuResponse.getExhonereOuiNon());
|
||||
donneesImpositionTfu.setIfu(donneesImpositionTfuResponse.getIfu());
|
||||
donneesImpositionTfu.setNombreBat(donneesImpositionTfuResponse.getNombreBat());
|
||||
donneesImpositionTfu.setNombrePiscine(donneesImpositionTfuResponse.getNombrePiscine());
|
||||
donneesImpositionTfu.setNombreUlog(donneesImpositionTfuResponse.getNombreUlog());
|
||||
donneesImpositionTfu.setNomProp(donneesImpositionTfuResponse.getNomProp());
|
||||
donneesImpositionTfu.setNomSc(donneesImpositionTfuResponse.getNomSc());
|
||||
donneesImpositionTfu.setNpi(donneesImpositionTfuResponse.getNpi());
|
||||
donneesImpositionTfu.setNumBatiment(donneesImpositionTfuResponse.getNumBatiment()==null?"":donneesImpositionTfuResponse.getNumBatiment());
|
||||
donneesImpositionTfu.setNumUniteLogement(donneesImpositionTfuResponse.getNumUniteLogement()==null?"":donneesImpositionTfuResponse.getNumUniteLogement());
|
||||
donneesImpositionTfu.setPrenomProp(donneesImpositionTfuResponse.getPrenomProp());
|
||||
donneesImpositionTfu.setPrenomSc(donneesImpositionTfuResponse.getPrenomSc());
|
||||
donneesImpositionTfu.setRaisonSociale(donneesImpositionTfuResponse.getRaisonSociale());
|
||||
donneesImpositionTfu.setSecteurId(donneesImpositionTfuResponse.getSecteurId());
|
||||
donneesImpositionTfu.setStandingBat(donneesImpositionTfuResponse.getStandingBat());
|
||||
donneesImpositionTfu.setStructureId(donneesImpositionTfuResponse.getStructureId());
|
||||
donneesImpositionTfu.setSuperficieAuSolBat(donneesImpositionTfuResponse.getSuperficieAuSolBat());
|
||||
donneesImpositionTfu.setSuperficieAuSolUlog(donneesImpositionTfuResponse.getSuperficieAuSolUlog());
|
||||
donneesImpositionTfu.setTelProp(donneesImpositionTfuResponse.getTelProp());
|
||||
donneesImpositionTfu.setTelSc(donneesImpositionTfuResponse.getTelSc());
|
||||
donneesImpositionTfu.setTfuMetreCarre(donneesImpositionTfuResponse.getTfuMetreCarre());
|
||||
donneesImpositionTfu.setTitreFoncier(donneesImpositionTfuResponse.getTitreFoncier());
|
||||
donneesImpositionTfu.setValeurLocativeAdm(donneesImpositionTfuResponse.getValeurLocativeAdm());
|
||||
donneesImpositionTfu.setBatimentExhonereOuiNon(donneesImpositionTfuResponse.getBatimentExhonereOuiNon());
|
||||
donneesImpositionTfu.setUniteLogementExhonereOuiNon(donneesImpositionTfuResponse.getUniteLogementExhonereOuiNon());
|
||||
try {
|
||||
Optional<BaremRfuNonBati> baremRfuNonBatiOptional=baremRfuNonBatiRepository.findAllByCommune_IdAndZoneRfu_Id(impositionsTfu.getCommune().getId(),donneesImpositionTfu.getZoneRfuId());
|
||||
if(baremRfuNonBatiOptional.isPresent()){
|
||||
donneesImpositionTfu.setValeurAdministrativeParcelleNonBati(baremRfuNonBatiOptional.get().getValeurAdministrative());
|
||||
donneesImpositionTfu.setTauxParcelleNonBati(baremRfuNonBatiOptional.get().getTaux());
|
||||
}
|
||||
|
||||
|
||||
donneesImpositionTfuRepository.save(donneesImpositionTfu);
|
||||
n++;
|
||||
}catch (DataIntegrityViolationException e) {
|
||||
if (e.getCause() instanceof org.hibernate.exception.ConstraintViolationException constraintEx &&
|
||||
constraintEx.getSQLException().getSQLState().equals("23505")) {
|
||||
System.out.println("Doublon détecté (clé unique) !");
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
impositionsTfuRepository.save(impositionsTfu);
|
||||
return n;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DonneesImpositionTfu> getDonneesFiscalesByImposition(Long impositionsId) {
|
||||
return donneesImpositionTfuRepository.findAllByImpositionsTfu_Id(impositionsId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DonneesImpositionTfu> getDonneesFiscalesByImpositionArrondissement(Long impositionsId, Long arrondissementId) {
|
||||
Optional<Arrondissement> optionalArrondissement=arrondissementRepository.findById(arrondissementId);
|
||||
if(optionalArrondissement.isPresent()){
|
||||
return donneesImpositionTfuRepository.findAllByImpositionsTfu_IdAndCodeArrondissement(impositionsId,optionalArrondissement.get().getCode());
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package io.gmss.fiscad.implementations.rfu.metier;
|
||||
|
||||
import io.gmss.fiscad.entities.rfu.metier.ImpositionsTfu;
|
||||
import io.gmss.fiscad.enums.StatusAvis;
|
||||
import io.gmss.fiscad.exceptions.BadRequestException;
|
||||
import io.gmss.fiscad.exceptions.NotFoundException;
|
||||
import io.gmss.fiscad.interfaces.rfu.metier.ImpositionsTfuService;
|
||||
import io.gmss.fiscad.repositories.rfu.metier.ImpositionsTfuRepository;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class ImpositionsTfuServiceImpl implements ImpositionsTfuService {
|
||||
|
||||
private final ImpositionsTfuRepository impositionsTfuRepository;
|
||||
|
||||
public ImpositionsTfuServiceImpl(ImpositionsTfuRepository impositionsTfuRepository) {
|
||||
this.impositionsTfuRepository = impositionsTfuRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImpositionsTfu createImpositionsTfu(ImpositionsTfu impositionsTfu) throws BadRequestException {
|
||||
if (impositionsTfu.getId() != null) {
|
||||
throw new BadRequestException("Impossible de créer une nouvelle unité de logement ayant un id non null.");
|
||||
}
|
||||
List<ImpositionsTfu> impositionsTfus=impositionsTfuRepository.getImpositionsTfuByCommuneAndExercice(impositionsTfu.getCommune().getCode(),impositionsTfu.getExercice().getAnnee());
|
||||
if (!impositionsTfus.isEmpty()) {
|
||||
throw new BadRequestException("Une Imposition non annulée existe déjà");
|
||||
}
|
||||
impositionsTfu.setStatusAvis(StatusAvis.CREE);
|
||||
impositionsTfu.setDateGeneration(LocalDate.now());
|
||||
return impositionsTfuRepository.save(impositionsTfu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImpositionsTfu annulerImpositionsTfu(ImpositionsTfu impositionsTfu) throws BadRequestException {
|
||||
if (impositionsTfu.getId() == null) {
|
||||
throw new BadRequestException("Impossible d'annuler une imposition ayant un id null.");
|
||||
}
|
||||
if (!impositionsTfuRepository.existsById(impositionsTfu.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans notre base de données.");
|
||||
}
|
||||
impositionsTfu.setStatusAvis(StatusAvis.ANNULE);
|
||||
return impositionsTfuRepository.save(impositionsTfu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImpositionsTfu validerImpositionsTfu(ImpositionsTfu impositionsTfu) throws BadRequestException {
|
||||
if (impositionsTfu.getId() == null) {
|
||||
throw new BadRequestException("Impossible de valider une imposition ayant un id null.");
|
||||
}
|
||||
if (!impositionsTfuRepository.existsById(impositionsTfu.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans notre base de données.");
|
||||
}
|
||||
impositionsTfu.setStatusAvis(StatusAvis.VALIDE);
|
||||
return impositionsTfuRepository.save(impositionsTfu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImpositionsTfu updateImpositionsTfu(Long id, ImpositionsTfu impositionsTfu) throws NotFoundException {
|
||||
if (impositionsTfu.getId() == null) {
|
||||
throw new BadRequestException("Impossible de mettre à jour une nouvelle unité de logement ayant un id null.");
|
||||
}
|
||||
if (!impositionsTfuRepository.existsById(impositionsTfu.getId())) {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans notre base de données.");
|
||||
}
|
||||
return impositionsTfuRepository.save(impositionsTfu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteImpositionsTfu(Long id) throws NotFoundException {
|
||||
Optional<ImpositionsTfu> impositionsTfuOptional = impositionsTfuRepository.findById(id);
|
||||
if (impositionsTfuOptional.isPresent()) {
|
||||
impositionsTfuRepository.deleteById(impositionsTfuOptional.get().getId());
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans notre base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ImpositionsTfu> getImpositionsTfuList(Pageable pageable) {
|
||||
return impositionsTfuRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImpositionsTfu> getImpositionsTfuList() {
|
||||
return impositionsTfuRepository.findAll();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<ImpositionsTfu> getImpositionsTfuById(Long id) {
|
||||
if (impositionsTfuRepository.existsById(id)) {
|
||||
return impositionsTfuRepository.findById(id);
|
||||
} else {
|
||||
throw new NotFoundException("Impossible de trouver la nouvelle unité de logement spécifiée dans la base de données.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user